/*
 * Geist, shipped with the app rather than fetched from Google. Fetching it
 * meant every visit told Google about this server, and the page fell back to
 * a system font with no internet. Variable fonts: one file covers every
 * weight. SIL Open Font License — see fonts/OFL.txt.
 */
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin.woff2) format('woff2');
  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: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin-ext.woff2) format('woff2');
  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;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-mono-latin.woff2) format('woff2');
  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: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-mono-latin-ext.woff2) format('woff2');
  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;
}

/*
 * Couchbreak, in the theme of Gerard's website (C:\dev\playdeck).
 *
 * Same language as that site: warm stone surfaces rather than cool
 * grey, amber as the single accent, and depth built two different ways —
 * light mode leans on layered stone-tinted shadows, dark mode on
 * progressively lighter surfaces plus a hairline top highlight, because
 * shadows are effectively invisible on near-black.
 */

:root {
  color-scheme: light;

  /*
   * Warm paper rather than white. Pure white cards on a near-white page
   * glared, especially in a dim room; these keep the same steps between
   * page, card and inset, a few shades down and warmer.
   */
  --canvas: #e8e4de;
  --surface: #f5f2ed;
  /* A step off the cards, as in dark mode — loading posters and list rows
     were otherwise invisible boxes on the same colour. */
  --surface-2: #ede9e3;
  --hairline: rgb(28 25 23 / 0.10);

  --elev-1: 0 1px 2px -1px rgb(28 25 23 / 0.10), 0 2px 8px -3px rgb(28 25 23 / 0.10);
  --elev-2: 0 2px 4px -2px rgb(28 25 23 / 0.10), 0 10px 22px -6px rgb(28 25 23 / 0.14);
  --elev-3: 0 4px 8px -4px rgb(28 25 23 / 0.10), 0 24px 48px -12px rgb(28 25 23 / 0.20);

  /* Ambient wash that keeps large empty areas from reading as dead grey. */
  /* Half as strong as it was: on paper it read as a stain. */
  --ambient:
    radial-gradient(60rem 40rem at 15% -10%, rgb(180 130 40 / 0.05), transparent 60%),
    radial-gradient(50rem 36rem at 100% 0%, rgb(200 150 60 / 0.04), transparent 55%);

  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;

  /*
   * "Projector": one warm gold, slightly deeper and less yellow than the old
   * amber, kept for three jobs only — the one primary button on a screen,
   * progress, and what is playing or chosen right now. Everything else is
   * the stone greys. (The amber-* names stay, pointed at the new gold, so
   * the music and setup sheets follow.)
   */
  --amber-300: #f7cb85;
  --amber-400: #f4b860;
  --amber-500: #e9a23b;
  --amber-600: #d18a26;
  --amber-700: #a86a17;
  --amber-800: #7c4a0e;

  --accent: #e9a23b;
  --accent-hover: #d8922c;
  --on-accent: #1c1917;
  --accent-wash: rgb(233 162 59 / 0.14);
  --accent-line: rgb(233 162 59 / 0.45);
  /* Green, kept for good news only (online, ready,
     in step, how far you have watched). Gold stays for what you press. */
  --good: #6a8c4b;
  --good-text: #4a6630;

  /* Chosen tabs and segments: light on dark, reversed here on paper. */
  --select-bg: #1c1917;
  --select-fg: #f5f2ed;

  /* Body text a touch softer than headings: near-black on paper is harsh too. */
  --text: var(--stone-800);
  --text-strong: var(--stone-900);
  --muted: var(--stone-600);
  --faint: var(--stone-500);
  --hover-wash: #e4dfd8;
  --accent-text: var(--amber-800);
  --danger: #b91c1c;

  /* One type scale (Geist), body at 15. */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 30px;
  --fs-3xl: 44px;

  /* One set of corners. */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --ease-editorial: cubic-bezier(0.2, 0.8, 0.2, 1);
  --poster: 2 / 3;
}

html.dark {
  color-scheme: dark;

  --canvas: #12100e;
  --surface: #191714;
  --surface-2: #201e1b;
  --hairline: rgb(255 255 255 / 0.08);

  /* Inset highlight simulates light from above; the shadow grounds the card. */
  --elev-1: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.7),
    0 2px 8px -3px rgb(0 0 0 / 0.5);
  --elev-2: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.7),
    0 12px 26px -8px rgb(0 0 0 / 0.6);
  --elev-3: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 4px 8px -4px rgb(0 0 0 / 0.7),
    0 28px 56px -14px rgb(0 0 0 / 0.75);

  --ambient:
    radial-gradient(70rem 42rem at 16% -12%, rgb(196 138 42 / 0.17), transparent 62%),
    radial-gradient(56rem 36rem at 100% -6%, rgb(214 160 70 / 0.09), transparent 58%),
    radial-gradient(120rem 80rem at 50% 30%, transparent 55%, rgb(0 0 0 / 0.40) 100%);

  --text: #fafaf9;
  --text-strong: #fafaf9;
  --muted: var(--stone-400);
  --faint: var(--stone-500);
  --hover-wash: var(--stone-800);
  --accent-text: #f4b860;
  --accent-hover: #f4b860;
  --good: #9cbf7a;
  --good-text: #b8d49a;
  --select-bg: #f5f2ed;
  --select-fg: #1c1917;
  --danger: #f87171;
}

/*
 * Switching themes: every colour changes in the same instant. Each control
 * eased its own colours at its own speed, so for a moment the search box
 * and tabs were black on a page already light (see the theme button).
 */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: none !important;
}

* { box-sizing: border-box; }

/* Room for the scrollbar always kept, so the page is the same width whether
   a library is long enough to scroll or not: switching from Films to a short
   library moved the search and the menu over by the scrollbar's width. */
html { scrollbar-gutter: stable; }

html, body {
  margin: 0;
  /* The full-width glow above is 100vw, which counts the scrollbar too. */
  overflow-x: clip;
  background: var(--canvas);
  color: var(--text);
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Fixed so the wash stays put while content scrolls past it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--ambient);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; color: var(--text-strong); }
h2 { font-size: var(--fs-lg); margin: 0 0 14px; }
/* Headings inside windows: the same plain sentence case as on the page,
   a step smaller. (They were small grey capitals.) */
h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
  margin: 28px 0 10px;
}
/* A count beside a heading: "All films (2)", the number quiet. */
.head-count { color: var(--muted); font-weight: 500; }
/* Paragraphs in windows stop at a comfortable line. */
.modal-card p, .setup-body p { max-width: 65ch; }
code {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: var(--fs-sm); margin: 10px 0 0; }
[hidden] { display: none !important; }

/* One easing curve for the whole product. */
a, button, input, select {
  transition-property: color, background-color, border-color, box-shadow, transform, opacity;
  transition-duration: 180ms;
  transition-timing-function: var(--ease-editorial);
}

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

button, .ghost-select {
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 500;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--elev-1);
}
button:hover:not(:disabled), .ghost-select:hover { background: var(--hover-wash); }
button:active:not(:disabled) { transform: scale(0.96); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }

button.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
button.ghost:hover:not(:disabled) { background: var(--hover-wash); color: var(--text); }
button.danger { color: var(--muted); }
button.danger:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
button.danger.confirm { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
button.icon-only { padding: 8px; }
button svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

input, .ghost-select {
  font: inherit;
  font-size: var(--fs-md);
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  box-shadow: var(--elev-1);
}
input::placeholder { color: var(--faint); }

/* Keyboard focus only: the default rectangle looks broken on rounded cards. */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--text-strong);
  outline-offset: 2px;
}

::selection { background: rgb(244 184 96 / 0.4); }

* { scrollbar-width: thin; scrollbar-color: var(--stone-300) transparent; }
html.dark * { scrollbar-color: var(--stone-700) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--stone-300);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
html.dark ::-webkit-scrollbar-thumb { background-color: var(--stone-700); }

/* --- sign in ------------------------------------------------------------ */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 32px;
  display: grid;
  gap: 12px;
  box-shadow: var(--elev-3);
}
.gate-note { color: var(--muted); margin: 0 0 6px; font-size: var(--fs-md); }
.gate-card button { justify-content: center; margin-top: 4px; }

.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.025em;
  color: var(--text-strong);
}
/* The Couchbreak mark: the couch, with a pause mark on its backrest. */
.logo-mark {
  width: 30px; height: 30px; flex: none;
  background: url(logo.svg) center / contain no-repeat;
}
/*
 * On the sign-in card the brand leads: bigger, with a soft glow. Exactly
 * the logo above scaled up (couch, lettering and gap alike), so the opening
 * logo, which only scales, lands on it without the lettering jumping.
 */
.gate-card .logo { --k: calc(52 / 30); font-size: calc(var(--fs-lg) * var(--k)); gap: calc(10px * var(--k)); margin-bottom: 6px; }
.gate-card .logo-mark {
  width: 52px; height: 52px;
  filter: drop-shadow(0 8px 18px rgb(233 162 59 / 0.32));
}

/*
 * The opening (app.js, intro), as on the TV: the logo large in the middle
 * while the app loads, then it arcs to its place on the first screen and
 * the page shows around it. Across and up move as two layers with their own
 * timing, up leading, so it rises and then sweeps over; the logo itself only
 * shrinks. Without the flight for anyone who asks for less motion.
 */
.intro {
  position: fixed; inset: 0; z-index: 1000;
  background-color: var(--canvas);
  transition: background-color 450ms ease;
}
.intro.fading { background-color: transparent; }
.intro-x {
  position: absolute; left: 50%; top: 50%;
  transition: transform 1000ms cubic-bezier(0.7, 0, 0.3, 1);
}
.intro-y {
  position: absolute; left: 0; top: 0;
  transition: transform 1000ms cubic-bezier(0.15, 0.55, 0.3, 1);
}
.intro-logo {
  position: absolute; left: 0; top: 0; margin: 0; white-space: nowrap;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) scale(2.4);
  transition: transform 1000ms cubic-bezier(0.5, 0, 0.25, 1), opacity 300ms ease;
  animation: intro-in 600ms ease-out backwards; /* not "both": a held end state would override .landed */
}
.intro-logo.landed { opacity: 0; }
@keyframes intro-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .intro-x, .intro-y, .intro-logo { transition: opacity 300ms ease; animation: none; }
}

/* --- top bar ------------------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(24px);
}
/*
 * The header on a computer: one set of sizes for the bar, the logo, the
 * libraries and the two circles, a step larger on a big monitor. The logo's
 * couch, lettering and gap scale together (--bar-k), so the opening logo,
 * which only scales, still lands on it exactly (introFly, app.js).
 */
@media (min-width: 641px) {
  :root { --bar-h: 72px; --bar-k: calc(35 / 30); --tab-fs: 15.5px; --tab-icon: 20px; --circle: 44px; }
  .topbar { height: var(--bar-h); }
  .topbar .logo { font-size: calc(var(--fs-lg) * var(--bar-k)); gap: calc(10px * var(--bar-k)); }
  .topbar .logo-mark { width: calc(30px * var(--bar-k)); height: calc(30px * var(--bar-k)); }
}
@media (min-width: 1880px) {
  :root { --bar-h: 80px; --bar-k: calc(40 / 30); --tab-fs: 17px; --tab-icon: 22px; --circle: 48px; }
}
/* The logo, the search in the middle of the window, Add videos and the menu. */
/* Both sides as wide as the wider of the two (--side, set by app.js), so the
   search sits in the middle of the window, right over the library tabs. */
.topbar { display: grid; grid-template-columns: minmax(var(--side, max-content), 1fr) minmax(0, 520px) minmax(var(--side, max-content), 1fr); }
.topbar .logo { justify-self: start; }
.topbar #search { grid-column: 2; width: 100%; max-width: none; margin: 0; }
.topbar-end { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 12px; }

/*
 * The libraries on a computer: a row under the top bar that stays there as
 * the page scrolls, centred, each a small icon and its name (the counts are
 * on the shelves below). A phone has them along the foot (further down).
 */
