:root {
  --font-display: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", "Menlo", monospace;

  --bg-deep: #0f0f14;
  --bg-blackout: #000;
  --bg-surface: rgba(17, 20, 28, 0.92);
  --bg-surface-strong: rgba(26, 29, 40, 0.9);
  --bg-glass: rgba(17, 20, 28, 0.72);
  --bg-control: rgba(255, 255, 255, 0.035);
  --bg-control-hover: rgba(255, 255, 255, 0.07);
  --bg-card-top: rgba(255, 255, 255, 0.03);
  --bg-card-bottom: rgba(255, 255, 255, 0.01);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --accent: #818cf8;
  --accent-secondary: #a78bfa;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-line: rgba(129, 140, 248, 0.3);

  --status-good: #22c55e;
  --status-warn: #f59e0b;
  --status-error: #ef4444;

  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(129, 140, 248, 0.34);

  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.25), inset 0 0 0 1px var(--line);
  --shadow-stage: 0 8px 32px rgba(0, 0, 0, 0.4);

  --space-xs: clamp(0.5rem, 0.6vw, 0.75rem);
  --space-sm: clamp(0.875rem, 1vw, 1rem);
  --space-md: clamp(1.25rem, 1.6vw, 1.5rem);
  --space-lg: clamp(1.75rem, 2.5vw, 2rem);
  --space-xl: clamp(2.5rem, 4vw, 3rem);
  --space-2xl: clamp(3.5rem, 6vw, 4.5rem);
  --space-3xl: clamp(5rem, 9vw, 7rem);

  --step--1: clamp(0.82rem, 0.8rem + 0.08vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.16vw, 1.08rem);
  --step-1: clamp(1.22rem, 1.14rem + 0.34vw, 1.38rem);
  --step-2: clamp(1.52rem, 1.38rem + 0.56vw, 1.78rem);
  --step-3: clamp(1.9rem, 1.66rem + 0.9vw, 2.3rem);
  --step-4: clamp(2.38rem, 2rem + 1.3vw, 3rem);
  --step-5: clamp(2.98rem, 2.42rem + 1.9vw, 3.95rem);

  --motion-fast: 180ms;
  --motion-base: 280ms;
  --motion-slow: 560ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
}

body {
  min-width: 320px;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

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

.watch-app {
  position: relative;
  width: min(960px, calc(100% - 2 * var(--space-lg)));
  margin: 0 auto;
  padding: var(--space-md) 0 var(--space-2xl);
}

.watch-app--minimal {
  padding: var(--space-md) 0;
}

.watch-app--theatre {
  width: min(1180px, calc(100% - 2 * var(--space-md)));
}

.watch-app__halo {
  display: none;
}

.watch-app__bar {
  position: relative;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin: 0 auto var(--space-sm);
  padding: var(--space-sm) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: blur(18px);
  box-shadow: none;
}

.watch-app__brand {
  display: grid;
  gap: 0.2rem;
}

.brand {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.watch-app__nav,
.hero__actions,
.watch-hero__meta,
.status-card__meta,
.stage-shell__meta,
.stage-shell__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nav-link,
.button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control);
  text-decoration: none;
  transition:
    transform var(--motion-base) var(--ease-out),
    border-color var(--motion-base) var(--ease-out),
    background-color var(--motion-base) var(--ease-out);
}

.nav-link:hover,
.button:hover,
.chip:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--bg-control-hover);
}

.button--primary,
.chip--primary {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), rgba(129, 140, 248, 0.04));
}

.watch-app__main,
.landing,
.control-page,
.watch-page,
.watch-hero,
.watch-grid,
.hero,
.highlights,
.metric-grid,
.command-grid,
.control-board,
.timeline-list,
.request-shell {
  display: grid;
  gap: var(--space-xl);
}

.watch-app__main--minimal {
  min-height: calc(100dvh - 2 * var(--space-md));
  align-content: center;
}

.watch-app__main--theatre {
  place-items: center;
}

.hero {
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.75fr);
  align-items: start;
}

.hero__copy,
.hero__aside,
.screen-card,
.stack-card,
.feature-card,
.room-preview,
.rail-card,
.metric-card,
.command-card,
.activity-card {
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, var(--bg-card-top), transparent 24%),
    var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.hero__aside,
.watch-grid__side {
  align-content: start;
}

.hero__aside {
  display: grid;
  gap: var(--space-md);
}

.hero__copy,
.screen-card,
.stack-card,
.hero__aside,
.rail-card,
.room-preview,
.metric-card,
.command-card,
.activity-card {
  padding: var(--space-lg);
}

.hero__copy h1,
.watch-hero__copy h1,
.screen-card h2,
.stack-card h3,
.feature-card h3,
.activity-card h3,
.command-card h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero__copy h1 {
  margin-top: var(--space-sm);
  font-size: var(--step-5);
  max-width: 12ch;
}

.watch-hero__copy h1 {
  margin-top: var(--space-sm);
  font-size: var(--step-4);
}

.lede,
.hero__note,
.stack-card__note,
.room-preview p,
.feature-card p,
.rail-card p,
.screen-card p,
.status-card p,
.moment p,
.activity-card p,
.command-card p,
.timeline-row__copy p {
  margin: var(--space-sm) 0 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.eyebrow,
.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.status-card {
  display: grid;
  gap: var(--space-sm);
}

.status-card p:first-of-type {
  margin-top: 0;
  color: var(--text-primary);
  font-size: var(--step-1);
  font-weight: 600;
}

.highlights,
.room-grid__list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.room-preview,
.metric-card,
.command-card,
.activity-card {
  display: grid;
  gap: var(--space-sm);
}

.room-preview__top,
.screen-card__topline,
.stack-card__head,
.queue-row,
.queue-row__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.room-grid {
  display: grid;
  gap: var(--space-lg);
}

.room-grid__intro h2 {
  margin: var(--space-sm) 0 0;
  font-family: var(--font-display);
  font-size: var(--step-3);
}

.watch-hero {
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.8fr);
  align-items: start;
}

.watch-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
}

.watch-grid__main,
.watch-grid__side,
.moment-list,
.queue-list,
.panel-grid,
.activity-grid {
  display: grid;
  gap: var(--space-md);
}

