:root {
  --bg-deep: #08080a;
  --bg-surface: rgba(18, 18, 22, 0.72);
  --bg-elevated: rgba(22, 22, 27, 0.86);
  --bg-glass: rgba(14, 14, 18, 0.84);
  --border-hairline: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --specular-top: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --text-main: #f5f5f4;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --accent: #e14b6a;
  --accent-soft: rgba(225, 75, 106, 0.16);
  --accent-glow: rgba(225, 75, 106, 0.34);
  --secondary: #eab308;
  --danger: #e11d48;
  --success: #34d399;

  --orb-1: rgba(225, 75, 106, 0.14);
  --orb-2: rgba(120, 90, 160, 0.1);

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 10px;
  --shadow-cinema: 0 30px 70px rgba(0, 0, 0, 0.65);
}

html[data-vibe="midnight-dusk"] {
  --bg-deep: #06080f;
  --bg-surface: rgba(13, 17, 29, 0.76);
  --bg-elevated: rgba(16, 21, 36, 0.88);
  --bg-glass: rgba(10, 14, 24, 0.86);
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --accent-glow: rgba(129, 140, 248, 0.34);
  --secondary: #38bdf8;
  --orb-1: rgba(99, 102, 241, 0.16);
  --orb-2: rgba(56, 189, 248, 0.09);
}

html[data-vibe="candlelight-amber"] {
  --bg-deep: #0b0907;
  --bg-surface: rgba(24, 19, 15, 0.76);
  --bg-elevated: rgba(29, 23, 18, 0.88);
  --bg-glass: rgba(19, 15, 11, 0.88);
  --accent: #e5984b;
  --accent-soft: rgba(229, 152, 75, 0.16);
  --accent-glow: rgba(229, 152, 75, 0.32);
  --secondary: #fb7185;
  --orb-1: rgba(229, 152, 75, 0.14);
  --orb-2: rgba(225, 75, 106, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.aurora-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(110px);
  transition: background 0.6s ease;
}
.orb-a {
  width: 56vw;
  height: 56vw;
  max-width: 720px;
  max-height: 720px;
  top: -18%;
  left: -10%;
  background: var(--orb-1);
}
.orb-b {
  width: 48vw;
  height: 48vw;
  max-width: 640px;
  max-height: 640px;
  bottom: -22%;
  right: -8%;
  background: var(--orb-2);
}

.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.024;
  background-image: radial-gradient(rgba(255, 255, 255, 0.9) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }

.svg-brand { width: 30px; height: 30px; display: block; color: var(--accent); }
.svg-lg { width: 24px; height: 24px; display: block; }
.svg-md { width: 19px; height: 19px; display: block; }
.svg-sm { width: 16px; height: 16px; display: block; }
.svg-xs { width: 13px; height: 13px; display: block; }
.svg-rx { width: 32px; height: 32px; display: block; }

button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* Toast Stack */
.toast-stack {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--specular-top), var(--shadow-cinema);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  max-width: 340px;
  animation: toastIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.error { border-color: rgba(225, 29, 72, 0.5); color: #fecdd3; }
.toast.love { border-color: rgba(225, 75, 106, 0.45); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===================== LOBBY VIEW ===================== */
.lobby-view {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px clamp(20px, 4vw, 44px) 52px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lobby-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(28px, 4.5vh, 48px);
}

.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; }
.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.brand-tag {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-hairline);
  font-size: 0.76rem;
  color: var(--text-muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.https-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.28);
  color: #fde68a;
  font-size: 0.83rem;
  margin-bottom: 24px;
}

.lobby-stage {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
}

.lobby-showcase {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 4.6vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 50ch;
}

/* Live Camera Mirror */
.mirror-frame {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #0c0c10;
  border: 1px solid var(--border-hairline);
  box-shadow: var(--specular-top), var(--shadow-cinema);
  aspect-ratio: 16 / 9.5;
}
.mirror-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}
.mirror-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.82rem;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.03), transparent 65%);
}
.fallback-ring {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mirror-hud {
  position: absolute;
  inset: auto 14px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mirror-controls { display: flex; gap: 8px; }
.hud-circle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 14, 18, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  transition: all 0.18s ease;
}
.hud-circle.active { background: rgba(255, 255, 255, 0.14); }
.hud-circle.muted { background: rgba(225, 29, 72, 0.25); border-color: rgba(225, 29, 72, 0.55); color: #fda4af; }
.hud-circle:hover { transform: translateY(-1px); }

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(14, 14, 18, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-main);
  transition: background 0.18s ease;
}
.hud-pill:hover { background: rgba(255, 255, 255, 0.12); }

.capability-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.capability-strip li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.79rem;
  color: var(--text-muted);
}
.capability-strip svg { color: var(--accent); }