@media (min-width: 641px) {
  #library-tabs.library-tabs {
    position: sticky; top: var(--bar-h, 64px); z-index: 19;
    flex-wrap: nowrap; justify-content: center; gap: 6px;
    margin: 0; padding: 10px 24px;
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
  }
  /* One header, not two strips: the top bar and the tabs share one panel, with
     no line between them; the line under the tabs shows only once the page
     has scrolled beneath them (body.scrolled, app.js). */
  #app:has(#library-tabs:not([hidden])) .topbar { border-bottom-color: transparent; }
  /* One frosted panel behind both: the tabs' panel reaches up behind the top
     bar, which then has none of its own (two panels met in a faint seam). */
  #app:has(#library-tabs:not([hidden])) .topbar { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #library-tabs.library-tabs:not([hidden]) { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #library-tabs.library-tabs::before {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; top: calc(-1 * var(--bar-h, 64px)); z-index: -1;
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    /* At the top of the page nothing is behind the header: no panel at all, so
       the header sits on the page itself; it fades in once the page scrolls. */
    opacity: 0; transition: opacity 200ms ease;
  }
  body.scrolled #library-tabs.library-tabs::before { opacity: 1; }
  /* The banner area's line of light along its top read as a second break right under the tabs. */
  #app:has(#library-tabs:not([hidden])) main > .continue-band::after { display: none; }
  body.scrolled #library-tabs.library-tabs { border-bottom-color: var(--hairline); }
  #library-tabs.library-tabs { padding-top: 4px; padding-bottom: 10px; }
  /* One capsule holding every library, the chosen one lifted out in a light
     pill with its icon in amber; the same glass as the search above it. */
  #library-tabs .tab-group {
    display: flex; gap: 2px; padding: 4px; border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--text) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  }
  #library-tabs button.library-tab, #library-tabs button.library-tab:hover:not(:disabled) {
    align-items: center; gap: 9px; padding: 7px 18px; border: 0; background: transparent;
    color: color-mix(in srgb, var(--text) 78%, transparent); font-size: var(--tab-fs); font-weight: 500;
    transition: background 160ms ease, color 160ms ease;
  }
  #library-tabs button.library-tab:hover:not(:disabled):not([aria-selected="true"]) {
    background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text);
  }
  /* The same weight as the others: bold made the chosen name wider, and the
     names beside it shifted each time the choice moved. The pill says it. */
  #library-tabs button.library-tab[aria-selected="true"], #library-tabs button.library-tab[aria-selected="true"]:hover:not(:disabled) {
    background: var(--select-bg); color: var(--select-fg); font-weight: 500;
  }
  #library-tabs .count { font-size: var(--fs-xs); font-weight: 500; color: color-mix(in srgb, var(--text) 45%, transparent); font-variant-numeric: tabular-nums; }
  #library-tabs .library-tab[aria-selected="true"] .count { color: color-mix(in srgb, var(--select-fg) 55%, transparent); }
  #library-tabs .tab-icon { display: block; width: var(--tab-icon); height: var(--tab-icon); flex: none; }
  #library-tabs .tab-icon svg { display: block; width: var(--tab-icon); height: var(--tab-icon); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  #library-tabs .library-tab[aria-selected="true"] .tab-icon { color: var(--amber-600, #d97706); }
  #library-tabs .library-tab[aria-selected="true"] .tab-icon svg { stroke-width: 2; }
  /*
   * The right of the bar: two matching circles. Search is a round magnifier
   * that opens leftwards into a field when clicked (or while it holds words),
   * over the bar rather than pushing anything along; the menu is the round
   * amber initial of whoever is signed in. Add videos is in that menu.
   */
  .topbar-end { padding-left: calc(var(--circle) + 8px); gap: 8px; }
  .topbar #search {
    position: absolute; top: calc((var(--bar-h) - var(--circle)) / 2); right: calc(24px + var(--circle) + 8px); z-index: 2;
    width: var(--circle); height: var(--circle); margin: 0; padding: 0 0 0 var(--circle); border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--surface) 70%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M20 20l-4.2-4.2'/%3E%3C/svg%3E") no-repeat calc((var(--circle) - 20px) / 2) center / 20px;
    border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    color: var(--text); cursor: pointer;
    transition: width 220ms var(--ease-editorial), background-color 160ms ease;
  }
  .topbar #search:hover { background-color: color-mix(in srgb, var(--text) 10%, var(--surface)); }
  .topbar #search::placeholder { color: transparent; }
  .topbar #search::-webkit-search-cancel-button { display: none; }
  .topbar #search:focus, .topbar #search:not(:placeholder-shown) {
    width: 340px; cursor: text;
    background-color: var(--surface); padding-right: 14px;
  }
  .topbar #search:focus::placeholder { color: var(--muted); }
  .topbar #btn-upload { display: none; }
  button.menu-button {
    width: var(--circle); height: var(--circle); padding: 0; justify-content: center; border-radius: 50%;
    background: var(--amber-500); color: #2a1a05;
  }
  button.menu-button:hover:not(:disabled) { background: var(--amber-400); }
  button.menu-button > svg, button.menu-button .menu-name, button.menu-button .menu-chevron { display: none; }
  .menu-initial { font-size: calc(var(--circle) * 0.4); font-weight: 700; line-height: 1; }

  /* The libraries in the bar itself, when they fit (body.tabs-in-bar, app.js):
     the row under the bar folds away and the bar is the whole header. */
  /* While searching, the bar (and its open field) comes in front of them. */
  .topbar:focus-within { z-index: 22; }
  body.tabs-in-bar #library-tabs.library-tabs:not([hidden]) {
    position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h, 64px); z-index: 21;
    display: flex; align-items: center; justify-content: center;
    padding: 0; border: 0; pointer-events: none;
  }
  body.tabs-in-bar #library-tabs.library-tabs::before { display: none; }
  body.tabs-in-bar #library-tabs .tab-group { pointer-events: auto; }
  body.tabs-in-bar.scrolled #app:has(#library-tabs) .topbar {
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    border-bottom-color: var(--hairline);
  }
}
/* A phone keeps Add videos in its bar, so not in the menu as well. */
@media (max-width: 640px) {
  #btn-upload-menu { display: none; }
  .menu-initial { display: none; }
}
/* Search, Add and one menu: the rest (Folders, Status, TV, Away, the
   account, light or dark, Sign out) is in the menu, each with its name. */
#btn-upload { white-space: nowrap; }
button.menu-button { position: relative; gap: 8px; padding-inline: 10px 8px; color: var(--text); }
button.menu-button svg { width: 20px; height: 20px; }
button.menu-button .menu-chevron { width: 14px; height: 14px; color: var(--muted); transition: transform 160ms; }
.topbar.menu-open .menu-chevron { transform: rotate(180deg); }
.menu-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.topbar-actions {
  display: none; position: absolute; top: calc(100% + 6px); right: 16px; z-index: 30;
  flex-direction: column; align-items: stretch; gap: 2px;
  min-width: 240px; padding: 6px;
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--elev-3);
  animation: card-in 140ms var(--ease-editorial);
}
.topbar.menu-open .topbar-actions { display: flex; }
.topbar-actions button {
  justify-content: flex-start; gap: 12px; width: 100%; white-space: nowrap;
  padding: 10px 12px; color: var(--text); box-shadow: none;
}
.topbar-actions button[hidden] { display: none; }
.topbar-actions hr { border: 0; border-top: 1px solid var(--hairline); margin: 4px 6px; }
.topbar-actions .menu-note { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); max-width: 8rem; overflow: hidden; text-overflow: ellipsis; }
/* The count of who is watching: in the menu by Status, and on the menu
   button's corner (not over a word) while it is closed. */
.topbar-actions .nav-badge { position: static; margin-left: auto; box-shadow: none; }
#btn-menu .nav-badge { top: -4px; right: -4px; }

main { padding: 28px 24px 8px; max-width: 1600px; margin: 0 auto; }
main section { margin-bottom: 44px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head .ghost-select { padding: 6px 10px; font-size: var(--fs-sm); }
.section-head h2 { margin-right: auto; }

/* --- libraries ---------------------------------------------------------- */

.library-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
/* The capsule around the libraries is for a computer (above); elsewhere its tabs lay out as if it were not there. */
.library-tabs .tab-group { display: contents; }
.library-tab {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 8px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--surface-2);
  color: var(--text); font-size: var(--fs-md); font-weight: 600; cursor: pointer;
  box-shadow: none;
}
.library-tab .count { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
button.library-tab:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
/* Chosen, here and in every segmented control (Status, History, the music
   filter, a show's seasons): one look. */
button.library-tab[aria-selected="true"], button.library-tab[aria-selected="true"]:hover:not(:disabled),
.segmented button.on, .segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] {
  background: var(--select-bg); border-color: transparent; color: var(--select-fg);
}
.library-tab[aria-selected="true"] .count { color: color-mix(in srgb, var(--select-fg) 62%, transparent); }

/* Home videos: wide pictures, grouped by the month they were filmed. */
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.wide .card-art { aspect-ratio: 16 / 9; }
.grid-heading {
  grid-column: 1 / -1; margin: 14px 0 -14px; font-size: var(--fs-md); font-weight: 600;
  color: var(--muted); letter-spacing: 0.01em;
}
.grid-heading:first-child { margin-top: 0; }

/* A basis of its own, so on a phone Edit and Delete wrap under the
   description instead of squeezing it to a word a line. */
