/* ═══════════════════════════════════════════════════════════
   CINELUX — Deep Midnight Cinema Theme
   Palette: near-black bg · deep purple-indigo glow · 
            electric violet accent · warm amber highlight
   ═══════════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg: #07060d;
  --bg-mid: #0d0b18;
  --surface: #110f1e;
  --surface-2: #16132a;
  --surface-3: #1c1830;
  --surface-hover: #221e38;

  /* Borders */
  --border: rgba(140, 120, 220, 0.14);
  --border-mid: rgba(140, 120, 220, 0.24);
  --border-glow: rgba(160, 130, 255, 0.38);

  /* Text */
  --text: #ede8ff;
  --text-soft: #b8b0d8;
  --text-dim: #6e6890;

  /* Accent — cinema crimson */
  --accent: #9b1b1b;
  --accent-2: #e05555;
  --accent-deep: #6b0f0f;
  --accent-soft: rgba(155, 27, 27, 0.22);
  --accent-veil: rgba(155, 27, 27, 0.1);
  --accent-glow: rgba(155, 27, 27, 0.38);

  /* Highlight — warm gold */
  --gold: #f0b429;
  --gold-soft: rgba(240, 180, 41, 0.14);
  --gold-veil: rgba(240, 180, 41, 0.07);

  /* Danger */
  --danger: #ff5c5c;
  --danger-soft: rgba(255, 92, 92, 0.14);

  /* Shadows */
  --shadow: 0 24px 64px rgba(20, 4, 4, 0.72);
  --shadow-glow: 0 0 40px rgba(155, 27, 27, 0.16);

  /* Radii */
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --max-width: 1440px;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  scroll-behavior: smooth;
  overflow: hidden;
  scrollbar-width: none;
}

body {
  height: 100%;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -10%,
      rgba(155, 27, 27, 0.22),
      transparent
    ),
    radial-gradient(
      ellipse 40% 30% at 80% 10%,
      rgba(220, 60, 60, 0.08),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 10% 80%,
      rgba(100, 20, 20, 0.12),
      transparent
    ),
    linear-gradient(180deg, #07060d 0%, #0f0808 50%, #060505 100%);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -ms-overflow-style: none;
  overscroll-behavior: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0;
  height: 0;
}

a {
  color: inherit;
  text-decoration: none;
}
button,
input {
  font: inherit;
}

/* ── Page shell & ambience ── */
.page-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}
.ambient,
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.ambient-a {
  background: radial-gradient(
    ellipse 70% 50% at 50% 0%,
    rgba(155, 27, 27, 0.18),
    transparent 60%
  );
  filter: blur(60px);
}
.ambient-b {
  background: radial-gradient(
    ellipse 40% 30% at 85% 15%,
    rgba(220, 80, 80, 0.07),
    transparent
  );
  filter: blur(80px);
}
.noise {
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  mix-blend-mode: overlay;
}

/* ══════════════════════════════════════════════
   NAVBAR  (home / join / name / create only)
   ══════════════════════════════════════════════ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 60px;
  background: rgba(7, 6, 13, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid rgba(140, 120, 220, 0.1);
}
.nav-brand {
  font-family: "Newsreader", serif;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(155, 27, 27, 0.8);
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  transition:
    color 160ms,
    background 160ms;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.nav-link.active {
  color: var(--text);
  background: var(--accent-veil);
}
.nav-cta {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: rgba(155, 27, 27, 0.2);
  color: #e05555;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid rgba(155, 27, 27, 0.35);
  cursor: pointer;
  transition:
    background 160ms,
    transform 160ms;
}
.nav-cta:hover {
  background: rgba(155, 27, 27, 0.35);
  transform: translateY(-1px);
}

/* Hide nav on room screens */
.route-host .site-nav,
.route-viewer .site-nav {
  display: none;
}

/* ══════════════════════════════════════════════
   APP SHELL  (non-room screens)
   ══════════════════════════════════════════════ */
.app {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 48px 72px;
}

.screen {
  display: none;
}
.screen-active {
  display: block;
}

/* Room screens break out of .app */
.screen[data-screen="host"].screen-active,
.screen[data-screen="viewer"].screen-active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.icon-button,
.button,
.ghost-button,
.send-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.button,
.ghost-button,
.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-md);
  transition:
    transform 150ms ease,
    opacity 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}
.button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}
.button:active,
.ghost-button:active {
  transform: translateY(0);
}

