/* The viewer page's own rules, on top of /assets/tokens.css and /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. The look is
   the design canvas's friends' boards: blue-black, silver, Audiowide titles. */

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

/* ---- the wordmark, top left on every door ---- */
/* The host pages' own wordmark (.brand and .logo in base.css), at the host's size. */
.vbrand {
  display: flex; align-items: center;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) 0;
}
body.watch.playing .vbrand { display: none; }

/* ---- the doors: invite, waiting, the end ---- */
.door {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  width: 100%; max-width: 460px; margin: 0 auto;
  padding: var(--space-6) 24px;
  text-align: center;
  animation: rise .35s ease both;
}
.door h1 { margin: 0; font-family: var(--font-display); font-size: clamp(24px, 4.4vw, 34px); line-height: 1.25; }
.door p { margin: 0; line-height: 1.5; }
.door-head { display: flex; flex-direction: column; gap: 8px; }
.door a { color: var(--ds-silver); }
.lead { margin: 0; font-size: clamp(16px, 2.2vw, 20px); }
.overview { max-width: 60ch; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.info .overview { margin-top: var(--space-3); }

/* A round mark over a door's words: the screen while waiting, the moon at the end. */
.door-mark {
  display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--ds-silver);
}
.door-mark .icon { width: 40px; height: 40px; stroke-width: 1.6; }

/* A quiet panel: the waiting words, the privacy note. */
.door-card {
  display: flex; flex-direction: column; gap: 6px; width: 100%;
  padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.door-note {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--muted); font-size: 12px; text-align: left;
}
.door-note .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }

.btn.big {
  width: 100%; min-height: 48px; height: auto; padding: 12px 24px;
  border-radius: 10px; font-size: 16px;
}

/* ---- the waiting room (decision 59): the host's picture and "The show starts soon" ---- */
.door.waiting { max-width: 560px; gap: 32px; }
.door.waiting h1 { font-size: clamp(30px, 4.4vw, var(--ds-type-xxl)); }
.waiting-image {
  display: block; width: 480px; max-width: 100%; height: auto;
  max-height: 50vh; max-height: 50dvh; object-fit: contain;
  border-radius: 16px;
}
/* Its one sound control, at the end of the header: the speaker struck through until sound is on. */
.vbrand .vsound { margin-left: auto; color: var(--ds-text-muted); }
.vbrand .vsound .icon { width: 20px; height: 20px; }
.vsound[data-state="off"] .i-on, .vsound[data-state="on"] .i-off { display: none; }

/* ---- the code box ---- */
.code-form { display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: 100%; text-align: left; }
.code-label { color: var(--muted); font-size: 13px; }
.input.code {
  height: 56px; text-align: center;
  background: var(--surface); border-color: var(--accent); border-radius: 10px;
  font-family: var(--font-display); font-size: 28px; letter-spacing: .3em; font-variant-numeric: tabular-nums;
}
.code-note { margin: 0; color: var(--err); font-size: 15px; text-align: center; }

/* ---- 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 - 160px); max-height: calc(100dvh - 160px);
  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; }

/* Over the top of the picture: the title, the count and the live pill, on the scrim's gradient.
   It fades with the controls (base.css), so the film is clear while it plays. */
.vtop {
  position: absolute; z-index: 3; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 16px max(24px, env(safe-area-inset-right)) 36px max(24px, env(safe-area-inset-left));
  background: linear-gradient(180deg, var(--ds-scrim), var(--ds-scrim-clear));
  pointer-events: none;
  transition: opacity var(--ds-fade-long) ease;
}
.vtop .brand { flex: none; } /* the full wordmark, as on the host pages; the title gives way */
.vtop h1 { min-width: 0; margin: 0; overflow: hidden; font-family: var(--font-display); font-size: 16px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.vtop-grow { flex: 1; }
.vtop .pill { margin: 0; }
.vtop .pill.live[data-state="paused"] { border-color: var(--border-2); background: var(--surface); color: var(--ds-silver); }

/* "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, 10, 34, .45);
  text-align: center;
}
.veil p {
  margin: 0; padding: 24px 28px; border: 1px solid var(--border-2); border-radius: 16px;
  background: rgba(8, 20, 54, .94); font-family: var(--font-display); font-size: clamp(20px, 3vw, 28px); line-height: 1.3;
}

.stage .sound { position: absolute; z-index: 4; inset: 0; margin: auto; width: max-content; height: max-content; }
#paused:not([hidden]) ~ .sound { display: none; } /* nothing to hear, and it would hide the words */
.stage .catchup {
  position: absolute; z-index: 4; top: 64px; right: 16px; width: auto; min-width: 0;
}
.stage .note {
  position: absolute; z-index: 3; top: 64px; left: 16px; max-width: calc(100% - 32px); margin: 0;
  padding: 10px 16px; border: 1px solid var(--border-2); border-radius: 12px;
  background: rgba(8, 20, 54, .94); font-size: 15px;
  animation: rise .25s ease;
}

.info { padding: var(--space-4) 2px var(--space-5); }
.info:has(> [hidden]:only-child) { padding-bottom: 0; }
.info .lead { font-size: clamp(15px, 1.8vw, 18px); }
.next { margin-top: var(--space-5); }
.next ol { margin: 0; padding-left: 1.4em; font-size: 16px; 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); color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }
.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: 16px; line-height: 1.6; }
.doc h1 { margin: 0 0 var(--space-2); font-family: var(--font-display); font-size: clamp(24px, 4vw, 34px); line-height: 1.25; }
.doc ul { padding-left: 1.2em; }
.doc li { margin: var(--space-3) 0; }
.doc .repo { font-family: var(--font-mono); font-size: 14px; 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(18px, 2.6vw, 22px); }

/* ---- 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); }
  .vtop { gap: 10px; padding: 10px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
  .vtop .vcount { display: none; }
  .vtop h1 { font-size: 14px; }
  .vtop .pill { height: 24px; padding: 0 10px; font-size: 11px; }
  .stage .catchup { top: 48px; right: 10px; padding: 10px 18px; min-height: 44px; }
  .stage .note { top: 48px; left: 10px; font-size: 14px; }
}
/* A phone on its side: the picture fills the screen, edge to edge, like full screen. */
@media (max-height: 500px) and (orientation: landscape) {
  body.watch.playing .foot { display: none; }
  body.watch.playing .info { display: none; }
  .theater { padding: 0; }
  .theater .stage { border-radius: 0; box-shadow: none; }
  .theater .stage video { max-height: 100vh; max-height: 100dvh; }
  .vtop .vcount { display: none; }
  .vtop { padding-left: max(44px, env(safe-area-inset-left)); padding-right: max(44px, env(safe-area-inset-right)); }
}

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