.library-row { flex: 1 1 220px; min-width: 0; }
.library-row .folder-meta { margin-top: 2px; }
.library-edit {
  display: grid; gap: 10px; width: 100%; padding-top: 10px; margin-top: 10px;
  border-top: 1px solid var(--hairline);
}
.library-edit .rename { margin: 0; }
.library-people { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* Storage: one row per drive, a bar of your videos, everything else, free. */
.storage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* Add videos: pick a library (or make one) before choosing files. */
.add-card { width: min(520px, 100%); }
.add-library-list { display: grid; gap: 8px; margin: 10px 0 12px; }
.add-option {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 11px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.add-option:hover { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.add-option input { accent-color: var(--accent); margin: 0; }
.add-option .name { font-weight: 600; }
.add-option .info { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.add-option:has(input:checked) { border-color: var(--text-strong); }
#add-new-library { margin: 0 0 12px; }
.add-actions { display: flex; gap: 8px; margin-top: 6px; }
.storage-list li {
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.storage-head { display: flex; align-items: baseline; gap: 10px; font-size: var(--fs-md); }
.storage-head strong { font-size: var(--fs-md); }
.storage-head .tag {
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted); border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 1px 8px;
}
.storage-head .free { margin-left: auto; color: var(--muted); }
.storage-head .free.low { color: var(--danger); font-weight: 600; }
.storage-bar {
  display: flex; height: 8px; margin: 9px 0 7px; border-radius: var(--r-pill); overflow: hidden;
  background: var(--hover-wash, rgb(255 255 255 / 0.08));
}
.storage-bar .videos { background: var(--amber-500); }
.storage-bar .other { background: var(--stone-500, #78716c); }
.storage-note { font-size: var(--fs-xs); color: var(--muted); }
.library-edit-head {
  margin: 4px 0 -4px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
}
.library-edit > select.ghost-select { justify-self: start; padding: 6px 10px; font-size: var(--fs-sm); }
.library-people[aria-disabled="true"] { opacity: 0.45; }
#library-list li { flex-wrap: wrap; }
.picker-foot .ghost-select { padding: 6px 10px; font-size: var(--fs-sm); }
#detail-library { padding: 6px 10px; font-size: var(--fs-sm); }

/* --- poster grid -------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 30px 22px;
}

.card {
  border: 0; padding: 0; background: none; text-align: left;
  display: block; cursor: pointer; width: 100%;
  box-shadow: none;
  border-radius: var(--r-md);
  /*
   * A card is a button, and a browser centres a button's contents in its
   * height. The grid stretches every card in a row to the tallest one, so a
   * film with a one-line title sat a few pixels lower than its neighbour
   * with two lines. Kept to its own height, at the top of the row.
   */
  align-self: start;
}
.card:hover:not(:disabled) { background: none; transform: none; }

/* Cards lift a little further and settle rather than snap. */
.card-art {
  position: relative;
  aspect-ratio: var(--poster);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  box-shadow: var(--elev-1);
  transition: transform 320ms var(--ease-editorial), box-shadow 320ms var(--ease-editorial);
}
@media (hover: hover) {
  .card:hover .card-art { transform: translateY(-3px); box-shadow: var(--elev-2); }
}
/* A stand-in poster already says the title: the words under it are kept
   for screen readers only, so the name is not printed twice. */
.card:has(.card-art .standin) .card-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.card:has(.card-art .standin) .card-sub:not(.keep) { display: none; }
/* Loading: a soft shimmer, so an empty tile looks intended. */
.card-art:not(:has(img, .standin)) {
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 60%, var(--hover-wash)) 50%, var(--surface-2) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }
.card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A stand-in poster (standin.js): the title set large on a colour taken
   from the name, sized to whatever box it is in. */
.standin {
  position: relative; width: 100%; height: 100%;
  container-type: size;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.5em;
  padding: 10% 9%;
  background:
    radial-gradient(120% 70% at 20% 0%, rgb(255 255 255 / 0.16), transparent 60%),
    linear-gradient(160deg, var(--standin-a), var(--standin-b));
  color: rgb(255 255 255 / 0.94);
  overflow: hidden;
}
.standin-title {
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.02;
  font-size: clamp(11px, 15cqmin, 44px);
  overflow-wrap: anywhere; text-wrap: balance;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden;
}
.standin-title.long { font-size: clamp(10px, 11cqmin, 34px); }
.standin-line {
  font-size: clamp(9px, 6.5cqmin, 15px); font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgb(255 255 255 / 0.62);
}
/* A little tile (the music bar): the title a size up for the space, three lines at most. */
@container (max-width: 64px) {
  .standin-title, .standin-title.long { font-size: clamp(7px, 19cqmin, 14px); -webkit-line-clamp: 3; }
}

/* A credit line above the title, in small caps — the thing that makes the
   grid read editorial rather than like a file browser. */
.card-title {
  margin: 14px 2px 0;
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.011em;
  color: var(--text-strong);
  transition: color 180ms var(--ease-editorial);
}

/* Two lines at most, so one long title doesn't push its whole row apart;
   the full title is on hover and on the film's page. */
.card-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.card-sub { margin: 5px 2px 0; font-size: var(--fs-sm); color: var(--muted); }
.card-scores { display: flex; gap: 12px; margin: 5px 2px 0; font-size: var(--fs-sm); color: var(--muted); }
.score { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.score svg { width: 14px; height: 14px; flex: none; }
.meta .score svg { width: 15px; height: 15px; }
.meta .score { color: var(--text); font-weight: 600; }

.badge {
  position: absolute; top: 8px; right: 8px;
  background: rgb(12 10 9 / 0.72);
  backdrop-filter: blur(4px);
  color: #fafaf9;
  border-radius: var(--r-pill);
  padding: 3px 8px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.3;
}
.badge.accent { background: var(--accent); color: var(--on-accent); backdrop-filter: none; }
/* Out of reach: a problem label, quiet — the film is still all there. */
.badge.offline { background: rgb(12 10 9 / 0.82); color: #fca5a5; box-shadow: inset 0 0 0 1px rgb(248 113 113 / 0.45); }
.offline-note {
  margin: 0 0 8px; font-size: var(--fs-sm); font-weight: 500;
  color: var(--muted);
}
.notice.offline {
  border-color: color-mix(in srgb, var(--muted) 35%, transparent);
  background: color-mix(in srgb, var(--muted) 8%, transparent);
}


/* --- continue watching ---------------------------------------------------
 * A lit band reaching to the page's edges, with wide backdrop cards: the
 * same as on the TV, and unlike the poster grid below in every way.
 */
.continue-band {
  position: relative;
  isolation: isolate;
  margin: 0 -24px 30px;
  padding: 24px 24px 28px;
}
/*
 * The glow runs the whole width of the window, as the top bar does, while
 * the cards stay in line with the page. It used to stop just past the
 * content, which on a wide screen left it ending in mid-air.
 */
/*
 * Light from above rather than a coloured block: a soft ellipse spreading
 * down from the top, fading out every way so it has no edges, and along the
 * top a thin line of light, brightest in the middle, gone at the ends.
 */
.continue-band::before {
  content: '';
  position: absolute; z-index: -1; top: 0; bottom: -40px;
  left: 50%; width: 100vw; transform: translateX(-50%);
  background:
    radial-gradient(60% 100% at 50% 0%, rgb(233 162 59 / 0.08), rgb(233 162 59 / 0.025) 55%, transparent 80%);
  pointer-events: none;
}
.continue-band::after {
  content: '';
  position: absolute; z-index: -1; top: 0; height: 1px;
  left: 50%; width: 100vw; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgb(233 162 59 / 0.18) 25%, rgb(244 184 96 / 0.35) 50%, rgb(233 162 59 / 0.18) 75%, transparent);
  pointer-events: none;
}
/* Flush under the top bar, unless a notice is showing above it. */
main > .continue-band { margin-top: -28px; }
main > .notice:not([hidden]) ~ .continue-band { margin-top: 0; }
/*
 * Films' banner (filmHero in app.js): the film's backdrop to the right,
 * darkened to the left under the words, one film fading into the next.
 */
.film-hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(280px, 30vw, 420px);
  margin: 0 0 26px;
  display: flex; align-items: center;
  border-radius: var(--r-lg); border: 1px solid var(--hairline); background: #0c0a09;
  box-shadow: var(--elev-2);
}
.fh-slides { position: absolute; inset: 0 0 0 28%; z-index: -2; }
.fh-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1200ms ease; }
.fh-slide.on { opacity: 1; }
.fh-slide img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.fh-shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, #0c0a09 30%, rgb(12 10 9 / 0.85) 45%, rgb(12 10 9 / 0.25) 75%, rgb(12 10 9 / 0.05)),
    linear-gradient(0deg, rgb(12 10 9 / 0.55), transparent 40%);
}
.fh-text { width: min(560px, 55%); padding: 30px 32px; color: #f5f5f4; transition: opacity 260ms ease; }
.fh-text.changing { opacity: 0; }
/* On a computer: one height whichever film it shows, the words held to the
   foot, so as it turns the buttons and everything below stay put (with only a
   minimum, a longer summary moved them, 23 Nov). A phone stacks it instead. */
@media (min-width: 641px) {
  .film-hero { height: clamp(300px, 30vw, 420px); min-height: 0; align-items: flex-end; }
}
.fh-text .music-hero-kicker { color: #a8a29e; }
.continue-band .fh-title {
  font-weight: 650;
  margin: 0 0 6px; font-size: var(--fs-2xl); line-height: 1.1; letter-spacing: -0.025em; color: #fff;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.fh-meta { margin: 0 0 10px; font-size: var(--fs-md); color: #d6d3d1; }
.fh-overview {
  margin: 0 0 18px; font-size: var(--fs-md); line-height: 1.55; color: #e7e5e4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.fh-dots { position: absolute; right: 20px; bottom: 16px; display: flex; gap: 8px; }
.fh-dot {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / 0.35); box-shadow: none; cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
}
.fh-dot:hover:not(:disabled) { background: rgb(255 255 255 / 0.7); }
.fh-dot.on { background: #f5f2ed; transform: scale(1.25); }
/* Home videos: the file's facts as small pills, and the town's map inset at the right. */
.fh-specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 18px; }
.fh-specs span {
  padding: 4px 10px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600;
  font-variant-numeric: tabular-nums; color: #e7e5e4;
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.1);
}
.fh-specs span:first-child { color: #fafaf9; background: rgb(255 255 255 / 0.16); }
.film-hero.home .fh-meta { color: #a8a29e; }
/*
 * The map fills the right of the banner, top to bottom. The picture under
 * it is blurred and darkened, starting a little left of the map and in two
 * steps (a light blur, then the full one) so the picture softens gradually.
 */
.fh-map { position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: min(31%, 480px); margin: 0; }
/* The blur layers reach well left of the map; every fade is eased (slow at
   both ends) so no edge can be seen where it starts or ends. */
.fh-map::before, .fh-map::after {
  content: ""; position: absolute; inset: 0 0 0 -50%; z-index: -1; pointer-events: none;
}
.fh-map::before {
  background: linear-gradient(90deg, rgb(12 10 9 / 0) 25%, rgb(12 10 9 / 0.08) 40%, rgb(12 10 9 / 0.25) 55%, rgb(12 10 9 / 0.38) 72%, rgb(12 10 9 / 0.42) 85%);
  -webkit-backdrop-filter: blur(26px) saturate(0.75); backdrop-filter: blur(26px) saturate(0.75);
  --fh-ease: linear-gradient(90deg, transparent 22%, rgb(0 0 0 / 0.1) 32%, rgb(0 0 0 / 0.35) 42%, rgb(0 0 0 / 0.7) 52%, rgb(0 0 0 / 0.92) 60%, #000 66%);
  -webkit-mask-image: var(--fh-ease); mask-image: var(--fh-ease);
}
.fh-map::after {
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  --fh-ease: linear-gradient(90deg, transparent 0, rgb(0 0 0 / 0.1) 10%, rgb(0 0 0 / 0.35) 20%, rgb(0 0 0 / 0.7) 30%, rgb(0 0 0 / 0.92) 38%, #000 44%);
  -webkit-mask-image: var(--fh-ease); mask-image: var(--fh-ease);
}
.fh-map img {
  /* Cropped from the left (the faded side), so the pin keeps its place. */
  position: relative; width: 100%; height: 100%; object-fit: cover; object-position: right center; display: block;
  --fh-ease: linear-gradient(90deg, transparent 0, rgb(0 0 0 / 0.08) 10%, rgb(0 0 0 / 0.3) 22%, rgb(0 0 0 / 0.65) 34%, rgb(0 0 0 / 0.9) 44%, #000 52%);
  -webkit-mask-image: var(--fh-ease); mask-image: var(--fh-ease);
}
.fh-map figcaption {
  position: absolute; right: 18px; top: 14px;
  font-size: var(--fs-xs); letter-spacing: 0.02em; color: rgb(214 211 209 / 0.4);
}
/* With the map panel at the right, the picture moves left so its middle sits
   in the clear gap between the words and the map; its right end runs under
   the panel, which blurs it. */
.film-hero.home .fh-slides { inset: 0 8% 0 16%; }
/* No map (the video knows no place): the picture runs to the right edge,
   with no dark strip where the map would be ... */
.film-hero.home.no-map .fh-slides { inset: 0 0 0 16%; }
/* ... and three stills from the video stand in the map's place, stacked,
   over a soft darkening so they read as their own panel (app.js, paintStills). */
.fh-stills {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: min(31%, 480px);
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 10px;
  padding: 22px 26px 22px 0;
}
.fh-stills[hidden] { display: none; }
.fh-stills::before {
  content: ""; position: absolute; inset: 0 0 0 -60%; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgb(12 10 9 / 0) 15%, rgb(12 10 9 / 0.35) 45%, rgb(12 10 9 / 0.62) 70%, rgb(12 10 9 / 0.7));
}
.fh-still {
  display: block; height: calc((100% - 20px) / 3); width: auto; max-width: 100%; object-fit: cover;
  border-radius: 10px; background-color: #1c1917;
  border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.7);
}
@media (max-width: 900px) { .fh-map, .fh-stills { display: none; } }
@media (max-width: 640px) {
  /* A phone: the picture across the top, the words under it, no summary. */
  .film-hero { display: block; min-height: 0; }
  .fh-slides { position: relative; inset: auto; height: 200px; z-index: 0; }
  .fh-shade { background: linear-gradient(0deg, #0c0a09 0, rgb(12 10 9 / 0.3) 120px, transparent 200px); height: 200px; bottom: auto; }
  .fh-text { width: auto; padding: 14px 18px 18px; position: relative; }
  .fh-text .music-hero-line, .fh-overview { display: none; }
  .fh-dots { top: 12px; bottom: auto; right: 14px; }
  /* The map below the words, full width. */
  .fh-map { display: block; position: relative; inset: auto; width: auto; aspect-ratio: 16 / 10; margin: 0 18px 18px; }
  .fh-map[hidden] { display: none; }
  .fh-map::before, .fh-map::after { display: none; }
  .fh-map img {
    --fh-feather: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent),
                  linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
    -webkit-mask-image: var(--fh-feather); mask-image: var(--fh-feather);
    -webkit-mask-composite: source-in; mask-composite: intersect;
  }
  .fh-map figcaption { top: auto; bottom: 6%; right: 10%; }
  .film-hero.home .fh-slides { inset: auto; }
}
@media (max-width: 640px) {
  /* Films on a phone: the words over the foot of the picture, so the banner
     takes a third of the screen rather than half. (Home videos keep the
     words and the map below.) */
  .film-hero:not(.home) { display: flex; align-items: flex-end; min-height: 250px; }
  .film-hero:not(.home) .fh-slides { position: absolute; inset: 0; height: auto; z-index: -2; }
  .film-hero:not(.home) .fh-shade {
    inset: 0; height: auto;
    background: linear-gradient(0deg, rgb(12 10 9 / 0.96) 0, rgb(12 10 9 / 0.6) 120px, transparent 210px);
  }
  .film-hero:not(.home) .fh-text { padding: 12px 16px 14px; }
  .film-hero:not(.home) .fh-kicker { display: none; }
  .film-hero:not(.home) .fh-title { font-size: var(--fs-xl); margin-bottom: 4px; }
  .film-hero:not(.home) .fh-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 12px; }
  .film-hero:not(.home) .detail-actions button { padding-block: 8px; }
}
@media (prefers-reduced-motion: reduce) { .fh-slide, .fh-text { transition: none; } }

/* The tabs sit at the top of the band; Continue watching, when shown, below them. */
.continue-band .library-tabs { margin-bottom: 22px; }
.continue-band.tabs-only { padding-bottom: 18px; margin-bottom: 22px; }
.continue-band.tabs-only .library-tabs { margin-bottom: 0; }
.continue-band.hero-last { padding-bottom: 6px; margin-bottom: 24px; }
.continue-band.hero-last .film-hero { margin-bottom: 0; }
/* Tabs alone: no light and no rule, which read as a stray line. */
.continue-band.tabs-only::before, .continue-band.tabs-only::after { display: none; }
/* The same heading as every other section: plain, sentence case. */
.continue-band h2 {
  display: flex; align-items: center;
  margin-bottom: 14px;
}
.continue-row {
  display: flex; gap: 18px;
  overflow-x: auto;
  /* Room for the lift on hover. */
  padding: 8px 2px 10px; margin: -8px -2px -10px;
}
.cw-card {
  flex: 0 0 320px;
  /* Top of the row, not centred in it: see .card. */
  align-self: flex-start;
  padding: 0; border: 0; background: none; box-shadow: none;
  display: block; text-align: left; border-radius: var(--r-md);
}
.cw-card:hover:not(:disabled) { background: none; transform: none; }
.cw-art {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  box-shadow: var(--elev-2);
  transition: transform 320ms var(--ease-editorial), box-shadow 320ms var(--ease-editorial), border-color 320ms var(--ease-editorial);
}
.cw-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cw-art img.poster { object-position: center 25%; }
/* The card's own words name it already. */
.cw-art .standin-title, .cw-art .standin-line { display: none; }
/* The text sits on the picture, so it is light in both themes. */
.cw-art::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 70%;
  background: linear-gradient(to top, rgb(10 9 8 / 0.92), transparent);
}
.cw-text { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 1; color: #fafaf9; }
.cw-title {
  font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-left { font-size: var(--fs-sm); color: #d6d3d1; margin-top: 2px; }
.cw-art .progress-bar { z-index: 1; height: 5px; }
.cw-card:focus-visible .cw-art {
  transform: translateY(-3px);
  border-color: rgb(255 255 255 / 0.4);
  box-shadow: var(--elev-3);
}
@media (hover: hover) {
  .cw-card:hover .cw-art { transform: translateY(-3px); border-color: rgb(255 255 255 / 0.28); box-shadow: var(--elev-3); }
}

.progress-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(255 255 255 / 0.25); }
/* How far you have watched: gold, as the player's own bar. It was thyme
   green from the Reelthyme name; green now only means in step or online. */
.progress-bar span { display: block; height: 100%; background: var(--accent); }

.empty { text-align: center; padding: 72px 20px; color: var(--muted); }
.empty h3 { font-size: var(--fs-lg); margin-bottom: 8px; }
.empty .hint { font-size: var(--fs-sm); }

/* --- modals ------------------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(12 10 9 / 0.5);
  backdrop-filter: blur(6px);
  /*
   * Top-aligned, with the card's auto margins doing the centring: centred
   * when it fits, and when it is taller than the window it starts at the
   * top and scrolls. Centring with place-items instead pushed the top of a
   * tall card — the backdrop and the close button — above the window,
   * where it could not be scrolled to.
   */
  display: grid; place-items: start center;
  /* One column exactly as wide as the window, so a card with a wide row in
     it (the cast) scrolls that row instead of spilling off the screen. */
  grid-template-columns: minmax(0, 1fr);
  padding: 24px; overflow: auto;
}
.modal > .modal-card { margin-block: auto; }
.modal-card {
  position: relative;
  width: min(780px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-3);
  padding: 28px;
}
.phone-only { display: none; }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; }

/* --- a film's, a show's and an album's window: one frame -----------------
 * The wide picture across the top (the backdrop; else the poster or cover,
 * softened; else the stand-in's colours — see paintBackdrop in standin.js),
 * the poster or cover at the left over its foot, then the kind, the title,
 * one line of facts and one gold button. What follows (cast, episodes,
 * tracks) runs full width below.
 *
 * Not overflow: hidden — that cut the More menu off at the window's edge.
 * The picture rounds its own top corners instead.
 */
.detail-card { width: min(1000px, 100%); padding: 0; }
.detail-art {
  aspect-ratio: 21 / 8;
  background: var(--surface-2) center 30% / cover no-repeat;
  position: relative;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.detail-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--surface) 2%, color-mix(in srgb, var(--surface) 30%, transparent) 62%, transparent);
}
/* A poster or cover stretched across: blurred into a wash of its colours. */
.detail-art.from-poster::before {
  content: ''; position: absolute; inset: 0;
  -webkit-backdrop-filter: blur(40px) saturate(1.15); backdrop-filter: blur(40px) saturate(1.15);
  background: rgb(12 10 9 / 0.2);
}
/* Nothing at all: the stand-in's colours, a shorter band. */
.detail-art.no-art {
  aspect-ratio: 21 / 6;
  background:
    radial-gradient(110% 90% at 18% 0%, rgb(255 255 255 / 0.10), transparent 60%),
    linear-gradient(160deg, var(--standin-a, var(--surface-2)), var(--standin-b, var(--surface-2)));
}
.detail-head {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: end;
  padding: 0 32px 6px; margin-top: -128px; position: relative; z-index: 1;
}
.detail-art.no-art + .detail-head { margin-top: -96px; }
.detail-head.no-poster { grid-template-columns: minmax(0, 1fr); margin-top: -56px; }
.detail-poster {
  aspect-ratio: var(--poster); border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--hairline); box-shadow: var(--elev-3); background: var(--surface-2);
}
.detail-poster.square { aspect-ratio: 1; }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-info { min-width: 0; }
.detail-kind { margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.detail-info h2 { font-size: var(--fs-2xl); line-height: 1.1; margin: 0 0 8px; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.detail-info .overview { margin-bottom: 18px; }
.detail-body { padding: 4px 32px 32px; position: relative; }

/* Over the picture the close button carries its own dark ground, so it
   shows in either theme whatever the picture is. */
.detail-card > .modal-close {
  width: 40px; height: 40px; justify-content: center;
  background: rgb(12 10 9 / 0.5); color: #fafaf9; border-color: rgb(255 255 255 / 0.16);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.detail-card > .modal-close:hover:not(:disabled) { background: rgb(12 10 9 / 0.75); color: #fff; }

/* Windows fade and rise a little as they open. */
.modal:not([hidden]) > .modal-card { animation: card-in 160ms var(--ease-editorial); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 640px) {
  /* On a phone a film, show or album is the whole screen, with no frame
     round it; the poster gives way to the picture across the top. */
  .modal:has(> .detail-card) { padding: 0; }
  body.has-music-bar .modal:has(> .detail-card) { padding-bottom: 0; }
  .detail-card { min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .modal > .detail-card { margin-block: 0; }
  .detail-art { aspect-ratio: 16 / 10; border-radius: 0; }
  .detail-art.no-art { aspect-ratio: 16 / 7; }
  .detail-head, .album-head { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px 4px; margin-top: -64px; }
  .detail-art.no-art + .detail-head, .detail-head.no-poster { margin-top: -40px; }
  .detail-head .detail-poster { display: none; }
  .detail-info h2 { font-size: var(--fs-xl); }
  .detail-body { padding: 4px 16px 28px; }
  body.has-music-bar .detail-card { padding-bottom: 150px; }
  .modal-close { width: 44px; height: 44px; justify-content: center; background: rgb(12 10 9 / 0.55); color: #fafaf9; border-color: rgb(255 255 255 / 0.16); }
  /* Play (or Resume) across the screen; the rest one row of icons with short names. */
  .detail-actions { gap: 8px; }
  .detail-actions > .primary { flex: 1 1 100%; justify-content: center; padding-block: 12px; }
  .detail-actions > [data-short], .detail-actions > .more { flex: 1 1 0; min-width: 0; }
  .detail-actions [data-short] {
    width: 100%; flex-direction: column; justify-content: center; gap: 4px;
    padding: 8px 2px; font-size: var(--fs-xs); font-weight: 500;
    background: none; border-color: transparent; box-shadow: none; color: var(--text);
  }
  .detail-actions [data-short] .btn-label { display: none; }
  .detail-actions [data-short]::after { content: attr(data-short); white-space: nowrap; }
  .detail-actions [data-short] svg { width: 20px; height: 20px; }
  .detail-actions .more .more-menu { left: auto; right: 0; }
}

.meta {
  color: var(--muted); font-size: var(--fs-sm); margin: 0 0 14px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.meta .dot { opacity: 0.45; }
.overview { margin: 0 0 18px; max-width: 65ch; font-size: var(--fs-md); color: var(--text); opacity: 0.88; }
.detail-facts { margin: 26px 0 4px; border-top: 1px solid var(--hairline); padding-top: 14px; }
.detail-facts summary {
  cursor: pointer; width: fit-content; list-style: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
}
.detail-facts summary::-webkit-details-marker { display: none; }
.detail-facts summary::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 10px; vertical-align: 2px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform 160ms;
}
.detail-facts[open] summary::after { transform: rotate(45deg); vertical-align: 4px; }
.detail-facts summary:hover { color: var(--text); }
.detail-facts dl {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px;
  margin: 14px 0 0; font-size: var(--fs-sm);
}
.detail-facts dt { color: var(--faint); }
.detail-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* Second-rank actions: real buttons, quieter than Play. */
button.secondary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border-color: var(--hairline); color: var(--text);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) { background: var(--hover-wash); border-color: color-mix(in srgb, var(--text) 25%, transparent); }
button.secondary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.secondary.icon-only { padding: 9px 11px; }
button.secondary.on { color: var(--text-strong); border-color: color-mix(in srgb, var(--text) 35%, transparent); }

/* Everything else about a film, out of the way until wanted. */
.more { position: relative; }
/* Hangs from its button; .up opens it above when there is no room below,
   .end lines it up with the button's right edge near the window's. Kept
   inside the page's own layout so it zooms with the page on big screens. */
.more-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 5;
  min-width: 250px; padding: 6px; white-space: nowrap;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  box-shadow: var(--elev-3, 0 20px 50px rgb(0 0 0 / 0.35));
}
.more-menu button {
  width: 100%; text-align: left; justify-content: flex-start;
  background: none; border: 0; box-shadow: none; border-radius: var(--r-sm);
  padding: 9px 12px; font-size: var(--fs-md); color: var(--text);
}
.more-menu button:hover:not(:disabled) { background: var(--hover-wash); }
.more-menu button.danger { color: var(--danger); }
.more-menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 6px 4px; }
.more-menu.up { top: auto; bottom: calc(100% + 6px); }
.more-menu.end { left: auto; right: 0; }
.more-select {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 6px 6px 12px; font-size: var(--fs-md); color: var(--muted);
}
.more-select select { padding: 6px 8px; font-size: var(--fs-sm); }
.rename { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rename input[type="text"], .rename input[type="url"] { flex: 1; min-width: 180px; }
.rename input[type="number"] { width: 110px; }

.steps { color: var(--muted); padding-left: 20px; margin: 0 0 8px; font-size: var(--fs-md); }
.steps li { margin-bottom: 8px; }
.steps strong, .steps code { color: var(--text-strong); }

/* Lists in windows (sign-ins, people, libraries, folders, TVs, codes): thin
   ruled rows inside one card, like an album's tracks — calmer than a stack
   of raised cards, and twice as many to a screen on a phone. */
.device-list {
  list-style: none; margin: 0; padding: 0; display: grid;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
}
.device-list:empty { display: none; }
.device-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; font-size: var(--fs-md);
}
.device-list li + li { border-top: 1px solid var(--hairline); }
.device-list li:has(.reset-form) { flex-wrap: wrap; }
.device-list .reset-form { flex-basis: 100%; margin: 0; }
.device-list li.muted { justify-content: center; color: var(--muted); }
.device-list .spacer { margin-left: auto; }
/* "Show 12 more" under a long list, and the action beneath it. */
.device-list li.list-more { justify-content: flex-start; padding: 4px 8px; }
.device-list li.list-more button { font-size: var(--fs-sm); padding: 6px 10px; }
.list-action { margin-top: 10px; font-size: var(--fs-sm); }
.device-list .code {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: var(--fs-lg); letter-spacing: 0.14em; color: var(--text-strong);
}

/* --- match picker ------------------------------------------------------- */

.match-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 16px; margin-top: 14px;
}
.match {
  border: 1px solid var(--hairline); background: var(--surface-2);
  border-radius: var(--r-sm); overflow: hidden; padding: 0;
  cursor: pointer; display: block; text-align: left;
  box-shadow: var(--elev-1);
  transition: transform 320ms var(--ease-editorial), box-shadow 320ms var(--ease-editorial);
}
.match:hover:not(:disabled) { background: var(--surface-2); }
@media (hover: hover) { .match:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--elev-2); } }
.match.current { outline: 2px solid var(--amber-500); outline-offset: -2px; }
.match-art { aspect-ratio: var(--poster); background: var(--canvas) center / cover no-repeat; }
.match-label { padding: 9px 10px; font-size: var(--fs-sm); line-height: 1.35; }
.match-label span {
  display: block; color: var(--muted);
  font-size: var(--fs-xs); margin-top: 3px;
}

/* --- upload queue ------------------------------------------------------- */

.queue {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  width: min(390px, calc(100vw - 44px));
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--elev-3);
  overflow: hidden;
}
.queue-head { display: flex; align-items: center; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--hairline); }
.queue-head strong { font-size: var(--fs-md); font-weight: 600; }
.queue-head button { margin-left: auto; }
.queue ul { list-style: none; margin: 0; padding: 8px; max-height: 46vh; overflow: auto; display: grid; gap: 2px; }
.queue li { padding: 10px 8px; border-radius: var(--r-sm); }
.queue li + li { border-top: 1px solid var(--hairline); }
.queue-name { font-size: var(--fs-sm); display: flex; gap: 10px; align-items: baseline; }
.queue-name strong { font-weight: 500; }
.queue-name span { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.queue-track { height: 4px; border-radius: var(--r-pill); background: var(--stone-200); margin-top: 8px; overflow: hidden; }
html.dark .queue-track { background: var(--stone-700); }
.queue-track span {
  display: block; height: 100%; width: 0;
  background: var(--amber-500);
  transition: width 250ms var(--ease-editorial);
}
.queue li.done .queue-track span { background: var(--good); }
.queue li.failed .queue-track span { background: var(--danger); }
.queue-note { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }
.queue li.failed .queue-note { color: var(--danger); }
.queue-retry { padding: 2px 10px; font-size: var(--fs-xs); margin-left: 4px; }
.queue-pill {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  padding: 8px 14px; border-radius: var(--r-pill); font-size: var(--fs-sm);
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--elev-3);
}
.queue-pill.bad { color: var(--danger); }

