/* ─────────────────────────────────────────────────────────────────────────────
   Mediathek — a cinema at home.

   The pictures are the show: posters and backdrops carry all the colour, the
   interface stays dark and quiet around them. One idea is loud — the backdrop
   of a title lights the page behind it, the way a screen lights a dim room.
   Every colour, radius and step lives in these tokens.
   ───────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Big Shoulders";
  src: url("/fonts/big-shoulders.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --ink:      #0f131a;   /* the room */
  --ink-2:    #161b24;   /* surfaces */
  --ink-3:    #1e2430;   /* raised, hover */
  --line:     #272e3b;
  --line-2:   #38414f;
  --text:     #eef1f6;
  --text-2:   #a4adbb;
  --text-3:   #6f7889;
  --ivory:    #f3ece0;   /* projector light: the one button that plays */
  --ivory-ink:#17130d;
  --amber:    #ffb547;   /* progress, things in motion */
  --good:     #5fd3a4;
  --bad:      #ff6b6b;

  --display: "Big Shoulders", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-s: 8px;
  --r: 12px;
  --r-l: 20px;
  --gutter: clamp(16px, 4vw, 48px);
  --top-h: 64px;
  --tab-h: 64px;

  --shadow: 0 18px 50px rgb(0 0 0 / .45);
  --ring: 0 0 0 2px var(--ink), 0 0 0 4px var(--ivory);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  /* Kept for player.css, which predates this palette. */
  --accent: var(--amber);
  --bg-elevated: var(--ink-2);
  --border: var(--line);
  --fg-muted: var(--text-2);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-s); }
[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }
h1, h2, h3 { font-weight: 700; line-height: 1.1; text-wrap: balance; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Buttons and fields ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text);
  font-weight: 650; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: #262d3b; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--ivory); border-color: var(--ivory); color: var(--ivory-ink); }
.btn-primary:hover { background: #fff8ec; }
.btn-primary .icon { stroke-width: 2.2; }
.btn-ghost { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); backdrop-filter: blur(10px); }
.btn-ghost:hover { background: rgb(255 255 255 / .16); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #2a0707; }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.text-btn { border: 0; background: none; padding: 6px 2px; color: var(--text-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.text-btn:hover { color: var(--text); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--ink-3); color: var(--text); }
.icon-btn.subtle { color: var(--text-3); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 650; color: var(--text-2); }
.field label small { font-weight: 400; color: var(--text-3); }
.field input, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--ink); color: var(--text);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: rgb(243 236 224 / .55); }
.field input:focus-visible, .field textarea:focus-visible { box-shadow: none; }
.field-row { display: flex; gap: 12px; }
.field.grow { flex: 1; min-width: 0; }
.field.narrow { width: 120px; flex: none; }
.form-error { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.form-success { color: var(--good); font-size: 14px; }

.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--text-2); font-weight: 650; font-size: 14px; }
.segmented button small { font-size: 12px; color: var(--text-3); font-weight: 600; }
.segmented button[aria-selected="true"], .segmented button[aria-checked="true"] { background: rgb(255 255 255 / .13); color: var(--text); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06); }
.segmented button[aria-selected="true"] small, .segmented button[aria-checked="true"] small { color: var(--text-2); }
.segmented button:disabled { opacity: .4; cursor: default; }
.segmented .icon { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: none; color: var(--text-2); font-weight: 650; font-size: 14px; }
.chip.on { background: var(--ink-3); color: var(--text); border-color: var(--text-3); }
.chip .icon { width: 16px; height: 16px; }

/* A field is one capsule: the capsule shows focus, the input inside never
   draws a second ring of its own. */
.filter-field, .search-field { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line); color: var(--text-3); cursor: text; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.filter-field:focus-within, .search-field:focus-within { border-color: rgb(255 255 255 / .22); color: var(--text-2); background: var(--ink-3); }
.filter-field input, .search-field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text); outline: none; -webkit-appearance: none; appearance: none; }
.filter-field input:focus-visible, .search-field input:focus-visible { box-shadow: none; }
.filter-field input::placeholder, .search-field input::placeholder { color: var(--text-3); }
.filter-field input::-webkit-search-decoration, .filter-field input::-webkit-search-cancel-button,
.search-field input::-webkit-search-decoration, .search-field input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.meter { display: block; height: 4px; border-radius: 999px; background: rgb(255 255 255 / .14); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--amber); transition: width .5s ease; }
.meter.big { height: 8px; }