.panel-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
}

.activity-grid,
.metric-grid,
.command-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-grid--compact {
  gap: var(--space-sm);
}

.screen-card h2 {
  margin-top: var(--space-sm);
  font-size: var(--step-3);
}

.stack-card--accent {
  background:
    linear-gradient(180deg, rgba(129, 140, 248, 0.12), transparent 28%),
    var(--bg-surface);
}

.stage-shell {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background:
    linear-gradient(180deg, rgba(129, 140, 248, 0.06), transparent 22%),
    var(--bg-surface);
  box-shadow: var(--shadow-stage);
}

.stage-shell__media {
  position: relative;
  min-height: 28rem;
  background: linear-gradient(180deg, rgba(129, 140, 248, 0.08), rgba(17, 19, 26, 0.28));
}

.stage-shell__transport {
  position: relative;
  min-height: 28rem;
  background: #000;
  z-index: 0;
}

.stage-shell__poster,
.stage-shell__poster--fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-shell__poster--fallback {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.stage-shell__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 8, 12, 0.16), rgba(8, 8, 12, 0.78) 74%, rgba(8, 8, 12, 0.96) 100%);
}

.stage-shell__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  align-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg);
}

.stage-shell__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.stage-shell__copy {
  display: grid;
  gap: var(--space-sm);
  max-width: 42rem;
}

.stage-shell__copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-4);
  letter-spacing: -0.05em;
}

.stage-shell__dock {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-top: 1px solid var(--line);
  background: rgba(8, 8, 12, 0.92);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, var(--bg-card-top), transparent 24%),
    var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.panel,
.empty {
  padding: var(--space-lg);
}

.stack {
  display: grid;
  gap: var(--space-sm);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.status::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--accent);
}

.status--warn::before {
  background: #fb923c;
}

.meta {
  color: var(--text-secondary);
}

.empty {
  text-align: center;
  color: var(--text-muted);
}

.detail-list {
  display: grid;
  gap: var(--space-xs);
  padding: 0;
  margin: 0;
  list-style: none;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-secondary);
}

.player-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #000;
  box-shadow: var(--shadow-stage);
  transition:
    border-color var(--motion-base) var(--ease-out),
    box-shadow var(--motion-base) var(--ease-out);
}

.player-shell:hover,
.player-shell:focus-within,
.player-shell:has([data-gosx-video-interaction="active"]) {
  border-color: var(--line-strong);
  box-shadow:
    var(--shadow-stage),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 34px rgba(129, 140, 248, 0.12);
}

.player-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  background: #000;
}

.player-shell [data-gosx-engine-kind="video"] {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  border-radius: 0.9rem;
  background: #000;
}

.player-shell [data-gosx-video] {
  cursor: inherit;
}

.player-video,
.player-shell [data-gosx-engine-kind="video"] video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #000;
}

.player-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  text-align: center;
}

.player-unavailable strong {
  color: var(--text-primary);
}

