/* AnyFin — calm, car-dashboard clarity.
   Near-black with flat charcoal cards (no borders: surfaces do the separating),
   one blue for the main action, white for progress, and big rounded touch
   targets that work at arm's length on a car screen. One family, Figtree. */

@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/vendor/fonts/figtree-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/vendor/fonts/figtree-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --ink: #111112;        /* the page */
  --ink-2: #1f1f21;      /* cards, fields, the nav track */
  --ink-3: #2c2c2f;      /* hover */
  --ink-4: #3a3a3d;      /* selected segment, secondary buttons */
  --line: rgb(255 255 255 / 0.1);
  --text: #f5f5f7;
  --text-dim: #9a9aa0;
  --accent: #3d6ae0;     /* the main action (Play, Sign in) and focus only */
  --accent-hover: #5279e8;
  --accent-ink: #ffffff;
  --signal: #ff6b5e;

  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.375rem;
  --step-2: 1.625rem;
  --step-3: 2rem;
  --display: clamp(2.2rem, 4.6vw, 3.25rem);

  --gutter: clamp(16px, 3.2vw, 40px);
  --radius: 14px;        /* buttons, fields, segmented tracks */
  --radius-sm: 10px;     /* segments, menu items */
  --radius-card: 18px;
  --radius-panel: 24px;
  --header-h: 100px;
  font-family: var(--font);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.1; letter-spacing: -0.01em; }
p { margin: 0; }

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

.muted { color: var(--text-dim); }
.error { color: var(--signal); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -64px; z-index: 50;
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---- Display type ------------------------------------------------------- */

.display {
  font-weight: 650;
  font-size: var(--display);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink-4);
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #46464a; }
.btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn-primary { min-width: 160px; background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--ink-4); }
.btn-icon { padding: 0; width: 56px; }
.btn[aria-pressed="true"] svg { color: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---- Header -------------------------------------------------------------- */

.topnav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 32px);
  padding: 0 var(--gutter);
  transition: background-color 0.2s;
}
.topnav.is-solid, .topnav.is-static { background: rgb(17 17 18 / 0.92); backdrop-filter: blur(16px); }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.015em;
  text-decoration: none;
  line-height: 1;
}
.wordmark img { width: 1.6em; height: 1.6em; flex: none; }
/* Sections as a segmented control: one track, the current one raised. */
.topnav nav { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--ink-2); }
.topnav nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.topnav nav a:hover { color: var(--text); }
.topnav nav a[aria-current="page"] { color: var(--text); background: var(--ink-4); font-weight: 600; }
/* The search box gives up width first when the header gets crowded. */
.topnav .search { margin-left: auto; position: relative; flex: 0 1 300px; min-width: 120px; }
.topnav .search input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink-2);
}
.topnav .search input::placeholder { color: var(--text-dim); }
.topnav .search svg { position: absolute; left: 16px; top: 15px; width: 22px; height: 22px; fill: var(--text-dim); pointer-events: none; }

.user-menu { position: relative; }
.avatar {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: grid; place-items: center; overflow: hidden;
  border: 0; padding: 0; cursor: pointer;
  background: var(--ink-2); font-weight: 650; font-size: 1.0625rem;
}
.avatar:hover { background: var(--ink-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px; padding: 6px;
  border-radius: var(--radius); background: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px rgb(0 0 0 / 0.5);
}
.menu-name { padding: 12px 14px 10px; font-weight: 650; }
.menu-name small { display: block; color: var(--text-dim); font-weight: 400; }
.menu a, .menu button {
  display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 14px;
  border: 0; border-radius: var(--radius-sm); background: none;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--ink-3); }

/* ---- Search panel (results as you type) ------------------------------------ */

.search-scrim { position: fixed; inset: var(--header-h) 0 0; z-index: 18; background: rgb(0 0 0 / 0.55); }
.search-panel {
  position: fixed;
  top: calc(var(--header-h) - 4px);
  left: var(--gutter);
  right: var(--gutter);
  z-index: 19;
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border-radius: var(--radius-panel);
  background: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgb(0 0 0 / 0.55);
}
/* Tesla: the on-screen keyboard covers about the bottom 45% and the page isn't
   resized, so results stay in the part of the screen above it. */