/* Right: Ticket Entry Card */
.ticket-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(28px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--specular-top), var(--shadow-cinema);
}

.ticket-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 22px;
}
.ticket-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.ticket-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  box-shadow: var(--specular-top);
}

.ticket-form { display: flex; flex-direction: column; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-muted);
}
.field-group .opt { font-weight: 400; color: var(--text-dim); margin-left: 4px; }

.field-group input,
.field-group select,
.inline-add-form input,
.inline-add-form select,
.poll-create-form input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: rgba(0, 0, 0, 0.36);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.field-group input:focus,
.field-group select:focus,
.inline-add-form input:focus,
.poll-create-form input:focus {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.52);
}

.field-group select,
.inline-add-form select {
  line-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

.mono-input {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.vibe-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vibe-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.18s ease;
}
.vibe-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-main);
}
.swatch { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.swatch-rose { background: #e14b6a; }
.swatch-dusk { background: #818cf8; }
.swatch-amber { background: #e5984b; }

.btn-cinema-primary {
  margin-top: 4px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 12px 28px -6px var(--accent-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-cinema-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-cinema-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.invite-preview {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.invite-preview-top { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.9rem; }
.invite-count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.invite-sub { margin: 4px 0 0; font-size: 0.77rem; color: var(--text-muted); }

/* ===================== ROOM VIEW ===================== */
.room-view {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lights-dimmer {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 4, 0.78);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: 4;
}
.room-view.lights-dimmed .lights-dimmer { opacity: 1; }
.room-view.lights-dimmed .room-topbar,
.room-view.lights-dimmed .control-dock { opacity: 0.25; }
.room-view.lights-dimmed .room-topbar:hover,
.room-view.lights-dimmed .control-dock:hover { opacity: 1; }

.heartbeat-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  box-shadow: inset 0 0 130px 28px rgba(225, 75, 106, 0.5);
}
.heartbeat-overlay.active { animation: heartWave 1.6s ease-out forwards; }
@keyframes heartWave {
  0% { opacity: 0; }
  20% { opacity: 1; }
  45% { opacity: 0.3; }
  65% { opacity: 0.85; }
  100% { opacity: 0; }
}

.reactions-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
}
.floating-rx {
  position: absolute;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: floatUp 2.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.floating-rx span {
  font-size: 0.68rem;
  background: rgba(12, 12, 16, 0.82);
  border: 1px solid var(--border-hairline);
  padding: 2px 8px;
  border-radius: 999px;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.75); }
  15% { opacity: 1; transform: translateY(-25px) scale(1.05); }
  80% { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(-270px) scale(0.92); }
}

/* Precision Topbar */
.room-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  transition: opacity 0.25s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.room-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.42rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.badge-chip.host { background: rgba(229, 152, 75, 0.16); color: #fcd34d; border: 1px solid rgba(229, 152, 75, 0.3); }
.badge-chip.locked { background: var(--accent-soft); color: #fda4af; border: 1px solid rgba(225, 75, 106, 0.32); }

/* Unified Session Capsule */
.session-capsule {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--specular-top);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.capsule-item { display: inline-flex; align-items: center; gap: 5px; }
.capsule-item.clickable { color: var(--text-main); transition: color 0.15s ease; }
.capsule-item.clickable:hover { color: var(--accent); }
.capsule-item.accent { color: #fda4af; }
.capsule-sep { width: 1px; height: 12px; background: var(--border-hairline); }

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}
.icon-tool {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
  transition: all 0.18s ease;
}
.icon-tool:hover { color: var(--text-main); border-color: var(--border-strong); }
.icon-tool.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text-main); }

/* Workspace */
.room-workspace {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.stage-area {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 20px 88px;
  min-width: 0;
  gap: 12px;
}

.ambient-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: blur(80px) saturate(1.55);
  opacity: 0.48;
  transition: opacity 0.4s ease;
  z-index: 0;
}
.ambient-canvas.off { opacity: 0; }

/* Theater Stage */
.theater-stage {
  position: relative;
  z-index: 8;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theater-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  background: #030305;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
  box-shadow: var(--shadow-cinema);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theater-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.yt-wrap { width: 100%; height: 100%; }
.yt-wrap iframe, #ytPlayerFrame { width: 100%; height: 100%; border: 0; }

.subtitle-overlay {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 82%;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(4, 4, 6, 0.8);
  color: #fff;
  font-size: clamp(0.92rem, 1.8vw, 1.25rem);
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 12;
}

.theater-badge-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 14;
  pointer-events: none;
}
.theater-live-pill, .theater-title-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(10, 10, 14, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-hairline);
  font-size: 0.74rem;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulseGlow 1.5s infinite;
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.theater-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 16px 14px;
  background: linear-gradient(to top, rgba(4, 4, 6, 0.92), transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.theater-viewport:hover .theater-controls,
.theater-controls:focus-within { opacity: 1; }
.theater-scrubber-row { display: flex; align-items: center; gap: 10px; }
.time-code { font-size: 0.72rem; color: var(--text-muted); min-width: 44px; }
.seek-slider { flex: 1; accent-color: var(--accent); cursor: pointer; }
.mini-slider { width: 82px; accent-color: var(--accent); cursor: pointer; }

.theater-btn-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.theater-left-btns, .theater-right-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vol-cluster { display: flex; align-items: center; gap: 6px; }
.ctrl-mini {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.09);
}
.ctrl-mini:hover { background: rgba(255, 255, 255, 0.16); }

.chip-toggle, .chip-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
}
.chip-toggle.active { background: var(--accent); border-color: transparent; }
.chip-danger { background: rgba(225, 29, 72, 0.2); border-color: rgba(225, 29, 72, 0.45); color: #fecdd3; }

/* Participant Video Grid */
.participants-grid {
  position: relative;
  z-index: 8;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 14px;
  align-items: center;
  justify-items: center;
}

.participants-grid.grid-solo {
  grid-template-columns: minmax(280px, 860px);
  justify-content: center;
}
.participants-grid.grid-duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1200px;
}
.participants-grid.grid-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1280px;
}
.participants-grid.grid-quad {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  max-width: 1060px;
}

/* Intimate Duo Focus (Partner Full Stage + Self Corner PiP) */
.participants-grid.grid-duo-pip {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1040px;
}
.participants-grid.grid-duo-pip .peer-tile:not(.self) {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 165px);
}
.participants-grid.grid-duo-pip .peer-tile.self {
  position: fixed;
  right: 26px;
  bottom: 90px;
  width: 216px;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  z-index: 16;
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.72);
}
.participants-grid.grid-duo-pip .peer-tile.self .avatar-monogram {
  width: 42px;
  height: 42px;
  font-size: 1.25rem;
}