/* --- player ------------------------------------------------------------- */

/*
 * The picture fills the screen. The film's name at the top, the close
 * button, and Couchbreak's own controls at the foot (not the browser's, which
 * were different in every browser) show over it on a soft shade while the
 * pointer moves or a key is pressed, and all the while it is paused; then
 * they fade, with the pointer, and leave the picture alone.
 */
.player { position: fixed; inset: 0; z-index: 60; background: #000; color: #fafaf9; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player:not(.awake) { cursor: none; }
.player-title, .player-close, .player-controls {
  opacity: 0; pointer-events: none;
  transition: opacity 240ms var(--ease-editorial);
}
.player.awake .player-title, .player.awake .player-close, .player.awake .player-controls,
.player-controls:focus-within { opacity: 1; }
.player.awake .player-close, .player.awake .player-controls, .player-controls:focus-within { pointer-events: auto; }
.player-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 44px; height: 44px; justify-content: center;
  background: rgb(12 10 9 / 0.5);
  border-color: rgb(255 255 255 / 0.16);
  color: #fafaf9;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.player-close:hover:not(:disabled) { background: rgb(12 10 9 / 0.8); }

/* The foot: the position bar with the time, then one row of buttons. */
.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 56px 20px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgb(0 0 0 / 0.82), rgb(0 0 0 / 0.5) 55%, transparent);
}
.pc-scrub { display: flex; align-items: center; gap: 14px; padding: 0 6px; }
.pc-time {
  min-width: 3.4em; font-size: var(--fs-sm); font-weight: 500; color: #e7e5e4;
  font-variant-numeric: tabular-nums;
}
.pc-time:last-child { text-align: right; color: #a8a29e; }
.pc-seek-wrap { position: relative; flex: 1; display: flex; align-items: center; }
/* Drawn here, not by the browser: gold to where the film is, a paler band
   for what has loaded, a white dot to drag. --p and --b are 0 to 1. */
.pc-seek, .pc-volume-range {
  --p: 0; --b: 0; --dot: 14px; --h: 5px;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer;
}
.pc-seek:hover, .pc-seek:focus-visible { --h: 7px; }
.pc-seek::-webkit-slider-runnable-track {
  height: var(--h); border-radius: var(--r-pill); transition: height 120ms;
  background:
    linear-gradient(90deg, var(--accent) 0 calc(var(--p) * 100%), transparent 0),
    linear-gradient(90deg, rgb(255 255 255 / 0.36) 0 calc(var(--b) * 100%), rgb(255 255 255 / 0.18) 0);
}
.pc-volume-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, #fafaf9 0 calc(var(--p) * 100%), rgb(255 255 255 / 0.25) 0);
}
.pc-seek::-webkit-slider-thumb, .pc-volume-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--dot); height: var(--dot); margin-top: calc((var(--h) - var(--dot)) / 2);
  border-radius: 50%; border: 0; background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.45);
}
.pc-volume-range::-webkit-slider-thumb { --dot: 12px; margin-top: -4px; }
.pc-seek::-moz-range-track, .pc-volume-range::-moz-range-track { height: var(--h); border-radius: var(--r-pill); background: rgb(255 255 255 / 0.2); }
.pc-volume-range::-moz-range-track { height: 4px; }
.pc-seek::-moz-range-progress { height: var(--h); border-radius: var(--r-pill); background: var(--accent); }
.pc-volume-range::-moz-range-progress { height: 4px; border-radius: var(--r-pill); background: #fafaf9; }
.pc-seek::-moz-range-thumb, .pc-volume-range::-moz-range-thumb {
  width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.45);
}
.pc-seek:focus-visible, .pc-volume-range:focus-visible { outline: 2px solid #fafaf9; outline-offset: 2px; border-radius: var(--r-xs); }
/* Above the bar: the frame there (when the film has preview pictures) and its time. */
.pc-seek-tip {
  position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.pc-seek-time {
  padding: 3px 8px; border-radius: var(--r-xs);
  background: rgb(12 10 9 / 0.85); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums;
}
/* One cell of a sheet of frames (see paintPreview in app.js); dark until the sheet arrives. */
.pc-seek-frame {
  background-color: #1c1917; background-repeat: no-repeat; border-radius: var(--r-xs);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.3), 0 6px 20px rgb(0 0 0 / 0.55);
}
.pc-row { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.pc-spacer { flex: 1; }
button.pc-btn {
  width: 44px; height: 44px; padding: 0; justify-content: center; flex: none;
  background: none; border: 0; box-shadow: none; border-radius: var(--r-pill); color: #fafaf9;
}
button.pc-btn:hover:not(:disabled) { background: rgb(255 255 255 / 0.12); }
.pc-btn svg { width: 24px; height: 24px; stroke-width: 1.8; }
.pc-play svg { width: 26px; height: 26px; }
.pc-play .i-pause, .pc-play.playing .i-play,
#pc-mute .i-muted, #pc-mute.muted .i-sound,
#pc-fullscreen .i-exit, .player.full #pc-fullscreen .i-enter { display: none; }
.pc-play.playing .i-pause, #pc-mute.muted .i-muted, .player.full #pc-fullscreen .i-exit { display: block; }
#pc-airplay.on { color: var(--accent-text); }
.pc-volume { display: flex; align-items: center; gap: 4px; }
.pc-volume-range { width: 84px; }
/* A phone's volume is its own buttons. */
@media (hover: none) { .pc-volume-range { display: none; } }
@media (max-width: 640px) {
  .player-controls { padding: 48px 8px max(6px, env(safe-area-inset-bottom)); }
  .pc-scrub { gap: 10px; padding: 0 8px; }
  #pc-back, #pc-forward { display: none; }
}

/* Waiting for the picture: a slow ring in the middle. */
.player-spinner {
  position: absolute; left: 50%; top: 50%; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 3px solid rgb(255 255 255 / 0.18); border-top-color: #fafaf9;
  animation: spin 900ms linear infinite; display: none; pointer-events: none;
}
.player.waiting .player-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Up next: bottom right over the last frame, counting down. */
.upnext {
  position: absolute; right: 24px; bottom: 130px; z-index: 4;
  display: flex; gap: 16px; align-items: stretch;
  width: min(560px, calc(100% - 48px));
  padding: 14px; border-radius: var(--r-md);
  background: rgb(23 22 20 / 0.94); border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: var(--elev-3, 0 20px 50px rgb(0 0 0 / 0.5)); color: #fafaf9;
}
.upnext-art {
  flex: 0 0 180px; aspect-ratio: 16 / 9; border-radius: var(--r-sm);
  background: #292524 center / cover no-repeat;
}
.upnext-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.upnext-eyebrow { margin: 0; font-size: var(--fs-sm); font-weight: 500; color: var(--stone-400); font-variant-numeric: tabular-nums; }
.upnext h3 { margin: 4px 0 2px; font-size: var(--fs-lg); font-weight: 600; color: #fafaf9; text-transform: none; letter-spacing: -0.01em; }
.upnext-sub { margin: 0; font-size: var(--fs-sm); color: var(--stone-400); }
.upnext-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.upnext-bar { height: 3px; margin-top: 10px; border-radius: 3px; background: rgb(255 255 255 / 0.15); overflow: hidden; }
.upnext-bar span { display: block; height: 100%; width: 0; background: var(--amber-500); }
@media (max-width: 640px) { .upnext-art { display: none; } }

/* Continue watching: a small x to take a film off the band. */
.cw-remove {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgb(12 10 9 / 0.72); color: #fafaf9; font-size: var(--fs-lg); line-height: 1;
  opacity: 0; transition: opacity 160ms;
}
.cw-card:hover .cw-remove, .cw-card:focus-within .cw-remove, .cw-remove:focus-visible { opacity: 1; }
@media (hover: none) { .cw-remove { opacity: 0.85; } }
.cw-remove:hover { background: rgb(12 10 9 / 0.92); }
/* What is playing, top left, shown and hidden with the controls. */
.player-title {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  padding: 18px 80px 48px 24px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(rgb(0 0 0 / 0.7), transparent);
  color: #fafaf9;
  white-space: nowrap; overflow: hidden;
}
.player-title strong { display: block; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.player-title span { display: block; margin-top: 1px; font-size: var(--fs-xs); color: var(--stone-400); }
.player-title span:empty { display: none; }
/* What a key just did (Space, ← →, M, C), over the picture for a moment. */
.player-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  padding: 10px 18px; border-radius: var(--r-pill); pointer-events: none;
  background: rgb(12 10 9 / 0.72); color: #fafaf9; font-size: var(--fs-lg); font-weight: 600;
  backdrop-filter: blur(8px);
}
.player-hint.fade { animation: hint-fade 900ms ease forwards; }
@keyframes hint-fade { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
.player-status {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgb(12 10 9 / 0.82); border: 1px solid rgb(255 255 255 / 0.12);
  color: #fafaf9;
  padding: 14px 22px; border-radius: var(--r-sm); font-size: var(--fs-md); text-align: center;
}

/* --- misc --------------------------------------------------------------- */

.drop-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  pointer-events: none;
}
.drop-overlay div {
  border: 2px dashed color-mix(in srgb, var(--text-strong) 45%, transparent);
  border-radius: var(--r-lg);
  padding: 60px 90px;
  font-size: var(--fs-lg); font-weight: 500;
  color: var(--text-strong);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 80; max-width: min(520px, calc(100vw - 40px));
  /* As wide as its words: held at half the screen by left: 50%, it wrapped
     a short message into a narrow column on a phone. */
  width: max-content;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 12px 18px;
  box-shadow: var(--elev-3); font-size: var(--fs-md);
}
.toast.bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

.attribution {
  border-top: 1px solid var(--hairline);
  padding: 24px 28px 40px;
  color: var(--faint);
  font-size: var(--fs-xs);
  text-align: center;
}
.attribution a { color: var(--muted); }
/* On a wide screen the credits are one line. */
@media (min-width: 1100px) {
  .attribution br { display: none; }
  #tmdb-credit:not([hidden])::before, #places-credit:not([hidden])::before { content: " · "; }
}

@media (max-width: 640px) {
  /* One slim row: the logo, then search (behind its icon), Add and the
     menu as icons. Search opens as a row of its own under them. */
  .topbar { display: flex; height: auto; min-height: 56px; padding: 6px 8px 6px 16px; gap: 2px; flex-wrap: wrap; }
  .topbar-end { display: contents; }
  .topbar .logo { margin-right: auto; }
  .topbar .phone-only { display: inline-flex; }
  .topbar #search { display: none; order: 3; max-width: none; flex-basis: 100%; margin: 4px 8px 6px 0; }
  .topbar.searching #search { display: block; }
  .topbar > button.icon-only, #btn-upload, button.menu-button { width: 44px; height: 44px; padding: 0; justify-content: center; }
  #btn-upload { background: none; border-color: transparent; box-shadow: none; }
  #btn-upload .btn-label, .menu-name, .menu-chevron { display: none; }
  .topbar-actions { right: 8px; }
  .topbar-actions button { padding: 12px; }
  .modal { padding: 12px; }
  main { padding: 18px 16px 4px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 22px 14px; }
  .continue-band { margin-left: -16px; margin-right: -16px; padding: 20px 16px 22px; }
  main > .continue-band { margin-top: -18px; }
  main > .notice:not([hidden]) ~ .continue-band { margin-top: 0; }
  .cw-card { flex-basis: 78vw; max-width: 300px; }

  .modal-card:not(.detail-card) { padding: 22px 18px; }
  .queue { right: 12px; left: 12px; bottom: 12px; width: auto; }
  /* iOS force-zooms the page when a focused field is under 16px. */
  input, select { font-size: var(--fs-lg); }
}

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

/* --- server folder picker ------------------------------------------------ */

.picker {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--elev-1);
  overflow: hidden;
}
.picker-path { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--hairline); }
.picker-path input {
  flex: 1; min-width: 0;
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: var(--fs-sm);
}
.picker-list {
  list-style: none; margin: 0; padding: 6px;
  max-height: 260px; overflow: auto;
  display: grid; gap: 2px;
}
.picker-list li { margin: 0; }
.picker-list button {
  width: 100%; justify-content: flex-start;
  background: none; border-color: transparent; box-shadow: none;
  font-weight: 400; font-size: var(--fs-md);
  padding: 8px 10px;
}
.picker-list button:hover:not(:disabled) { background: var(--hover-wash); }
.picker-list .dir-icon { color: var(--muted); }
.picker-list .empty-note { padding: 18px 10px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.picker-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-top: 1px solid var(--hairline);
}
.picker-foot span { flex: 1; font-size: var(--fs-sm); }

.relocate-intro { margin: -4px 0 10px; font-size: var(--fs-sm); line-height: 1.5; }
.relocate-intro code, .relocate-result code {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: var(--fs-xs);
  word-break: break-all;
}
.relocate-result {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.relocate-result > p { margin: 0; font-size: var(--fs-md); line-height: 1.5; }
.relocate-missing {
  list-style: none; margin: 8px 0 0; padding: 0;
  max-height: 180px; overflow: auto;
  font-size: var(--fs-xs); color: var(--muted);
  display: grid; gap: 3px;
}
.relocate-missing strong { color: var(--text); font-weight: 550; }
.relocate-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* The path has a line of its own and the folder's controls sit together
   under it, at the right. Beside it, on a phone, they squeezed the path to a
   letter's width, one letter per line. */
.folder-row { display: block; flex: 1 1 100%; min-width: 0; }
#folder-list li { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
.device-list .device-name { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  /* Rows of a name and a button or two (sign-ins, libraries, people): the
     buttons go under the name rather than squeezing it to a word a line. */
  .device-list li { flex-wrap: wrap; }
  /* A sign-in's name has the line to itself, so "last used" and Sign out sit
     under every one alike, not beside some and under others. */
  .device-list .device-name { flex-basis: 100%; }
  .device-list .device-name + .muted { margin-right: auto; }
}
.folder-row .folder-path {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: var(--fs-sm);
  word-break: break-all;
}
.folder-row .folder-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.folder-row .folder-meta.bad { color: var(--danger); }

/* --- accounts ------------------------------------------------------------ */

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input { width: auto; box-shadow: none; margin: 0; accent-color: var(--amber-600); }
.gate-card .check { margin: 2px 0 2px; }

#account-name { font-weight: 550; }
.person-row { display: block; flex: 1; min-width: 0; }
.person-row .person-name { font-size: var(--fs-md); font-weight: 550; }
.person-row .person-meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--muted);
}
.tag.warn,
html.dark .tag.warn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* A note that needs acting on, without being an error. */
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 0 0 24px;
  padding: 14px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--elev-1);
  color: var(--text);
  font-size: var(--fs-md);
}
.notice p { margin: 0; flex: 1 1 320px; line-height: 1.5; }
.notice-actions { display: flex; gap: 8px; }
.notice-inline {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

/* --- cast and related ---------------------------------------------------- */

.detail-body section { margin-top: 4px; }
.detail-body section h3 { margin-top: 22px; }

/* Horizontal rails, scrolled with the wheel or a trackpad. */
.people-row, .related-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 0;
}