.is-tesla .search-panel { max-height: calc(55vh - var(--header-h)); }
.search-panel.is-loading .search-body { opacity: 0.55; transition: opacity 0.15s 0.1s; }
.search-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search-hint { padding: 8px 6px; color: var(--text-dim); }
.search-section + .search-section:not(:empty) { margin-top: 14px; }
.search-section h2, .search-section-head h2 { margin: 0 0 6px 6px; font-size: var(--step--1); font-weight: 600; color: var(--text-dim); }
.search-section-head { display: flex; align-items: center; justify-content: space-between; }
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px; }
.search-option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 8px;
  border-radius: 12px;
  text-decoration: none;
  min-width: 0;
}
.search-option:hover, .search-option[aria-selected="true"] { background: var(--ink-3); }
.search-option:focus-visible { outline-offset: -2px; }
.search-art { flex: none; width: 44px; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; background: var(--ink-4); }
.search-art.is-wide { width: 88px; aspect-ratio: 16 / 9; }
.search-art img { width: 100%; height: 100%; object-fit: cover; }
.search-text { display: grid; min-width: 0; }
.search-title, .search-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-title { font-weight: 600; }
.search-sub { color: var(--text-dim); font-size: var(--step--1); }
.search-all {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-top: 12px;
  border-radius: 12px;
  background: var(--ink-4);
  font-weight: 600;
  text-decoration: none;
}
.search-all:hover, .search-all[aria-selected="true"] { background: #46464a; }
.search-recent { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 6px; }
.search-recent button, .search-clear {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--ink-4);
  font-weight: 550;
  cursor: pointer;
}
.search-clear { min-height: 36px; padding: 0 12px; background: transparent; color: var(--text-dim); }
.search-recent button:hover { background: #46464a; }
.search-clear:hover { color: var(--text); }

/* Narrow but not phone (the car's browser beside its map): search is just its
   icon until tapped, then takes the tabs' place while you type. */
@media (min-width: 721px) and (max-width: 1000px) {
  .topnav nav a { padding: 0 16px; }
  .topnav .search { flex: 0 0 52px; min-width: 52px; }
  .topnav .search input { padding-right: 0; cursor: pointer; }
  .topnav .search input::placeholder { color: transparent; }
  .topnav .search:focus-within { flex: 1 1 auto; }
  .topnav .search:focus-within input { padding-right: 16px; cursor: text; }
  .topnav .search:focus-within input::placeholder { color: var(--text-dim); }
  .topnav:has(.search:focus-within) nav { display: none; }
}

@media (max-width: 720px) {
  :root { --header-h: 140px; }
  .topnav { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; row-gap: 10px; }
  .topnav nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topnav nav a { flex: 1 0 auto; justify-content: center; padding: 0 12px; }
  .topnav .search { flex: 1; min-width: 0; }
  .topnav .search input { width: 100%; }
}

/* ---- Page frame ------------------------------------------------------------ */

.page { padding: calc(var(--header-h) + 16px) var(--gutter) 64px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-weight: 650; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.05; letter-spacing: -0.025em; }

.notice {
  max-width: 60ch;
  padding: 20px 22px;
  border-radius: var(--radius-card);
  background: var(--ink-2);
}
.notice .btn { margin-top: 14px; }

/* ---- Art glow (focus/hover) --------------------------------------------- */
/* A poster's own image, blurred, glows behind it: it lights up rather than lifts. */

.art { position: relative; isolation: isolate; border-radius: var(--radius-card); }
.art::before {
  content: "";
  position: absolute;
  inset: 6%;
  z-index: -1;
  background: var(--art, none) center / cover;
  filter: blur(22px) saturate(1.5);
  opacity: 0;
  transition: opacity 0.25s;
  border-radius: inherit; /* glow in the picture's shape (round for people), not the photo's rectangle */
}
.art-frame { position: relative; overflow: hidden; border-radius: var(--radius-card); background: var(--ink-2); }
.art-frame img { width: 100%; height: 100%; object-fit: cover; }
/* Only cards you can open light up, and hover only where there's a real
   pointer: touch screens keep :hover "stuck" after a tap. */
a.card:focus-visible .art::before { opacity: 0.7; }
@media (hover: hover) {
  a.card:hover .art::before { opacity: 0.7; }
}
.card:focus-visible { outline: none; }
.card:focus-visible .art-frame { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- Cards --------------------------------------------------------------- */

.card { display: block; min-width: 0; text-decoration: none; color: inherit; }
.card .art-frame { aspect-ratio: 2 / 3; }
.card-title { margin-top: 10px; padding: 0 4px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { padding: 0 4px; color: var(--text-dim); font-size: var(--step--1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Wide cards are one tile: picture on top, title on the same surface. */
.card.is-wide { border-radius: var(--radius-card); background: var(--ink-2); padding-bottom: 14px; transition: background-color 0.2s; }
.card.is-wide .art, .card.is-wide .art-frame { border-radius: var(--radius-card) var(--radius-card) 0 0; }
.card.is-wide .art-frame { aspect-ratio: 16 / 9; }
.card.is-wide .art::before { display: none; }
.card.is-wide .card-title { margin-top: 12px; padding: 0 18px; font-size: 1.0625rem; }
.card.is-wide .card-sub { padding: 0 18px; }
@media (hover: hover) {
  a.card.is-wide:hover { background: var(--ink-3); }
}
.card.is-wide:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card.is-wide:focus-visible .art-frame { outline: none; }
.art-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14px;
  font-weight: 650; font-size: 1.1rem; line-height: 1.2; text-align: center;
  color: var(--text-dim);
}
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(0 0 0 / 0.5); }
.progress::after { content: ""; display: block; height: 100%; width: var(--pct, 0%); background: var(--text); }
.watched {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgb(17 17 18 / 0.85); color: var(--text);
}
.watched svg { width: 16px; height: 16px; fill: currentColor; }
.card.is-skeleton .art-frame { background: var(--ink-2); }
.card.is-skeleton .card-title { width: 70%; height: 1em; background: var(--ink-2); border-radius: 4px; }
.card.is-skeleton.is-wide .card-title { background: var(--ink-3); }

/* ---- Shelves --------------------------------------------------------------- */

.shelf { margin-top: 40px; }
.shelf-head { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.shelf-head h2 { font-size: var(--step-1); font-weight: 650; }
.shelf-head a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border-radius: 12px; background: var(--ink-2);
  font-size: 0.9375rem; font-weight: 600; text-decoration: none;
}
.shelf-head a:hover { background: var(--ink-3); }
.shelf-nav { margin-left: auto; display: flex; gap: 8px; }
.shelf-nav button {
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: var(--ink-2); cursor: pointer; display: grid; place-items: center;
}
.shelf-nav button:hover { background: var(--ink-3); }
.shelf-nav svg { width: 20px; height: 20px; fill: currentColor; }
.shelf-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--col, 176px);
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  margin: 0 calc(var(--gutter) * -1);
  padding: 14px var(--gutter) 18px;
  scrollbar-width: none;
}
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track > * { scroll-snap-align: start; }
.shelf-track.is-wide { --col: 300px; }
@media (max-width: 600px) {
  .shelf-track { --col: 132px; gap: 12px; }
  .shelf-track.is-wide { --col: 250px; }
  .shelf-nav { display: none; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 28px 18px;
}
.grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 20px 12px; } }