/* Filmstrip when Theater is active */
.stage-area.theater-active .participants-grid {
  flex: 0 0 auto;
  height: 122px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.stage-area.theater-active .peer-tile {
  position: static !important;
  width: 204px;
  height: 100%;
  max-height: 122px;
  border-radius: var(--radius-md);
}
.stage-area.theater-active .avatar-monogram { width: 40px; height: 40px; font-size: 1.2rem; }

.peer-tile {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 175px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: linear-gradient(160deg, rgba(24, 24, 30, 0.94), rgba(12, 12, 16, 0.98));
  border: 1px solid var(--border-hairline);
  box-shadow: var(--specular-top), 0 18px 42px rgba(0, 0, 0, 0.48);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.peer-tile.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 18px 42px rgba(0, 0, 0, 0.55);
}
.peer-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.peer-tile.self.mirrored video { transform: scaleX(-1); }

.peer-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-monogram {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.peer-overlay-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.peer-tz-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 8, 12, 0.7);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}
.peer-host-crown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(229, 152, 75, 0.22);
  border: 1px solid rgba(229, 152, 75, 0.35);
  color: #fde68a;
  font-size: 0.66rem;
  font-weight: 600;
}

.peer-overlay-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 12px 10px;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.85), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.peer-name { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-state-icons { display: flex; align-items: center; gap: 5px; }
.state-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 14, 18, 0.72);
}
.state-dot.off { color: #fda4af; background: rgba(225, 29, 72, 0.25); }

/* Floating Detached Side Drawer */
.side-drawer {
  position: relative;
  z-index: 18;
  width: 344px;
  max-width: 92vw;
  margin: 6px 16px 86px 0;
  background: var(--bg-glass);
  backdrop-filter: blur(28px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xl);
  box-shadow: var(--specular-top), var(--shadow-cinema);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.22s ease, margin 0.22s ease, opacity 0.2s ease;
}
.side-drawer.collapsed {
  width: 0;
  margin: 0;
  opacity: 0;
  border: none;
  pointer-events: none;
}

.drawer-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 10px;
  border-bottom: 1px solid var(--border-hairline);
}
.drawer-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}
.drawer-tab.active { background: rgba(255, 255, 255, 0.09); color: var(--text-main); }
.drawer-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.unread-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }

