/* The viewer page's own rules, on top of /assets/base.css. Big type and big tap targets: it is
   read from a couch and tapped on a phone. Every look the script needs is a class or [hidden]
   here, because the Content-Security-Policy allows no inline styles. */

body.watch, body.doc {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 16px;
}
body.watch main { flex: 1; display: flex; flex-direction: column; }

/* ---- the doors: invite, waiting, join, the end ---- */
.door {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-4);
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: var(--space-6) var(--gutter);
  text-align: center;
  animation: rise .35s ease both;
}
.door h1 { margin: 0; font-size: clamp(26px, 5vw, 44px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.lead { margin: 0; font-size: clamp(17px, 2.4vw, 22px); }
.overview { max-width: 60ch; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.art { display: block; width: min(440px, 86vw); height: auto; border-radius: 20px; box-shadow: var(--shadow); }
.art.poster-art { width: min(280px, 62vw); aspect-ratio: var(--poster-ratio); object-fit: cover; background: var(--surface-2); }

.btn.big {
  min-width: 240px; min-height: 64px; height: auto; padding: 14px 40px;
  border-radius: 18px; font-size: 21px; font-weight: 700;
}

/* ---- the code box ---- */
.code-form { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); width: 100%; max-width: 380px; }
.code-label { font-size: clamp(17px, 2.4vw, 22px); }
.input.code {
  height: 72px; max-width: 320px; text-align: center;
  font-size: 40px; font-weight: 700; letter-spacing: .3em; font-variant-numeric: tabular-nums;
  border-radius: 18px;
}
.code-note { margin: 0; color: var(--err); font-size: 18px; }

/* ---- the player ---- */
.theater { display: flex; flex-direction: column; width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--space-4) var(--gutter) 0; }
.theater .stage {
  position: relative; display: grid; place-items: center; min-height: 0;
  overflow: hidden; border-radius: var(--radius); background: #000;
  box-shadow: 0 0 0 1px var(--border), var(--shadow);
}
.theater .stage video {
  display: block; width: 100%; height: auto;
  max-height: calc(100vh - 220px); max-height: calc(100dvh - 220px);
  aspect-ratio: 16 / 9; object-fit: contain; background: #000;
}
.theater .stage .spinner { inset: 0; margin: auto; z-index: 1; }

/* Full screen: the stage, with its prompts and controls, fills the screen. */
.theater .stage:fullscreen { border-radius: 0; box-shadow: none; }
.theater .stage:fullscreen video { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; }
.theater .stage:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.theater .stage:-webkit-full-screen video { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }

/* "Paused by the host", over the frozen picture */
.veil {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; padding: var(--space-5);
  background: rgba(3, 4, 7, .55);
  text-align: center;
}
.veil p { margin: 0; padding: 14px 26px; border-radius: 16px; background: rgba(9, 10, 15, .8); font-size: clamp(22px, 4vw, 40px); font-weight: 700; }

.stage .sound { position: absolute; z-index: 4; inset: 0; margin: auto; width: max-content; height: max-content; }
.stage .catchup {
  position: absolute; z-index: 4; top: 16px; right: 16px; min-width: 0;
  background: rgba(9, 10, 15, .82); border-color: var(--accent); color: var(--text);
}
.stage .note {
  position: absolute; z-index: 3; top: 16px; left: 16px; max-width: calc(100% - 32px); margin: 0;
  padding: 10px 16px; border: 1px solid var(--border-2); border-radius: 12px;
  background: rgba(9, 10, 15, .82); font-size: 16px; font-weight: 600;
  animation: rise .25s ease;
}
.stage .note.top { left: 50%; transform: translateX(-50%); animation: none; }

.controls {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 28px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .72));
}
.controls .grow { flex: 1; }
.btn.ctl { min-width: 56px; height: 48px; padding: 0 18px; border-color: rgba(255, 255, 255, .18); background: rgba(9, 10, 15, .62); font-size: 16px; }
.btn.ctl:hover { background: rgba(31, 35, 49, .9); }
.btn.ctl[aria-pressed="true"] { border-color: var(--accent); }
.volume { display: flex; align-items: center; }
.volume input { width: 140px; height: 48px; accent-color: var(--accent); cursor: pointer; }

.info { padding: var(--space-4) 2px var(--space-5); }
.info h1 { margin: 6px 0 2px; font-size: clamp(22px, 3.2vw, 36px); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.info .lead { font-size: clamp(16px, 2vw, 20px); }
.live { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 650; }
.live #clock, .live #viewers { font-weight: 500; }
.next { margin-top: var(--space-5); }
.next ol { margin: 0; padding-left: 1.4em; font-size: 17px; line-height: 1.7; }

/* ---- the footer and the plain pages ---- */
.foot { display: flex; flex-wrap: wrap; gap: var(--space-5); justify-content: center; align-items: center; padding: var(--space-5) var(--gutter); font-size: 15px; }
.foot form { margin: 0; }
.linkish { padding: 0; border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--text); }
body.watch.playing .foot { padding-top: 0; }

.doc main { flex: 1; width: 100%; max-width: 700px; margin: 0 auto; padding: var(--space-6) var(--gutter) 60px; font-size: 17px; line-height: 1.6; }
.doc h1 { margin: 0 0 var(--space-2); font-size: clamp(26px, 4.5vw, 38px); letter-spacing: -.02em; line-height: 1.2; }
.doc ul { padding-left: 1.2em; }
.doc li { margin: var(--space-3) 0; }
.doc .repo { font-family: var(--font-mono); font-size: 15px; overflow-wrap: anywhere; }
.doc .back { margin-top: var(--space-6); }
.doc.short main { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.doc.short p { margin: 0 0 var(--space-5); font-size: clamp(19px, 3vw, 24px); }

/* ---- phones ---- */
@media (max-width: 760px) {
  .theater { padding: 0; }
  .theater .stage { border-radius: 0; box-shadow: none; }
  .theater .stage video { max-height: 70vh; }
  .info { padding: var(--space-4) var(--gutter) var(--space-5); }
  .controls { gap: var(--space-2); padding: 24px 10px 10px; }
  .btn.ctl { height: 44px; padding: 0 12px; font-size: 15px; }
  .volume input { width: 90px; }
  .stage .catchup { top: 10px; right: 10px; padding: 10px 18px; font-size: 17px; min-height: 48px; }
  .stage .note { top: 10px; left: 10px; font-size: 14px; }
  .btn.big { width: 100%; max-width: 380px; }
}
@media (max-width: 420px) {
  .volume { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .door, .stage .note { animation: none; }
  .live-dot { animation: none; }
}
