/* Squad Theater 3.0  -  Grand Stage cinematic theme (UI polish) */
:root {
  --velvet: #6b1e2e;
  --velvet-dark: #4a1420;
  --velvet-deep: #2d0a12;
  --gold: #d4af37;
  --gold-light: #e8c96a;
  --gold-dim: #9a7b2c;
  --gold-glow: rgba(212, 175, 55, 0.35);
  --wood: #3d2314;
  --wood-dark: #1e1008;
  --bg-top: #3d1518;
  --bg-mid: #1a080c;
  --bg-bot: #0a0406;
  --text: #f5e6d3;
  --muted: rgba(245, 230, 211, 0.62);
  --line: rgba(212, 175, 55, 0.28);
  --line-strong: rgba(212, 175, 55, 0.48);
  --danger: #e85d5d;
  --ok: #5dce8a;
  --warn: #e8b84a;
  --panel: rgba(14, 6, 10, 0.88);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: "Clash Display", "Palatino Linotype", Palatino, serif;
  --font-body: "Satoshi", system-ui, -apple-system, Segoe UI, sans-serif;
  --font-italic: "Clash Display", Georgia, serif;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(212, 175, 55, 0.06);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-hc="1"] {
  --text: #fff8ef;
  --muted: rgba(255, 248, 239, 0.82);
  --line: rgba(232, 201, 106, 0.55);
  --gold: #f0d78c;
  --gold-light: #f7e7a8;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-bot);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(140, 45, 65, 0.5), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(60, 20, 30, 0.45), transparent),
    radial-gradient(ellipse 50% 40% at 100% 90%, rgba(40, 15, 25, 0.4), transparent),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 45%, var(--bg-bot));
  overflow-x: hidden;
}

body.theater-live {
  background: #050203;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/*  -  -  -  Screens  -  -  -  */
.screen {
  display: none;
  min-height: 100dvh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/*  -  -  -  Landing ambient  -  -  -  */
#screen-landing {
  align-items: center;
  justify-content: center;
  padding: calc(1.5rem + var(--safe-top)) 1rem calc(2rem + var(--safe-bottom));
  position: relative;
  overflow: hidden;
}

.lobby-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.35;
  animation: spotPulse 8s var(--ease) infinite alternate;
}
.spot-a {
  width: min(50vw, 320px);
  height: min(50vw, 320px);
  left: 10%;
  top: 8%;
  background: rgba(212, 175, 55, 0.22);
}
.spot-b {
  width: min(45vw, 280px);
  height: min(45vw, 280px);
  right: 5%;
  bottom: 15%;
  background: rgba(107, 30, 46, 0.45);
  animation-delay: -3s;
}
.spot-c {
  width: min(30vw, 180px);
  height: min(30vw, 180px);
  left: 45%;
  bottom: 5%;
  background: rgba(232, 201, 106, 0.12);
  animation-delay: -5s;
}
@keyframes spotPulse {
  from {
    transform: scale(1);
    opacity: 0.28;
  }
  to {
    transform: scale(1.12);
    opacity: 0.42;
  }
}

.curtain-side {
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(20vw, 150px);
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 10px,
      rgba(0, 0, 0, 0.12) 10px 12px
    ),
    linear-gradient(90deg, #2a0a12, #6b1e2e 38%, #4a1420 70%, #3a0c16);
  opacity: 0.72;
  z-index: 0;
}
.curtain-side.left {
  left: 0;
  box-shadow: inset -28px 0 50px rgba(0, 0, 0, 0.45);
}
.curtain-side.right {
  right: 0;
  transform: scaleX(-1);
}

/*  -  -  -  Landing card  -  -  -  */
.card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background:
    linear-gradient(165deg, rgba(52, 20, 28, 0.96), rgba(10, 4, 8, 0.98) 55%, rgba(14, 6, 10, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 230, 180, 0.08);
  padding: 1.85rem 1.55rem 1.4rem;
  text-align: center;
  backdrop-filter: blur(16px);
  animation: cardIn 0.55s var(--ease) both;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card-ornament {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0.55rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.55;
}

.marque {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.85rem;
}
.marque-bulb {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 55%, #8a6a1a);
  box-shadow: 0 0 8px var(--gold-glow);
  animation: bulb 2.4s ease-in-out infinite;
  opacity: 0.85;
}
.marque-bulb:nth-child(odd) {
  animation-delay: 0.4s;
}
.marque-bulb:nth-child(3n) {
  animation-delay: 0.9s;
}
@keyframes bulb {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.9;
  margin: 0 0 0.65rem;
}

.card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 4.4vw, 1.85rem);
  color: var(--gold-light);
  letter-spacing: 0.03em;
  margin: 0 0 0.45rem;
  line-height: 1.22;
  text-shadow: 0 2px 24px rgba(212, 175, 55, 0.18);
}