.drawer-pane { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px; gap: 10px; }
.drawer-pane.active { display: flex; }

.pane-head h4 { margin: 0 0 3px; font-size: 0.9rem; }
.pane-head p { margin: 0; font-size: 0.75rem; color: var(--text-muted); }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.chat-item {
  padding: 8px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-hairline);
  font-size: 0.83rem;
  line-height: 1.45;
  align-self: flex-start;
  max-width: 92%;
}
.chat-item.mine { align-self: flex-end; background: var(--accent-soft); border-color: rgba(255, 255, 255, 0.12); }
.chat-item.system { align-self: center; background: transparent; border: none; color: var(--text-dim); font-size: 0.72rem; text-align: center; padding: 2px 6px; }
.chat-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 0.69rem; color: var(--text-muted); margin-bottom: 2px; }

.quick-prompts { display: flex; gap: 6px; flex-wrap: wrap; }
.prompt-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  font-size: 0.71rem;
  color: var(--text-muted);
}
.prompt-chip:hover { border-color: var(--accent); color: var(--text-main); }

.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: rgba(0, 0, 0, 0.42);
  font-size: 0.84rem;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.btn-send, .btn-add-sm {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inline-add-form { display: flex; gap: 6px; }
.inline-add-form select { width: 92px; flex-shrink: 0; }
.watchlist-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-hairline);
}
.watch-item.done .watch-title { text-decoration: line-through; opacity: 0.5; }
.watch-check { display: flex; align-items: center; gap: 9px; text-align: left; flex: 1; min-width: 0; }
.watch-tag { font-size: 0.65rem; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.watch-title { font-size: 0.83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-sub { font-size: 0.69rem; color: var(--text-dim); }
.btn-del-sm { color: var(--text-dim); padding: 4px; }
.btn-del-sm:hover { color: #fda4af; }

.poll-create-form { display: flex; flex-direction: column; gap: 8px; }
.poll-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poll-opt-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}
.poll-opt-btn.voted { border-color: var(--accent); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); pointer-events: none; transition: width 0.25s ease; }
.poll-opt-btn span { position: relative; z-index: 1; }

.participants-list { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.person-row {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.person-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.person-meta { font-size: 0.72rem; color: var(--text-muted); }
.person-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Precision Circular Floating Dock */
.control-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  transition: opacity 0.25s ease;
}
.dock-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(26px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--specular-top), var(--shadow-cinema);
}
.dock-sep { width: 1px; height: 22px; background: var(--border-hairline); margin: 0 3px; }

.dock-circle {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.16s ease;
}
.dock-circle:hover { background: rgba(255, 255, 255, 0.09); color: var(--text-main); }
.dock-circle.active { background: rgba(255, 255, 255, 0.12); color: var(--text-main); }
.dock-circle.muted { background: rgba(225, 29, 72, 0.22); color: #fda4af; }
.dock-circle.love { color: #fda4af; }
.dock-circle.love:hover { background: var(--accent-soft); }
.dock-circle.danger { background: rgba(225, 29, 72, 0.22); color: #fda4af; }
.dock-circle.danger:hover { background: var(--danger); color: #fff; }

.dock-pill-hero {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 20px -4px var(--accent-glow);
  transition: filter 0.16s ease, transform 0.16s ease;
}
.dock-pill-hero:hover { filter: brightness(1.08); transform: translateY(-1px); }

.dock-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

/* Popovers */
.popover-anchor { position: relative; }
.popover-menu, .reactions-popover {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  backdrop-filter: blur(26px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--specular-top), var(--shadow-cinema);
  z-index: 40;
}
.popover-menu { width: 292px; padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.popover-title { padding: 6px 10px; font-size: 0.7rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.popover-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}
.popover-item:hover { background: rgba(255, 255, 255, 0.07); }
.popover-item strong { display: block; font-size: 0.83rem; }
.popover-item small { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.reactions-popover { display: flex; gap: 4px; padding: 6px 8px; }
.rx-btn { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; transition: transform 0.14s ease, background 0.14s ease; }
.rx-btn:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.14); }

/* Sleep Overlay */
.sleep-overlay { position: fixed; inset: 0; z-index: 80; background: #040407; display: flex; align-items: center; justify-content: center; }
.starfield-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sleep-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 24px; }
.sleep-eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-dim); }
.sleep-aura-ring {
  width: 110px;
  height: 110px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sleep-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; }
.sleep-clocks { display: flex; gap: 32px; }
.clock-box { display: flex; flex-direction: column; gap: 4px; }
.clock-label { font-size: 0.73rem; color: var(--text-muted); }
.clock-box strong { font-size: 1.7rem; font-weight: 500; }
.sleep-controls { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.sleep-timer-select { display: flex; align-items: center; gap: 10px; font-size: 0.81rem; color: var(--text-muted); }
.sleep-timer-select select { padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border-hairline); }
.sleep-countdown { font-size: 0.84rem; color: var(--accent); }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(2, 2, 5, 0.74); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 430px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--specular-top), var(--shadow-cinema); overflow: hidden; }
.modal-card.wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-hairline); }
.modal-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.modal-close { color: var(--text-muted); padding: 4px; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-body.center-col { align-items: center; }
.modal-desc { margin: 0; font-size: 0.84rem; color: var(--text-muted); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; width: 100%; }
.modal-actions.wrap { flex-wrap: wrap; }
.btn-ghost { padding: 9px 14px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.83rem; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-main); }
.btn-danger-sm { padding: 9px 15px; border-radius: var(--radius-sm); background: var(--danger); color: #fff; font-size: 0.82rem; font-weight: 600; }
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.84rem; color: var(--text-muted); }
.divider { border: none; border-top: 1px solid var(--border-hairline); margin: 4px 0; }
.polaroid-preview { max-width: 100%; max-height: 58vh; border-radius: 10px; box-shadow: var(--shadow-cinema); }

/* Responsive */
@media (max-width: 920px) {
  .lobby-stage { grid-template-columns: 1fr; }
  .room-topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .session-capsule { order: 3; width: 100%; justify-content: center; }
  .participants-grid.grid-trio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .participants-grid.grid-duo-pip .peer-tile.self { width: 136px; right: 14px; bottom: 84px; }
  .side-drawer {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 84px;
    z-index: 26;
    margin: 0;
    width: calc(100% - 24px);
    max-width: 360px;
  }
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .participants-grid.grid-duo,
  .participants-grid.grid-trio,
  .participants-grid.grid-quad {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .stage-area.theater-active .participants-grid { height: 94px; }
  .stage-area.theater-active .peer-tile { width: 148px; }
}