.person { flex: 0 0 86px; text-align: center; }
button.person-link {
  display: block; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; cursor: pointer; border-radius: var(--r-md);
}
button.person-link:hover:not(:disabled) { background: none; transform: none; }
@media (hover: hover) {
  button.person-link:hover .person-name { text-decoration: underline; text-underline-offset: 3px; }
  button.person-link:hover .person-photo { box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 45%, transparent); }
}
.person-photo {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.person-photo.blank {
  display: grid;
  place-content: center;
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--faint);
}
.person-name {
  font-size: var(--fs-xs);
  font-weight: 550;
  margin-top: 8px;
  line-height: 1.3;
  color: var(--text-strong);
}
.person-role {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
  /* Two lines at most: one actor playing twenty-four people should not
     stretch the whole row. The full list is in the tooltip. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.related-card {
  flex: 0 0 104px;
  /* A button lays its contents out in a row; a card stacks them. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}
.related-card:hover:not(:disabled) { background: none; transform: none; }
.related-art {
  width: 104px;
  aspect-ratio: var(--poster);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  box-shadow: var(--elev-1);
  transition: transform 320ms var(--ease-editorial), box-shadow 320ms var(--ease-editorial);
}
@media (hover: hover) { .related-card:hover .related-art { transform: translateY(-3px); box-shadow: var(--elev-2); } }
.related-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-title {
  font-size: var(--fs-xs);
  font-weight: 550;
  margin-top: 8px;
  line-height: 1.3;
  color: var(--text-strong);
}
.related-why {
  font-size: var(--fs-xs);
  color: var(--faint);
  margin-top: 3px;
}

/* The age rating sits in the meta line, boxed like a classification mark. */
.cert {
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}

/* --- quality control, over the player ------------------------------------ */

/*
 * Together, audio and subtitles, and quality: buttons in the control bar
 * with a word beside the icon, each opening its menu above it.
 */
.player-buttons { display: flex; align-items: center; gap: 2px; }
.quality { position: relative; display: flex; }
.quality-menu { position: absolute; right: 0; bottom: calc(100% + 12px); z-index: 5; }
/* A film can carry dozens of subtitle languages: the list scrolls rather
   than running off the top of the screen. */
#tracks-menu { display: flex; flex-direction: column; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); }
#tracks-options { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.quality-menu-head + .quality-option { margin-top: 0; }
.quality-menu .quality-menu-head:not(:first-child) {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid rgb(255 255 255 / 0.1);
}
/* Subtitles on a soft panel, at the size the browser picks for the picture. */
#video::cue {
  background: rgb(0 0 0 / 0.62);
  color: #fff;
}
button.quality-button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: none; border: 0; box-shadow: none;
  color: #fafaf9;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