.note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--ink-2); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.note.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, var(--line)); }
.note.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); margin: 0 0 18px; }
.note .icon { margin-top: 1px; }

.switch-row { display: flex; align-items: flex-start; gap: 14px; padding: 6px 0; cursor: pointer; }
.switch-row input, .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { display: inline-flex; cursor: pointer; }
.switch { position: relative; width: 46px; height: 28px; flex: none; border-radius: 999px; background: var(--line-2); transition: background .15s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: transform .15s ease; }
:is(.switch-row, .toggle) input:checked + .switch { background: var(--good); }
:is(.switch-row, .toggle) input:checked + .switch::after { transform: translateX(18px); }
:is(.switch-row, .toggle) input:focus-visible + .switch { box-shadow: var(--ring); }
.switch-row span:last-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { color: var(--text-2); font-size: 13px; line-height: 1.4; }

.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: var(--ink-3); color: var(--text); font-weight: 700; font-size: 16px; }
.avatar.big { width: 72px; height: 72px; font-size: 28px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l));
  background: var(--ink);
  border-bottom: 1px solid rgb(255 255 255 / .05);
  transition: background .25s ease, border-color .25s ease;
}
.over-hero .topbar:not(.scrolled) { background: linear-gradient(rgb(15 19 26 / .7), rgb(15 19 26 / 0)) border-box; border-bottom-color: transparent; backdrop-filter: none; }
.over-hero .topbar:not(.scrolled) .tab:not(.active) { text-shadow: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand span { font: 800 26px/1 var(--display); letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-weight: 650; font-size: 15px; }
.tab:hover { color: var(--text); background: var(--ink-3); }
.tab.active { color: var(--text); background: rgb(255 255 255 / .11); }
.tab .icon { width: 18px; height: 18px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #2b1a00; font: 700 12px/20px var(--body); text-align: center; font-style: normal; }
#account { margin-left: auto; }
.page { padding: 0 calc(var(--gutter) + var(--safe-r)) calc(64px + var(--safe-b)) calc(var(--gutter) + var(--safe-l)); max-width: 1680px; margin: 0 auto; }
.tabbar { display: none; }
.loading-page { height: 60vh; }

/* ── Spotlight ─────────────────────────────────────────────────────────────
   The backdrop of what you are watching fills the top of the page and fades
   into the room. Without a backdrop, the poster stands in, blurred. */
.spotlight, .title-hero { position: relative; isolation: isolate; margin: calc(-1 * (var(--top-h) + var(--safe-t))) calc(-1 * (var(--gutter) + var(--safe-l))) 0 calc(-1 * (var(--gutter) + var(--safe-r))); }
.backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: hsl(var(--hue, 215) 30% 14%); }
.backdrop img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.backdrop.from-poster img { opacity: .25; }
.backdrop::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(90deg, rgb(15 19 26 / .92) 0%, rgb(15 19 26 / .55) 45%, rgb(15 19 26 / .05) 75%),
  linear-gradient(0deg, var(--ink) 0%, rgb(15 19 26 / 0) 45%); }