.player-shell:fullscreen {
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-shell:fullscreen .player-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.player-shell:fullscreen [data-gosx-engine-kind="video"],
.player-shell:fullscreen [data-gosx-engine-kind="video"] video {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

.player-shell:fullscreen:has([data-gosx-video-interaction="idle"]),
.player-shell:fullscreen [data-gosx-video-interaction="idle"] {
  cursor: none;
}

.player-shell:fullscreen:has([data-gosx-video-interaction="active"]),
.player-shell:fullscreen [data-gosx-video-interaction="active"] {
  cursor: auto;
}

.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
}

.player-toolbar__room {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--step--1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-toolbar__actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  min-width: 0;
  max-width: 100%;
}

.player-toolbar__actions .chip {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* --- Subtitle overlay --- */
/* Merged with the duplicate .subtitle-overlay rule that used to live near
   the "Subtitle Overlay" section further down; z-index/display keep that
   later block's values since source order made it win before the merge. */
.subtitle-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

.subtitle-overlay:empty {
  display: none;
}

.gosx-video-subtitle-overlay {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35em;
  padding: 0 5% max(3.5%, 1.5rem);
  /* The runtime pins this overlay to the RENDERED VIDEO RECTANGLE (see
     fitSubtitleOverlayToVideo), so making it a size container lets cue text scale
     with the picture itself. Cues then keep the same apparent size in a small
     window, a maximised one, and fullscreen — instead of being a fixed rem that
     looks oversized in a small player and postage-stamp tiny on a TV. */
  container-type: inline-size;
  transition:
    padding var(--motion-base) var(--ease-out),
    opacity var(--motion-base) var(--ease-out);
}

.gosx-video-subtitle-overlay[hidden] {
  display: none !important;
}

.player-external-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.player-external-controls--party {
  justify-content: center;
}

.player-hud-controls {
  position: absolute;
  inset: auto var(--space-sm) var(--space-sm);
  z-index: 6;
  width: auto;
  max-width: calc(100% - var(--space-sm) - var(--space-sm));
  justify-content: flex-end;
  align-items: flex-end;
  padding: calc(var(--space-xs) * 0.7);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--bg-surface) 78%, transparent);
  box-shadow: var(--shadow-stage);
  pointer-events: none;
  backdrop-filter: blur(18px);
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Auto-hide: the video engine stamps data-gosx-video-interaction="idle" on
   its mount after a few seconds without pointer activity. The engine wraps
   the mount in an anonymous element, so the shell-level :has() reaches it
   where a sibling combinator cannot — the HUD fades unless the pointer is on
   it or a control inside it holds focus. */
.player-shell:has(.player-video[data-gosx-video-interaction="idle"]) .player-hud-controls:not(:hover):not(:focus-within) {
  opacity: 0;
}

/* Fullscreen targets .player-shell so the engine mount, the subtitle
   overlay, and the HUD all stay composited together. */
.player-shell:fullscreen {
  padding: 0;
  border: none;
  border-radius: 0;
  background: #000;
}

.player-shell:fullscreen .player-frame {
  width: 100%;
  height: 100%;
  max-height: none;
  border: none;
  border-radius: 0;
}

.player-hud-controls > * {
  pointer-events: auto;
}

.player-hud-controls--party {
  justify-content: center;
}

.player-hud-controls .player-caption-controls {
  flex: 0 1 20rem;
  max-width: min(100%, 24rem);
}

.player-hud-controls .player-audio-controls {
  flex: 0 1 15rem;
  max-width: min(100%, 18rem);
}

.player-hud-controls .player-sound-toggle {
  min-width: 4.75rem;
}

.player-hud-controls .player-volume-controls {
  flex: 0 0 auto;
  min-width: 6rem;
}

.player-hud-controls .player-quality-controls {
  flex: 0 1 8rem;
  max-width: min(100%, 9rem);
}

.player-caption-controls {
  display: inline-flex;
  flex: 1 1 18rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: min(100%, 28rem);
  align-items: center;
  gap: 0.35rem;
}

/* Small button clusters nested inside .player-caption-controls: sync offset
   (-, readout, +, reset), size (S/M/L), and style (Classic/Boxed/Minimal).
   Each is its own flex group so its buttons stay glued together and wrap as a
   unit instead of interleaving with the cluster next to it. */
.player-caption-offset,
.player-caption-size,
.player-caption-style {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.player-caption-offset__value {
  min-width: 2.75rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.player-audio-controls {
  display: inline-flex;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: min(100%, 18rem);
}

.player-caption-toggle,
.player-sound-toggle,
.player-fullscreen-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.15rem;
  padding: 0 calc(var(--space-xs) * 0.9);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition:
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}

.player-caption-toggle[hidden],
.player-sound-toggle[hidden] {
  display: none;
}

.player-caption-select,
.player-audio-select,
.player-quality-select {
  flex: 1 1 8rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 2.15rem;
  padding: 0 1.9rem 0 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition:
    background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
}

.player-caption-toggle:hover,
.player-sound-toggle:hover,
.player-caption-select:hover,
.player-audio-select:hover,
.player-quality-select:hover {
  border-color: var(--line-strong);
  background: var(--bg-control-hover);
  color: var(--text-primary);
}

.player-caption-toggle:focus-visible,
.player-sound-toggle:focus-visible,
.player-caption-select:focus-visible,
.player-audio-select:focus-visible,
.player-quality-select:focus-visible,
.player-volume-slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.player-volume-controls {
  display: inline-flex;
  align-items: center;
}

.player-volume-slider {
  width: 100%;
  min-width: 5rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.player-quality-controls[hidden] {
  display: none;
}

.player-viewer-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 2.15rem;
  padding: 0 calc(var(--space-xs) * 0.9);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0;
  backdrop-filter: blur(18px);
}

.player-viewer-count[hidden] {
  display: none;
}

.player-caption-toggle:active,
.player-sound-toggle:active {
  transform: translateY(1px);
}

.player-caption-toggle[aria-pressed="true"],
.player-sound-toggle[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.player-sound-toggle[data-watch-audio-muted="true"] {
  border-color: color-mix(in srgb, var(--status-warn) 56%, transparent);
  color: var(--status-warn);
}

.player-caption-toggle[data-watch-subtitle-state="loading"],
.player-caption-toggle[data-watch-subtitle-state="warming"] {
  border-color: color-mix(in srgb, var(--status-warn) 56%, transparent);
  color: var(--status-warn);
}

.player-caption-toggle[data-watch-subtitle-state="error"] {
  border-color: color-mix(in srgb, var(--status-error) 56%, transparent);
  color: var(--status-error);
}

.gosx-video-sync-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: transparent;
  color: var(--text-primary);
  text-align: center;
  pointer-events: none;
}

.gosx-video-sync-overlay[hidden] {
  display: none !important;
}

/* Only dim the video with the opaque backdrop during intermission (the one
   state whose status panel is actually shown). In every other state the
   backdrop stays transparent and click-through, so a playing video is never
   hidden if the engine fails to set [hidden] — observed on Firefox, where the
   player sits at the live edge (readyState 1) and the overlay stayed opaque
   over a video that was decoding and advancing fine. */
.player-shell[data-watch-player-state="intermission"] .gosx-video-sync-overlay {
  background: var(--bg-blackout);
  pointer-events: auto;
}

.gosx-video-sync-overlay__panel {
  position: relative;
  display: none;
  width: min(28rem, 100%);
  gap: var(--space-xs);
  padding: clamp(1rem, 2.8vw, 1.65rem);
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  background: var(--bg-glass);
  box-shadow: 0 1.25rem 4rem color-mix(in srgb, var(--bg-blackout) 42%, transparent);
  backdrop-filter: blur(18px);
}

.player-shell[data-watch-player-state="intermission"] .gosx-video-sync-overlay__panel {
  display: grid;
}

.player-shell[data-watch-player-state="buffering"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="connecting"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="loading"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="syncing"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="starting"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="retrying"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="reconnecting"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="paused"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="error"] .gosx-video-sync-overlay__panel,
.player-shell[data-watch-player-state="blocked"] .gosx-video-sync-overlay__panel {
  display: none;
}

.gosx-video-sync-overlay__panel::before {
  content: "";
  justify-self: center;
  width: 2.4rem;
  height: 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 1.5rem var(--accent-line);
  animation: watch-status-pulse var(--motion-slow) var(--ease-out) infinite alternate;
}

.gosx-video-sync-overlay__title {
  color: var(--text-secondary);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.gosx-video-sync-overlay__count {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: clamp(3.25rem, 11vw, 7rem);
  font-weight: 800;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.gosx-video-sync-overlay__detail {
  color: var(--text-muted);
  font-size: var(--step-0);
  overflow-wrap: anywhere;
}

.gosx-video-sync-overlay__meter {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.gosx-video-sync-overlay__bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  transition: width var(--motion-base) var(--ease-out);
}

.gosx-video-sync-overlay__action {
  justify-self: center;
  min-width: 7rem;
  min-height: 2.5rem;
  padding: calc(var(--space-xs) * 0.85) var(--space-sm);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-base) var(--ease-out),
    background-color var(--motion-base) var(--ease-out);
}

.gosx-video-sync-overlay__action:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--bg-control-hover);
}

.gosx-video-sync-overlay__action:active {
  transform: translateY(0);
}

.player-live-hud {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 3;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem var(--space-xs);
  max-width: min(22rem, calc(100% - 2 * var(--space-sm)));
  padding: calc(var(--space-xs) * 0.75) var(--space-xs);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg-glass);
  color: var(--text-primary);
  box-shadow: var(--shadow-stage);
  pointer-events: none;
  backdrop-filter: blur(18px);
  transition:
    opacity var(--motion-base) var(--ease-out),
    transform var(--motion-base) var(--ease-out),
    border-color var(--motion-base) var(--ease-out);
}