button.quality-button:hover:not(:disabled), .quality.open button.quality-button { background: rgb(255 255 255 / 0.12); }
.quality-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* On a phone the icons alone, the words kept for screen readers. */
@media (max-width: 640px) {
  button.quality-button { width: 44px; padding: 0; justify-content: center; }
  .quality-button > span:not(.together-dot) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  #together.active .together-button-dot { position: absolute; top: 9px; right: 9px; }
}
.quality-menu {
  min-width: 230px;
  padding: 8px;
  border-radius: var(--r-md);
  background: rgb(23 22 20 / 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.75);
  color: #fafaf9;
}
.quality-menu-head {
  margin: 4px 10px 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--stone-400);
}
.quality-option {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: var(--r-sm); background: none; box-shadow: none;
  color: #fafaf9; font-size: var(--fs-md); font-weight: 500; text-align: left;
}
.quality-option:hover:not(:disabled) { background: rgb(255 255 255 / 0.08); }
.quality-option small { color: var(--stone-400); font-size: var(--fs-xs); font-weight: 400; }
/* The name sits by its tick, the note at the far end. */
.quality-option > span { flex: 1; }
.quality-option[aria-checked="true"] { color: var(--amber-400); }
.quality-option[aria-checked="true"]::before { content: '✓'; margin-right: -6px; }
.quality-now {
  margin: 6px 10px 2px; padding-top: 8px;
  border-top: 1px solid rgb(255 255 255 / 0.1);
  font-size: var(--fs-xs); color: var(--stone-400);
}

/* --- the addresses a TV can use ------------------------------------------ */

.address-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.address-list li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.address-list code { font-size: var(--fs-xs); }
.address-list .where {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--faint);
  min-width: 8ch;
}
.address-list .where.vpn { color: var(--text); }
/* Words written in lower case where they come from. */
.related-why::first-letter, .address-list .where::first-letter, .stream-state::first-letter, .stream-mode::first-letter { text-transform: uppercase; }

/* --- remote access ------------------------------------------------------ */

.remote-status { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); }
.remote-status .spacer { flex: 1; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.status-dot[data-state="online"] { background: var(--good); }
.status-dot[data-state="connecting"] { background: var(--amber-500); }
.status-dot[data-state="error"] { background: var(--danger); }
.connect-out {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.connect-out p { font-size: var(--fs-xs); margin: 8px 0 0; }
.connect-link { display: flex; gap: 8px; }
.connect-link input { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.connect-code {
  display: block; margin-top: 10px; font-size: var(--fs-xs); letter-spacing: 0.04em;
  word-break: break-all; color: var(--text-strong); background: none; padding: 0;
}
.router-line { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); }
.router-line .status-dot { margin-top: 6px; }
.router-line p { margin: 0; line-height: 1.5; }
/* Lined up with the text above it, past the dot. */
.router-note { margin: 6px 0 0 19px; font-size: var(--fs-xs); line-height: 1.5; }
.router-note.warn { color: var(--text); }
.router-note.warn::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--amber-500); vertical-align: 1px; }
.router-line + .check, .router-note + .check { margin-top: 10px; }
#remote-code-form select { min-width: 0; }

/* --- sideways rows ------------------------------------------------------
 * No scrollbar: the arrows, the wheel and swiping move them (see makeRail
 * in app.js). Cards snap to a clean edge when a swipe or a page stops.
 */
.rail { position: relative; }
.continue-row, .people-row, .related-row {
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 2px;
}
.continue-row::-webkit-scrollbar, .people-row::-webkit-scrollbar, .related-row::-webkit-scrollbar { display: none; }
.cw-card, .person, .related-card { scroll-snap-align: start; }
/*
 * With a mouse or trackpad a row is slid, not scrolled (see makeRail): the
 * window crops it, with room above and below for the lift on hover, and the
 * row is as wide as its cards, one layer moved as a piece. Safari scrolling
 * these rows left the posters' pictures behind their titles.
 */
.rail-view {
  overflow: hidden;
  overflow: clip;
  padding: 8px 2px 10px; margin: -8px -2px -10px;
}
.rail-view > .sliding {
  overflow: visible;
  padding: 0; margin: 0;
  width: max-content; min-width: 100%;
  scroll-snap-type: none;
  will-change: transform;
}

/* --- films by kind ------------------------------------------------------
 * Rows of posters above the grid of everything (see paintShelves in app.js),
 * the same cards as the grid, sliding sideways like Continue watching.
 */
.film-shelves { margin-bottom: 40px; }
.film-shelf + .film-shelf { margin-top: 30px; }
/* The same heading as Continue watching and All films: the rows were small
   grey labels beside them and easy to miss (26 Nov). */
.film-shelf h2 { margin-bottom: 14px; }
.shelf-row {
  display: flex; gap: 22px;
  overflow-x: auto;
  /* Room for the lift on hover, as .continue-row. */
  padding: 8px 2px 10px; margin: -8px -2px -10px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 2px;
}
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row .card { flex: 0 0 165px; width: 165px; scroll-snap-align: start; }
/* The picture rounds its own corners rather than relying on the clip. */
.shelf-row .card-art img { border-radius: calc(0.75rem - 1px); }
@media (max-width: 640px) {
  .film-shelves { margin-bottom: 28px; }
  .film-shelf + .film-shelf { margin-top: 22px; }
  .shelf-row { gap: 14px; }
  .shelf-row .card { flex-basis: 118px; width: 118px; }
}

.rail-arrow {
  position: absolute; top: 50%; z-index: 3;
  width: 40px; height: 40px; margin-top: -20px; padding: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--hairline);
  box-shadow: var(--elev-2);
  opacity: 0;
  transition: opacity 180ms var(--ease-editorial), background-color 180ms var(--ease-editorial);
}
.rail-arrow.back { left: -12px; }
.rail-arrow.forward { right: -12px; }
.rail-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rail:hover .rail-arrow, .rail-arrow:focus-visible { opacity: 1; }
.rail-arrow:hover:not(:disabled) { background: var(--select-bg); color: var(--select-fg); border-color: transparent; }
/* Continue watching: centred on the pictures, not the whole row. */
.continue-band .rail-arrow { top: calc(50% - 1px); }
/* Touch screens swipe; arrows that only show on hover would never show. */
@media (hover: none) { .rail-arrow { display: none; } }