.button {
  min-height: 50px;
  padding: 0 22px;
  font-weight: 600;
  font-size: 0.92rem;
}
.button-primary {
  background: var(--accent);
  color: #fff;
  box-shadow:
    0 8px 28px rgba(155, 27, 27, 0.45),
    0 0 0 1px rgba(192, 40, 42, 0.3);
}
.button-primary:hover {
  box-shadow:
    0 12px 36px rgba(155, 27, 27, 0.6),
    0 0 0 1px rgba(192, 40, 42, 0.4);
}
.button-secondary {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-mid);
}
.button-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
}

.button svg,
.ghost-button svg,
.send-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.lock-copy svg,
.full-icon svg,
.ended-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ghost-button {
  padding: 0 14px;
  min-height: 38px;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 0.86rem;
}
.danger-ghost {
  color: #ff8080;
  border-color: rgba(255, 92, 92, 0.22);
}
.danger-ghost:hover {
  background: var(--danger-soft);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wide-button {
  width: min(100%, 460px);
}

/* ══════════════════════════════════════════════
   CHIPS / PILLS / LABELS
   ══════════════════════════════════════════════ */
.eyebrow,
.section-label,
.page-kicker,
.room-chip,
.status-chip,
.feature-chip,
.live-pill {
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
}
.eyebrow,
.section-label,
.page-kicker {
  color: var(--accent-2);
  margin: 0 0 12px;
}

.feature-chip,
.status-chip,
.room-chip,
.live-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-mid);
  background: var(--accent-veil);
  color: var(--accent-2);
}
.status-chip.live-red {
  background: rgba(255, 92, 92, 0.14);
  border-color: rgba(255, 92, 92, 0.28);
  color: #ff9090;
}
.status-chip.green {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.24);
  color: #6ee7b7;
}
.live-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 60, 60, 0.7);
  border-color: rgba(255, 120, 120, 0.2);
  color: #ffd5d0;
  animation: pulse-live 2s ease-in-out infinite;
}
@keyframes pulse-live {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 60, 60, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 60, 60, 0);
  }
}

/* ── Avatar bubble ── */
.avatar-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #9b1b1b, #c0282a);
  border: 1.5px solid rgba(192, 40, 42, 0.4);
  flex-shrink: 0;
  user-select: none;
  box-shadow: 0 0 12px rgba(155, 27, 27, 0.3);
}
.avatar-bubble.alt {
  background: linear-gradient(135deg, #6b0f0f, #9b1b1b);
}
.avatar-bubble.small {
  width: 28px;
  height: 28px;
  font-size: 0.72rem;
}
.avatar-bubble.tiny {
  width: 22px;
  height: 22px;
  font-size: 0.62rem;
}

/* ══════════════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════════════ */
.landing-hero {
  padding: 64px 0 52px;
  max-width: 820px;
}
.landing-hero h1 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(3rem, 6.5vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.01em;
  color: var(--text);
}
.landing-hero h1 em {
  font-style: italic;
  background: linear-gradient(135deg, #e05555, #c0282a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-copy {
  max-width: 560px;
  margin: 22px 0 0;
  font-size: 1.08rem;
  color: var(--text-soft);
  line-height: 1.75;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* ── Preview card ── */
.preview-card {
  width: min(100%, 860px);
  margin: 44px 0 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), var(--shadow-glow);
}
.preview-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(
      ellipse at 50% 50%,
      rgba(100, 60, 220, 0.22),
      rgba(4, 2, 16, 0.95)
    ),
    #0a0816;
  overflow: hidden;
}
.preview-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 60%,
    rgba(7, 6, 13, 0.8) 100%
  );
}
.preview-play {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(155, 27, 27, 0.35);
  border: 1px solid rgba(192, 40, 42, 0.4);
  backdrop-filter: blur(12px);
  z-index: 1;
}
.preview-play svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}
.preview-audience {
  position: absolute;
  left: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 1;
}
.audience-more {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 8, 22, 0.9);
  color: var(--text-dim);
  font-size: 0.68rem;
}
.preview-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px 18px;
}
.preview-title {
  margin: 0 0 3px;
  font-family: "Newsreader", serif;
  font-size: 1.15rem;
  color: var(--text);
}
.preview-subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* ── Info cards ── */
.section-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.narrow-stack {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.info-card {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition:
    border-color 200ms,
    box-shadow 200ms;
}
.info-card:hover {
  border-color: var(--border-mid);
  box-shadow:
    var(--shadow),
    0 0 24px rgba(155, 109, 255, 0.08);
}
.muted-card {
  background: var(--surface-2);
}
.info-card h2 {
  margin: 0 0 10px;
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(1.3rem, 1.7vw, 1.7rem);
  letter-spacing: 0.01em;
  color: var(--text);
}
.info-card p {
  color: var(--text-soft);
  line-height: 1.7;
  margin: 0;
  font-size: 0.93rem;
}

/* ══════════════════════════════════════════════
   CENTER STAGE  (name / join)
   ══════════════════════════════════════════════ */
.center-stage {
  width: min(100%, 560px);
  margin: 8vh auto 0;
  padding: 48px 44px 52px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), var(--shadow-glow);
}
.center-stage h2 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
  color: var(--text);
}
.page-copy {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 0.95rem;
}
.name-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: block;
}