.tagline {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 0.95rem;
  line-height: 1.45;
}

.feature-pills {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.feature-pills li {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}

.field {
  text-align: left;
  margin-bottom: 0.9rem;
}
.field label,
.field-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.38rem;
  font-weight: 500;
}
.label-soft {
  opacity: 0.55;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78em;
}
.field input,
.field select {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.48);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input::placeholder {
  color: rgba(245, 230, 211, 0.32);
}
.field input:hover,
.field select:hover {
  border-color: rgba(212, 175, 55, 0.4);
}
.field input:focus,
.field select:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.14);
  background: rgba(0, 0, 0, 0.55);
}

.room-code-input {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 1.05rem;
  text-align: center;
}

.hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0.45rem 0 0;
  line-height: 1.4;
}

.segment {
  display: flex;
  gap: 0.4rem;
  padding: 0.28rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.38);
}
.segment-cards .segment-btn {
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.4rem;
  min-height: 52px;
}
.seg-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.seg-sub {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.segment-btn {
  flex: 1;
  min-height: 42px;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.18s var(--ease), color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.segment-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.segment-btn.active {
  background: linear-gradient(165deg, rgba(232, 201, 106, 0.28), rgba(107, 30, 46, 0.5));
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 240, 200, 0.12);
}
.segment-sm .segment-btn {
  min-height: 36px;
  font-size: 0.78rem;
}

.host-mode-row {
  margin-bottom: 0.75rem;
}

.chip.sync {
  border-color: rgba(93, 206, 138, 0.5);
  color: var(--ok);
  background: rgba(93, 206, 138, 0.08);
}

.sync-match {
  margin-top: 1rem;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 8, 12, 0.75), rgba(0, 0, 0, 0.45));
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.sync-match-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.4rem;
}
.sync-match-meta {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 0.8rem;
  word-break: break-all;
  line-height: 1.4;
}
.sync-match-status {
  font-size: 0.78rem;
  color: var(--ok);
  margin: 0.65rem 0 0;
  min-height: 1.2em;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.05rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 50px;
  padding: 0.78rem 1.15rem;
  border-radius: 13px;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: transform 0.16s var(--ease), box-shadow 0.16s ease, background 0.16s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(145deg, #f0d78c, var(--gold) 45%, #b8922a);
  color: #1a0c10;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 28px rgba(212, 175, 55, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  color: var(--gold-light);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--line-strong);
}
.btn-ghost {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: none;
  min-height: 40px;
}
.btn-ghost:hover {
  color: var(--gold-light);
}
.btn-danger {
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.4);
  color: #ffb4b4;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(232, 93, 93, 0.2);
}

.fine-links {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  justify-content: center;
  font-size: 0.78rem;
  align-items: center;
}
.fine-links a,
.linkish {
  color: var(--gold-dim);
  text-decoration: none;
  min-height: auto;
  padding: 0;
  font-size: 0.78rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.fine-links a:hover,
.linkish:hover {
  color: var(--gold-light);
}

.version-foot {
  margin: 1rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: rgba(245, 230, 211, 0.38);
}

.recent {
  margin-top: 1.25rem;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.recent h2 {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 0.55rem;
  font-weight: 500;
}
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.recent-list button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.recent-list button:hover {
  border-color: var(--line);
  background: rgba(212, 175, 55, 0.06);
}
.recent-list .meta {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 0.95rem;
  background: rgba(0, 0, 0, 0.28);
}
.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(232, 184, 74, 0.4);
  animation: pulseDot 2s ease infinite;
}
.status-pill.live .dot {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: none;
}
@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/*  -  -  -  Theater shell  -  -  -  */
#screen-theater {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #050203;
}