/* --- server status ------------------------------------------------------ */

.status-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.status-tile {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--elev-1);
  min-width: 0;
}
.status-label {
  font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
}
.status-value {
  font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em;
  color: var(--text-strong); margin-top: 4px; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.status-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

.status-graph {
  margin-top: 12px; background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 12px 14px 10px; box-shadow: var(--elev-1);
}
.status-graph svg { display: block; width: 100%; height: 96px; }
/* --- status: Now and History (see paintHistory in app.js) ----------------- */
/* One segmented control for every "this or that" choice: Status's Now and
   History, its days, the music filter. Chosen is light on dark (see
   .library-tab), never gold. */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-pill);
}
.segmented button {
  border: 0; background: none; box-shadow: none; padding: 6px 14px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
}
.segmented button:hover:not(:disabled) { background: none; color: var(--text-strong); }
.status-tabs { margin: 4px 0 16px; }

.history-days { margin: 0 0 14px; }

.history-people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.history-person {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-width: 120px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md); font-size: var(--fs-sm);
}
.history-person span { color: var(--muted); font-size: var(--fs-xs); }
.history-person.live { border-color: var(--amber-500); }

.history-timeline { margin-bottom: 18px; }
.history-hours { position: relative; height: 16px; margin-left: 96px; font-size: var(--fs-xs); color: var(--muted); }
.history-hours span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.history-hours span:first-child { transform: none; }
.history-row { display: flex; align-items: center; gap: 8px; height: 26px; }
.history-row-label { flex: 0 0 88px; font-size: var(--fs-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-track {
  position: relative; flex: 1; height: 14px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--hairline);
  /* Faint marks every six hours, so a bar's time can be judged by eye. */
  background-image: linear-gradient(90deg, transparent calc(25% - 1px), var(--hairline) 25%, transparent calc(25% + 1px),
    transparent calc(50% - 1px), var(--hairline) 50%, transparent calc(50% + 1px),
    transparent calc(75% - 1px), var(--hairline) 75%, transparent calc(75% + 1px));
}
.history-bar { position: absolute; top: 1px; bottom: 1px; border-radius: var(--r-pill); min-width: 4px; }
.history-bar.watch { background: var(--amber-500); }
.history-bar.listen { background: #38bdf8; }
.history-bar.live { box-shadow: 0 0 0 2px rgb(233 162 59 / 0.35); }
.history-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); opacity: 0.55; border-radius: 1px; }
.history-now { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1px dashed var(--muted); }

.history-list section + section { margin-top: 14px; }
.history-list h3 { margin: 0 0 8px; }
.history-list ol { list-style: none; margin: 0; padding: 0; }
.history-item {
  display: grid; grid-template-columns: 112px 22px minmax(0, 1fr); align-items: start; gap: 6px;
  padding: 8px 0; border-top: 1px solid var(--hairline); font-size: var(--fs-md);
}
.history-when { color: var(--muted); font-size: var(--fs-xs); padding-top: 2px; font-variant-numeric: tabular-nums; }
.history-icon { text-align: center; color: var(--muted); }
.history-item.watch .history-icon { color: var(--amber-500); }
.history-item.listen .history-icon { color: #38bdf8; }
.history-meta { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.history-live {
  display: inline-block; padding: 1px 7px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700;
  background: var(--amber-500); color: #1c1917; vertical-align: 1px;
}
@media (max-width: 560px) {
  .history-item { grid-template-columns: 74px 18px minmax(0, 1fr); }
  .history-row-label { flex-basis: 64px; }
  .history-hours { margin-left: 72px; }
}

/* Behind the scenes (see paintWork in app.js). */
.status-work {
  margin: 12px 0 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
}
.status-work h3 { margin: 0 0 8px; }
.work-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.work-head { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); margin-bottom: 5px; }
.work-detail { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-bar { position: relative; height: 8px; border-radius: var(--r-pill); background: var(--hairline); overflow: hidden; }
.work-fill { position: absolute; top: 0; bottom: 0; border-radius: var(--r-pill); transition: width 600ms var(--ease-editorial), left 600ms var(--ease-editorial); }
.work-fill.prep { background: var(--amber-500); }
.work-fill.convert { background: #38bdf8; }
.work-fill.copy { background: #34d399; }
.work-fill.scan { background: var(--stone-400); }
.work-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text); }

/* Status from away, and what needs someone (see paintAttention in app.js). */
.status-away { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); }
.status-attention {
  margin: 0 0 12px; padding: 12px 14px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--r-md);
}
.status-attention h3 { margin: 0 0 6px; color: var(--danger); }
.status-attention ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); display: grid; gap: 4px; }

/* Films being made ready for full quality (see paintPrep in app.js). */
.status-prep {
  margin: 12px 0 0; padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  font-size: var(--fs-sm); color: var(--text);
}
.status-graph path.grid { stroke: var(--hairline); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.status-graph path.home { fill: var(--stone-400); opacity: 0.55; }
.status-graph path.away { fill: var(--amber-500); opacity: 0.85; }
.status-legend { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); }
.status-legend .spacer { margin-left: auto; }
.status-legend .key::before {
  content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px;
}
.status-legend .key.home::before { background: var(--stone-400); }
.status-legend .key.away::before { background: var(--amber-500); }