.player-live-hud[hidden] {
  display: none;
}

.player-live-hud__dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0.8rem var(--accent-line);
}

.player-live-hud__label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--step--1);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-live-hud__meter {
  grid-column: 1 / -1;
  width: 100%;
  height: 0.2rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-control);
}

.player-live-hud__bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--motion-base) var(--ease-out);
}

.player-shell[data-watch-player-state="live"] .player-live-hud {
  border-color: var(--accent-line);
}

.player-shell[data-watch-player-tone="live"] .player-live-hud__dot,
.player-shell[data-watch-player-tone="live"] .player-live-hud__bar {
  background: var(--status-good);
  box-shadow: 0 0 0.8rem color-mix(in srgb, var(--status-good) 42%, transparent);
}

.player-shell[data-watch-player-tone="warn"] .player-live-hud__dot,
.player-shell[data-watch-player-tone="warn"] .player-live-hud__bar {
  background: var(--status-warn);
  box-shadow: 0 0 0.8rem color-mix(in srgb, var(--status-warn) 42%, transparent);
}

.player-shell[data-watch-player-tone="error"] .player-live-hud__dot,
.player-shell[data-watch-player-tone="error"] .player-live-hud__bar {
  background: var(--status-error);
  box-shadow: 0 0 0.8rem color-mix(in srgb, var(--status-error) 42%, transparent);
}

.player-shell[data-watch-player-tone="live"] .player-live-hud__dot {
  animation: watch-live-pulse 1.6s var(--ease-out) infinite;
}

@keyframes watch-live-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-good) 45%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0.45rem color-mix(in srgb, var(--status-good) 0%, transparent);
  }
}

@keyframes watch-status-pulse {
  from {
    opacity: 0.48;
    transform: scaleX(0.62);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

.player-shell [data-gosx-engine-kind="video"][data-gosx-video-overlay-state] video {
  filter: brightness(0.72);
}

/* Cues lift ONLY while the video's own transport is actually on screen, and only
   far enough to clear it.

   They used to lift for `:has(.player-hud-controls)` as well — but that is a plain
   sibling <div> of external controls that is ALWAYS in the DOM and sits BELOW the
   video, never over it. So the rule matched permanently and shoved every cue ~14% up
   the picture for controls that were not covering anything. Worse, the
   `:has(.player-hud-controls):has(...active)` variant scores (0,4,0), out-specifying
   the (0,3,0) `:fullscreen` rule — which is why fullscreen kept the cues floating
   high instead of dropping them to the bottom of the frame. */
.player-shell:has([data-gosx-video-interaction="active"]) .gosx-video-subtitle-overlay,
.player-shell [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] .gosx-video-subtitle-overlay {
  padding-bottom: max(11%, 4rem);
}

/* The external control strip (quality / subtitle / audio pickers, transport) lives
   INSIDE .player-shell, and fullscreen targets the shell — so fullscreen drags the
   strip into the fullscreen layer, where nothing was hiding it. It sat there
   permanently across the bottom of the film, and as a flex item it also stole layout
   height from the video.
   In fullscreen it should behave like a video HUD: lifted out of flow, overlaid on
   the picture, and visible only while the transport is on screen. */
.player-shell:fullscreen {
  position: relative;
}

/* Fullscreen must be edge-to-edge black, whatever element the browser actually
   promoted. The app's own button fullscreens .player-shell, but the video engine can
   fullscreen its OWN mount — and that mount carries border-radius: 0.9rem plus a
   16/9 aspect-ratio, which then shows up as a rounded frame inset from the screen
   edge. Reset the chrome on the fullscreen element itself AND on anything inside one,
   so neither path can leave a border behind. */
:fullscreen,
:fullscreen .player-frame,
:fullscreen [data-gosx-engine-kind="video"],
:fullscreen [data-gosx-engine-kind="video"] video {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  background: #000;
}

[data-gosx-engine-kind="video"]:fullscreen,
[data-gosx-engine-kind="video"]:fullscreen video,
.player-frame:fullscreen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
}

.player-shell:fullscreen .player-external-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-out);
}

.player-shell:fullscreen:has([data-gosx-video-interaction="active"]) .player-external-controls,
.player-shell:fullscreen [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] ~ .player-external-controls {
  opacity: 1;
  pointer-events: auto;
}

.player-shell:fullscreen .gosx-video-subtitle-overlay {
  padding-bottom: max(3.5%, 2rem);
}

.player-shell:fullscreen:has([data-gosx-video-interaction="active"]) .gosx-video-subtitle-overlay,
.player-shell:fullscreen [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] .gosx-video-subtitle-overlay {
  padding-bottom: max(10%, 5rem);
}

.subtitle-overlay-text {
  position: absolute;
  box-sizing: border-box;
  max-inline-size: min(100%, var(--gosx-text-layout-max-width, 100%));
  color: #fff;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  contain: layout style;
}

.subtitle-overlay-text--start {
  text-align: start;
}

.subtitle-overlay-text--end {
  text-align: end;
}

.subtitle-overlay-text--center {
  text-align: center;
}

/* Typography lives here, on the class every text cue always carries — not on
   .gosx-video-subtitle-cue below — so it is the single source of truth
   regardless of which .subtitle-style-* variant (also targeting .subtitle-cue)
   is active. -webkit-text-stroke has no Firefox support, so the "stroke" is
   faked with a layered text-shadow instead: a blurred dark pair scaled to the
   picture (cqw, so it holds up at any player size/fullscreen) plus two
   1px-offset shadows for a crisp diagonal edge. */
.subtitle-cue {
  display: block;
  width: fit-content;
  max-width: 100%;
  text-align: center;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
  margin: 0 auto 0.25em;
  overflow-wrap: anywhere;
  word-break: normal;
  text-shadow:
    0 0 0.15cqw #000,
    0 0 0.15cqw #000,
    1px 1px 0 #000,
    -1px -1px 0 #000;
}

