/* Shared by the host page and the viewer page: the page's names for the design tokens and the
   common components. The tokens themselves are tokens.css, generated from design/tokens.json and
   linked before this file. Page-specific rules go in host/host.css and viewer/watch.css. No inline styles anywhere: the
   Content-Security-Policy forbids them, so every look a script needs is a class here or there. */

:root,
[data-density] {
  /* The page's names for the design system's tokens (tokens.css, from design/tokens.json; decision
     38). Declared again under [data-density] so that a density set on any element reaches every
     rule inside it. */
  /* colours: blue-black and silver */
  --bg: var(--ds-bg);
  --surface: var(--ds-surface-1);
  --surface-2: var(--ds-surface-2);
  --surface-3: var(--ds-surface-3);
  --border: var(--ds-line);
  --border-2: var(--ds-outline);
  --text: var(--ds-text);
  --muted: var(--ds-text-muted);
  --faint: var(--ds-text-muted);
  --accent: var(--ds-accent);           /* links, focus, the played part of a timeline */
  --accent-2: var(--ds-live);           /* on air */
  --accent-soft: rgba(59, 130, 255, .16);
  --on-accent: var(--ds-text-on-silver);
  --ok: var(--ds-success);
  --ok-soft: var(--ds-success-soft);
  --warn: #f2c14e;
  --err: var(--ds-live-text);
  --err-soft: var(--ds-live-soft);

  /* shape and depth */
  --radius: var(--ds-radius-lg);
  --radius-sm: var(--ds-radius-md);
  --radius-xs: var(--ds-radius-sm);
  --shadow: 0 20px 60px rgba(0, 0, 0, .55);

  /* spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --gutter: 32px;

  /* type: Electrolize for everything, Audiowide for the logo, screen titles and film titles */
  --font: var(--ds-font-ui);
  --font-display: var(--ds-font-display);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-sm: var(--ds-type-sm);
  --text-md: var(--ds-type-md);
  --text-lg: var(--ds-type-lg);
  --control: var(--ds-control-height);

  /* the card grid: portrait posters */
  --card-min: var(--ds-poster-width, 150px);
  --poster-ratio: 2 / 3;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scrollbar-color: var(--border-2) var(--bg); scrollbar-width: thin; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: var(--text-md)/1.45 var(--font);
  /* One weight per face (decision 38): emphasis is size and colour, never a made-up bold. */
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, b, strong, th { font-weight: 400; }
.display { font-family: var(--font-display); font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ds-silver); }
a:hover { color: var(--text); }
img { max-width: 100%; }
svg.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: var(--ds-focus-ring-width) solid var(--accent); outline-offset: var(--ds-focus-ring-offset); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.98); } }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap;
  padding: 14px var(--gutter);
  background: var(--ds-rail);
  border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
/* The wordmark: the Monogram F in a silver tile, then the name in Audiowide. */
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: 15px; color: var(--ds-silver-soft); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.logo {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: var(--ds-silver); color: var(--ds-text-on-silver); font-family: var(--font-display); font-size: 15px; line-height: 1;
}

/* ---- page layout ---- */
.page { padding: var(--space-5) var(--gutter) 60px; }
.section-title { margin: 0 0 var(--space-3); color: var(--text); font-family: var(--font-display); font-size: 14px; font-weight: 400; }

/* ---- buttons ---- */
/* Buttons (docs/design/components.md, decision 39): secondary by default; primary is silver with
   dark text; Go live is green and End night red, both with dark text. No button is filled blue:
   white on the accent fails AA. */