/* Name form */
.name-form {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}
.name-form input,
.code-field input,
.chat-composer input {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mid);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
  transition:
    border-color 180ms,
    box-shadow 180ms,
    background 180ms;
}
.name-form input:focus,
.code-field input:focus,
.chat-composer input:focus {
  border-color: rgba(155, 109, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(155, 109, 255, 0.14);
  background: rgba(155, 109, 255, 0.05);
}
.name-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  text-align: center;
  font-size: 1.05rem;
}

/* ── Join ── */
.join-stage {
  padding-bottom: 44px;
}
.code-field {
  margin: 26px auto 18px;
  width: min(100%, 440px);
}
.code-field input {
  width: 100%;
  min-height: 84px;
  padding: 0 22px;
  text-align: center;
  letter-spacing: 0.45em;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  text-transform: uppercase;
}
.code-field input::placeholder {
  color: rgba(200, 190, 255, 0.2);
}

.helper-copy {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.form-error {
  min-height: 20px;
  margin: -6px 0 14px;
  color: #ff9a9a;
  font-size: 0.84rem;
  line-height: 1.4;
}
.code-field.has-error input {
  border-color: rgba(255, 120, 120, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 120, 120, 0.12);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  transition: color 150ms;
}
.back-link:hover {
  color: var(--text-soft);
}

/* ── Create modal ── */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 16, 0.78);
  backdrop-filter: blur(18px);
  z-index: 0;
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  margin: 9vh auto 0;
  padding: 44px 36px 38px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), var(--shadow-glow);
}
.modal-card h2 {
  margin: 6px 0 0;
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  letter-spacing: 0.01em;
  color: var(--text);
}
.room-code-panel {
  margin: 22px auto 20px;
  padding: 20px 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--accent-veil);
  border: 1px solid var(--border-mid);
}
.room-code {
  margin-bottom: 16px;
  color: var(--accent-2);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  letter-spacing: 0.18em;
  text-shadow: 0 0 24px rgba(192, 132, 252, 0.4);
}
.room-code-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.lock-copy {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.lock-copy svg {
  width: 13px;
  height: 13px;
}
.center {
  text-align: center;
}

/* ══════════════════════════════════════════════
   ROOM LAYOUT  (host + viewer — full viewport)
   ══════════════════════════════════════════════ */
.host-layout,
.viewer-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px 18px 12px;
  gap: 10px;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse 60% 40% at 50% 0%,
      rgba(155, 27, 27, 0.14),
      transparent 60%
    ),
    var(--bg);
}

/* ── Room topbar (room screens only — no site-nav) ── */
.room-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.room-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.room-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.room-fullscreen svg {
  width: 18px;
  height: 18px;
}
.room-brand {
  font-family: "Newsreader", serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.room-brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(155, 27, 27, 0.8);
}
.room-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  background: var(--accent-veil);
  color: var(--accent-2);
  border-color: var(--border-mid);
}
.top-status {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ── Room content grid ── */
.room-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Stage panel ── */
.stage-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(
      ellipse 140% 90% at 10% 0%,
      rgba(155, 27, 27, 0.1),
      transparent 55%
    ),
    radial-gradient(
      ellipse 120% 70% at 90% 10%,
      rgba(240, 180, 41, 0.05),
      transparent 60%
    ),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  flex-shrink: 0;
}
.video-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 8px;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(155, 27, 27, 0.08),
    #050208
  );
  border: 1px solid var(--border);
}
.fs-minimize {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.fs-minimize svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fs-minimize:hover {
  background: rgba(0, 0, 0, 0.7);
}
.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.stage-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  text-align: center;
  pointer-events: none;
}
.stage-placeholder svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}
.stage-placeholder p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* ── Chat panel ── */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(
      ellipse 140% 90% at 10% 0%,
      rgba(155, 27, 27, 0.08),
      transparent 55%
    ),
    radial-gradient(
      ellipse 120% 70% at 90% 10%,
      rgba(140, 120, 220, 0.06),
      transparent 60%
    ),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header h3 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--text);
}