.gosx-video-subtitle-cue {
  color: #fff;
  /* cqw = 1% of the subtitle overlay's width, and the overlay is pinned to the
     rendered video rectangle — so cue text is a constant fraction of the PICTURE at
     any window size and in fullscreen. The old fixed 1.32rem was oversized in a small
     player and far too small on a TV. The rem bounds keep it legible at the extremes. */
  font-size: clamp(0.95rem, 3.1cqw, 2.6rem);
  line-height: 1.25;
}

.player-shell:fullscreen .gosx-video-subtitle-cue {
  font-size: 1.72rem;
}

/* The flat fullscreen size above and `.subtitle-size-s/l .subtitle-cue` (the
   non-fullscreen size steps, further down) are BOTH equal-specificity (0,3,0)
   vs (0,2,0) — the flat rule always won, so every size choice collapsed to
   the same fullscreen size. Cue nodes carry both `.gosx-video-subtitle-cue`
   and `.subtitle-cue` (see renderSubtitleCue in watch-runtime.js), so these
   companions route through `.subtitle-size-*` to `.gosx-video-subtitle-cue`
   instead for (0,4,0) — enough to win. They scale from the SAME 1.72rem
   ceiling the default already uses (not the cqw clamp's 2.6rem cap) so the
   "m" step keeps today's fullscreen size exactly. */
.player-shell:fullscreen .subtitle-size-s .gosx-video-subtitle-cue {
  font-size: calc(1.72rem * 0.85);
}

.player-shell:fullscreen .subtitle-size-m .gosx-video-subtitle-cue {
  font-size: 1.72rem;
}

.player-shell:fullscreen .subtitle-size-l .gosx-video-subtitle-cue {
  font-size: calc(1.72rem * 1.25);
}

.subtitle-overlay-text--start .subtitle-cue {
  margin-left: 0;
  margin-right: auto;
  text-align: start;
}

.subtitle-overlay-text--end .subtitle-cue {
  margin-left: auto;
  margin-right: 0;
  text-align: end;
}

.subtitle-image {
  position: absolute;
  object-fit: contain;
  image-rendering: auto;
  pointer-events: none;
}

/* --- Subtitle sizes (viewport-scaled) --- */
/* Each step is expressed in picture-relative units (cqw) so the choice survives
   a resize or a jump to fullscreen. Bitmap (PGS) cues size themselves with
   per-cue percentages of the overlay box, which already tracks the picture —
   so the same s/m/l steps scale them via `transform: scale()` around a
   bottom-anchored origin, matching where dialogue subtitles normally sit,
   instead of a second, disconnected sizing system. */
.subtitle-size-s .subtitle-cue { font-size: clamp(0.8rem, 2.4cqw, 2rem); }
.subtitle-size-m .subtitle-cue { font-size: clamp(0.95rem, 3.1cqw, 2.6rem); }
.subtitle-size-l .subtitle-cue { font-size: clamp(1.15rem, 4cqw, 3.4rem); }

.subtitle-size-s .subtitle-image { transform: scale(0.85); transform-origin: 50% 100%; }
.subtitle-size-m .subtitle-image { transform: scale(1); transform-origin: 50% 100%; }
.subtitle-size-l .subtitle-image { transform: scale(1.25); transform-origin: 50% 100%; }

/* --- Subtitle style: Classic (shadow-only default, no backing) --- */
.subtitle-style-classic .subtitle-cue {
  color: #fff;
  text-shadow:
    0 0 0.15cqw #000,
    0 0 0.15cqw #000,
    1px 1px 0 #000,
    -1px -1px 0 #000;
}

/* --- Subtitle style: Boxed (glassmorphic background) ---
   Scoped to .subtitle-cue (text only) so bitmap .subtitle-image cues, which
   already carry their own baked-in background, never gain a second box. */
.subtitle-style-boxed .subtitle-cue {
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  padding: 0.3em 0.6em;
  border-radius: 0.4em;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Subtitle style: Minimal (light grey, reduced edge weight) --- */
.subtitle-style-minimal .subtitle-cue {
  color: rgba(255, 255, 255, 0.75);
  text-shadow:
    0 0 0.08cqw rgba(0, 0, 0, 0.7),
    1px 1px 0 rgba(0, 0, 0, 0.55);
}

.stage-shell__meta {
  color: var(--text-secondary);
}

.metric-grid,
.command-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card strong {
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: -0.04em;
}

.command-card {
  align-content: start;
}

.command-card .chip {
  justify-self: start;
}

.activity-card {
  min-height: 100%;
}

.control-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-control);
}

.timeline-row--warn {
  border-color: rgba(255, 255, 255, 0.16);
}

.timeline-row__copy {
  display: grid;
  gap: 0.35rem;
}

.timeline-row__copy strong {
  font-size: var(--step-1);
}

.timeline-row__meta {
  display: grid;
  justify-items: end;
  gap: 0.45rem;
}

.timeline-row__meta form {
  margin: 0;
}

.queue-row {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--line);
}

.queue-row:last-child {
  border-bottom: 0;
}

.queue-row__index {
  width: 2rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.queue-row__body {
  flex: 1;
  min-width: 0;
}

.queue-row__body strong {
  display: block;
}

.queue-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--motion-base) var(--ease-out);
}

.queue-link:hover {
  color: var(--accent);
}

.queue-row__body p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

.queue-row__actions {
  display: flex;
  gap: 0.4rem;
}

.queue-row__actions form {
  margin: 0;
}

.queue-row__status,
.queue-row__state,
.status-card__meta span {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: var(--step--1);
  background: var(--bg-control);
}

.moment {
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-control);
}

.detail-poster {
  width: min(100%, 18rem);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  margin-top: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.library-page,
.library-results,
.library-card-grid,
.library-search-panel,
.filter-list {
  display: grid;
  gap: var(--space-lg);
}

.request-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) auto;
  gap: var(--space-sm);
  align-items: end;
}

.request-form--compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.request-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.form-notice {
  display: grid;
  gap: 0.35rem;
  padding: var(--space-sm);
  border: 1px solid var(--accent-line);
  border-radius: 1rem;
  background: var(--accent-soft);
}