.spotlight { min-height: min(48vh, 460px); display: flex; align-items: flex-end; padding: calc(48px + var(--top-h) + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) 40px calc(var(--gutter) + var(--safe-l)); margin-bottom: 8px; }
.spotlight-copy { max-width: 620px; display: flex; flex-direction: column; gap: 12px; }
.spotlight-kicker { color: var(--text-2); font-weight: 600; font-size: 14px; }
.spotlight h1, .title-copy h1 { font: 700 clamp(32px, 4.5vw, 60px)/1.1 var(--body); letter-spacing: -.025em; text-shadow: 0 2px 30px rgb(0 0 0 / .4); }
.spotlight-line { color: var(--text); font-size: 17px; text-shadow: 0 1px 12px rgb(0 0 0 / .6); }
.spotlight .meter { width: min(320px, 70%); }
.spotlight-actions, .title-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ── Shelf ─────────────────────────────────────────────────────────────── */
.shelf-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px 0 24px; }
.shelf-bar .filter-field { width: min(340px, 100%); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 32px 20px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; padding: 0; border: 0; background: none; text-align: left; color: inherit; }
.tile > .poster { width: 100%; }
.tile > strong, .tile > small { max-width: 100%; }
.tile > strong { margin-top: 8px; font-size: 15px; font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile > small { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile:focus-visible { box-shadow: none; }
.tile:focus-visible .poster { box-shadow: var(--ring); }
.poster { position: relative; aspect-ratio: 2 / 3; border-radius: var(--r); overflow: hidden; background: hsl(var(--hue, 215) 28% 20%); box-shadow: 0 8px 24px rgb(0 0 0 / .35); transition: transform .2s ease, box-shadow .2s ease; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-blank { display: flex; align-items: flex-end; padding: 14px; background: linear-gradient(160deg, hsl(var(--hue, 215) 45% 34%), hsl(calc(var(--hue, 215) + 40) 40% 14%)); }
.poster-blank span { font: 800 clamp(22px, 2.4vw, 30px)/.95 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
@media (hover: hover) { .tile:hover .poster { box-shadow: 0 0 0 2px var(--line-2); } }
.flag { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--amber); color: #2b1a00; font-size: 11.5px; font-weight: 750; letter-spacing: .01em; box-shadow: 0 2px 8px rgb(0 0 0 / .3); }
.flag .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.flag-ok { background: rgb(15 19 26 / .85); color: var(--good); }
.flag-busy { background: rgb(15 19 26 / .85); color: var(--amber); }
.meter.on-poster { position: absolute; left: 10px; right: 10px; top: calc((100% - 40px) * 1); margin-top: -14px; }
.tile .meter.on-poster { top: auto; bottom: auto; position: relative; margin: -12px 10px 4px; z-index: 1; }
.no-match { padding: 40px 0; color: var(--text-2); }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 520px; padding: 72px 0; }
.empty h2 { font: 800 40px/1 var(--display); text-transform: uppercase; }
.empty p { color: var(--text-2); }

/* ── Rails ─────────────────────────────────────────────────────────────────
   Rows that run off the edge of the screen, so it is plain there is more. */
.rail-block { margin: 12px 0 28px; }
.rail-block h2 { font-size: 20px; margin-bottom: 12px; }
.rail-wrap { --rail-w: 168px; --rail-mid: calc(var(--rail-w) * .75); position: relative; margin: 0 calc(-1 * (var(--gutter) + var(--safe-r))) 0 calc(-1 * (var(--gutter) + var(--safe-l))); }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: var(--rail-w); gap: 20px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: calc(var(--gutter) + var(--safe-l)); padding: 6px calc(var(--gutter) + var(--safe-r)) 18px calc(var(--gutter) + var(--safe-l)); scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail-step { position: absolute; top: calc(6px + var(--rail-mid)); translate: 0 -50%; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / .16); background: rgb(15 19 26 / .82); color: var(--text); backdrop-filter: blur(8px); box-shadow: var(--shadow); opacity: 0; transition: opacity .15s ease; }
.rail-step.prev { left: calc(var(--gutter) / 2); }
.rail-step.next { right: calc(var(--gutter) / 2); }
.rail-wrap:hover .rail-step { opacity: 1; }
.rail-step:hover { background: var(--ink-3); }
@media (hover: none) { .rail-step { display: none; } }
.resume-rail .rail-wrap { --rail-w: 340px; --rail-mid: calc(var(--rail-w) * 9 / 32); }
.resume-card { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 16 / 9; padding: 14px 16px; border: 0; border-radius: var(--r); overflow: hidden; text-align: left; color: var(--text); background: hsl(var(--hue, 215) 30% 16%); box-shadow: 0 8px 24px rgb(0 0 0 / .35); transition: transform .2s ease, box-shadow .2s ease; }
.resume-card .backdrop::after { background: linear-gradient(0deg, rgb(10 13 18 / .94) 0%, rgb(10 13 18 / .35) 55%, rgb(10 13 18 / 0) 100%); }
.resume-card .backdrop img { transition: transform .4s ease; }
.resume-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.resume-text strong { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-text small { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-card .meter { margin-top: 10px; height: 3px; }
.resume-play { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgb(15 19 26 / .55); border: 1px solid rgb(255 255 255 / .35); backdrop-filter: blur(6px); }
.resume-play .icon { width: 16px; height: 16px; margin-left: 2px; }
.resume-card:focus-visible { box-shadow: var(--ring); }
@media (hover: hover) {
  .resume-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgb(0 0 0 / .5); }
  .resume-card:hover .backdrop img { transform: scale(1.04); }
  .resume-card:hover .resume-play { background: var(--ivory); color: var(--ivory-ink); border-color: var(--ivory); }
}

/* ── A title's page ────────────────────────────────────────────────────── */
.title-hero { padding: calc(20px + var(--top-h) + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) 40px calc(var(--gutter) + var(--safe-l)); min-height: min(70vh, 660px); display: flex; flex-direction: column; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 8px; border-radius: 999px; border: 0; background: rgb(15 19 26 / .5); color: var(--text); font-weight: 650; backdrop-filter: blur(8px); }
.title-head { margin-top: auto; display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr); gap: 36px; align-items: end; padding-top: 48px; }
.title-copy { display: flex; flex-direction: column; gap: 12px; min-width: 0; max-width: 720px; }
.title-copy h1 { font-size: clamp(30px, 4vw, 52px); }
.facts { color: var(--text); font-size: 16px; }
.overview { color: var(--text-2); max-width: 64ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.overview.open { -webkit-line-clamp: unset; }
.title-copy .more { align-self: flex-start; margin-top: -10px; padding: 2px 0; }
.resume-note { color: var(--text-2); font-size: 14px; }
.title-poster { box-shadow: 0 24px 60px rgb(0 0 0 / .6); }
.seasons { padding: 8px 0 24px; }
.season-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 20px; scrollbar-width: none; }
.season-tabs::-webkit-scrollbar { display: none; }
.season-tabs button { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: none; color: var(--text-2); font-weight: 650; }
.season-tabs button:hover { color: var(--text); }
.season-tabs button[aria-selected="true"] { background: rgb(255 255 255 / .12); color: var(--text); border-color: transparent; }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px 24px; }
.episode { display: flex; align-items: center; gap: 4px; border-radius: var(--r); }
.episode-play { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; padding: 8px; border: 0; border-radius: var(--r); background: none; text-align: left; color: inherit; }
.episode-play:hover { background: var(--ink-2); }
.still { position: relative; width: 156px; flex: none; aspect-ratio: 16 / 9; border-radius: var(--r-s); overflow: hidden; background: linear-gradient(135deg, hsl(var(--hue) 30% 22%), hsl(var(--hue) 25% 12%)); }
.still img { width: 100%; height: 100%; object-fit: cover; }
.still > i { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / .25); opacity: 0; transition: opacity .15s ease; }
.episode-play:hover .still > i, .episode.seen .still > i { opacity: 1; }
.still .icon { width: 28px; height: 28px; filter: drop-shadow(0 1px 4px rgb(0 0 0 / .6)); }
.seen-mark .icon { color: var(--good); stroke-width: 2.6; }
.meter.on-still { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px; }
.episode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.episode-text strong { font-size: 16px; font-weight: 650; }
.episode-text small { color: var(--text-2); font-size: 13px; }
.episode.seen .episode-text strong { color: var(--text-2); }