.stream-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
  /* One column the width of the card, so a long title shortens instead of
     pushing the row off the side. */
  grid-template-columns: minmax(0, 1fr);
}
.stream-list li.muted {
  border: 1px dashed var(--hairline); border-radius: var(--r-sm);
  padding: 18px 14px; text-align: center; font-size: var(--fs-md);
}
.stream {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 12px; box-shadow: var(--elev-1);
}
.stream-poster {
  width: 54px; aspect-ratio: var(--poster); object-fit: cover; flex: none;
  border-radius: var(--r-xs); background: var(--hairline);
}
/* An album cover, square, where a film has its poster. */
.stream-poster.square { aspect-ratio: 1; }
.stream-body { flex: 1; min-width: 0; }
.stream-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.stream-title {
  font-weight: 600; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.stream-top .muted { font-size: var(--fs-sm); flex: none; }
/* Artist and album can be long: they give way before the title does. */
.stream-top .stream-artist { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-state {
  margin-left: auto; flex: none; align-self: center;
  border-radius: var(--r-pill); padding: 2px 9px;
  font-size: var(--fs-xs); font-weight: 600;
  background: var(--hairline); color: var(--muted);
}
.stream-state.playing { background: var(--accent); color: var(--on-accent); }
.stream-who { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.stream-who strong { color: var(--text); font-weight: 600; }
.stream-where {
  margin-left: 8px; padding: 1px 7px; border-radius: var(--r-pill); font-size: var(--fs-xs);
  border: 1px solid var(--hairline); white-space: nowrap;
}
.stream-where.away { color: var(--text); }
.stream-bar { height: 4px; border-radius: var(--r-pill); background: var(--hairline); margin: 10px 0 6px; overflow: hidden; }
.stream-bar > div { height: 100%; background: var(--amber-500); border-radius: inherit; transition: width 1.8s linear; }
.stream-meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stream-rate { margin-left: auto; color: var(--text); font-weight: 500; }

@media (max-width: 640px) {
  .status-tiles { grid-template-columns: minmax(0, 1fr); }
  .status-tile { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; }
  .status-value { font-size: var(--fs-xl); margin-top: 0; }
  .status-label { flex-basis: 100%; }
  .stream-poster { width: 42px; }
  .stream-rate { margin-left: 0; }
  /* The artist and album on a line of their own: beside the title they cut
     it to a few letters ("Low Ti…"). */
  .stream-top { flex-wrap: wrap; row-gap: 2px; }
  .stream-top .stream-title { flex: 1 1 0; }
  .stream-top .stream-artist { order: 3; flex: 1 1 100%; }
}
.stream-poster[hidden] { display: none; }
.stream-how { display: inline-flex; align-items: center; gap: 6px; }
.stream-mode {
  border-radius: var(--r-xs); padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; line-height: 17px;
  background: var(--hairline); color: var(--text);
}


/* How many are watching, on the Status button. */
#btn-status { position: relative; }
.nav-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: var(--r-pill); background: var(--amber-500); color: #1c1917;
  font-size: var(--fs-xs); font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  font-variant-numeric: tabular-nums;
}

/* --- large monitors -------------------------------------------------------
 * Sizes here are in pixels, which on a 1440p or 4K monitor left the page a
 * small island in the middle. On big screens the whole page is drawn larger,
 * in steps, and allowed wider. A step needs the height as well as the width:
 * by width alone a 5120 × 2160 ultrawide was zoomed like a tall 4K screen,
 * and the page felt blown up, with little of it in view top to bottom. Each
 * step leaves at least about 1050 px of height and 1850 px of width as the
 * page sees them.
 */
@media (min-width: 2200px) {
  main { max-width: 2200px; }
}
@media (min-width: 2200px) and (min-height: 1260px) {
  html { zoom: 1.2; }
}
@media (min-width: 2600px) and (min-height: 1470px) {
  html { zoom: 1.4; }
}
@media (min-width: 3000px) and (min-height: 1680px) {
  html { zoom: 1.6; }
}

/* --- watch together (see together.js) --------------------------------------- */

/* The live dot: green in step, amber while screens catch up or get ready. */
.together-dot {
  flex: none; width: 8px; height: 8px; border-radius: var(--r-pill);
  background: #9cbf7a; box-shadow: 0 0 0 0 rgb(156 191 122 / 0.55);
  animation: together-pulse 2.2s ease-out infinite;
}
.together-dot.warn { background: var(--amber-500); box-shadow: 0 0 0 0 rgb(233 162 59 / 0.55); animation-name: together-pulse-amber; }
.together-dot.still { animation: none; }
@keyframes together-pulse { 0% { box-shadow: 0 0 0 0 rgb(156 191 122 / 0.55); } 70%, 100% { box-shadow: 0 0 0 7px rgb(156 191 122 / 0); } }
@keyframes together-pulse-amber { 0% { box-shadow: 0 0 0 0 rgb(233 162 59 / 0.55); } 70%, 100% { box-shadow: 0 0 0 7px rgb(233 162 59 / 0); } }
@media (prefers-reduced-motion: reduce) { .together-dot { animation: none; } }

/* The banner over the library: the film, who is watching, how far in. */
.together-banner {
  display: flex; align-items: center; gap: 16px;
  margin: 0 0 24px; padding: 12px 14px 12px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow: var(--elev-1);
}
.together-banner[hidden] { display: none; }
.tb-art {
  flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: var(--r-sm);
  background: var(--surface-2) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.tb-text { flex: 1; min-width: 0; }
.tb-eyebrow {
  display: flex; align-items: center; gap: 8px; margin: 0 0 3px;
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted);
}
.tb-title { margin: 0; font-size: var(--fs-lg); font-weight: 650; line-height: 1.3; text-transform: none; letter-spacing: -0.01em; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-who { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-bar { height: 3px; margin-top: 9px; border-radius: var(--r-pill); background: var(--hairline); overflow: hidden; max-width: 360px; }
.tb-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--amber-500); transition: width 600ms var(--ease-editorial); }
.tb-join { flex: none; }
@media (max-width: 560px) {
  .together-banner { flex-wrap: wrap; }
  .tb-art { width: 84px; }
  .tb-join { width: 100%; justify-content: center; }
  .tb-who { white-space: normal; }
}

/* The film's page: a session already on for it. */

#detail-together .together-dot { margin-right: 2px; }

/* The button in the player. */
.together-button-dot { display: none; width: 7px; height: 7px; }
#together.active .together-button-dot { display: block; }


/* The panel. Always on the dark of the player. */
.together-menu { width: 320px; max-width: calc(100vw - 32px); padding: 6px; }
.together-off { padding: 14px 12px 10px; text-align: left; }
.together-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-md);
  background: rgb(255 255 255 / 0.08); color: #fafaf9;
}
.together-badge svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.together-off h3 { margin: 12px 0 4px; font-size: var(--fs-lg); font-weight: 650; color: #fafaf9; text-transform: none; letter-spacing: -0.01em; }
.together-off p { margin: 0 0 14px; font-size: var(--fs-sm); line-height: 1.5; color: var(--stone-300); }
.together-primary {
  width: 100%; justify-content: center; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--accent); border: 0; box-shadow: none;
  color: var(--on-accent); font-size: var(--fs-md); font-weight: 650;
}
.together-primary:hover:not(:disabled) { background: #f4b860; }

.together-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 10px; }
.together-head .together-dot { width: 10px; height: 10px; }
.together-head-text { display: flex; flex-direction: column; min-width: 0; }
.together-head-text strong { font-size: var(--fs-md); font-weight: 650; color: #fafaf9; }
.together-head-text small { font-size: var(--fs-xs); color: var(--stone-400); }

.together-members { list-style: none; margin: 0; padding: 2px 0 6px; }
.together-member {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; border-radius: var(--r-sm);
}
.together-member.you { background: rgb(255 255 255 / 0.05); }
.tm-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: rgb(255 255 255 / 0.07); color: var(--stone-300);
}
.tm-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tm-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tm-name strong { font-size: var(--fs-md); font-weight: 600; color: #fafaf9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-name small { font-size: var(--fs-xs); color: var(--stone-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-state {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 500; color: var(--stone-300); font-variant-numeric: tabular-nums;
}
.tm-state::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--stone-500); }
.tm-state.ok { color: #b8d49a; }
.tm-state.ok::before { background: #9cbf7a; }
.tm-state.near, .tm-state.wait { color: var(--amber-300); }
.tm-state.near::before, .tm-state.wait::before { background: var(--amber-500); }
.tm-state.leads {
  padding: 3px 8px; border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.1); color: #fafaf9;
}
.tm-state.leads::before { display: none; }

.together-delay {
  display: flex; align-items: center; gap: 12px;
  margin: 0 4px; padding: 11px 6px;
  border-top: 1px solid rgb(255 255 255 / 0.08);
}
.together-delay-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.together-delay-text span { font-size: var(--fs-sm); font-weight: 600; color: #fafaf9; }
.together-delay-text small { font-size: var(--fs-xs); color: var(--stone-400); line-height: 1.35; }
.together-stepper {
  flex: none; display: inline-flex; align-items: center;
  padding: 2px; border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.1);
}
/* The signs are drawn, not typed: a font's − and + sit off the middle. */
.together-stepper button {
  flex: none; justify-content: center;
  width: 28px; height: 28px; padding: 0; border-radius: var(--r-pill);
  background: transparent; border: 0; box-shadow: none; color: #fafaf9;
}
.together-stepper button:hover:not(:disabled) { background: rgb(255 255 255 / 0.1); }
.together-stepper button svg { width: 14px; height: 14px; stroke-width: 2; stroke-linecap: round; }
.together-stepper output {
  min-width: 52px; text-align: center;
  font-size: var(--fs-sm); font-weight: 600; color: #fafaf9; font-variant-numeric: tabular-nums;
}

.together-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 4px; padding: 9px 6px 6px;
  border-top: 1px solid rgb(255 255 255 / 0.08);
}
.together-foot small { font-size: var(--fs-xs); color: var(--stone-500); font-variant-numeric: tabular-nums; }
.together-leave {
  padding: 6px 11px; border-radius: var(--r-pill); gap: 6px;
  background: transparent; border: 1px solid rgb(255 255 255 / 0.14); box-shadow: none;
  color: var(--stone-200, #e7e5e4); font-size: var(--fs-sm); font-weight: 600;
}
.together-leave svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.together-leave:hover:not(:disabled) { background: rgb(248 113 113 / 0.12); border-color: rgb(248 113 113 / 0.45); color: #fca5a5; }
/* On a phone the panel spans the screen above the buttons, rather than
   hanging off its own button (which sits left of the others) and off the edge. */
@media (max-width: 560px) {
  #together-menu {
    position: fixed; left: 12px; right: 12px; bottom: 120px;
    width: auto; max-width: none;
    max-height: calc(100vh - 180px); max-height: calc(100dvh - 180px); overflow-y: auto;
  }
}

/* --- the folder notice: one line, the rest under Details ------------------- */
.notice.offline { flex-wrap: nowrap; gap: 12px; padding: 8px 8px 8px 16px; }
.notice.offline p { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice.offline:not(.open) .offline-more { display: none; }
.notice.offline.open { align-items: flex-start; }
.notice.offline.open p { white-space: normal; padding: 6px 0; }
.offline-details { flex: none; font-size: var(--fs-sm); padding: 6px 10px; }

/* --- a phone ------------------------------------------------------------------ */
.tab-icon { display: none; }
@media (max-width: 640px) {
  /* The libraries: a bar along the foot of the screen, where the thumb is,
     each with its icon over its name; the music bar sits just above it. */
  .library-tabs, .continue-band .library-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0;
    display: flex; flex-wrap: nowrap; gap: 0; overflow-x: auto; scrollbar-width: none;
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-top: 1px solid var(--hairline);
  }
  .library-tabs::-webkit-scrollbar { display: none; }
  button.library-tab, button.library-tab:hover:not(:disabled) {
    flex: 1 0 72px; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px; padding: 6px 4px; border: 0; border-radius: var(--r-sm);
    background: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 500;
  }
  button.library-tab[aria-selected="true"], button.library-tab[aria-selected="true"]:hover:not(:disabled) {
    background: none; color: var(--text-strong); font-weight: 600;
  }
  .library-tab .count { display: none; }
  .tab-icon { display: block; width: 24px; height: 24px; }
  .tab-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .library-tab[aria-selected="true"] .tab-icon svg { stroke-width: 2.2; }
  .tab-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app:has(#library-tabs:not([hidden])) main { padding-bottom: 84px; }
  body:has(#library-tabs:not([hidden])) .music-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.has-music-bar:has(#library-tabs:not([hidden])) main { padding-bottom: 236px; }
  body:has(#library-tabs:not([hidden])) .toast,
  body:has(#library-tabs:not([hidden])) .queue,
  body:has(#library-tabs:not([hidden])) .queue-pill { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.has-music-bar:has(#library-tabs:not([hidden])) .toast,
  body.has-music-bar:has(#library-tabs:not([hidden])) .queue { bottom: 230px; }
  /* The band, with its tabs gone to the foot and nothing else in it, folds
     away. It is no layer of its own here, or the bar at the foot, inside
     it, was drawn under the posters further down the page. */
  .continue-band.tabs-only { padding: 0; margin: 0 0 8px; }
  .continue-band { isolation: auto; }

  /* A heading has its line; the menus beside it go on the next. */
  .section-head { flex-wrap: wrap; row-gap: 10px; }
  .section-head h2 { flex: 1 0 100%; }

  /* Room for a thumb. */
  .modal-close { width: 44px; height: 44px; justify-content: center; }
  .cw-remove { width: 40px; height: 40px; font-size: var(--fs-lg); }
  button.track-info { width: 44px; height: 44px; justify-content: center; }

}

/* A long folder path, shortened in the middle (see pathTailAt in app.js). */
.folder-row .folder-path.split { display: flex; min-width: 0; white-space: nowrap; word-break: normal; }
.folder-path.split .head { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.folder-path.split .tail { flex: none; }
/* The banner's title a step up the scale on a wide screen. */
@media (min-width: 1200px) { .continue-band .fh-title { font-size: var(--fs-3xl); } }

/* The name in two tones, as on the app icon: Couch in white, break in amber. */
.logo-name b { font-weight: inherit; color: #f59e0b; }

/* --- Settings ---------------------------------------------------------------
 * One window with its parts down the side (see SETTINGS in app.js): You,
 * People, TVs, Away from home, Libraries, Server, Status. Each part is its
 * own window underneath, all wearing the same side, so it reads as one.
 */
/*
 * One size whatever part is showing, the part scrolling inside it: each part
 * is its own window underneath, and the window resized to each one's height
 * as you moved between them, jumping up and down the screen (27 Nov).
 */
.settings-card {
  width: min(1040px, 100%);
  height: min(780px, calc(100vh - 48px));
  padding: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.modal:has(> .settings-card) { overflow: hidden; }
.settings-nav {
  padding: 22px 12px;
  border-right: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  overflow-y: auto;
}
/* The links stay in view as a long part scrolls. */
.settings-links { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 22px; }
.settings-title {
  margin: 0 0 12px; padding: 0 12px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--muted);
}
.settings-nav button {
  display: flex; align-items: center; gap: 11px; justify-content: flex-start;
  width: 100%; padding: 9px 12px;
  background: none; border: 0; border-radius: var(--r-md);
  color: var(--muted); font: inherit; font-size: var(--fs-md); font-weight: 500; box-shadow: none;
  text-align: left; cursor: pointer;
}
.settings-nav button svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.settings-nav button:hover { background: var(--surface-2); color: var(--text); }
.settings-nav button[aria-current="page"] { background: var(--surface-2); color: var(--text-strong); }
.settings-nav button[aria-current="page"] svg { color: var(--accent); }
.settings-nav button[hidden] { display: none; }
.settings-body { padding: 28px 32px 32px; min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
/* A part comes in with a short fade, rather than appearing all at once. */
.settings-body.arriving { animation: settings-arrive 0.18s ease-out; }
@keyframes settings-arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .settings-body.arriving { animation: none; } }
.settings-body > h2, .settings-pane > h2 { font-size: var(--fs-xl); margin: 0 0 6px; }
.settings-card .modal-close { top: 16px; right: 16px; }

/* A line under a part's title, and quiet notes under a setting. */
.pane-lead { margin: 0 0 6px; color: var(--muted); font-size: var(--fs-md); }
.settings-body .hint { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.setting-state { margin: 0 0 8px; color: var(--text); font-size: var(--fs-sm); }
.check + .setting-state { margin-top: 6px; }

/* The long explanations, folded: there when wanted, not in the way. */
.more-about { margin-top: 10px; font-size: var(--fs-sm); color: var(--muted); }
.more-about summary {
  cursor: pointer; width: fit-content; list-style: none;
  color: var(--muted); font-size: var(--fs-sm);
}
.more-about summary::-webkit-details-marker { display: none; }
.more-about summary::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 9px 2px 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
.more-about[open] summary::before { transform: rotate(45deg); }
.more-about summary:hover { color: var(--text); }
.more-about p { margin: 8px 0 0; line-height: 1.55; }

/* People: one Manage button a row, its actions on a line of their own. */
.people-list li { flex-wrap: wrap; }
.people-list .manage { flex: none; }
.person-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }
.person-actions[hidden] { display: none; }
button.danger.strong { color: var(--danger); }
.people-list form { flex-basis: 100%; margin: 0; }

/* Away from home: its state at the top, in one panel. */
.remote-summary {
  margin-top: 18px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  display: grid; gap: 10px;
}
.remote-summary .remote-detail { margin: 0 0 0 19px; font-size: var(--fs-xs); color: var(--muted); }
.remote-summary .remote-detail[hidden] { display: none; }
.remote-summary #remote-setup { display: grid; gap: 10px; }
.remote-summary #remote-setup[hidden] { display: none; }
.remote-summary .router-note { margin-top: -4px; }
.licence-line { align-items: center; }
.licence-line .status-dot { margin-top: 0; }
.licence-line p { flex: 1; }
.licence-line button { padding: 4px 10px; font-size: var(--fs-sm); }
.remote-summary #remote-activate { margin: 0; }

/* TVs: the address help folded under the steps. */
.settings-body .steps { margin-bottom: 12px; }
.more-about .address-list { margin-top: 8px; }
#remote-tv-off { margin-top: 28px; }

/* Status: the library at a glance, full width. */
.status-library h3 { margin-top: 24px; }
.status-facts {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
}
.status-facts li { padding: 10px 14px; font-size: var(--fs-sm); color: var(--text); }
.status-facts li + li { border-top: 1px solid var(--hairline); }
.status-facts li[hidden] { display: none; }

@media (max-width: 760px) {
  /* On a phone the side becomes a row of the parts across the top. */
  .settings-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 48px); }
  .settings-nav { min-height: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
  .settings-links {
    position: static; flex-direction: row;
    padding: 12px 52px 12px 12px; gap: 6px; width: max-content;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav { border-right: 0; border-bottom: 1px solid var(--hairline); border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .settings-title { display: none; }
  .settings-nav button { width: auto; flex: none; white-space: nowrap; padding: 8px 12px; }
  .settings-body { padding: 20px 18px 24px; }
  /* The × sits at the end of that row: the parts scroll under it, not through it. */
  .settings-card .modal-close { top: 9px; right: 8px; background: var(--surface); box-shadow: -14px 0 12px var(--surface); }
}

/* --- the demo's way in (gate-demo in index.html) --------------------------- */
.gate-demo { display: grid; gap: 12px; margin: 4px 0 6px; }
.gate-demo[hidden] { display: none; }
.gate-demo-text { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.gate-demo-or { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: var(--fs-xs); }
#account-demo { margin-top: 14px; }
/* Its credits: folded away on the sign-in card, one a line in the footer. */
.demo-credits { color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.demo-credits summary { cursor: pointer; width: max-content; margin: 0 auto; }
.demo-credits summary:hover { color: var(--text); }
.demo-credits .demo-credits-lines { display: grid; gap: 6px; margin-top: 10px; text-align: left; }
.demo-credits a, #demo-credit a { color: inherit; }
#demo-credit { display: grid; gap: 2px; margin-top: 8px; }
#demo-credit[hidden] { display: none; }
.demo-credit-line { display: block; }