.form-notice p {
  margin: 0;
  color: var(--text-primary);
}

.library-search-panel {
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(129, 140, 248, 0.08), transparent 22%),
    var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.library-search {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: end;
}

.search-field {
  display: grid;
  gap: 0.45rem;
}

.search-field--wide {
  grid-column: span 2;
}

.search-field input,
.search-field select,
.search-field textarea,
.search {
  min-height: 3rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-control);
  color: var(--text-primary);
}

.search-field textarea,
.search--editor {
  min-height: 18rem;
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.55;
}

.library-search__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.filter-list {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.filter-chip {
  display: grid;
  gap: 0.35rem;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-control);
}

.library-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}

.library-card {
  display: grid;
  gap: var(--space-md);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--bg-card-top), transparent 24%),
    var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.library-card__art-shell {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, rgba(129, 140, 248, 0.12), rgba(17, 19, 26, 0.28));
}

.library-card__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-card__art--placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
}

.library-card__badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: rgba(8, 8, 12, 0.88);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-primary);
}

.library-card__body,
.library-card__footer {
  display: grid;
  gap: var(--space-sm);
}

.library-card__body {
  padding: 0 var(--space-lg) var(--space-lg);
}

.library-card__topline,
.library-card__actions,
.library-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: space-between;
}

.library-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: -0.03em;
}

.library-card__meta,
.library-card__queue-note {
  color: var(--text-muted);
}

.library-pagination {
  justify-content: center;
  padding-bottom: var(--space-lg);
}

/* Viewer-focused watch layout */
.login-page {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 2 * var(--space-md));
}

.login-card {
  display: grid;
  justify-items: center;
  gap: var(--space-md);
  width: min(24rem, 100%);
  padding: var(--space-xl);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}

.channel-list {
  display: grid;
  gap: var(--space-sm);
  width: 100%;
  margin-top: var(--space-sm);
}

.channel-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  color: inherit;
  text-align: left;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--channel-accent, var(--accent));
}

.channel-card:hover,
.channel-card:focus-visible {
  border-color: var(--channel-accent, var(--accent));
  background: rgba(56, 189, 248, 0.08);
}

.channel-card small {
  color: var(--channel-accent, var(--accent));
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.channel-card span {
  color: var(--text-muted);
}

.watch-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  width: min(920px, 100%);
  margin: var(--space-md) auto 0;
}

.watch-info__now-playing {
  display: grid;
  gap: var(--space-sm);
}

.watch-info__now-playing h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.watch-info__now-playing h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: 0;
  line-height: 1.15;
}

.watch-info__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  color: var(--text-secondary);
}

.watch-info__clock {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.watch-info__queue {
  display: grid;
  gap: var(--space-md);
  align-content: start;
}

.watch-page {
  gap: var(--space-md);
}

.watch-page--theatre {
  width: 100%;
  min-height: calc(100dvh - 2 * var(--space-md));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-sm);
}

.watch-page > .player-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: var(--space-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.watch-page--theatre > .player-shell {
  width: min(1120px, 100%);
  padding: var(--space-sm);
  border-top: 2px solid var(--channel-accent, var(--line));
}

.watch-page > .player-shell .player-frame {
  overflow: hidden;
  border-radius: 0.9rem;
}

.party-access-panel {
  width: min(32rem, 100%);
  margin: var(--space-lg) auto;
}

.party-stage {
  display: grid;
  gap: var(--space-sm);
  width: min(1040px, 100%);
  margin: 0 auto;
}

.party-stage__masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--bg-card-top), var(--bg-card-bottom));
}

.party-stage__identity {
  display: grid;
  min-width: 0;
  gap: var(--space-xs);
}

.party-stage__identity h1 {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.06;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-stage__meta,
.party-stage__room,
.party-stage__time,
.party-transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.party-stage__meta {
  color: var(--text-secondary);
  font-size: var(--step--1);
}

.party-stage__meta span,
.party-stage__code {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control);
}

.party-stage__room {
  justify-content: flex-end;
}

.party-stage__code {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0;
}

.player-shell--party {
  display: grid;
  gap: var(--space-sm);
}

.party-stage__progress {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm) 0;
}

.party-stage__time {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.party-stage__progressbar {
  height: 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-control);
}

.party-stage__progressbar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--status-good));
  transition: width var(--motion-base) var(--ease-out);
}

.player-toolbar--party {
  align-items: center;
  flex-wrap: wrap;
  padding: 0 var(--space-sm) var(--space-xs);
}

.player-toolbar--party .player-toolbar__room {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: var(--step--1);
}

.player-toolbar--party .player-toolbar__room strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--step-0);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-toolbar--party .player-toolbar__actions {
  flex: 1 1 14rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.player-toolbar--party .player-external-controls {
  flex: 1 1 auto;
}

.party-now-playing {
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.55fr);
  align-items: stretch;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-glass);
}

.party-next-up {
  display: grid;
  gap: 0.35rem;
  padding: var(--space-sm);
  border: 1px solid var(--accent-line);
  border-radius: 0.8rem;
  background: var(--accent-soft);
}

.party-next-up strong {
  color: var(--text-primary);
  font-size: var(--step-0);
}

.party-next-up p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--step--1);
}

.party-control-panel {
  display: grid;
  gap: var(--space-sm);
}

.party-transport {
  align-items: stretch;
}

.party-transport form {
  display: flex;
  flex: 1 1 8rem;
  margin: 0;
}

.party-transport--secondary form {
  flex-basis: 10rem;
}

.transport-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.85rem;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--bg-control);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 800;
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    background-color var(--motion-fast) var(--ease-out);
}

.transport-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--bg-control-hover);
}

.transport-button:active {
  transform: translateY(0);
}