/* ---- Hero (home and detail) ------------------------------------------------- */
/* One big tile: words on the left, the backdrop filling the right. On narrow
   screens the backdrop moves on top (wrap-reverse) and the words go under it. */

.hero {
  display: flex;
  flex-wrap: wrap-reverse;
  margin: calc(var(--header-h) + 8px) var(--gutter) 0;
  border-radius: var(--radius-panel);
  overflow: hidden;
  background: var(--ink-2);
  min-height: min(420px, 62vh);
}
.hero-art { order: 2; flex: 1.5 1 300px; min-width: 0; min-height: 220px; background: var(--ink-3); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.hero > .hero-body, .hero > .detail-grid { flex: 1 1 300px; min-width: 0; padding: clamp(20px, 4vw, 44px); }
.hero > .hero-body { display: flex; flex-direction: column; justify-content: center; max-width: 680px; }
.hero > .notice { margin: 24px; }
.hero .art-frame { background: var(--ink-3); }
/* Translucent, so it stays a step lighter than whatever backdrop is behind it. */
.hero .btn-ghost { background: rgb(255 255 255 / 0.12); }
.hero .btn-ghost:hover { background: rgb(255 255 255 / 0.18); }
.hero-logo { max-width: min(420px, 100%); max-height: 150px; object-fit: contain; object-position: left bottom; margin-bottom: 18px; }
.hero h1 { margin-bottom: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-dim); font-size: 1.0625rem; margin-bottom: 14px; }
.facts .rating { padding: 0 8px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.overview { max-width: 62ch; color: rgb(245 245 247 / 0.86); line-height: 1.6; }
.hero .overview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; align-items: center; }
.resume { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.resume-meter { width: 140px; height: 4px; border-radius: 2px; background: var(--ink-4); overflow: hidden; }
.resume-meter span { display: block; height: 100%; background: var(--text); }

/* Side by side down to ~640px (the car's browser beside its map is ~770px);
   below that the picture stacks on top in 16:9. */
@media (max-width: 680px) {
  .hero-art { min-height: 0; aspect-ratio: 16 / 9; }
}
/* Short screens (the car is ~600px tall): a tighter card so Resume and the
   next row are in view without scrolling. */
@media (max-height: 760px) {
  .hero-logo { max-height: 96px; margin-bottom: 12px; }
  .hero h1 { margin-bottom: 10px; }
  .hero .overview { -webkit-line-clamp: 2; }
  .actions { margin-top: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-body, .hero > .detail-grid { animation: rise 0.5s ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---- Detail page --------------------------------------------------------- */

/* Poster and words fill the card; the backdrop sits faintly behind them
   rather than taking a banner's worth of height (car screens are short). */
.detail .hero { position: relative; isolation: isolate; min-height: 0; }
.detail .hero-art { position: absolute; inset: 0; z-index: -1; min-height: 0; aspect-ratio: auto; background: none; opacity: 0.12; filter: blur(2px); pointer-events: none; }
.detail .hero > .detail-grid, .detail .hero > .hero-body { flex: 1 1 100%; max-width: none; }
.detail-grid { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: start; }
.detail-poster { width: 220px; }
.detail-poster .art-frame { aspect-ratio: 2 / 3; }
.detail-poster.is-wide { width: 320px; }
.detail-poster.is-wide .art-frame { aspect-ratio: 16 / 9; }
.detail-grid:has(.detail-poster.is-wide) { grid-template-columns: 320px 1fr; }
.series-link { display: inline-block; margin-bottom: 8px; color: var(--text-dim); font-weight: 600; text-decoration: none; }
.series-link:hover { color: var(--text); }
/* Car-width screens: a smaller picture so the words and buttons get the room. */
@media (min-width: 761px) and (max-width: 1000px) {
  .detail-grid { grid-template-columns: 160px 1fr; gap: 28px; }
  .detail-poster { width: 160px; }
  .detail-grid:has(.detail-poster.is-wide) { grid-template-columns: 240px 1fr; }
  .detail-poster.is-wide { width: 240px; }
}
@media (max-width: 760px) {
  .detail-grid, .detail-grid:has(.detail-poster.is-wide) { grid-template-columns: 1fr; gap: 20px; }
  .detail-poster { width: 140px; }
  .detail-poster.is-wide { width: 100%; max-width: 360px; }
}

.detail-body { padding: 8px var(--gutter) 64px; }
.detail .hero .overview { display: block; -webkit-line-clamp: unset; max-height: 12lh; overflow-y: auto; }
.detail .hero-logo { max-height: 140px; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; max-width: 70ch; }
.info-list dt { color: var(--text-dim); }
.info-list dd { margin: 0; }

/* Segmented, like the header: one track, the chosen season raised. */
.seasons { display: inline-flex; gap: 4px; flex-wrap: wrap; max-width: 100%; padding: 4px; margin-bottom: 20px; border-radius: var(--radius); background: var(--ink-2); }
.seasons button {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim); font-weight: 600; cursor: pointer;
}
.seasons button:hover { color: var(--text); }
.seasons button[aria-pressed="true"] { background: var(--ink-4); color: var(--text); }

.episodes { display: grid; gap: 4px; max-width: 1100px; }
.episode {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 12px;
  margin: 0 -12px;
  border-radius: var(--radius-card);
  text-decoration: none;
  color: inherit;
}
.episode:hover { background: var(--ink-2); }
.episode .art-frame { aspect-ratio: 16 / 9; }
.episode-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.episode-number { font-weight: 650; font-size: var(--step-2); line-height: 1; color: var(--text-dim); min-width: 2ch; }
.episode-title { font-weight: 650; font-size: var(--step-1); text-decoration: none; }
a.episode-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.episode > a { display: block; border-radius: var(--radius); }
.episode > a:focus-visible .art-frame { outline: 2px solid var(--accent); outline-offset: 3px; }
.episode .overview { font-size: var(--step--1); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) {
  .episode { grid-template-columns: 132px 1fr; gap: 12px; }
  .episode .overview { -webkit-line-clamp: 2; }
}

.cast { --col: 132px; }
.person .art-frame { aspect-ratio: 1; border-radius: 50%; }
.person .art { border-radius: 50%; }

/* ---- Browse controls ---------------------------------------------------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--ink-2); }
.chips button {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim); font-weight: 600; cursor: pointer;
}
.chips button:hover { color: var(--text); }
.chips button[aria-pressed="true"] { background: var(--ink-4); color: var(--text); }
.select-field select {
  height: 52px; padding: 0 16px; border: 0; border-radius: var(--radius);
  background: var(--ink-2);
}
/* A–Z: pinned under the header while the grid scrolls beneath it. On narrow
   screens the letters scroll sideways instead of shrinking below a fingertip. */
.az {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  margin: 0 calc(var(--gutter) * -1) 8px;
  padding: 8px var(--gutter);
  background: var(--ink);
}
.az-track {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--ink-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.az-track::-webkit-scrollbar { display: none; }
.az button {
  flex: 1 0 36px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
}
.az button:hover { color: var(--text); }
.az button[aria-pressed="true"] { background: var(--ink-4); color: var(--text); }
.load-more { display: flex; justify-content: center; padding: 32px 0; }
.result-count { color: var(--text-dim); }

/* ---- Sign in ------------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--ink);
}
.login {
  width: min(400px, 100%);
}
.login .wordmark { display: flex; font-size: clamp(2rem, 8vw, 2.5rem); gap: 14px; margin-bottom: 14px; }
.login-server { color: var(--text-dim); font-size: 1.0625rem; margin-bottom: 32px; }
.login-server strong { color: var(--text); font-weight: 600; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field span { font-weight: 550; font-size: var(--step--1); color: var(--text-dim); }
.field input {
  height: 56px; padding: 0 16px;
  border: 0; border-radius: var(--radius);
  background: var(--ink-2); font-size: 1.0625rem;
}
.field input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 24px; color: var(--text-dim); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.login .btn { width: 100%; justify-content: center; }
.form-error { margin: -8px 0 16px; color: var(--signal); }
.login-foot { margin-top: 28px; color: var(--text-dim); font-size: var(--step--1); }

/* Tesla in-car browser only (html.is-tesla, set by device.js). Its on-screen
   keyboard covers roughly the bottom 45% of the screen and the page is neither
   resized nor scrolled, so the whole form sits in a wide strip across the top,
   with touch-sized fields for typing at arm's length. */
.is-tesla .login-page { place-items: start center; padding: 3vh 4vw 0; }
.is-tesla .login {
  width: min(1240px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  grid-template-areas: "brand form" "foot form";
  column-gap: 56px;
  align-items: start;
}
.is-tesla .login-brand { grid-area: brand; }
.is-tesla #login-form { grid-area: form; }
.is-tesla .login-foot { grid-area: foot; margin-top: 10px; font-size: 1rem; }
.is-tesla .login .wordmark { font-size: clamp(2.25rem, 3.4vw, 2.75rem); margin-bottom: 18px; }
.is-tesla .login-server { margin-bottom: 0; font-size: 1.15rem; }
.is-tesla .login-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.is-tesla .field { margin-bottom: 0; }
.is-tesla .field span { font-size: 1rem; }
.is-tesla .field input { height: 64px; padding: 0 20px; font-size: 1.35rem; }
.is-tesla .form-error { margin: 14px 0 0; font-size: 1.1rem; }
.is-tesla .login-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; }
.is-tesla .check { margin: 0; font-size: 1.1rem; }
.is-tesla .check input { width: 26px; height: 26px; }
.is-tesla .login .btn { width: auto; min-width: 220px; min-height: 64px; font-size: 1.25rem; }
/* Portrait screens (older Model S/X): brand above the form, still all at the top. */
@media (max-width: 1000px) {
  .is-tesla .login { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "form" "foot"; row-gap: 20px; }
  .is-tesla .login-brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 20px; }
  .is-tesla .login .wordmark { font-size: 2.25rem; margin-bottom: 0; }
}

/* ---- YouTube downloads ------------------------------------------------------ */

.youtube { max-width: 1100px; }
.yt-add { display: flex; flex-wrap: wrap; gap: 12px; }
.yt-add input {
  flex: 1 1 320px; min-width: 0; height: 56px; padding: 0 18px;
  border: 0; border-radius: var(--radius); background: var(--ink-2); font-size: 1.0625rem;
}
.yt-add input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.yt-add select { height: 56px; padding: 0 14px; border: 0; border-radius: var(--radius); background: var(--ink-2); }
.yt-status { min-height: 1.5em; margin-top: 10px; color: var(--text-dim); }
.yt-status.error { color: var(--signal); }
.yt-note { margin-bottom: 8px; }
.yt-downloads { display: grid; gap: 8px; margin-top: 12px; }
.yt-download { display: grid; gap: 10px; padding: 14px 18px; border-radius: 14px; background: var(--ink-2); }
.yt-download-text { display: grid; gap: 2px; min-width: 0; }
.yt-download-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-download-status { color: var(--text-dim); font-size: var(--step--1); }
.yt-download[data-status="error"] .yt-download-status { color: var(--signal); }
.yt-download[data-status="done"] .yt-download-status { color: var(--text); }
.yt-meter { height: 4px; border-radius: 2px; background: var(--ink-4); overflow: hidden; }
.yt-meter span { display: block; height: 100%; background: var(--text); transition: width 0.4s; }

/* ---- Guest join page --------------------------------------------------------- */

.join-page { min-height: 100vh; background: var(--ink); }
.join { width: min(560px, 100%); margin: 0 auto; padding: 24px 16px 48px; }
.join .wordmark { margin: 0 0 24px; }
.join-form { display: grid; gap: 12px; padding: 24px; border-radius: var(--radius-panel); background: var(--ink-2); }
.join-form h1 { font-size: var(--step-2); }
.join-form input { height: 56px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--ink-3); font-size: 1.0625rem; }
.join-form input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.join-form .form-error { margin: 0; }
.join-head p { font-size: var(--step-1); font-weight: 650; }
.join .muted { margin: 4px 0 16px; }
.join .actions { justify-content: center; }
.join-note { text-align: center; }
.join-pick { margin-top: 16px; display: grid; gap: 12px; }
.join-pick h2 { font-size: var(--step-1); }
.join-pick h3 { margin: 4px 0 8px; font-size: var(--step-0); color: var(--text-dim); }
.join-pick input { height: 52px; padding: 0 16px; border: 0; border-radius: var(--radius); background: var(--ink-3); font-size: 1.0625rem; }
.join-pick input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.join-results, .join-episodes { display: grid; gap: 4px; }
.join-option { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.join-option:hover { background: var(--ink-3); }
.join-back { justify-self: start; min-height: 44px; }
.join-seasons { flex-wrap: wrap; width: fit-content; max-width: 100%; margin-bottom: 8px; }

/* ---- AnyFin Remote --------------------------------------------------------- */

.play-on { position: relative; }
.play-on .menu { left: 0; right: auto; z-index: 15; }
/* In the top layer (popover): placed by play-on.js next to its button. */
.play-on-menu[popover] { position: fixed; inset: auto; margin: 0; border: 0; color: inherit; }

.remote-page .page-head { margin-bottom: 16px; }
.remote { max-width: 760px; }
.remote-screens { flex-wrap: wrap; width: fit-content; max-width: 100%; margin-bottom: 16px; }
.remote-card { padding: clamp(20px, 4vw, 32px); border-radius: var(--radius-panel); background: var(--ink-2); }
.remote-card.is-idle h2 { font-size: var(--step-1); margin-bottom: 8px; }
.remote-now { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.remote-art { flex: none; width: auto; max-width: 40%; height: 120px; border-radius: 12px; object-fit: cover; background: var(--ink-3); }
.remote-titles { min-width: 0; display: grid; gap: 4px; }
.remote-titles h2 { font-size: var(--step-2); line-height: 1.15; }
.remote-status { color: var(--text-dim); }
.remote-progress { margin-bottom: 20px; }
.remote-seek { width: 100%; height: 28px; margin: 0; }
.remote-times { display: flex; justify-content: space-between; color: var(--text-dim); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.remote-transport { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 6vw, 40px); margin-bottom: 24px; }
.remote-skip, .remote-play {
  display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  font-weight: 650; font-size: 1.125rem;
}
.remote-skip { width: 68px; height: 68px; background: var(--ink-4); }
.remote-skip:hover { background: #46464a; }
.remote-play { width: 92px; height: 92px; background: var(--accent); color: var(--accent-ink); }
.remote-play:hover { background: var(--accent-hover); }
.remote-play svg { width: 40px; height: 40px; fill: currentColor; }
.remote-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.remote-options:empty { display: none; }
.remote-select { display: grid; gap: 6px; }
.remote-select span { color: var(--text-dim); font-size: var(--step--1); font-weight: 550; }
.remote-select select { height: 52px; padding: 0 14px; border: 0; border-radius: var(--radius); background: var(--ink-4); }
.remote-card .actions { margin-top: 0; }
.remote-flash { max-width: 760px; margin-bottom: 12px; padding: 14px 18px; border-radius: var(--radius); background: var(--ink-3); }
@media (max-width: 600px) {
  .remote-now { flex-direction: column; align-items: flex-start; }
  .remote-art { max-width: 100%; height: 160px; }
}

/* ---- Player -------------------------------------------------------------- */

.player-page { background: #000; overflow: hidden; }

.stage {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  user-select: none;
}
.stage.idle { cursor: none; }

#screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* canvas is a replaced element, so this letterboxes it */
}

.subtitles {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 12%;
  text-align: center;
  pointer-events: none;
  transition: bottom 0.2s;
}
.stage:not(.idle) .subtitles { bottom: calc(12% + 56px); }
.subtitles p {
  display: inline-block;
  margin: 2px 0;
  padding: 2px 10px;
  background: rgb(0 0 0 / 0.6);
  border-radius: 4px;
  font-size: clamp(16px, 2.6vw, 34px);
  line-height: 1.3;
  white-space: pre-line;
  text-shadow: 0 1px 2px #000;
}
.subtitles p + p { display: block; width: fit-content; margin-inline: auto; }

.topbar, .controls {
  position: absolute;
  left: 0;
  right: 0;
  padding: 16px 20px;
  transition: opacity 0.25s;
}
.stage.idle .topbar, .stage.idle .controls { opacity: 0; pointer-events: none; }

.topbar {
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(rgb(0 0 0 / 0.7), transparent);
}
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: #fff; text-decoration: none; background: rgb(255 255 255 / 0.1);
}
.back:hover { background: rgb(255 255 255 / 0.2); }
.back svg { width: 22px; height: 22px; fill: currentColor; }
.titles h1 { margin: 0; font-weight: 650; font-size: 1.35rem; line-height: 1.15; }
.titles p { margin: 2px 0 0; font-size: 0.85rem; color: #bbb; }

.controls {
  bottom: 0;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.8));
  padding-top: 40px;
}
.control-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.time { font-variant-numeric: tabular-nums; font-size: 0.9rem; margin-left: 4px; white-space: nowrap; }

.controls button {
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.1);
  cursor: pointer;
  font-size: 0.85rem;
}
.controls button:hover { background: rgb(255 255 255 / 0.2); }
.controls button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.controls svg { width: 22px; height: 22px; fill: currentColor; display: block; margin: auto; }
#play .icon-pause, #play.is-playing .icon-play { display: none; }
#play.is-playing .icon-pause { display: block; }

.select { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #bbb; }
.select select {
  max-width: 180px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgb(255 255 255 / 0.2);
  background: rgb(0 0 0 / 0.6);
  color: #fff;
}
.volume { width: 90px; accent-color: var(--accent); }

.seek {
  --played: 0%;
  --buffered: 0%;
  width: 100%;
  height: 18px;
  margin: 0 0 6px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--played), rgb(255 255 255 / 0.4) var(--played) var(--buffered), rgb(255 255 255 / 0.2) var(--buffered));
}
.seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--played), rgb(255 255 255 / 0.4) var(--played) var(--buffered), rgb(255 255 255 / 0.2) var(--buffered));
}
.seek::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border: 4px solid rgb(255 255 255 / 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  cursor: pointer;
  /* Centre by layout, not nudges: an inline SVG sits on a text baseline, which
     browsers place differently. The play path is drawn so its centroid is the
     middle of its 24x24 box, which is the optical centre of a triangle. */
  display: grid;
  place-items: center;
  padding: 0;
}
.big-play svg { display: block; width: 44px; height: 44px; fill: currentColor; }
.big-play:hover { background: var(--accent); color: #fff; }

.message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
  padding: 20px 24px;
  border-radius: 16px;
  background: rgb(31 31 33 / 0.95);
  text-align: center;
}
.message p { margin: 0 0 12px; }
.message a { color: var(--text); margin-left: 12px; }
.message button, .toast button {
  padding: 6px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 16px;
  border-radius: 12px;
  background: rgb(31 31 33 / 0.95);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Up next, at the end of an episode. */
.up-next {
  position: absolute;
  right: 24px;
  bottom: 120px;
  width: min(360px, calc(100% - 48px));
  padding: 14px;
  border-radius: 16px;
  background: rgb(31 31 33 / 0.95);
  box-shadow: 0 0 0 1px var(--line);
}
.up-next .art-frame { aspect-ratio: 16 / 9; margin-bottom: 12px; }
.up-next p { color: #bbb; font-size: 0.8rem; }
.up-next h2 { font-size: 1.05rem; font-weight: 650; margin: 2px 0 12px; }
.up-next .actions { margin: 0; }
.up-next .btn { min-height: 38px; padding: 0 14px; font-size: 0.9rem; }

/* ---- Party: invite panel and reactions ---------------------------------------- */

#invite-toggle.has-guests { background: var(--accent); color: #fff; }
#invite-toggle[aria-expanded="true"] { background: var(--ink-4); }
.invite-panel {
  position: absolute;
  right: 16px;
  bottom: 104px;
  width: min(340px, calc(100% - 32px));
  max-height: calc(100% - 140px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 16px;
  background: rgb(31 31 33 / 0.95);
  backdrop-filter: blur(10px);
  text-align: center;
}
.invite-panel h2 { margin: 0 0 12px; font-size: 1.1rem; }
.invite-panel p { margin: 10px 0 0; color: #ccc; font-size: 0.9rem; line-height: 1.4; }
/* White with a quiet zone: phone cameras need the contrast to lock on. */
.invite-qr { width: min(220px, 38vh); height: auto; margin: 0 auto; padding: 8px; border-radius: 12px; background: #fff; }
.invite-panel .check { justify-content: center; margin: 12px 0 0; color: #ddd; }
.invite-guests { color: var(--text) !important; font-weight: 600; }
.invite-panel .actions { justify-content: center; margin-top: 14px; }
.invite-panel .btn { min-height: 44px; padding: 0 18px; font-size: 0.95rem; }
/* Short screens (the car is ~600px tall): everything, buttons included, in view. */
@media (max-height: 700px) {
  .invite-panel { padding: 14px; bottom: 96px; max-height: calc(100% - 120px); }
  .invite-panel h2 { margin-bottom: 8px; }
  .invite-qr { width: min(170px, 29vh); padding: 6px; }
  .invite-panel p { margin-top: 8px; font-size: 0.82rem; }
  .invite-panel .check { margin-top: 8px; }
  .invite-panel .actions { margin-top: 10px; }
}

.reactions { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; } /* above the controls; taps pass through */
.reaction {
  position: absolute;
  bottom: 24%;
  display: grid;
  justify-items: center;
  gap: 4px;
  animation: float-up 3.2s ease-out forwards;
}
.reaction-emoji { font-size: clamp(40px, 6vw, 76px); line-height: 1; filter: drop-shadow(0 4px 12px rgb(0 0 0 / 0.5)); }
.reaction-name { padding: 2px 10px; border-radius: 999px; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
@keyframes float-up {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  12% { transform: translateY(-4vh) scale(1.08); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-55vh) scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .reaction { animation: fade-out 3s forwards; }
}
@keyframes fade-out { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* Reaction buttons on phones (Remote and guest pages). */
.reaction-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 20px; }
.reaction-bar button {
  width: 56px; height: 56px; border: 0; border-radius: 16px;
  background: var(--ink-4); font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.reaction-bar button:hover { background: #46464a; }
.reaction-bar button:active { transform: scale(0.92); }

.hud {
  position: absolute;
  top: 76px;
  right: 16px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgb(0 0 0 / 0.75);
  font: 12px/1.5 ui-monospace, 'SF Mono', Menlo, monospace;
  pointer-events: none;
}

@media (max-width: 700px) {
  .topbar, .controls { padding-left: 16px; padding-right: 16px; }
  .select span, #back10, #fwd30, .volume { display: none; }
  .select select { max-width: 110px; }
  .hud { left: 16px; right: 16px; top: 64px; font-size: 10px; white-space: pre-wrap; }
  .up-next { right: 16px; left: 16px; width: auto; bottom: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- Live TV ------------------------------------------------------------- */

.live-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
}
.live-watch { position: sticky; top: calc(var(--header-h) + 16px); min-width: 0; }
.live-stage {
  position: relative;
  inset: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
}
.live-stage:fullscreen { aspect-ratio: auto; border-radius: 0; }
.live-stage .controls { padding: 32px 12px 12px; }
.live-stage .hud { top: 12px; right: 12px; }
.live-stage:not([data-state="playing"]) .controls,
.live-stage[data-state="idle"] .controls { opacity: 1; }
.live-stage[data-state="idle"] .controls :is(button, input) { visibility: hidden; }
.live-badge {
  margin-left: 4px; padding: 3px 8px; border-radius: 6px;
  background: var(--signal); color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.live-stage[data-state="idle"] .live-badge { visibility: hidden; }

.live-now { display: flex; align-items: center; gap: 14px; padding: 14px 4px 0; }
.live-now-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; background: #48484d; padding: 6px; }
.live-now h1 { margin: 0; font-size: var(--step-1); font-weight: 650; line-height: 1.2; }
.live-now p { margin: 2px 0 0; }

.live-guide { min-width: 0; }
.live-filters { display: grid; gap: 10px; margin-bottom: 12px; }
.live-filters .chips { overflow-x: auto; }
.live-filters .chips button { flex: 0 0 auto; padding: 0 14px; }
.live-filters select { width: 100%; }
.live-search {
  width: 100%; height: 52px; padding: 0 16px; border: 0; border-radius: var(--radius);
  background: var(--ink-2); color: var(--text); font: inherit;
}
.live-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-empty { padding: 16px 4px; }

.channel-list {
  display: grid; gap: 6px;
  max-height: calc(100vh - var(--header-h) - 160px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.channel-row {
  display: grid; grid-template-columns: 48px 44px minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 64px; padding: 8px 12px 8px 8px; border: 0; border-radius: var(--radius);
  background: var(--ink-2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.channel-row:hover { background: var(--ink-3); }
.channel-row[aria-current="true"] { background: var(--ink-4); box-shadow: inset 3px 0 0 var(--accent); }
.channel-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Mid-grey: IPTV logos come both dark-on-clear and light-on-clear. */
.channel-logo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: #48484d; overflow: hidden; }
.channel-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.channel-initial { font-weight: 700; color: var(--text-dim); }
.channel-number { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: var(--step--1); text-align: right; }
.channel-text { display: grid; gap: 2px; min-width: 0; }
.channel-name, .channel-show { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-name { font-weight: 600; }
.channel-show { color: var(--text-dim); font-size: var(--step--1); }
.channel-progress {
  --done: 0%;
  height: 3px; margin-top: 4px; border-radius: 2px;
  background: linear-gradient(to right, #fff var(--done), rgb(255 255 255 / 0.15) var(--done));
}

/* The car's browser (≈773×601): a narrower list beside the picture. */
@media (max-width: 1000px) {
  .live-page { grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; }
  .channel-row { grid-template-columns: 40px minmax(0, 1fr); min-height: 56px; }
  .channel-logo { width: 40px; height: 40px; }
  .channel-number { display: none; }
  .live-now { padding-top: 10px; }
  .live-now-logo { width: 44px; height: 44px; }
}
@media (max-width: 1000px) and (max-height: 700px) {
  .live-page { padding-bottom: 16px; }
  .live-filters .live-search { height: 44px; }
  .channel-list { max-height: calc(100vh - var(--header-h) - 130px); }
}
@media (max-width: 700px) {
  .live-page { grid-template-columns: 1fr; }
  .live-watch { position: static; }
  .live-stage .volume { display: none; }
  .channel-list { max-height: none; overflow: visible; }
}