.theater-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: calc(0.5rem + var(--safe-top)) 0.8rem 0.55rem;
  background: linear-gradient(180deg, rgba(18, 6, 10, 0.96), rgba(8, 3, 5, 0.92));
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 12;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.theater-top .brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold));
  box-shadow: 0 0 10px var(--gold-glow);
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  white-space: nowrap;
}
.theater-top .room-meta {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  min-width: 0;
}
.chip {
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.25);
}
.chip.director {
  background: rgba(212, 175, 55, 0.16);
  border-color: var(--line-strong);
}
.room-label {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.seat-count {
  opacity: 0.85;
  white-space: nowrap;
}
.top-actions {
  display: flex;
  gap: 0.32rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.icon-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--gold-light);
  font-size: 0.78rem;
  padding: 0 0.55rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.icon-btn:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--line-strong);
}
.icon-btn:active {
  transform: scale(0.97);
}
.icon-btn.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.2);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}
.icon-btn-leave:hover {
  border-color: rgba(232, 93, 93, 0.45);
  color: #ffb4b4;
  background: rgba(232, 93, 93, 0.1);
}

.theater-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}
@media (min-width: 900px) {
  .theater-body {
    grid-template-columns: 1fr minmax(280px, 320px);
  }
  .side-panel {
    border-left: 1px solid var(--line);
  }
}

/*  -  -  -  Stage  -  -  -  */
.stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #000;
}

.proscenium {
  position: absolute;
  inset: 0 0 auto 0;
  height: 18px;
  z-index: 9;
  pointer-events: none;
  background: linear-gradient(180deg, #2a1210, #1a0a0c 70%, transparent);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}
.proscenium-arch {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 4px;
  height: 6px;
  border-radius: 0 0 40% 40% / 0 0 100% 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.25), transparent);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, #12080a 0%, #000 70%);
}

.screen-bezel {
  position: absolute;
  inset: 2.5% 3%;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 4px;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 2;
  opacity: 0.7;
}

#film-video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
  position: relative;
  z-index: 1;
}

.stage-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 65% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0.55;
}

.film-grain {
  opacity: 0.065;
  mix-blend-mode: overlay;
  z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.5s steps(2) infinite;
}
@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(-2%, 2%);
  }
}

.house-lights {
  z-index: 4;
  background: radial-gradient(ellipse at 50% 0%, rgba(140, 50, 60, 0.4), transparent 55%);
  transition: opacity 0.9s var(--ease), background 0.9s ease;
  opacity: 1;
  pointer-events: none;
}
body.show-started .house-lights {
  opacity: 0.08;
}
.house-lights.dim {
  opacity: 1 !important;
  background: radial-gradient(ellipse at 50% 0%, rgba(20, 8, 12, 0.45), rgba(0, 0, 0, 0.6) 70%);
}
.house-lights.blackout {
  opacity: 1 !important;
  background: rgba(0, 0, 0, 0.9);
}

/* Curtains with folds */
.curtains {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
}
.curtain {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #1e080e, #6b1e2e 28%, #4a1420 55%, #6b1e2e 78%, #1e080e);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55);
  transition: transform 1.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.curtain .fold {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.22), transparent);
  opacity: 0.7;
}
.curtain .fold:nth-child(1) {
  left: 18%;
}
.curtain .fold:nth-child(2) {
  left: 42%;
}
.curtain .fold:nth-child(3) {
  left: 68%;
}
.curtain.left {
  transform-origin: left center;
  border-right: 1px solid rgba(0, 0, 0, 0.35);
}
.curtain.right {
  transform-origin: right center;
  border-left: 1px solid rgba(0, 0, 0, 0.35);
}
.curtains.open .curtain.left {
  transform: translateX(-102%);
}
.curtains.open .curtain.right {
  transform: translateX(102%);
}

.lobby-message {
  position: absolute;
  z-index: 6;
  text-align: center;
  padding: 1.6rem 1.4rem;
  max-width: min(30rem, 90%);
  background: linear-gradient(165deg, rgba(30, 12, 16, 0.72), rgba(8, 3, 5, 0.78));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}
.lobby-message h2 {
  font-family: var(--font-display);
  color: var(--gold-light);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0.04em;
}
.lobby-message p {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}
.lobby-message.hidden {
  display: none;
}