/* ── Overlays ──────────────────────────────────────────────────────────── */
.shade { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l)); background: rgb(5 7 10 / .7); backdrop-filter: blur(6px); animation: fade .15s ease-out; }
.dialog { width: min(440px, 100%); padding: 26px; border-radius: var(--r-l); background: var(--ink-2); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; animation: rise .18s ease-out; }
.dialog h2 { font-size: 21px; }
.dialog p { color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.sheet-shade { place-items: stretch end; padding: 0; }
.sheet { position: relative; width: min(560px, 100vw); height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--ink-2); border-left: 1px solid var(--line); box-shadow: var(--shadow); animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-wide { width: min(1040px, 100vw); }
.sheet-close { position: absolute; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); z-index: 3; background: rgb(15 19 26 / .6); color: var(--text); backdrop-filter: blur(8px); }
.sheet-body { padding: calc(28px + var(--safe-t)) calc(28px + var(--safe-r)) calc(32px + var(--safe-b)) 28px; display: flex; flex-direction: column; gap: 20px; }
.sheet-body h2 { font-size: 24px; padding-right: 48px; }
.sheet-body h3 { font-size: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes slide-up { from { transform: translateY(60px); opacity: .4; } }
.toast { position: fixed; z-index: 150; left: 50%; bottom: calc(28px + var(--safe-b)); translate: -50% 20px; max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 999px; background: var(--ivory); color: var(--ivory-ink); font-weight: 650; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease, translate .2s ease; }
.toast.show { opacity: 1; translate: -50% 0; }
.toast.bad { background: var(--bad); color: #2a0707; }
.account-sheet { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.account-sheet .btn { margin-top: 12px; }

/* ── Administration: shared ────────────────────────────────────────────── */
.page-head { padding: 32px 0 22px; display: flex; flex-direction: column; gap: 8px; }
.page-head h1 { font: 800 clamp(38px, 4.6vw, 56px)/.92 var(--display); text-transform: uppercase; }
.page-head > .muted { max-width: 60ch; }

/* Search */
.search-form { margin-top: 12px; max-width: 760px; }
.search-field { min-height: 60px; padding: 0 7px 0 22px; font-size: 18px; }
.search-field > .icon { width: 22px; height: 22px; }
.search-clear { display: grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-3); }
.search-clear:hover { color: var(--text); background: rgb(255 255 255 / .08); }
.search-clear .icon { width: 18px; height: 18px; }
.search-go { flex: none; height: 46px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ivory); color: var(--ivory-ink); font-weight: 700; font-size: 15px; }
.search-go:hover { background: #fff8ec; }
.shelf { margin-bottom: 40px; }
.shelf h2 { font-size: 20px; margin-bottom: 16px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.search-hint { max-width: 560px; padding: 40px 0; display: flex; flex-direction: column; gap: 10px; }
.search-hint h2 { font: 800 34px/1 var(--display); text-transform: uppercase; }
.search-hint p { color: var(--text-2); }
.muted-tile .poster { filter: grayscale(.8) brightness(.6); }
.skeleton .poster, .skeleton strong, .skeleton small { background: var(--ink-2); box-shadow: none; }
.skeleton strong { height: 14px; width: 80%; border-radius: 6px; }
.skeleton small { height: 12px; width: 50%; border-radius: 6px; }
.sheet-hero { position: relative; isolation: isolate; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; align-items: end; margin: calc(-28px - var(--safe-t)) calc(-28px - var(--safe-r)) 0 -28px; padding: calc(84px + var(--safe-t)) 28px 20px; }
.sheet-hero .backdrop::after { background: linear-gradient(0deg, var(--ink-2) 5%, rgb(22 27 36 / .35) 70%); }
.sheet-hero h2 { font: 800 40px/.92 var(--display); text-transform: uppercase; padding: 0; }
.sheet-hero .facts { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.plot { color: var(--text-2); font-size: 15px; }
.sheet-task { display: flex; flex-direction: column; gap: 14px; }
.task-loading { display: flex; align-items: center; gap: 12px; color: var(--text-2); padding: 12px 0; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ivory); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.choice-line { color: var(--text-2); font-size: 14px; text-align: center; margin-top: -4px; }
.versions summary { cursor: pointer; color: var(--text-2); font-weight: 650; padding: 8px 0; }
.versions { display: flex; flex-direction: column; gap: 6px; }
.version { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--ink); text-align: left; }
.version:hover { border-color: var(--line-2); background: var(--ink-3); }
.version span { display: flex; flex-direction: column; }
.version small { color: var(--text-2); }
.version em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--good); }
.task-head { display: flex; justify-content: space-between; align-items: center; }
.quick { display: flex; gap: 12px; }
.season-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.season-pick { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--ink); text-align: left; }
.season-pick small { color: var(--text-2); font-size: 12px; line-height: 1.35; }
.season-pick > i { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; }
.season-pick > i .icon { width: 14px; height: 14px; opacity: 0; stroke-width: 2.6; }
.season-pick.on { border-color: var(--ivory); background: color-mix(in srgb, var(--ivory) 8%, var(--ink)); }
.season-pick.on > i { background: var(--ivory); border-color: var(--ivory); color: var(--ivory-ink); }
.season-pick.on > i .icon { opacity: 1; }
.season-pick:disabled { opacity: .45; cursor: default; }