.transport-button--primary {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.queue-row--current {
  margin-inline: calc(var(--space-xs) * -0.5);
  padding-inline: calc(var(--space-xs) * 0.5);
  border-color: var(--accent-line);
  border-radius: 0.75rem;
  background: var(--accent-soft);
}

.queue-row--played {
  opacity: 0.72;
}

.popout-runtime {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: min(1120px, 100%);
  margin: 0 auto;
  color: var(--text-secondary);
}

.popout-runtime__title {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.popout-runtime .player-external-controls {
  margin-top: 0.15rem;
}

.popout-runtime__title strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--step-0);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popout-runtime__meta,
.popout-runtime__clock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.popout-runtime__meta {
  color: var(--text-muted);
  font-size: var(--step--1);
}

.popout-runtime__meta span {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control);
}

.popout-runtime__clock {
  flex: 0 0 auto;
  justify-content: flex-end;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--step-0);
  font-variant-numeric: tabular-nums;
}

.popout-runtime__progress {
  grid-column: 1 / -1;
  height: 0.3rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-control);
}

.popout-runtime__progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--status-good), var(--accent));
  transition: width var(--motion-base) var(--ease-out);
}

.popout-runtime[data-watch-live-mode="intermission"] .popout-runtime__progress span {
  background: linear-gradient(90deg, var(--accent), var(--status-warn));
}

@media (max-width: 720px) {
  .gosx-video-subtitle-overlay {
    padding-inline: 4%;
    padding-bottom: max(8%, 2rem);
  }

  .player-shell:has([data-gosx-video-interaction="active"]) .gosx-video-subtitle-overlay {
    padding-bottom: max(14%, 3.75rem);
  }

  .gosx-video-subtitle-cue {
    font-size: 1.05rem;
  }

  .popout-runtime {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .popout-runtime__clock {
    justify-content: flex-start;
  }
}

.watch-info__queue > .panel {
  padding: var(--space-md);
  border-radius: 1rem;
  background: rgba(17, 20, 28, 0.78);
}

.live-cache-panel {
  border-color: var(--accent-line);
  background: rgba(129, 140, 248, 0.1) !important;
}

.channel-shell {
  width: min(960px, calc(100% - 2 * var(--space-lg)));
  margin: 0 auto;
  padding: var(--space-lg) 0 var(--space-2xl);
}

.channel-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.channel-wordmark {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
}

.channel-stage {
  display: grid;
  gap: var(--space-sm);
}

.channel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}

.channel-layout {
  display: grid;
  gap: var(--space-md);
}

.channel-panel {
  padding: var(--space-md);
  border-radius: 1.25rem;
  background: var(--bg-surface);
}

.channel-sidebar {
  padding: var(--space-md);
  border-radius: 1rem;
  background: rgba(17, 20, 28, 0.72);
}

.watch-info__next {
  display: grid;
  gap: 0.35rem;
  padding: var(--space-md);
  border: 1px solid var(--accent-line);
  border-radius: 1rem;
  background: var(--accent-soft);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

.watch-app__foot {
  margin-top: var(--space-2xl);
  color: var(--text-muted);
  font-size: var(--step-0);
}

@media (max-width: 960px) {
  .hero,
  .watch-hero,
  .watch-grid,
  .watch-info,
  .panel-grid,
  .highlights,
  .room-grid__list,
  .library-search,
  .request-form,
  .activity-grid,
  .metric-grid,
  .command-grid,
  .control-board {
    grid-template-columns: 1fr;
  }

  .watch-app {
    width: min(100%, calc(100% - 2 * var(--space-md)));
  }

  .watch-app__bar {
    position: static;
    padding: var(--space-md);
  }

  .stage-shell__media {
    min-height: 22rem;
  }
}

@media (max-width: 640px) {
  .watch-app {
    padding-top: var(--space-md);
  }

  .hero__copy h1,
  .watch-hero__copy h1 {
    max-width: none;
  }

  .queue-row,
  .queue-row__meta,
  .library-card__topline,
  .library-card__actions,
  .library-search__actions,
  .request-form__actions,
  .stage-shell__meta,
  .stage-shell__actions {
    align-items: flex-start;
  }

  .party-stage__masthead,
  .party-now-playing {
    grid-template-columns: 1fr;
  }

  .party-stage__identity h1 {
    white-space: normal;
  }

  .party-stage__room,
  .player-toolbar--party,
  .player-external-controls--party,
  .player-toolbar--party .player-toolbar__actions {
    justify-content: flex-start;
  }

  .player-toolbar--party .player-external-controls,
  .player-toolbar--party .player-toolbar__actions {
    flex-basis: 100%;
  }

  .player-hud-controls {
    inset: auto var(--space-xs) var(--space-xs);
    max-width: calc(100% - var(--space-xs) - var(--space-xs));
    justify-content: center;
    padding: calc(var(--space-xs) * 0.55);
  }

  .player-hud-controls .player-caption-controls,
  .player-hud-controls .player-audio-controls,
  .player-hud-controls .player-quality-controls {
    flex: 1 1 9rem;
    max-width: 100%;
  }

  .player-hud-controls .player-sound-toggle {
    flex: 0 0 auto;
    min-width: 4.25rem;
  }

  .player-hud-controls .player-volume-controls {
    flex: 1 1 7rem;
  }

  .player-toolbar__actions .chip {
    flex: 1 1 9rem;
  }

  .party-transport form {
    flex-basis: 100%;
  }

  .queue-row {
    flex-direction: column;
  }

  .queue-row__meta {
    width: 100%;
    justify-content: flex-start;
  }

  .search-field--wide {
    grid-column: auto;
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }

  .timeline-row__meta {
    justify-items: start;
  }
}

/* ─── Subtitle Overlay ─── */

.gosx-video-subtitle-overlay.subtitle-overlay {
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
}

/* ─── Player Shell (engine mount) ─── */

.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 0.8rem;
  overflow: hidden;
}

.player-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Off-hours still. Only rendered while the scheduled quiet window is active
   (the element carries [hidden] otherwise), so it can never cover live video. */
.gosx-video-offhours {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  background: #000;
  z-index: 5;
}
.gosx-video-offhours[hidden] { display: none; }
.gosx-video-offhours__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.gosx-video-offhours__image[hidden] { display: none; }
.gosx-video-offhours__resume {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}