.btn {
  display: inline-flex; gap: var(--space-2); align-items: center; justify-content: center;
  height: 40px; padding: 0 18px;
  border: 1px solid var(--border-2); border-radius: 10px;
  background: var(--surface-2); white-space: nowrap; cursor: pointer;
  text-decoration: none; color: var(--text);
  transition: background var(--ds-fade-short), border-color var(--ds-fade-short), color var(--ds-fade-short);
}
.btn:hover { background: var(--surface-3); }
.btn:active { border-color: var(--accent); }
.btn.primary { border-color: transparent; background: var(--ds-silver); color: var(--ds-text-on-silver); }
.btn.primary:hover { background: var(--ds-silver-soft); }
.btn.primary:active { background: #B9C1CE; }
.btn.go { border-color: transparent; background: var(--ds-go); color: var(--ds-text-on-go); }
.btn.go:hover { background: var(--ds-go-hover); }
.btn.go:active { background: var(--ds-go-pressed); }
.btn.end { border-color: transparent; background: var(--ds-live); color: var(--ds-text-on-live); }
.btn.end:hover { background: var(--ds-live-hover); }
.btn.end:active { background: #D3424A; color: var(--ds-text-on-live); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ds-silver); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.ghost:active { background: var(--surface-3); }
.btn.danger { border-color: rgba(229, 72, 77, .6); background: transparent; color: var(--ds-live-text); }
.btn.danger:hover { background: var(--err-soft); }
.btn.small { height: var(--control); padding: 0 12px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn.icon-only { width: 40px; padding: 0; }
.btn.small.icon-only { width: var(--control); }
.btn.on { border-color: var(--accent); color: var(--text); }
.btn:disabled { opacity: .4; cursor: default; }

/* ---- inputs and selects ---- */
.input, select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  outline: none; transition: border-color var(--ds-fade-short), box-shadow var(--ds-fade-short);
}
textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
select { cursor: pointer; }
.input::placeholder, textarea::placeholder { color: var(--faint); }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: var(--text-sm); }
.check { display: inline-flex; gap: var(--space-2); align-items: center; cursor: pointer; }
.check input { accent-color: var(--accent); }

/* ---- chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: var(--text-sm); white-space: nowrap; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.on { border-color: transparent; background: var(--ds-silver); color: var(--ds-text-on-silver); }
.chip button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; background: none; color: inherit; opacity: .7; cursor: pointer; }
.chip button:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: rgba(3, 10, 34, .82); font-size: 11px; }
.badge.accent { background: var(--ds-silver); color: var(--ds-text-on-silver); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

/* A status pill: a dot and a word ("Not live yet", "Live", "Prepared"). */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live { border-color: rgba(229, 72, 77, .45); background: var(--ds-live-soft); color: var(--ds-live-text); }
.pill.paused { border-color: var(--border-2); color: var(--ds-silver); }
.pill.ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.pill.silver { border-color: transparent; background: var(--ds-silver); color: var(--ds-text-on-silver); }
.pill.plain::before { display: none; }

/* ---- tabs ---- */
.tabs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 2px; padding: 3px; background: var(--surface); border-radius: var(--radius-sm); }
.tabs button, .tabs a { min-height: calc(var(--control) - 6px); padding: 0 12px; border: 0; border-radius: var(--radius-xs); background: none; color: var(--muted); font-size: var(--text-sm); text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs .on, .tabs [aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* The view switcher (Cinema / Studio / Couch): a pill; the chosen one is silver (decision 39). */
.switcher { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface); }
.switcher button { min-height: calc(var(--control) - 8px); padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.switcher button:hover { color: var(--text); }
.switcher [aria-checked="true"] { background: var(--ds-silver); color: var(--ds-text-on-silver); }

/* ---- the card grid: portrait posters ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: 20px 16px; }
.card { min-width: 0; cursor: pointer; outline: none; animation: rise .35s ease both; }
.card.kept { animation: none; }
.poster {
  position: relative; aspect-ratio: var(--poster-ratio); overflow: hidden;
  border-radius: var(--radius-sm); background: var(--surface-2);
  transition: transform var(--ds-fade-long) ease, box-shadow var(--ds-fade-long) ease;
}
.card:hover .poster { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:focus-visible .poster { box-shadow: 0 0 0 var(--ds-focus-ring-offset) var(--bg), 0 0 0 calc(var(--ds-focus-ring-offset) + var(--ds-focus-ring-width)) var(--accent); transform: scale(var(--ds-focus-scale)); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .3), transparent 25%, transparent 70%, rgba(0, 0, 0, .6)); pointer-events: none; }
.poster .placeholder { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px; background: linear-gradient(160deg, var(--surface-3), var(--surface)); color: rgba(255, 255, 255, .88); font-size: 14px; line-height: 1.15; }
.poster .badge { position: absolute; z-index: 1; }
.poster .badge.tl { top: 8px; left: 8px; }
.poster .badge.tr { top: 8px; right: 8px; }
.poster .badge.bl { bottom: 8px; left: 8px; }
.poster .badge.br { bottom: 8px; right: 8px; }
.card.missing .poster { opacity: .5; }
.card.seen .poster img { filter: saturate(.6) brightness(.8); }
.card h4 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 8px 2px 2px; font-size: var(--text-sm); line-height: 1.35; }
.card .sub { margin: 0 2px; color: var(--muted); font-size: var(--ds-type-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skeleton .poster { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton .line { height: 12px; margin: 12px 2px 0; border-radius: 6px; background: var(--surface-2); }
.skeleton .line.short { width: 55%; }
.empty { padding: 60px 20px; color: var(--muted); text-align: center; }

/* ---- dialogs (native <dialog>) ---- */
dialog.dialog {
  width: min(640px, calc(100vw - 32px)); max-height: 90vh; padding: 0;
  border: 1px solid var(--border-2); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: auto;
}
dialog.dialog[open] { animation: pop .2s ease; }
dialog.dialog.wide { width: min(1000px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: rgba(3, 10, 34, .8); }
.dialog header { display: flex; gap: var(--space-3); align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dialog header h2 { flex: 1; margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 400; }
.dialog .body { padding: 18px 22px; }
.dialog footer { display: flex; gap: var(--space-2); justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); }

/* ---- the dialog player ---- */
dialog.player {
  width: min(1400px, 94vw); max-height: 94vh; padding: 0;
  border: 1px solid var(--border-2); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden;
}
dialog.player[open] { display: grid; grid-template-columns: minmax(0, 1fr) 320px; animation: pop .22s ease; }
dialog.player.bare[open] { grid-template-columns: minmax(0, 1fr); }
/* A plain dark backdrop: a blurred one is redrawn under the video every frame. */
dialog.player::backdrop { background: rgba(3, 10, 34, .94); }
body:has(dialog.player[open]) .topbar { backdrop-filter: none; }
.stage { position: relative; display: grid; place-items: center; min-height: 320px; background: #000; }
.stage:focus { outline: none; }
.stage video { width: 100%; max-height: 94vh; aspect-ratio: 16 / 9; background: #000; }
.stage .close { position: absolute; top: 10px; right: 10px; z-index: 2; transition: opacity .25s ease; }
.stage .spinner { position: absolute; width: 38px; height: 38px; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; animation: spin .9s linear infinite; }
.player-info { display: flex; flex-direction: column; gap: var(--space-3); padding: 20px; overflow: auto; border-left: 1px solid var(--border); }
.player-info h3 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 400; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ds-live-text); animation: pulse 1.4s ease-in-out infinite; }

/* ---- the video player's control bar (decision 32): one design for the host's channel player and
   the friends' page. The scripts only set data-state, aria-label and data-tip on a button, the
   .vp-idle class on the stage, and the value of a <progress>: the page's policy allows no inline
   styles, so the played part of a slider is a <progress> under a see-through range input. ---- */
.vp {
  --vp-thumb: 14px;
  --vp-fill: #fff;
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  padding: 40px max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: linear-gradient(0deg, var(--ds-scrim), var(--ds-scrim-clear));
  color: #fff;
  pointer-events: none; /* the soft top of the gradient belongs to the picture */
  transition: opacity .25s ease;
}
.vp-row, .vp-seek { pointer-events: auto; }
.vp-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.vp-grow { flex: 1; min-width: 0; }

/* Faded while the film plays. Only opacity, so the Tab key can still reach the controls. */
.vp-idle, .vp-idle video { cursor: none; }
.vp-idle .vp, .vp-idle .vtop { opacity: 0; } /* .vtop: the viewer's title over the picture */
.vp-idle .vp-row, .vp-idle .vp-seek { pointer-events: none; }
.vp-idle .close:not(:focus-visible) { opacity: 0; pointer-events: none; }

.vp-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: #fff; cursor: pointer;
  transition: background-color .12s ease;
}
.vp-btn svg { display: none; width: 24px; height: 24px; fill: currentColor; stroke: none; }
.vp-btn .ln { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vp-btn:not([data-state]) svg,
.vp-btn[data-state="play"] .i-play, .vp-btn[data-state="pause"] .i-pause,
.vp-btn[data-state="high"] .i-high, .vp-btn[data-state="low"] .i-low, .vp-btn[data-state="muted"] .i-muted,
.vp-btn[data-state="enter"] .i-enter, .vp-btn[data-state="exit"] .i-exit { display: block; }
.vp-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .14); }
.vp-btn:focus-visible, .vp-range:focus-visible { outline: 2px solid #fff; outline-offset: 1px; box-shadow: 0 0 0 4px rgba(0, 0, 0, .65); }
.vp-range:focus-visible { border-radius: 6px; }

.vp-time { flex: none; padding: 0 8px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vp-time:empty { display: none; }

/* A slider: the track and its played part are the <progress>, the thumb is the range input's. The
   track is inset by half a thumb, the distance the thumb's centre stops short of each end. */
.vp-slider { position: relative; display: flex; align-items: center; }
.vp-fill {
  position: absolute; left: calc(var(--vp-thumb) / 2); top: 50%;
  width: calc(100% - var(--vp-thumb)); height: 4px; margin-top: -2px;
  -webkit-appearance: none; appearance: none; overflow: hidden;
  border: 0; border-radius: 2px; background: rgba(255, 255, 255, .3);
  pointer-events: none; transition: height .12s ease, margin-top .12s ease;
}
.vp-fill::-webkit-progress-bar { background: rgba(255, 255, 255, .3); }
.vp-fill::-webkit-progress-value { background: var(--vp-fill); }
.vp-fill::-moz-progress-bar { background: var(--vp-fill); }
.vp-range {
  position: relative; display: block; width: 100%; height: 100%; margin: 0; padding: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.vp-range::-webkit-slider-runnable-track { height: var(--vp-thumb); background: transparent; }
.vp-range::-moz-range-track { height: var(--vp-thumb); background: transparent; }
.vp-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--vp-thumb); height: var(--vp-thumb); border: 0; border-radius: 50%;
  background: var(--vp-fill); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
  transform: scale(.75); transition: transform .12s ease;
}
.vp-range::-moz-range-thumb {
  width: var(--vp-thumb); height: var(--vp-thumb); border: 0; border-radius: 50%;
  background: var(--vp-fill); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
  transform: scale(.75); transition: transform .12s ease;
}
.vp-range:active::-webkit-slider-thumb, .vp-range:focus-visible::-webkit-slider-thumb { transform: scale(1.3); }
.vp-range:active::-moz-range-thumb, .vp-range:focus-visible::-moz-range-thumb { transform: scale(1.3); }
.vp-range:disabled { cursor: default; }
.vp-range:disabled::-webkit-slider-thumb { visibility: hidden; }
.vp-range:disabled::-moz-range-thumb { visibility: hidden; }

.vp-vol { flex: none; width: 76px; height: 40px; margin: 0 4px 0 2px; }

/* The timeline: slim across the top of the bar, the played part in silver. */
.vp-seek { --vp-fill: var(--ds-silver); height: 20px; margin: 0 2px; }
.vp-seek.is-dragging .vp-fill { height: 6px; margin-top: -3px; }
.vp-note {
  position: absolute; right: 7px; bottom: 100%; max-width: calc(100% - 14px); padding: 3px 8px;
  border-radius: 6px; background: rgba(8, 20, 54, .94); color: #fff; font-size: 12px; line-height: 1.35;
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
/* It says what the timeline does before the hand can move it: on hover or keyboard focus, while
   dragging, and always where nothing can hover (a touch moves the film as soon as it lets go). */
.vp-range:focus-visible ~ .vp-note, .vp-seek.is-dragging .vp-note { opacity: 1; }
@media (hover: none) {
  .vp-range:not(:disabled) ~ .vp-note { opacity: 1; }
}

/* Tooltips and hover looks only where a pointer can hover. */
.vp-btn::after, .vp-vol::after {
  content: attr(data-tip); position: absolute; z-index: 1; left: 50%; bottom: calc(100% + 6px);
  padding: 4px 8px; border-radius: 6px; background: rgba(8, 20, 54, .94); color: #fff;
  font-size: 12px; line-height: 1.35; white-space: nowrap;
  opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity .12s ease;
}
.vp-row > :first-child::after { left: 0; transform: none; }
.vp-row > :last-child::after { left: auto; right: 0; transform: none; }
.vp-btn:focus-visible::after, .vp-vol:has(.vp-range:focus-visible)::after { opacity: 1; }
@media (hover: hover) {
  .vp-btn:hover { background: rgba(255, 255, 255, .16); }
  .vp-btn:hover::after, .vp-vol:hover::after { opacity: 1; }
  .vp-seek:hover .vp-fill { height: 6px; margin-top: -3px; }
  .vp-range:hover:not(:disabled)::-webkit-slider-thumb { transform: scale(1.3); }
  .vp-range:hover:not(:disabled)::-moz-range-thumb { transform: scale(1.3); }
  .vp-seek:hover .vp-range:not(:disabled) ~ .vp-note { opacity: 1; }
}

/* Phones and touch screens: every control is at least 44px. */
@media (max-width: 760px), (pointer: coarse) {
  .vp { --vp-thumb: 16px; padding-top: 14px; }
  .vp-btn { width: 44px; height: 44px; }
  .vp-vol { height: 44px; }
  .vp-seek { height: 44px; }
  .stage .btn.close { width: 44px; height: 44px; }
}
@media (max-width: 420px) {
  .vp-vol { display: none; } /* a phone's volume is on its own buttons */
  .vp-time { padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .vp, .vp-btn, .vp-btn::after, .vp-vol::after, .vp-fill, .vp-note, .stage .close { transition: none; }
  .vp-range::-webkit-slider-thumb { transition: none; }
  .vp-range::-moz-range-thumb { transition: none; }
}

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 50; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.toast { max-width: 360px; padding: 12px 16px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow); animation: rise .25s ease; }
.toast.ok { border-color: rgba(158, 224, 158, .4); }
.toast.err { border-color: rgba(229, 72, 77, .6); }
.toast button { margin-left: 12px; padding: 0; border: 0; background: none; color: var(--ds-silver); text-decoration: underline; cursor: pointer; }

/* ---- narrow screens ---- */
@media (max-width: 760px) {
  :root, [data-density] { --gutter: 16px; --card-min: 132px; }
  .topbar { padding: 10px var(--gutter); gap: var(--space-3); }
  dialog.player[open] { grid-template-columns: minmax(0, 1fr); width: 100vw; max-width: 100vw; border-radius: 0; }
  .player-info { border-left: 0; border-top: 1px solid var(--border); }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* ---- the API reference page (Redoc) ---- */
/* Redoc's "made by" link would show its maker's logo; docs.js never lets that image load: hide the link. */
.api-ref a[href^="https://redocly.com"] { display: none; }

/* The captions menu of a player (captions.js): opened from its captions button, for that screen only. */
.captions-menu {
  position: absolute; right: 12px; bottom: 60px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 60%; overflow-y: auto; padding: 6px;
  border: 1px solid var(--border-2); border-radius: 10px; background: rgba(8, 20, 54, .96);
}
.captions-menu[hidden] { display: none; }
/* The words themselves (captions.js): over the picture and over the control bar's shade, which
   would dim them, and under the captions menu. The script sets where their foot is and their size. */
.captions-text {
  position: absolute; z-index: 4; left: 4%; right: 4%; bottom: var(--captions-bottom, 4%);
  display: flex; flex-direction: column; align-items: center; gap: .12em;
  color: #fff; font: 400 var(--captions-size, 18px)/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  text-align: center; pointer-events: none;
}
.captions-text[hidden] { display: none; }
.captions-text > span { max-width: 100%; padding: .06em .4em; border-radius: 4px; background: rgba(0, 0, 0, .78); white-space: pre-line; }
.captions-menu .btn[aria-pressed="true"] { background: var(--ds-silver); color: var(--ds-text-on-silver); }