/* ── Chat feed — Discord compact ── */
.chat-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scroll-behavior: smooth;
}
.chat-feed::-webkit-scrollbar {
  width: 3px;
}
.chat-feed::-webkit-scrollbar-track {
  background: transparent;
}
.chat-feed::-webkit-scrollbar-thumb {
  background: rgba(155, 27, 27, 0.3);
  border-radius: 4px;
}

.message {
  padding: 1px 6px;
  border-radius: 6px;
  transition: background 100ms;
}
.message:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* First message in a group gets a little top breathing room */
.msg-first {
  margin-top: 10px;
}
/* Continuation messages are tight */
.msg-continued {
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.msg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #9b1b1b, #c0282a);
  border: 1px solid rgba(192, 40, 42, 0.3);
  flex-shrink: 0;
  margin-top: 2px;
  user-select: none;
}
.message-self .msg-avatar {
  background: linear-gradient(135deg, #6b0f0f, #9b1b1b);
}

.msg-continued .msg-avatar {
  height: 0;
  margin-top: 0;
  border-color: transparent;
  background: transparent;
}

.message-body {
  flex: 1;
  min-width: 0;
}

/* Header line: name + timestamp — only on first message */
.message-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 1px;
  flex-wrap: wrap;
}
.message-meta {
  color: #e05555;
  font-size: 0.76rem;
  font-weight: 600;
}
.message-self .message-meta {
  color: #f08080;
}
.host-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(240, 129, 129, 0.22);
  background: rgba(155, 27, 27, 0.12);
  color: #ffb1b1;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.message-time {
  color: var(--text-dim);
  font-size: 0.67rem;
}

/* The text line */
.message p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}
.message-self p {
  color: #d4d0f0;
}

/* Continuation: text sits flush under the previous line */
.msg-continued .message-body {
  padding-top: 0;
}
.msg-continued p {
  line-height: 1.3;
}

/* ── Chat composer ── */
.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 6px;
  padding: 7px 8px 9px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-composer input {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
  color: var(--text);
}
.send-button {
  width: 40px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(155, 27, 27, 0.22);
  color: #e05555;
  border: 1px solid rgba(155, 27, 27, 0.3);
}
.send-button:hover {
  background: rgba(155, 27, 27, 0.36);
}

/* ── Room footer controls ── */
.room-controls,
.viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.mute-button {
  width: 44px;
  height: 44px;
}
.mute-button svg {
  width: 18px;
  height: 18px;
}
.mic-button {
  position: relative;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease;
}
.mic-button.mic-active {
  color: #f6d7d7;
}
.mic-button.mic-speaking {
  background: rgba(240, 180, 41, 0.12);
  color: #ffe3a8;
  box-shadow:
    0 0 0 1px rgba(240, 180, 41, 0.22),
    0 0 18px rgba(240, 180, 41, 0.34);
  animation: micGlowPulse 1.2s ease-in-out infinite;
}
.mic-button.mic-speaking:hover {
  transform: translateY(-1px) scale(1.03);
}

@keyframes micGlowPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(240, 180, 41, 0.22),
      0 0 18px rgba(240, 180, 41, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(240, 180, 41, 0.28),
      0 0 22px rgba(240, 180, 41, 0.42);
  }
}


/* ══════════════════════════════════════════════
   ENDED / FULL SCREENS
   ══════════════════════════════════════════════ */