/* ---------------------------------------------------------------------------
   Prefixed fullscreen selectors.

   Every fullscreen rule above is written with the standard :fullscreen, which
   WebKit only matches from Safari 16.4. On anything older NONE of them apply, so
   the shell keeps its normal card chrome — border: 1px solid + border-radius:
   1.25rem — and fullscreen shows a rounded border inset from the screen edge.

   These MUST be separate rule blocks, not extra selectors bolted onto the ones
   above: a selector list containing a pseudo-class the browser does not know is
   discarded IN ITS ENTIRETY, so `:fullscreen, :-webkit-full-screen { }` would
   silently kill the standard rule in every modern browser.
   --------------------------------------------------------------------------- */
.player-shell:-webkit-full-screen {
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-shell:-webkit-full-screen .player-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.player-shell:-webkit-full-screen [data-gosx-engine-kind="video"],
.player-shell:-webkit-full-screen [data-gosx-engine-kind="video"] video {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

.player-shell:-webkit-full-screen:has([data-gosx-video-interaction="idle"]),
.player-shell:-webkit-full-screen [data-gosx-video-interaction="idle"] {
  cursor: none;
}

.player-shell:-webkit-full-screen:has([data-gosx-video-interaction="active"]),
.player-shell:-webkit-full-screen [data-gosx-video-interaction="active"] {
  cursor: auto;
}

/* Fullscreen targets .player-shell so the engine mount, the subtitle
   overlay, and the HUD all stay composited together. */
.player-shell:-webkit-full-screen {
  padding: 0;
  border: none;
  border-radius: 0;
  background: #000;
}

.player-shell:-webkit-full-screen .player-frame {
  width: 100%;
  height: 100%;
  max-height: none;
  border: none;
  border-radius: 0;
}

/* Cues lift ONLY while the video's own transport is actually on screen, and only
   far enough to clear it.

   They used to lift for `:has(.player-hud-controls)` as well — but that is a plain
   sibling <div> of external controls that is ALWAYS in the DOM and sits BELOW the
   video, never over it. So the rule matched permanently and shoved every cue ~14% up
   the picture for controls that were not covering anything. Worse, the
   `:has(.player-hud-controls):has(...active)` variant scores (0,4,0), out-specifying
   the (0,3,0) `:-webkit-full-screen` rule — which is why fullscreen kept the cues floating
   high instead of dropping them to the bottom of the frame. */
.player-shell:has([data-gosx-video-interaction="active"]) .gosx-video-subtitle-overlay,
.player-shell [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] .gosx-video-subtitle-overlay {
  padding-bottom: max(11%, 4rem);
}

/* The external control strip (quality / subtitle / audio pickers, transport) lives
   INSIDE .player-shell, and fullscreen targets the shell — so fullscreen drags the
   strip into the fullscreen layer, where nothing was hiding it. It sat there
   permanently across the bottom of the film, and as a flex item it also stole layout
   height from the video.
   In fullscreen it should behave like a video HUD: lifted out of flow, overlaid on
   the picture, and visible only while the transport is on screen. */
.player-shell:-webkit-full-screen {
  position: relative;
}

/* Fullscreen must be edge-to-edge black, whatever element the browser actually
   promoted. The app's own button fullscreens .player-shell, but the video engine can
   fullscreen its OWN mount — and that mount carries border-radius: 0.9rem plus a
   16/9 aspect-ratio, which then shows up as a rounded frame inset from the screen
   edge. Reset the chrome on the fullscreen element itself AND on anything inside one,
   so neither path can leave a border behind. */
:-webkit-full-screen,
:-webkit-full-screen .player-frame,
:-webkit-full-screen [data-gosx-engine-kind="video"],
:-webkit-full-screen [data-gosx-engine-kind="video"] video {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  background: #000;
}

[data-gosx-engine-kind="video"]:-webkit-full-screen,
[data-gosx-engine-kind="video"]:-webkit-full-screen video,
.player-frame:-webkit-full-screen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
}

.player-shell:-webkit-full-screen .player-external-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-out);
}

.player-shell:-webkit-full-screen:has([data-gosx-video-interaction="active"]) .player-external-controls,
.player-shell:-webkit-full-screen [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] ~ .player-external-controls {
  opacity: 1;
  pointer-events: auto;
}

.player-shell:-webkit-full-screen .gosx-video-subtitle-overlay {
  padding-bottom: max(3.5%, 2rem);
}

.player-shell:-webkit-full-screen:has([data-gosx-video-interaction="active"]) .gosx-video-subtitle-overlay,
.player-shell:-webkit-full-screen [data-gosx-engine-kind="video"][data-gosx-video-interaction="active"] .gosx-video-subtitle-overlay {
  padding-bottom: max(10%, 5rem);
}

.player-shell:-webkit-full-screen .gosx-video-subtitle-cue {
  font-size: 1.72rem;
}

/* :-webkit-full-screen mirror of the .subtitle-size-* companions above. */
.player-shell:-webkit-full-screen .subtitle-size-s .gosx-video-subtitle-cue {
  font-size: calc(1.72rem * 0.85);
}

.player-shell:-webkit-full-screen .subtitle-size-m .gosx-video-subtitle-cue {
  font-size: 1.72rem;
}

.player-shell:-webkit-full-screen .subtitle-size-l .gosx-video-subtitle-cue {
  font-size: calc(1.72rem * 1.25);
}

/* Final standard fullscreen reset. This intentionally appears after the
   page-scoped .watch-page > .player-shell rules so those card styles cannot
   reintroduce padding, shadows, or rounded inner frames in fullscreen. */
.watch-page > .player-shell:fullscreen,
.player-shell:fullscreen,
.watch-page > .player-shell[data-watch-fullscreen="true"],
.player-shell[data-watch-fullscreen="true"] {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  background: #000;
  backdrop-filter: none;
}

.watch-page > .player-shell:fullscreen .player-frame,
.player-shell:fullscreen .player-frame,
.watch-page > .player-shell[data-watch-fullscreen="true"] .player-frame,
.player-shell[data-watch-fullscreen="true"] .player-frame {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
}

.player-shell:fullscreen [data-gosx-engine-kind="video"],
.player-shell:fullscreen [data-gosx-engine-kind="video"] video,
.player-shell[data-watch-fullscreen="true"] [data-gosx-engine-kind="video"],
.player-shell[data-watch-fullscreen="true"] [data-gosx-engine-kind="video"] video {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
  background: #000;
}