.reactions-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}
.reaction-float {
  --rx: 0px;
  --rrot: 0deg;
  position: absolute;
  bottom: 14%;
  font-size: 1.8rem;
  animation: reactionUp 2.3s ease-out forwards;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
  pointer-events: none;
  z-index: 8;
}
@keyframes reactionUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.6) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--rx)), -130px) scale(1.15) rotate(var(--rrot));
  }
}

.sync-badge {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  z-index: 8;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
  max-width: min(70%, 280px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-badge[data-state="synced"],
.sync-badge[data-state="live_p2p"] {
  border-color: rgba(93, 206, 138, 0.45);
  color: #b8f0cb;
}
.sync-badge[data-state="nudge"],
.sync-badge[data-state="hard_seek"] {
  border-color: rgba(232, 184, 74, 0.5);
  color: #f5d98a;
}
.sync-badge[data-state="needs_gesture"],
.sync-badge[data-state="waiting_source"],
.sync-badge[data-state="idle"] {
  border-color: var(--line);
  color: var(--muted);
}

.subtitle-overlay {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  z-index: 8;
  max-width: min(90%, 42rem);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: clamp(0.92rem, 2.4vw, 1.28rem);
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.intermission-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(107, 30, 46, 0.55), transparent 55%),
    rgba(5, 2, 3, 0.92);
  animation: fadeIn 0.4s var(--ease);
}
.intermission-card[hidden] {
  display: none !important;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.intermission-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.55rem;
}
.intermission-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  margin: 0 0 0.55rem;
  color: var(--text);
  letter-spacing: 0.04em;
}
.intermission-card p {
  color: var(--muted);
  max-width: 28rem;
  margin: 0;
  line-height: 1.5;
}

#transport:not(.audience-limited) .audience-only {
  display: none !important;
}

.stats-hud {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  z-index: 8;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.64rem;
  line-height: 1.45;
  white-space: pre;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid var(--line);
  color: #b8d4a8;
  max-width: min(300px, 90%);
  display: none;
  backdrop-filter: blur(6px);
}
.stats-hud.show {
  display: block;
}

/* Transport */
.transport {
  flex-shrink: 0;
  padding: 0.6rem 0.8rem calc(0.6rem + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(22, 8, 12, 0.97), rgba(6, 2, 4, 0.99));
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}
.transport.audience-limited .host-only {
  display: none;
}

.seek-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.seek-row input[type="range"] {
  flex: 1;
  height: 6px;
  accent-color: var(--gold);
  cursor: pointer;
}

.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.38rem;
}
.ctrl-row .spacer {
  flex: 1;
  min-width: 0.5rem;
}

.emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}
.emoji-bar button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1.12rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.emoji-bar button:hover {
  border-color: var(--line);
  background: rgba(212, 175, 55, 0.12);
  transform: translateY(-1px);
}

/* Side panel */
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  max-height: 40vh;
  backdrop-filter: blur(10px);
}
@media (min-width: 900px) {
  .side-panel {
    max-height: none;
  }
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}
.side-tabs button {
  flex: 1;
  padding: 0.72rem 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.side-tabs button:hover {
  color: var(--text);
  background: rgba(212, 175, 55, 0.04);
}
.side-tabs button.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
  background: rgba(212, 175, 55, 0.06);
}

.side-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.side-pane.active {
  display: flex;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}
.chat-msg {
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(212, 175, 55, 0.08);
  line-height: 1.4;
}
.chat-msg .who {
  color: var(--gold);
  font-weight: 600;
  margin-right: 0.35rem;
}
.chat-msg.system {
  color: var(--muted);
  font-style: italic;
  font-size: 0.78rem;
  background: transparent;
  border: none;
  padding: 0.15rem 0.25rem;
}
.chat-msg .when {
  font-size: 0.64rem;
  color: rgba(245, 230, 211, 0.32);
  margin-left: 0.35rem;
}