.ended-backdrop,
.full-backdrop {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(20px);
  z-index: 0;
}
.ended-backdrop {
  background:
    radial-gradient(
      ellipse at 40% 30%,
      rgba(180, 60, 60, 0.2),
      transparent 40%
    ),
    rgba(4, 2, 16, 0.88);
}
.full-backdrop {
  background:
    radial-gradient(
      ellipse at 50% 30%,
      rgba(120, 40, 200, 0.2),
      transparent 40%
    ),
    rgba(4, 2, 16, 0.88);
}
.screen[data-screen="ended"].screen-active,
.screen[data-screen="full"].screen-active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 18px;
}
.ended-card,
.full-card {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  margin: 0;
  padding: 44px 34px 38px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), var(--shadow-glow);
  max-height: calc(100vh - 36px);
  overflow: auto;
}
.ended-card h2,
.full-card h2 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: 0.01em;
  color: var(--text);
}
.ended-card p,
.full-card p {
  max-width: 40ch;
  margin: 12px auto 0;
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 0.96rem;
}
.ended-icon,
.full-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-2);
  background: var(--accent-veil);
  border: 1px solid var(--border-mid);
}
.ended-icon svg,
.full-icon svg {
  width: 26px;
  height: 26px;
}
.ended-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  justify-items: center;
}

/* ══════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════ */
.connection-overlay {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 20;
  width: min(360px, calc(100vw - 36px));
}
.connection-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(18, 14, 38, 0.92);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.connection-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
}
.connection-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.45;
}
.connection-spinner {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-2);
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .room-content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .chat-panel {
    max-height: 260px;
  }
}

@media (max-width: 860px) {
  .app {
    padding: 0 24px 56px;
  }
  .site-nav {
    padding: 0 24px;
  }
  .landing-hero {
    padding-top: 40px;
  }
  .narrow-stack {
    grid-template-columns: 1fr;
  }
  .center-stage,
  .modal-card,
  .full-card,
  .ended-card {
    padding-left: 22px;
    padding-right: 22px;
  }
  .host-layout,
  .viewer-layout {
    padding: 10px 12px;
  }
  .room-controls,
  .viewer-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .button-primary,
  .button-secondary,
  .wide-button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 0 16px 48px;
  }
  .site-nav {
    padding: 0 16px;
  }
  .landing-hero h1 {
    font-size: clamp(2.4rem, 11vw, 3.4rem);
  }
  .code-field input {
    min-height: 72px;
    letter-spacing: 0.26em;
    font-size: 1.2rem;
  }
  .room-code {
    letter-spacing: 0.1em;
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }
  .chat-header {
    padding: 10px 12px 8px;
  }
  .chat-feed {
    padding: 6px 8px;
  }
  .chat-composer {
    padding: 6px 7px 8px;
  }
  .quality-picker {
    align-self: flex-end;
  }
  .quality-menu {
    min-width: 132px;
  }
  .nav-links {
    display: none;
  }
}

/* ══════════════════════════════════════════════
   SHARE BUTTON
   ══════════════════════════════════════════════ */
.share-button {
  color: var(--gold);
  border-color: rgba(240, 180, 41, 0.22);
}
.share-button:hover {
  background: rgba(240, 180, 41, 0.08);
  border-color: rgba(240, 180, 41, 0.38);
}
.share-button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   QUALITY PICKER
   ══════════════════════════════════════════════ */
.quality-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
}
.quality-toggle-btn {
  gap: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  min-height: 38px;
  padding: 0 12px;
}
.quality-toggle-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.quality-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 148px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--surface-3);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow-y: auto;
  max-width: calc(100vw - 24px);
}
.quality-menu li {
  padding: 9px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background 120ms,
    color 120ms;
}
.quality-menu li:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.quality-menu li[aria-selected="true"] {
  color: var(--accent-2);
  background: var(--accent-veil);
}

/* ── Volume Slider ── */
.audio-control-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding-right: 14px;
}
.audio-control-wrapper .mute-toggle-btn {
  border: none;
  background: transparent;
  min-width: 120px;
}
.audio-control-wrapper .mute-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}
.volume-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: transform 100ms;
}
.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border: none;
  transition: transform 100ms;
}
.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}
.volume-slider:focus {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

/* ── Expiry countdown notice ── */
.room-expiry-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 10px 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--gold-veil);
  border: 1px solid var(--gold-soft);
  color: var(--text-soft);
  font-size: 0.88rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.room-expiry-notice strong {
  color: var(--gold);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}
.room-expiry-notice .expiry-icon {
  font-size: 1.1rem;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  max-width: 380px;
  width: calc(100% - 48px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(18, 14, 38, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-mid);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: var(--shadow), var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-error {
  border-color: rgba(255, 120, 120, 0.4);
  background: rgba(32, 12, 22, 0.92);
  box-shadow: 0 4px 20px rgba(255, 100, 100, 0.08), var(--shadow);
}
.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.toast-message {
  flex-grow: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