/* Downloads */
.dl-summary { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: var(--r-l); background: var(--ink-2); border: 1px solid var(--line); margin-bottom: 28px; }
.dl-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.dl-speed { font: 800 clamp(40px, 6vw, 64px)/.95 var(--display); text-transform: uppercase; }
.dl-when { font-size: 18px; font-weight: 700; color: var(--amber); }
.dl-summary .note { margin: 0; }
.dl-idle { display: flex; align-items: center; gap: 14px; }
.dl-idle > .icon { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); stroke-width: 2.4; }
.dl-idle > span { display: flex; flex-direction: column; gap: 2px; }
.dl-idle strong { font-size: 18px; }
.dl-facts { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--text-2); font-size: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.dl-facts b { color: var(--text); }
.dl-list { display: flex; flex-direction: column; gap: 8px; }
.dl-row { display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: var(--r); background: var(--ink-2); border: 1px solid var(--line); }
.dl-poster { width: 52px; flex: none; border-radius: var(--r-s); box-shadow: none; }
.dl-poster.poster-blank span { font-size: 9px; }
.dl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dl-text strong { font-size: 16px; }
.dl-text small { color: var(--text-2); font-size: 13px; }
.dl-state { font-size: 14px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.dl-detail { font-size: 13px; color: var(--text-2); }
.dl-text .meter { margin-top: 6px; }
.is-loading .dl-state, .is-importing .dl-state { color: var(--amber); }
.is-done .dl-state { color: var(--good); }
.is-failed .dl-state, .is-failed .dl-detail { color: var(--bad); }
.is-missing .dl-state { color: var(--text-2); }
.dl-actions { display: flex; gap: 4px; }
.dl-group { margin-top: 32px; }
.dl-group h2, .group-head h2 { font-size: 18px; margin-bottom: 12px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; }

/* Users */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.user-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--r-l); background: var(--ink-2); border: 1px solid var(--line); }
.user-card.is-new { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 25%, transparent); }
.user-card header { display: flex; align-items: center; gap: 12px; }
.user-card header > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-card header strong { font-size: 17px; }
.user-card header small { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-facts { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.user-card .segmented.access { display: flex; }
.user-card .segmented.access button { flex: 1; justify-content: center; }
.access-fixed { display: flex; align-items: center; gap: 8px; color: var(--good); font-size: 14px; }
.selection-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; border-radius: var(--r); border: 1px dashed var(--line-2); background: none; text-align: left; color: var(--text-2); }
.selection-btn b { color: var(--text); }
.selection-btn:hover { border-color: var(--text-3); }
.user-note { font-size: 13px; color: var(--text-3); border-top: 1px solid var(--line); padding-top: 10px; }
.picker { display: flex; flex-direction: column; gap: 16px; }
.picker-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: sticky; top: calc(-28px - var(--safe-t)); z-index: 2; margin: 0 -28px; padding: 12px 28px; background: var(--ink-2); }
.picker-bar .filter-field { flex: 1; min-width: 200px; }
.picker-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 22px 14px; }
.pick .pick-mark { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgb(15 19 26 / .75); border: 1.5px solid rgb(255 255 255 / .6); }
.pick .pick-mark .icon { width: 16px; height: 16px; stroke-width: 2.6; opacity: 0; }
.pick.on .pick-mark { background: var(--good); border-color: var(--good); color: #062218; }
.pick.on .pick-mark .icon { opacity: 1; }
.pick:not(.on) .poster { filter: saturate(.4) brightness(.6); }
.picker-foot { position: sticky; bottom: calc(-32px - var(--safe-b)); margin: 0 -28px -32px; padding: 14px 28px calc(14px + var(--safe-b)); background: var(--ink-2); border-top: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.manage { display: flex; flex-direction: column; gap: 24px; }
.manage section { display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; flex-direction: column; gap: 4px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r); cursor: pointer; }
.check-row:hover { background: var(--ink-3); }
.check-row input { width: 20px; height: 20px; accent-color: var(--good); }
.check-row .avatar { width: 32px; height: 32px; font-size: 14px; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 20px; }

/* Settings: one list, a sentence per service; fields only while editing. */
.settings { max-width: 760px; border-radius: var(--r-l); background: var(--ink-2); border: 1px solid var(--line); }
.setting { display: flex; flex-direction: column; gap: 18px; padding: 20px 24px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.setting h2 { font-size: 17px; font-weight: 700; }
.setting-tools { display: flex; align-items: center; gap: 14px; flex: none; }
.state { display: flex; align-items: baseline; gap: 8px; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.state::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-3); transform: translateY(-1px); }
.state.good::before { background: var(--good); }
.state.bad { color: var(--bad); }
.state.bad::before { background: var(--bad); }
.state.plain::before { display: none; }
.setting > .meter { max-width: 360px; }
.setting-form { display: flex; flex-direction: column; gap: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields .wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 18px; }
.result { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.result:empty { display: none; }
.result.bad { color: var(--bad); }
.fineprint { max-width: 760px; margin-top: 14px; padding: 0 24px; color: var(--text-3); font-size: 12px; line-height: 1.5; }
@media (max-width: 560px) {
  .setting { padding: 18px; }
  .fields .field:not(.short) { grid-column: 1 / -1; }
  .fineprint { padding: 0 18px; }
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page { display: grid; place-items: center; padding: 24px; background:
  radial-gradient(120% 80% at 80% 0%, #24314a 0%, transparent 60%),
  radial-gradient(90% 70% at 0% 100%, #2b2216 0%, transparent 55%), var(--ink); }
.login { width: min(420px, 100%); }
.login-card { display: flex; flex-direction: column; gap: 16px; padding: 32px; border-radius: var(--r-l); background: rgb(22 27 36 / .9); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.login-card h1 { font: 800 44px/.95 var(--display); text-transform: uppercase; margin-top: 12px; }
.login-card .brand span { font-size: 24px; }
.login-card .text-btn { align-self: center; }

/* ── Small screens ─────────────────────────────────────────────────────────
   A phone gets the navigation at the bottom, the sheets from the bottom, and
   three posters to a row. */
@media (max-width: 860px) {
  .has-tabbar .tabs { display: none; }
  .has-tabbar .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
    background: rgb(15 19 26 / .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar .tab { flex-direction: column; justify-content: center; gap: 3px; padding: 0; border-radius: 0; font-size: 11px; background: none !important; }
  .tabbar .tab.active { color: var(--ivory); }
  .tabbar .tab.active .icon { stroke-width: 2.2; }
  .tabbar .tab .icon { width: 22px; height: 22px; }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; }
  .has-tabbar .page { padding-bottom: calc(var(--tab-h) + 32px + var(--safe-b)); }
  .has-tabbar .toast { bottom: calc(var(--tab-h) + 16px + var(--safe-b)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 22px 12px; }
  .rail-wrap { --rail-w: 124px; }
  .rail { gap: 12px; }
  .resume-rail .rail-wrap { --rail-w: 272px; }
  .title-head { grid-template-columns: 120px minmax(0, 1fr); gap: 18px; }
  .shelf-bar .filter-field { width: 100%; }
  .sheet-shade { place-items: end stretch; }
  .sheet, .sheet-wide { width: 100%; height: auto; max-height: calc(100dvh - 24px - var(--safe-t)); border-left: 0; border-top: 1px solid var(--line); border-radius: var(--r-l) var(--r-l) 0 0; animation: slide-up .25s cubic-bezier(.2, .8, .2, 1); }
  .sheet-body { padding: 24px 20px calc(28px + var(--safe-b)); }
  .sheet-hero { margin: -24px -20px 0; padding: 72px 20px 16px; grid-template-columns: 96px minmax(0, 1fr); }
  .sheet-hero h2 { font-size: 32px; }
  .picker-bar { margin: 0 -20px; padding: 10px 20px; top: -24px; }
  .picker-foot { margin: 0 -20px -28px; padding: 12px 20px calc(12px + var(--safe-b)); bottom: calc(-28px - var(--safe-b)); }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@media (max-width: 560px) {
  :root { --top-h: 56px; }
  .brand span { font-size: 22px; }
  .spotlight { min-height: 42vh; padding-bottom: 28px; }
  .spotlight-actions .btn, .title-actions .btn { flex: 1; }
  .backdrop::after { background: linear-gradient(0deg, var(--ink) 8%, rgb(15 19 26 / .6) 50%, rgb(15 19 26 / .15) 100%); }
  .title-head { grid-template-columns: 1fr; }
  .title-poster { width: 132px; }
  .shelf-bar .segmented { width: 100%; }
  .shelf-bar .segmented button { flex: 1; justify-content: center; }
  .still { width: 128px; }
  .search-field { min-height: 54px; padding-left: 16px; font-size: 16px; }
  .search-go { height: 42px; padding: 0 16px; }
  .field-row { flex-direction: column; }
  .field.narrow { width: 100%; }
  .dl-row { align-items: flex-start; }
  .dl-poster { width: 44px; }
  .dialog-actions .btn { flex: 1; }
}
@media (min-width: 1920px) {
  body { font-size: 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 44px 28px; }
  .rail-wrap { --rail-w: 220px; }
  .rail { gap: 28px; }
  .resume-rail .rail-wrap { --rail-w: 420px; }
  .tile > strong { font-size: 18px; }
  .btn-lg { min-height: 64px; font-size: 20px; padding: 0 32px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .spotlight, .title-hero { min-height: 0; padding-top: 48px; }
}
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .segmented button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