.chat-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 0.68rem 0.8rem;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.42);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.roster {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  list-style: none;
  margin: 0;
}
.roster li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 0.85rem;
  border-radius: 8px;
  transition: background 0.12s ease;
}
.roster li:hover {
  background: rgba(212, 175, 55, 0.04);
}
.roster .role {
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.roster .q {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-left: auto;
  box-shadow: 0 0 6px rgba(93, 206, 138, 0.4);
}
.roster .q.fair {
  background: var(--warn);
  box-shadow: 0 0 6px rgba(232, 184, 74, 0.35);
}
.roster .q.poor {
  background: var(--danger);
  box-shadow: none;
}
.roster .q.unknown {
  background: #666;
  box-shadow: none;
}

.host-tools {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  flex: 1;
}
.host-tools .dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 1.15rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.host-tools .dropzone:hover {
  border-color: rgba(212, 175, 55, 0.45);
}
.host-tools .dropzone.drag {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.playlist {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
}
.playlist li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.35rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
  border-radius: 6px;
}
.playlist li.active {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.08);
}
.playlist li button {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
}
.playlist li button:hover {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
}

/* Modals */
.cue-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 8rem);
  letter-spacing: 0.08em;
  color: var(--gold-light);
  background: rgba(10, 4, 6, 0.55);
  pointer-events: none;
  text-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
.cue-overlay[hidden] { display: none !important; }
.keys-list { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.35rem 1rem; margin: 1rem 0; }
.keys-list dt { font-family: var(--font-body); font-weight: 700; color: var(--gold); }
.keys-list dd { margin: 0; color: var(--muted); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.76);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}
.modal {
  width: min(520px, 100%);
  max-height: min(88dvh, 720px);
  overflow: auto;
  background: linear-gradient(165deg, #32161c, #12080c);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.3rem 1.2rem;
  animation: cardIn 0.35s var(--ease);
}
.modal h2 {
  font-family: var(--font-display);
  color: var(--gold-light);
  font-size: 1.12rem;
  margin: 0 0 0.75rem;
  letter-spacing: 0.03em;
}
.modal p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 0.75rem;
}
.modal .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.doctor-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.doctor-list li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 0.85rem;
}
.doctor-list .mark {
  flex-shrink: 0;
  width: 1.2rem;
  text-align: center;
}
.doctor-list .ok {
  color: var(--ok);
}
.doctor-list .fail {
  color: var(--danger);
}
.doctor-list .run {
  color: var(--warn);
}

.onboard-steps {
  text-align: left;
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.onboard-steps li {
  margin-bottom: 0.45rem;
  line-height: 1.45;
}

/* Toast */
#toasts {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
  width: min(380px, 92vw);
}
.toast {
  background: rgba(18, 8, 12, 0.94);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  text-align: center;
  animation: toastIn 0.28s var(--ease);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Album visualizer */
#visualizer {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  background: radial-gradient(circle at 50% 60%, #2d0a12, #050203);
}
body.mode-album #visualizer {
  display: block;
}
body.mode-album #film-video {
  opacity: 0.15;
}
body.mode-album .screen-bezel {
  opacity: 0.35;
}

/* Mobile */
@media (max-width: 599px) {
  .theater-top .brand-text {
    display: none;
  }
  .curtain-side {
    width: min(12vw, 48px);
    opacity: 0.4;
  }
  .card {
    padding: 1.4rem 1.15rem 1.2rem;
  }
  .side-panel {
    max-height: 38vh;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .ctrl-row {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .emoji-bar {
    order: 10;
    width: 100%;
    justify-content: center;
  }
  .subtitle-overlay {
    bottom: 18%;
    font-size: 0.95rem;
  }
  .segment-btn {
    min-height: 48px;
  }
  .room-meta {
    font-size: 0.7rem;
  }
  .proscenium {
    height: 10px;
  }
  .screen-bezel {
    inset: 1% 1.5%;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .film-grain,
  .curtain,
  .reaction-float,
  .house-lights,
  .spot,
  .marque-bulb,
  .card,
  .modal,
  .status-pill .dot {
    animation: none !important;
    transition: none !important;
  }
  .curtains.open .curtain.left,
  .curtains.open .curtain.right {
    transform: translateX(0);
    opacity: 0;
  }
  .lobby-ambient {
    display: none;
  }
}

/* Fullscreen stage */
.stage-wrap:fullscreen,
.stage-wrap:-webkit-full-screen {
  background: #000;
}
.stage-wrap:fullscreen .transport,
.stage-wrap:-webkit-full-screen .transport {
  opacity: 0.96;
}
.stage-wrap:fullscreen .proscenium,
.stage-wrap:-webkit-full-screen .proscenium {
  opacity: 0.5;
}
