/* Every colour, font and shape comes from the active theme (js/theme.js sets these from a theme
   file). The values below are Aurora's colours (the default theme), used until the theme loads and when
   there is no server to ask (the sign-in before one is connected, and offline). */
:root {
  --bg: #0B0B1A; --surface: #07070F; --raised: #1D1C35; --line: #36345C; --text: #EDEBFF; --muted: #B0ADD6;
  --accent: #7CF0B0; --on-accent: #0B2A1B; --danger: #FF8FA3; --warn: #F2D16B;
  --container: #13122A; --on-container: #EDEBFF; --tonal: #2F2758; --on-tonal: #E4DBFF;
  --night-bg: #0B0B1A; --night-surface: #07070F; --night-raised: #1D1C35; --night-line: #36345C; --night-text: #EDEBFF;
  --night-muted: #B0ADD6; --night-accent: #7CF0B0; --night-on-accent: #0B2A1B; --night-danger: #FF8FA3; --night-warn: #F2D16B;
  --font-display: 'Josefin Sans', Geist, system-ui, sans-serif; --font-body: Geist, system-ui, sans-serif; --font-mono: ui-monospace, Consolas, monospace;
  --radius: 12px; --radius-lg: 22px; --control-radius: 28px; --media-radius: 14px;
  --button-case: none; --button-tracking: 0.02em; --title-weight: 300; --title-style: normal; --title-tracking: 0.02em;
  /* Older names, kept so every rule reads from the theme. */
  --night: var(--bg); --booth: var(--surface); --rule: var(--line); --paper: var(--text); --mist: var(--muted); --lamp: var(--accent);
  --marquee: var(--font-display); --body: var(--font-body);
  --gutter: clamp(1rem, 3vw, 2.5rem);
  /* The focus ring: the site design's own colour (design.js sets --focus) or the theme's accent.
     Every ring reads this, on TVs too. */
  --ring: var(--focus, var(--accent));
  /* Colours that mean the same in every theme: live (broadcast red), all well and away from
     home. Day themes get darker ones that read on light backgrounds. */
  --live: #e0443e; --ok: #9fd1a8; --ok-dot: #8fd19e; --away: #6f9be6;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
/* A <details> element's content hangs from a slot the browser makes, which the rule above can't
   reach, so menus in one (the account menu, More) were measured without their padding. */
details > :not(summary) { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 1rem/var(--line-height, 1.5) var(--font-body); -webkit-font-smoothing: antialiased; }
:where(button, input, select, textarea) { font: inherit; color: inherit; }
a { color: inherit; }
:root[data-scheme="light"] { --ok: #236b3a; --ok-dot: #3a9d5d; --away: #3563b5; }
:focus-visible { outline: 2px solid var(--ring); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--title-weight); font-style: var(--title-style); letter-spacing: var(--title-tracking); line-height: 1.15; }

/* Buttons, chips, fields, menus and dialogs are one set, in material.css. */
.muted { color: var(--mist); }
.small { font-size: var(--type-small); }

/* Read by screen readers, not shown. */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Header */
.top { display: flex; align-items: center; padding: 1rem var(--gutter); }
.wordmark { font: var(--title-weight) 2.1rem/1 var(--font-display); letter-spacing: -0.01em; color: var(--paper); text-decoration: none; margin: 0; }
.nav { display: flex; gap: 1.1rem; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--mist); text-decoration: none; font: 600 var(--type-small)/1 var(--font-body); text-transform: var(--button-case); letter-spacing: var(--button-tracking); padding: 0.4rem 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--paper); }
.nav a[aria-current="page"] { color: var(--paper); border-bottom-color: var(--paper); }
.search-form { margin-left: auto; flex: 0 1 18rem; min-width: 0; }
.search, .field :is(input:not([type="checkbox"], [type="radio"]), textarea), .inline-form input, input.link, textarea { width: 100%; }
select { width: auto; }
.me { display: flex; align-items: center; gap: 0.75rem; color: var(--mist); white-space: nowrap; }
.me a { text-decoration: none; }
.me a:hover { color: var(--paper); }

.page { padding: 0 0 3rem; }
.section { padding: 0.75rem var(--gutter) 1.75rem; }
.section > h2 { margin: 0 0 0.9rem; }
.section > h2 a { text-decoration: none; }
.section > h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.status { margin: 0 var(--gutter) 0.75rem; color: var(--mist); }

/* Rows and grids */
.row { display: grid; grid-auto-flow: column; gap: 2rem; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 0.6rem; scrollbar-width: none; overscroll-behavior-x: contain; }
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row.posters { grid-auto-columns: clamp(8.5rem, 14vw, 11rem); }
.row.wide { --wide-track: clamp(14rem, 24vw, 19rem); grid-auto-columns: var(--wide-track); }
/* A wide row holding music (a Home row such as My list set to wide): music's square card is as tall as the wide
   pictures beside it, as the TV app draws it, so the row keeps its height. Each rule that sizes a wide row's cards
   names its width --wide-track (home.css, look.css, tv.css).
   A wide row's children are all cards (.card): the rule names them, and must not say "> *". After a :has() that is
   not on the rule's own subject, "any element" makes the browser restyle the whole page whenever any text on it is
   written again, which the music player does four times a second while a song plays. */
.row.wide:has(> .music-card) { display: flex; }
.row.wide:has(> .music-card) > .card { flex: none; width: var(--wide-track); }
.row.wide:has(> .music-card) > .music-card { width: calc(var(--wide-track) * 9 / 16); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 2.6rem 2rem; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

/* Cards */
.card { display: block; text-decoration: none; min-width: 0; }
.card:focus-visible { outline: none; }
.card:focus-visible .art { outline: 2px solid var(--ring); outline-offset: 3px; }
/* Posters always get a slight round, even in square-cornered themes: hard corners on artwork read as harsh. */
.art { position: relative; background: var(--booth); overflow: hidden; }
.poster .art { aspect-ratio: 2 / 3; }
.wide .art, .episode .art { aspect-ratio: 16 / 9; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .art img { filter: brightness(1.1); }
/* Missing artwork shares the native card's centered decorative initial. */
.art .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0.75rem;
  font: var(--title-weight) 1.4rem/1.05 var(--font-display); font-style: var(--title-style); color: var(--text);
  background: var(--raised); border: 1px solid var(--line);
}
.card h3 { font: 600 var(--type-note)/1.3 var(--font-body); letter-spacing: 0; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card p { margin: 0; font-size: var(--type-caption); color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Marks on a card's picture (docs/ui-consistency.md, Card marks), 8 px from its edges, the same on
   the web and in the native app: the count (unwatched episodes, versions) is a compact box at the
   upper right, a state (Watched, Finished, Completed) the same box at the lower left (.mark), the
   progress bar runs along the foot, and select mode's tick (select.css) has the upper left. */
.badge {
  position: absolute; z-index: 1; top: 0.5rem; right: 0.5rem; box-sizing: border-box; display: grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 0.4rem;
  border-radius: 4px; background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--paper);
  font-size: var(--type-tiny); font-weight: 700; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.badge.mark { top: auto; right: auto; bottom: 0.5rem; left: 0.5rem; font-weight: 600; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--bg) 75%, transparent); }
.progress span { display: block; height: 100%; background: var(--lamp); }

/* Cast */
.row.people { grid-auto-columns: 7.5rem; }
.person { text-align: center; }
.face { width: 6.5rem; height: 6.5rem; margin: 0 auto; border-radius: 50%; overflow: hidden; background: var(--booth); display: grid; place-items: center; font: var(--title-weight) 1.5rem/1 var(--font-display); color: var(--mist); }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face.large { width: 9rem; height: 9rem; margin: 0; font-size: 2.2rem; }
.person h3 { font-size: var(--type-note); white-space: normal; }
.person p { white-space: normal; }
.person-head { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; margin-bottom: 2rem; }
.person-head h1 { margin: 0 0 0.3rem; font-size: 2.2rem; }
.person-head > div { min-width: 0; }
@media (max-width: 640px) {
  /* A library's name wraps in its own column, so Select stays at the top right beside it whatever the name's
     length, with the count under the name (in a row that wraps, a name of middling length left Select a line of
     its own). */
  .toolbar > h1 { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
  html:not(.tv) .toolbar:has(> .select-toggle) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .25rem .75rem; }
  /* Whatever else is in it has a line of its own: the parts a toolbar with Select holds, each by its name (a part
     added to one needs its name here). Never "> *": after a :has() that is not on the rule's own subject, "any
     element" makes the browser restyle the whole page whenever any text on it is written again (a player's clock,
     four times a second while a song plays). :where() keeps the rule as weak as it was, so the lines below still win. */
  html:not(.tv) .toolbar:has(> .select-toggle) > :where(h1, .count, .kicker, .card-size, .ghost, .primary, .pill-action, .select-toggle) { grid-column: 1 / -1; }
  html:not(.tv) .toolbar:has(> .select-toggle) > h1 { grid-column: 1; grid-row: 1; }
  html:not(.tv) .toolbar:has(> .select-toggle) > .count { grid-column: 1; grid-row: 2; margin: 0; }
  html:not(.tv) .toolbar:has(> .select-toggle) > .select-toggle { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; margin: 0; }
  /* A library's own extra (Requests, Music preferences) is a small pill at the right of the count's line, not a bar
     of its own above Sort and Filters, so the first titles start a line higher, as in the app. */
  html:not(.tv) .toolbar:has(> .select-toggle) > :is(a, button).ghost:not(.select-toggle) { grid-column: 2 / 4; grid-row: 2; justify-self: end; align-self: center; margin: 0;
    min-height: var(--control-h-sm); padding: 0 var(--control-pad-sm); font-size: var(--control-font-sm); }
  /* The pill has a column of its own beside Select's, so a pill wider than Select (Music preferences) takes its room from
     the count's line, never the name's: the name keeps all but Select's width and is not broken inside a word. */
  html:not(.tv) .toolbar:has(> .select-toggle):has(> :is(a, button).ghost:not(.select-toggle)) { grid-template-columns: minmax(0, 1fr) auto auto; }
  html:not(.tv) .toolbar:has(> .select-toggle):has(> :is(a, button).ghost:not(.select-toggle)) > h1 { grid-column: 1 / 3; }
  html:not(.tv) .toolbar:has(> .select-toggle):has(> :is(a, button).ghost:not(.select-toggle)) > .select-toggle { grid-column: 3; }
  .person-head { grid-template-columns: 5rem minmax(0, 1fr); gap: 1rem; }
  .person-head > .face.large { width: 5rem; height: 5rem; font-size: 1.75rem; }
  .person-head h1 { font-size: var(--type-page, 2rem); }
  .person-head > button { grid-column: 1 / -1; justify-self: start; margin-left: 0; }
}
.crew { color: var(--mist); margin: 0.75rem 0; }
.crew a { color: var(--paper); text-decoration: none; }
.crew a:hover { text-decoration: underline; text-underline-offset: 3px; }
.section.flush { padding-top: 1.5rem; }
.qr { width: 220px; height: 220px; border-radius: var(--radius); }
.codes { margin: 0.5rem 0 1rem; padding: 0.75rem 1rem; background: var(--night); border-radius: var(--radius); font-size: 1.05rem; line-height: 1.7; columns: 2; }
/* A page's title: the same size and place on every page (a library, My list, Live TV, playlists, search). */
.toolbar h1, .section > h1, .section-head h1, .live-head h1, .search-head h1 { margin: 0; font-size: var(--type-page, 2rem); line-height: 1.15; }
.section > h1:not(.visually-hidden) { margin-bottom: 1.25rem; }
/* Search's title sits where every other page's does (a site page's, under its banner, has more room). */
.page-head.search-head { padding-top: 0.75rem; }
/* The count sits beside the name, the same on a library's and the games' pages; the rest go right. */
.toolbar .count { margin-right: auto; color: var(--mist); font-size: var(--type-note); }
.sentinel { height: 1px; }
/* Nothing here yet: a quiet panel with a title and a line, where the titles would have been. */
.empty { box-sizing: border-box; max-width: 36rem; margin: 0.5rem 0; padding: 1.25rem 1.5rem; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--mist); line-height: 1.55; }
.empty .actions { margin-top: 0.9rem; }
/* The panel's button never sticks out of it: at large text on a phone its words go onto a second line. */
.empty .actions > :is(.primary, .ghost) { max-width: 100%; padding-block: 0.4rem; white-space: normal; }
.empty strong { display: block; color: var(--paper); font: var(--title-weight) 1.2rem/1.3 var(--font-display); font-style: var(--title-style); letter-spacing: var(--title-tracking); margin-bottom: 0.3rem; }
/* A short labelled note replaces a paragraph of explanation. The label is in text colour and
   bold, the edge carries the kind, so no kind depends on colour alone. Here, not in
   the admin's sheet: Downloads and About show notes too (admin-kit.js `note`). */
.note { --edge: var(--accent); margin: .75rem 0; padding: .55rem .9rem .55rem 1rem; border-radius: var(--radius); background: linear-gradient(var(--edge), var(--edge)) left / 3px 100% no-repeat, color-mix(in srgb, var(--edge) 9%, transparent); color: var(--text); font-size: var(--type-note); line-height: 1.5; }
.note-performance { --edge: var(--warn); }
.note-warning { --edge: var(--danger); }
.note-tip { --edge: var(--ok-dot); }
.note-label { margin-right: .15rem; font-size: var(--type-caption); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
/* A library page's titles that didn't load: why (for the first page), and Try again, where they
   would have been. */
.load-problem { padding: 0.5rem 0 1.5rem; }
.load-problem .empty { margin-bottom: 0.75rem; }

/* Detail pages: the backdrop is the one big moment, with the title and Play over it. */
/* Each part of the page animates in, which makes it its own layer: the hero and details sit
   above what follows so their menus open over it. */
.hero { position: relative; z-index: 3; min-height: clamp(18rem, 43vh, 28rem); display: flex; align-items: flex-end; }
.hero.plain { min-height: 0; }
.hero-bg { position: absolute; inset: 0; background: var(--booth) center 20% / cover no-repeat; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(to top, var(--bg) 4%, color-mix(in srgb, var(--bg) 70%, transparent) 40%, color-mix(in srgb, var(--bg) 15%, transparent) 80%),
  linear-gradient(to right, color-mix(in srgb, var(--bg) 85%, transparent), color-mix(in srgb, var(--bg) 35%, transparent) 55%, transparent 80%); }
.hero.plain .hero-bg { background: linear-gradient(160deg, var(--container), var(--bg) 70%); }
.hero-inner { position: relative; display: grid; grid-template-columns: clamp(9rem, 17vw, 15rem) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); padding: 2.5rem var(--gutter) 0; width: 100%; align-items: end; }
.hero.no-poster .hero-inner { grid-template-columns: minmax(0, 1fr); }
.hero-inner .art { aspect-ratio: 2 / 3; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4); }
.hero-info { display: grid; gap: 0.9rem; justify-items: start; min-width: 0; max-width: 52rem; }
.hero h1 { margin: 0; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.08; overflow-wrap: anywhere; text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero h1.long-title { font-size: clamp(1.6rem, 3.4vw, 2.5rem); }
.hero .kicker { margin: 0 0 -0.5rem; }
.meta { margin: 0; color: var(--mist); line-height: 1.8; }
/* An age rating (PG, M): one small box, on a title's page and in the banner alike. */
:is(.rating-box, .age-badge) { display: inline-flex; align-items: center; min-height: 1.375rem; padding: 0 0.4rem; border: 1px solid color-mix(in srgb, currentColor 55%, transparent); border-radius: 4px;
  font-size: var(--type-tiny); font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; vertical-align: 1px; }
.rating-box { margin-right: 0.75rem; }
.play-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
/* The one big button: a title's Play. Everything else on the page is the usual size. */
.primary.play-main { min-height: 3.25rem; padding: 0 1.8rem 0 1.4rem; gap: 0.55rem; font-size: 1rem; }
.primary.play-main > svg { width: 1.5rem; height: 1.5rem; }
.version-pick { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--mist); font-size: var(--type-caption); }
.version-pick select { max-width: min(22rem, 70vw); }
.resume-line { display: flex; align-items: center; gap: 0.75rem; width: min(26rem, 100%); color: var(--mist); font-size: var(--type-small); white-space: nowrap; }
.resume-bar { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 22%, transparent); overflow: hidden; }
.resume-bar span { display: block; height: 100%; background: var(--accent); }
/* A title's row of buttons, the same on every kind of page (detail-actions.js): My list, Shuffle,
   Trailer, Download, then More. A kind or a platform without any of them draws no row. */
.detail-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.detail-row:empty { display: none; }
/* The title's column is never wider than the title's side of the page: a row that doesn't wrap
   would otherwise widen it, and Play and the facts with it, past a phone's edge. */
.hero-info { grid-template-columns: minmax(0, 1fr); }
.hero-info > * { min-width: 0; max-width: 100%; }
/* The genres of the line of facts: where there is room (a tablet, a computer). */
@media (max-width: 44rem) { .meta-wide { display: none; } }
@media (max-width: 640px) {
  /* A phone's buttons are one row of tiles, each its icon over its label, so four fit with their
     words whole. A row of two or three stays at its tiles' own size. */
  :is(.hero, .pl-head) .detail-row { flex-wrap: wrap; width: 100%; gap: 0.4rem; }
  /* A tile is never narrower than its longest word: with large text the tiles take a second row, their words whole. */
  :is(.hero, .pl-head) .detail-row > .pill-action, :is(.hero, .pl-head) .detail-row > details.more { flex: 1 1 4.5rem; max-width: 6.5rem; min-width: min-content; }
  :is(.hero, .pl-head) .detail-row .pill-action { flex-direction: column; justify-content: center; gap: 0.3rem; min-height: 3.75rem; padding: 0.5rem 0.3rem;
    font-size: var(--type-tiny); line-height: 1.2; text-align: center; white-space: normal; }
  :is(.hero, .pl-head) .detail-row .pill-action > span { max-width: 100%; }
  :is(.hero, .pl-head) .detail-row > details.more { display: flex; }
  :is(.hero, .pl-head) .detail-row details.more > summary.pill-action { display: flex; flex: 1; }
}
/* More, on a phone or a touch tablet, is a sheet from the foot of the screen with big rows, headed with
   what it's about, as the native app has it (a title's, a season's and an episode's); a tap beside it (the
   summary's own backdrop) closes it. A computer's is a menu. */
.sheet-title { display: none; }
@media (max-width: 640px), (pointer: coarse) and (hover: none) and (max-width: 1366px) {
  :is(.hero, .section, .detail):has(:is(.detail-row, .season-head, .ep-tools) details.more[open]) { position: relative; z-index: 50; }
  :is(.detail-row, .season-head, .ep-tools) details.more[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 1; background: rgb(0 0 0 / 0.55); cursor: default; }
  :is(.detail-row, .season-head, .ep-tools) details.more[open] > .more-menu { position: fixed; z-index: 2; inset: auto 0 0 0 !important; top: auto; box-sizing: border-box; width: auto; min-width: 0; max-width: none; max-height: calc(100vh - 4rem); overflow-y: auto;
    padding: 0.5rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px)); border-radius: 1rem 1rem 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / 0.4); animation: none; }
  :is(.detail-row, .season-head, .ep-tools) .more-menu > :is(.ghost, a.ghost) { min-height: 3.5rem; padding-inline: 1rem; font-size: 1rem; }
  :is(.detail-row, .season-head, .ep-tools) .more-menu > .menu-label { margin-inline: 1rem; }
  :is(.detail-row, .season-head, .ep-tools) .more-menu > .sheet-title { display: block; margin: 0.25rem 1rem 0.5rem; padding: 0; border: 0; color: var(--muted);
    font-size: 1rem; font-weight: 500; letter-spacing: 0; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
details.more.compact .more-menu, .detail-row details.more:last-child .more-menu { left: auto; right: 0; }
.detail { position: relative; z-index: 2; padding: 1.5rem var(--gutter) 0; max-width: 64rem; }
/* A show's line while its Next up waits for sound in a language (suggestions.js). */
.next-audio { margin: 0 0 0.9rem; }
/* Next up audio's picker (suggestions.js): the show's languages, how many episodes each has at the right. */
.lang-pick .lang-rows { display: grid; gap: 0.1rem; }
.lang-row { align-items: center; min-height: 2.5rem; padding: 0 0.25rem; border-radius: var(--radius); }
.lang-row .small { margin-left: auto; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.overview-box { max-width: 46rem; }
.overview { margin: 0; line-height: 1.65; }
.overview.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.admin-only-theirs { display: block; min-height: 2rem; }
.file-card + .file-card { border-top: 1px solid var(--line); padding-top: 0.75rem; }
.file-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
/* Seasons and episodes: the seasons as pills (and, dotted, the ones that aren't here: people.css),
   then one line for the season shown, with its own menu. */
.season-section { margin-top: 2rem; }
.season-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.season-bar:empty { display: none; }
.seasons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.season-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: var(--control-h); margin: 0.5rem 0 0.75rem; }
.season-count { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 0.5rem; color: var(--mist); }
.episodes { display: grid; gap: 0.35rem; max-width: 64rem; }
.ep-row { display: grid; grid-template-columns: clamp(9.5rem, 22vw, 15rem) minmax(0, 1fr) auto; gap: 0.5rem 1.1rem; align-items: start; padding: 0.6rem; border-radius: var(--radius-lg);
  transition: background-color var(--motion-fast, 0.15s) ease; }
.ep-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
/* A long season (the page adds .long past 100 episodes): rows off the screen aren't laid out or
   painted, and stand in with about the height a row has. A row being used goes back to normal (a
   menu open in it, focus inside it): the containment this brings would clip a computer's open
   menu, hold a phone's fixed sheet inside the row and cut off the TV's enlarged still. Not for a
   season of a few: nothing to save, and a row off the screen then has no box to find or click. */
.ep-row { contain-intrinsic-height: auto calc(clamp(9.5rem, 22vw, 15rem) * 9 / 16 + 1.2rem); }
.episodes.long .ep-row { content-visibility: auto; }
.episodes.long .ep-row:focus-within { content-visibility: visible; }
.episodes.long .ep-row:has(details[open]) { content-visibility: visible; }
/* The episode to watch next: a panel of its own (its Up next flag says why). */
.ep-row.is-next { background: var(--container); }
.ep-thumb { display: block; border-radius: var(--media-radius); }
.ep-thumb .art { position: relative; aspect-ratio: 16 / 9; }
.ep-thumb:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.play-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.15s ease; }
.play-hover svg { width: 2.5rem; height: 2.5rem; fill: #fff; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5)); }
.ep-thumb:focus-visible .play-hover { opacity: 1; }
@media (hover: hover) { .ep-thumb:hover .play-hover { opacity: 1; } }
.ep-row.is-watched .art img { opacity: 0.72; }
.ep-body { min-width: 0; padding-top: 0.2rem; }
.ep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; }
.ep-head h3 { margin: 0; font-size: 1.05rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.ep-head h3 a { color: var(--text); text-decoration: none; }
.ep-head h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.next-flag { padding: 0.1rem 0.55rem; border-radius: var(--control-radius); background: var(--accent); color: var(--on-accent); font-size: var(--type-tiny); font-weight: 500; }
.ep-meta { margin: 0.2rem 0 0; color: var(--mist); font-size: var(--type-small); }
.ep-meta:empty { display: none; }
.ep-overview { margin: 0.4rem 0 0; color: var(--mist); font-size: var(--type-small); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-tools { display: flex; gap: 0.35rem; align-items: center; }
/* A row's still plays; anywhere else on it opens the episode's page, so the text reaches down
   the whole row (on a phone the buttons beside it make the row taller than the text). */
.ep-body { cursor: pointer; align-self: stretch; }
.related { margin-top: 0.5rem; }
/* An episode's page (views.js renderEpisode): the show above its name, back to the show; the
   episodes either side; the season's rail with this one marked. */
.hero .kicker .episode-show { color: var(--mist); font-weight: 500; text-decoration: none; }
.hero .kicker .episode-show:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.episode-steps { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.episode-step { display: grid; gap: 0.1rem; flex: 0 1 auto; min-width: 0; max-width: min(100%, 24rem); padding: 0.55rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.episode-step strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-step:hover { border-color: var(--mist); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.episode-step:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.episode-card.is-current .art { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- First screens ----------
   Signing in (auth.js), and Who's watching and its PIN pad (profiles.js): the server's name big
   and centred over a soft wash of the theme's own colours, one card with the one thing to do,
   and the other ways in quiet under it. A TV's sizes are in tv.css. */
:is(.auth, .profiles) {
  /* The wash: the theme's selection colour glowing from the top, and its accent faintly from the
     corners below, on its background. By day and by night; High contrast keeps a plain page. */
  --wash: radial-gradient(120% 75% at 50% -15%, color-mix(in srgb, var(--tonal) 60%, transparent), transparent 65%),
    radial-gradient(70% 55% at 105% 105%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(60% 50% at -5% 100%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
  --card-w: 25rem;
}
:root[data-theme="high-contrast"] :is(.auth, .profiles) { --wash: none; }
.auth { position: relative; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: none; min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: 0; padding: clamp(3.5rem, 10vh, 6rem) var(--gutter) clamp(1.5rem, 5vh, 3rem); text-align: center; --field-h: 3rem; }
.auth::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--wash); }
/* A watch party's link (party.css): a wider card, not a narrower page. */
#auth.auth:has(.party-card) { --card-w: 30rem; max-width: none; }
/* The server's name, or its logo. */
.auth .wordmark { max-width: 100%; margin: 0; font-size: clamp(2.75rem, 12vw, 4rem); line-height: 1.05; overflow-wrap: anywhere; text-wrap: balance; }
/* A long name (auth.js marks it) a size down, so it doesn't take three lines on a phone. */
.auth .wordmark.long { font-size: clamp(2rem, 8vw, 3rem); }
#auth .wordmark.has-logo { display: flex; justify-content: center; }
#auth .wordmark .wordmark-logo { height: clamp(3.5rem, 16vw, 5.5rem); max-width: min(100%, 24rem); object-position: center; }
/* Beside the name, the logo is the name's height. */
#auth .wordmark .wordmark-logo:has(+ span) { height: 1.15em; }
/* The owner's tagline and welcome (main.js), when they wrote them. */
.auth > #brand-tagline { margin: 0.6rem 0 0; max-width: 30rem; }
.auth > .brand-welcome { margin: 1rem 0 0; max-width: 30rem; color: var(--text); }
.auth > :is(#brand-tagline, .brand-welcome):empty { display: none; }
.auth-cards { display: flex; justify-content: center; align-items: stretch; gap: 1.5rem; width: 100%; margin-top: clamp(1.75rem, 5vh, 2.75rem); }
.auth-card { box-sizing: border-box; width: 100%; max-width: var(--card-w); padding: 2rem; border-radius: var(--radius-lg); text-align: left;
  background: color-mix(in srgb, var(--container) 86%, transparent); color: var(--on-container);
  box-shadow: 0 28px 70px -30px rgb(0 0 0 / 0.55), inset 0 0 0 1px color-mix(in srgb, var(--text) 7%, transparent); }
.auth-card > :is(h1, h2) { margin: 0 0 1.5rem; font-size: 1.5rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.auth-card > h1:has(+ .auth-text:not([hidden])) { margin-bottom: 0.5rem; }
.auth-text { margin: 0 0 1.5rem; color: var(--muted); text-align: center; }
/* A screen with nothing to fill in (Can't reach the server, a link that has run out) is just
   its words and what to do next, without a card. */
.auth-main:has(> #auth-form:empty) { padding-block: 0; background: none; box-shadow: none; }
.auth-main:has(> #auth-form:empty) > .auth-text { margin-bottom: 0; }
/* The form: roomy fields, and the one thing to press across the card. */
.auth .stack { gap: 1.1rem; }
.auth .stack > .primary, .auth-alt > .primary { width: 100%; min-height: 3rem; font-size: 1rem; }
.auth .stack > .primary { margin-top: 0.3rem; }
.auth-alt > .primary { max-width: 18rem; }
.auth .field small { font-size: var(--type-caption); }
.auth .form-error { min-height: 0; color: var(--danger); font-size: var(--type-small); }
/* Kept for screen readers while empty, without taking room. */
.auth .form-error:empty { position: absolute; }
/* A new account's first question (welcome.js): the switches of Your settings, Media categories, one under another. */
.welcome-list { display: grid; gap: 0.35rem; margin-bottom: 0.4rem; }
.welcome-list .setting-switch { min-height: 3rem; padding-inline: 0.15rem; cursor: pointer; }
/* A code from an authenticator app: big and spaced, like the code itself. */
.auth .code-input { font-size: 1.25rem; letter-spacing: 0.2em; text-align: center; font-variant-numeric: tabular-nums; }
/* Asking for an account (join.js): a few lines for who they are, and signing in before it's
   decided says it's waiting as news, not an error. */
.auth textarea { min-height: 5.5rem; resize: vertical; }
.auth .form-error.calm { color: var(--text); }
/* On a TV, the form's short address beside its QR code, to type on a phone instead. */
.join-address { margin: 0; font: 600 clamp(1.3rem, 5vw, 1.6rem)/1.25 var(--font-display); color: var(--text); overflow-wrap: anywhere; }
/* Under the card: other ways in (words, not buttons), then which server this is. */
.auth-alt { display: grid; justify-items: center; gap: 1rem; width: 100%; max-width: var(--card-w); margin-top: 1.25rem; }
.auth-ways { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.75rem; }
.auth-ways:empty { display: none; }
.auth-server { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.1rem 1.25rem; margin: 0; color: var(--muted); font-size: var(--type-small); }
.auth-host { overflow-wrap: anywhere; }
.auth-server .text-button { font-size: var(--type-small); }
/* Back to Who's watching, where a back arrow goes. */
.auth-alt > .auth-back { position: absolute; top: 1rem; left: calc(var(--gutter) + 0.5rem); color: var(--text); }
/* Servers used before in this browser (Change server). */
.auth-recent { margin-top: 0.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.auth-card h2.auth-recent-title { margin: 0 0 0.6rem; font: 500 var(--type-small)/1.4 var(--font-body); letter-spacing: 0; text-align: left; color: var(--muted); }
/* A list of servers: this browser's (Change server). */
.server-list { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.server-list .server { box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 0.75rem; width: 100%; min-height: 3.5rem;
  padding: 0.6rem 0.9rem; border: 0; border-radius: var(--field-radius); background: var(--fill); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color var(--motion-fast) ease; }
.server-list .server:hover { background: var(--fill-hover); }
.server-list .server:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.server-list .server::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 0.5rem; height: 0.5rem; margin-right: 0.2rem; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); opacity: 0.55; }
.server-list .server strong { grid-column: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-list .server small { grid-column: 1; color: var(--muted); font-size: var(--type-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Signing in with a code: the code, a QR code for a phone, and whether it's been approved yet. */
.code-box { display: grid; justify-items: center; gap: 1.25rem; text-align: center; }
.code-show { display: grid; justify-items: center; gap: 1.25rem; }
.code-words { display: grid; gap: 0.6rem; }
.device-code { margin: 0; font: 700 clamp(2.4rem, 10vw, 3rem)/1.1 var(--font-display); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.device-qr { display: block; width: 11rem; height: 11rem; border-radius: var(--radius); background: #EDE7DA; }
.code-how { margin: 0 auto; max-width: 19rem; color: var(--muted); font-size: var(--type-small); }
.code-status { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0; color: var(--muted); font-size: var(--type-small); }
.code-status.waiting::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); animation: code-wait 1.8s ease-in-out infinite; }
@keyframes code-wait { 50% { opacity: 0.2; } }
/* Phones: no card, the form straight on the page, as phone apps sign in. */
@media (max-width: 599px) {
  .auth-card { padding: 0; background: none; box-shadow: none; }
  .auth-cards { margin-top: clamp(1.5rem, 5vh, 2.5rem); }
  .auth-alt { margin-top: 1.75rem; }
}

/* Who's watching: full screen and over everything, as on a TV, with big pictures a remote can
   reach, and the PIN pad for anyone who set one. */
.profiles { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; overflow-y: auto; padding: 2.5rem var(--gutter); background: var(--wash), var(--bg); color: var(--text); animation: fade-in 0.2s ease; }
.profiles-inner { display: grid; justify-items: center; gap: 1rem; width: min(72rem, 100%); text-align: center; }
.profiles-mark { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 5vw, 2rem); }
.profiles-mark.has-logo { display: flex; justify-content: center; }
.profiles-mark .wordmark-logo { height: clamp(2.25rem, 8vw, 3rem); object-position: center; }
.profiles h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 2.75rem); }
.profiles-help { margin: 0; max-width: 34rem; color: var(--muted); }
.profile-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(0.75rem, 2.5vw, 2rem); margin: 1.5rem 0 0.5rem; }
.profile-tile { --face: clamp(5.25rem, 11vw, 8.5rem); display: grid; justify-items: center; align-content: start; gap: 0.7rem; width: calc(var(--face) + 1rem); padding: 0.5rem 0; border: 0; border-radius: var(--radius);
  background: none; color: var(--muted); cursor: pointer; font: 500 1rem/1.3 var(--font-body); transition: color var(--motion-fast) ease; }
.profile-face { position: relative; display: grid; border-radius: 50%; }
.profile-tile .avatar { width: var(--face); height: var(--face); font-size: calc(var(--face) * 0.4); box-shadow: 0 0 0 3px transparent, 0 12px 28px -14px rgb(0 0 0 / 0.6);
  transition: box-shadow 0.15s ease, transform 0.15s ease; }
.profile-tile:hover { color: var(--text); }
/* Its ring is the picture's shadow (below); the transparent outline is the one a Windows contrast theme paints. */
.profile-tile:focus-visible { color: var(--text); outline: 2px solid transparent; outline-offset: 2px; }
.profile-tile:hover .avatar, .profile-tile:focus-visible .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--text); transform: scale(1.05); }
.profile-tile[aria-current="true"] .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent); }
.profile-tile[aria-current="true"] .profile-name { color: var(--text); }
.profile-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-add .profile-name { white-space: normal; }
.profile-add .avatar.add { background: color-mix(in srgb, var(--text) 6%, transparent); border: 2px dashed color-mix(in srgb, var(--text) 30%, transparent); box-sizing: border-box; color: var(--text); box-shadow: none; }
.profile-add .avatar.add svg { width: 38%; height: 38%; }
/* Manage profiles: a bin over each picture. */
.profile-remove { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgb(0 0 0 / 0.55); color: #fff; }
.profile-remove svg { width: 32%; height: 32%; }
.pin-mark { position: absolute; right: 2%; bottom: 2%; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--raised); color: var(--text); box-shadow: 0 0 0 3px var(--bg); }
.pin-mark svg { width: 0.95rem; height: 0.95rem; }
.profiles-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
.profiles-error:empty { display: none; }
/* The PIN pad: large round keys, three to a row, like a phone's. */
.pin-panel { display: grid; justify-items: center; gap: 0.9rem; }
.pin-panel > .avatar { margin-bottom: 0.25rem; box-shadow: 0 12px 28px -14px rgb(0 0 0 / 0.6); }
.pin-panel h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
.pin-help { margin: -0.4rem 0 0; color: var(--muted); font-size: var(--type-small); }
.pin-dots { display: flex; gap: 1rem; margin: 0.5rem 0 0.25rem; }
.pin-dot { width: 0.95rem; height: 0.95rem; border: 2px solid var(--muted); border-radius: 50%; transition: background-color 0.1s ease, border-color 0.1s ease, transform 0.1s ease; }
.pin-dot.filled { background: var(--text); border-color: var(--text); transform: scale(1.1); }
.pin-error { min-height: 1.4em; color: var(--danger); }
.pin-keys { display: grid; grid-template-columns: repeat(3, auto); gap: 0.9rem 1.25rem; margin-top: 0.25rem; }
.pin-key { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; padding: 0; border: 1px solid var(--control-line); border-radius: 50%; background: var(--fill); color: var(--text);
  font: 400 1.75rem/1 var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color var(--motion-fast) ease, transform 0.1s ease; }
.pin-key:hover { background: var(--fill-hover); }
.pin-key:active { background: var(--fill-press); transform: scale(0.94); }
.pin-key:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.pin-key.pin-word { background: none; border-color: transparent; font-size: var(--type-small); font-weight: 500; }
.pin-key.pin-word:hover { background: var(--hover); }
.pin-key svg { width: 1.6rem; height: 1.6rem; }
.pin-panel .pin-password { margin-top: 0.5rem; }
.pin-panel.shake { animation: pin-shake 0.35s ease; }
@keyframes pin-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (max-width: 640px) {
  .profiles { padding-block: 2rem; }
  .pin-key { width: 4.25rem; height: 4.25rem; }
  .pin-keys { gap: 0.8rem 1.1rem; }
}
@media (max-height: 640px) and (min-width: 641px) {
  .pin-key { width: 3.75rem; height: 3.75rem; font-size: 1.5rem; }
  .pin-keys { gap: 0.6rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .profiles, .pin-panel.shake, .code-status.waiting::before { animation: none; }
  .profile-tile .avatar, .pin-key, .pin-dot { transition: none; }
  .profile-tile:hover .avatar, .profile-tile:focus-visible .avatar, .pin-dot.filled { transform: none; }
}

/* Everyone's picture: one of Reel's own, or an initial on a colour. */
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 2.5rem; height: 2.5rem; border-radius: 50%; overflow: hidden; color: #fff; font: 600 1rem/1 var(--font-body); user-select: none; }
.avatar img { display: block; width: 100%; height: 100%; }
/* The Pixel set: small pixel art, scaled to the nearest pixel without smoothing (profiles.js avatar). */
.avatar.pixel img { image-rendering: pixelated; }
.avatar.initial { background: hsl(var(--avatar-hue, 150) 32% 38%); color: #fff; }
.avatar.small { width: 1.75rem; height: 1.75rem; font-size: var(--type-caption); }
.avatar.large { width: 6rem; height: 6rem; font-size: 2.4rem; }
/* The account menu's other people, above its links. */
.account-people { display: grid; gap: 2px; margin: 0 0 0.35rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--line); }
.account-links .account-person { gap: 0.65rem; }
.account-person-name { overflow: hidden; text-overflow: ellipsis; }
.account-person .pin-mark { position: static; width: auto; height: auto; margin-left: auto; background: none; box-shadow: none; color: var(--mist); }
.signout-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Your picture, in settings. */
.avatar-choices { display: flex; flex-wrap: wrap; gap: 0.65rem; }
/* A new password's box with Show and Hide beside it (util.js passwordReveal). */
.password-box { display: flex; align-items: center; gap: 0.5rem; }
.field > span.password-box { font-size: inherit; color: inherit; font-weight: inherit; }
.password-box input { flex: 1; min-width: 0; }
.profile-picture-row { display: flex; align-items: center; gap: 1.5rem; }
.avatar-picker { max-height: 85dvh; overflow: auto; width: min(42rem, calc(100vw - 2rem)); }
.avatar-category { border-top: 1px solid var(--line); padding: .6rem 0; }
.avatar-category > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.avatar-choice { border-radius: 50%; cursor: pointer; }
.avatar-choice .avatar { width: 3.25rem; height: 3.25rem; font-size: 1.3rem; }
.avatar-choice:has(input:checked) .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.avatar-choice:has(input:focus-visible) .avatar { outline: 2px solid var(--ring); outline-offset: 6px; }
.avatar-group-label { margin: 0.9rem 0 0.45rem; color: var(--mist); font-size: var(--type-small); }
.stack { display: grid; gap: 1rem; }
.stack.narrow { max-width: 24rem; }
.stack .primary { justify-self: start; }
.field small { font-size: var(--type-caption); }
.field input[readonly] { color: var(--mist); }
/* A folder, key or address shown as it is breaks anywhere rather than widen a phone. */
code { overflow-wrap: anywhere; }
.form-error { margin: 0; min-height: 1.5em; font-size: var(--type-small); }
.field-error { margin: .4rem 0 0; color: var(--danger); font-size: var(--type-small); }
.checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.checks label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--type-small); white-space: nowrap; }

/* Admin and account */
/* Positioned, so a visually hidden heading in a wide table (People's Actions) scrolls with it
   instead of widening the page on a phone. */
.table-wrap { position: relative; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--type-note); }
th { text-align: left; font-weight: 600; color: var(--mist); font-size: var(--type-caption); padding: 0 1rem 0.5rem 0; }
td { padding: 0.65rem 1rem 0.65rem 0; border-top: 1px solid var(--rule); vertical-align: top; }
.inline-form { display: flex; align-items: end; gap: 0.5rem 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.inline-form input { flex: 1 1 12rem; min-width: 0; }
/* In a stack (a dialog, a form) the stack spaces it. */
.stack > .inline-form { margin-bottom: 0; }
/* A callout's look (a quiet panel with a stripe down its edge) is in material.css. */
.callout p { margin: 0 0 0.75rem; }
.callout p:last-child { margin-bottom: 0; }
.folders { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; max-height: 16rem; overflow-y: auto; }
.link-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
/* A link to copy (a watch party's, an invite's): shown as it is. (button.link is a link-styled button: material.css.) */
input.link { font-family: var(--font-mono); font-size: var(--type-caption); color: var(--paper); }
.bar { height: 4px; margin: 0.5rem 0; max-width: 28rem; background: var(--booth); }
.bar span { display: block; height: 100%; background: var(--lamp); }

/* Player */
.player { position: fixed; inset: 0; background: #000; z-index: 10; }
.stage { height: 100%; overflow: hidden; }
.stage video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.stage .ass-subtitles { position: absolute; top: 0; left: 0; pointer-events: none; transform-origin: top left; }
/* player.js fitShape pads the video so the box inside the padding is the picture itself: the
   black bars are padding (still the video, so clicking them pauses), and text subtitles, laid
   out in that box, sit at the foot of the picture. A picture the browser has the wrong shape for
   is padded to the shape Reel measured and stretched to fill that. */
.stage video.reshaped { object-fit: fill; }
/* Picture (player.js), when this device keeps other than Fit: Fill covers the screen and cuts off
   the picture's edges (cropped in Reel's shape when the browser has it wrong), Stretch pulls it to
   the screen's shape. */
.stage video[data-picture="fill"] { object-fit: cover; }
.stage video[data-picture="fill"].cropped, .stage video[data-picture="stretch"] { object-fit: fill; }
/* Title across the top, over the picture; fades with the controls. */
.player-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: flex-start; gap: 0.75rem;
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-right, 0px)) 2.5rem max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-left, 0px));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.2) 60%, transparent); color: #fff; transition: opacity 0.35s ease, transform 0.35s ease; }
.stage.idle .player-bar { opacity: 0; transform: translateY(-0.5rem); pointer-events: none; }
.now { min-width: 0; flex: 1; padding-top: 0.2rem; }
.now h1 { margin: 0; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.3; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { margin: 0; font-size: var(--type-small); color: rgba(255, 255, 255, 0.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub:empty, .method:empty { display: none; }
.method { margin: 0; font-size: var(--type-caption); color: var(--mist); }
.choices { display: flex; gap: 0.5rem; align-items: center; flex: none; }
.choice { display: grid; gap: 0.35rem; font-size: var(--type-caption); color: var(--mist); }
.choice select { width: 100%; }
/* Menus open above the controls, next to the button that opened them. */
.player-menu { position: absolute; right: clamp(0.75rem, 3vw, 2rem); bottom: 6.25rem; z-index: 4; display: grid; gap: 0.9rem; width: min(21rem, calc(100% - 1.5rem));
  max-height: calc(100% - 8rem); overflow-y: auto; padding: 1.1rem 1.25rem 1.25rem; background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--text);
  border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); animation: pop-in 0.16s ease; }
.player-menu-title { margin: 0; font-weight: 500; font-size: 1rem; }
.player-menu-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.player-menu .check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; }
/* One choice of Playback settings, where a row of More opened it on that one (controls.js). */
#menu-settings.only-one > :not(.player-menu-title, .only) { display: none; }
/* More, on a phone or a touch tablet: the controls the bar leaves out, as big rows with an icon
   and plain words (56 px tall, as the app's own sheets have them). On a tablet a menu above the
   bar like the others; on a phone a sheet from the foot of the screen, or down the right when
   the phone is on its side, as Watch together's is (party.css). */
.pm-list { gap: 2px; padding: 0.375rem; }
.pm-row { display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 3.5rem; margin: 0; padding: 0.4rem 0.85rem; border: 0; border-radius: var(--radius); background: transparent; color: inherit;
  font: 500 1rem/1.3 var(--font-body); text-align: left; text-transform: none; letter-spacing: 0; cursor: pointer; }
.pm-row:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.pm-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.pm-ic { display: grid; place-items: center; flex: none; width: 1.5rem; height: 1.5rem; }
.pm-ic svg { width: 100%; height: 100%; fill: currentColor; }
@media (max-width: 640px) {
  html:not(.tv) #menu-more { right: 0; bottom: 0; left: 0; width: 100%; max-height: min(80%, 36rem); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55); background: var(--surface);
    padding: 0.5rem max(0.5rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-left, 0px)); }
}
@media (max-height: 30rem) {
  html:not(.tv) #menu-more { top: 0; right: 0; bottom: 0; left: auto; width: min(21rem, 52%); max-height: none; border-radius: var(--radius-lg) 0 0 var(--radius-lg); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55); background: var(--surface);
    padding: max(0.5rem, env(safe-area-inset-top, 0px)) max(0.5rem, env(safe-area-inset-right, 0px)) max(0.5rem, env(safe-area-inset-bottom, 0px)) 0.5rem; }
  .pm-row { min-height: 3rem; }
}
/* Loading, buffering, converting and reconnecting, in the middle of the picture. */
.player-state { position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 0.75rem;
  padding: 1rem 1.5rem; border-radius: var(--radius-lg); background: rgba(0, 0, 0, 0.55); color: #fff; pointer-events: none; animation: fade-in 0.2s ease; }
.player-state p { margin: 0; font-size: var(--type-note); }
.player-state .spinner { width: 2.75rem; height: 2.75rem; border-width: 3px; }
/* Opt-in technical detail for whoever asked for it. */
.playback-info { position: absolute; left: clamp(0.75rem, 3vw, 2rem); top: 5.5rem; z-index: 3; max-width: min(26rem, calc(100% - 1.5rem)); margin: 0; padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.78); color: #fff; border-radius: var(--radius); font: var(--type-caption)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.playback-info dl { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.9rem; margin: 0; }
.playback-info dt { color: rgba(255, 255, 255, 0.65); }
.playback-info dd { margin: 0; overflow-wrap: anywhere; }
/* Text subtitles. Their size (a share of the picture's height), colour and background come from
   Subtitle style, set on this device (player.js applyCueStyle). */
video::cue { background: rgba(0, 0, 0, 0.72); color: #fff; line-height: 1.35; }
/* Where the browser lets the page move its subtitle box (Chrome, Edge, Safari), it rises from
   the picture's foot by --cue-lift: a little, and above the controls while they show (player.js
   liftCues). Firefox has no such box and moves the cues themselves. */
video::-webkit-media-text-track-container { transform: translateY(calc(-1 * var(--cue-lift, 0px))); transition: transform 0.25s ease; }
@media (prefers-reduced-motion: reduce) { video::-webkit-media-text-track-container { transition: none; } }
.scrub { position: absolute; bottom: calc(100% - 1.2rem); transform: translateX(-50%); display: grid; justify-items: center; gap: 0.3rem; pointer-events: none; z-index: 3; }
.scrub-img { border: 2px solid var(--paper); border-radius: var(--radius); background-color: #000; background-repeat: no-repeat; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
.scrub span { padding: 0.1rem 0.5rem; background: rgba(0, 0, 0, 0.75); border-radius: 3px; font-variant-numeric: tabular-nums; }
.skip { position: absolute; right: var(--gutter); bottom: 6.75rem; z-index: 3; }
/* Panels over the picture (Up next, the version picker, subtitles) are drawn as its menus are. */
.up-next { position: absolute; z-index: 4; right: var(--gutter); bottom: 6.75rem; width: min(22rem, calc(100% - 2 * var(--gutter))); padding: 1.1rem 1.25rem 1.25rem; background: color-mix(in srgb, var(--surface) 96%, transparent); border: 0; border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); }
.up-next p { margin: 0; }
.up-next-title { font: var(--title-weight) 1.2rem/1.25 var(--font-display); margin: 0.2rem 0 0.9rem !important; }
/* Up next itself (#up-next, player.js and up-next-card.js; 0.85.0's design A): a see-through card, the credits showing
   behind it, with the next episode's still on top (its code and length on it), "Next episode" in the accent colour,
   its name and the show's, then Play now with the countdown as a lighter fill sweeping across it and the seconds left
   beside its words, and Watch credits. The direct children only: a rating that joins the card keeps its own look. */
.up-next-card { width: min(25rem, calc(100% - 2 * var(--gutter))); padding: 0.75rem 0.75rem 1rem;
  background: color-mix(in srgb, var(--surface) 74%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent); box-shadow: 0 18px 50px rgb(0 0 0 / 0.5); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .up-next-card { background: color-mix(in srgb, var(--surface) 90%, transparent); } }
@media (prefers-reduced-transparency: reduce) { .up-next-card { background: var(--surface); } }
.up-next-card > :is(.up-next-label, .up-next-title, .up-next-show, .actions) { padding-inline: 0.35rem; }
.up-next-card > .rate-card { margin-inline: 0.35rem; }
.up-next-still { position: relative; aspect-ratio: 16 / 9; margin-bottom: 0.9rem; border-radius: max(0.25rem, calc(var(--radius-lg) - 0.625rem)); overflow: hidden; background: rgb(0 0 0 / 0.35); }
.up-next-still img { display: block; width: 100%; height: 100%; object-fit: cover; }
.up-next-chip { position: absolute; left: 0.6rem; bottom: 0.6rem; padding: 0.28rem 0.55rem; border-radius: max(0.25rem, calc(var(--radius) - 0.25rem)); background: rgb(7 7 15 / 0.72); color: white; font: 600 var(--type-tiny)/1 var(--font-body); white-space: nowrap; }
.up-next-chip.end { left: auto; right: 0.6rem; }
.up-next-chip:empty { display: none; }
.up-next-label { font: 600 var(--type-tiny)/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.up-next-card > .up-next-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0.35rem 0 0.15rem !important;
  font: var(--title-weight) 1.45rem/1.2 var(--font-display); letter-spacing: var(--title-tracking); color: var(--text); }
.up-next-card > .up-next-show { margin: 0; color: var(--muted); font-size: var(--type-note); }
.up-next-card > .actions { gap: 0.6rem; margin-top: 1rem; }
.up-next-card > .actions > button { flex: none; min-height: 2.9rem; font-size: var(--type-note); }
.up-next-card > .actions > .ghost { padding-inline: 1.15rem; }
.up-next-play { position: relative; overflow: hidden; isolation: isolate; }
.up-next-card .up-next-play { padding-inline: 1rem 1.25rem; }
.up-next-card .up-next-play > svg { width: 1.25rem; height: 1.25rem; }
.up-next-fill { position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--accent) 55%, white); transform: scaleX(0); transform-origin: left; transition: transform 0.25s linear; }
.up-next-count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; margin-left: 0.1rem; border-radius: var(--control-radius); background: color-mix(in srgb, var(--on-accent) 16%, transparent);
  font-size: var(--type-caption); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .up-next-fill { transition: none; } }
/* A phone has no room for the still on top (on its side, nor upright, where the card would cover the picture rather
   than sit under it): a smaller one beside the words, the buttons under both. */
@media (max-height: 30rem), (max-width: 30rem) {
  .up-next-card:has(> .up-next-still:not([hidden])) { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); align-content: start; column-gap: 0.75rem; width: min(27rem, calc(100% - 2 * var(--gutter))); }
  .up-next-card > .up-next-still { grid-column: 1; grid-row: 1 / span 3; align-self: center; margin: 0; border-radius: max(0.25rem, calc(var(--radius) - 0.125rem)); }
  .up-next-card > :is(.up-next-label, .up-next-title, .up-next-show) { grid-column: 2; padding-inline: 0; }
  .up-next-card > .actions { margin-top: 0.75rem; padding-inline: 0; }
  .up-next-card > .rate-card { margin-inline: 0; }
  .up-next-card .up-next-play { padding-inline: 0.85rem 1rem; }
  .up-next-card > .actions > .ghost { padding-inline: 1rem; }
  .up-next-card > :is(.actions, .rate-card) { grid-column: 1 / -1; }
  .up-next-card > .up-next-title { font-size: var(--type-section); }
  .up-next-chip { left: 0.35rem; bottom: 0.35rem; padding: 0.2rem 0.4rem; font-size: var(--type-overline); }
  .up-next-chip.end { right: 0.35rem; }
}
/* The smallest phones (320 to 374 px, or larger text): Play now with its countdown and Watch credits don't fit side by
   side at their own size, so a shorter row keeps them there, each on one line: closer padding and a smaller step of
   the words (the app's UpNextCard.fit the same). Wider, the card is as it was. */
@media (max-width: 23.4rem) {
  .up-next-card > .actions { flex-wrap: nowrap; gap: 0.4rem; }
  .up-next-card > .actions > button { flex: 0 1 auto; min-width: 0; min-height: 2.75rem; font-size: var(--type-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .up-next-card .up-next-play { gap: 0.3rem; padding-inline: 0.6rem 0.7rem; }
  .up-next-card .up-next-play > svg { width: 1.1rem; height: 1.1rem; flex: none; }
  .up-next-card > .actions > .ghost { padding-inline: 0.7rem; }
}
.picker { top: 50%; bottom: auto; right: 50%; transform: translate(50%, -50%); width: min(30rem, calc(100% - 2 * var(--gutter))); }
.picker-list { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.picker-list button { display: grid; justify-items: start; gap: 0.1rem; width: 100%; padding-block: 0.6rem; text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; }
.picker-list button small { color: var(--mist); font-size: var(--type-caption); word-break: break-all; }
.picker-list button:first-child { border-color: var(--paper); }
/* Small labels: a status (.tag, .pill) or a fact (.set-badge and the site editor's). One shape,
   the theme's control corner. */
:is(.tag, .pill, .set-badge, .se-tag, .scope-pill, .canvas-badge, .theme-badges span) {
  box-sizing: border-box; display: inline-flex; align-items: center; min-height: 1.375rem; padding: 0 0.55rem; border: 1px solid transparent;
  border-radius: var(--control-radius); font: 600 var(--type-tiny)/1.2 var(--font-body); letter-spacing: 0.01em; white-space: nowrap; vertical-align: middle; }
.tag { margin-left: 0.5rem; border-color: var(--line); color: var(--mist); }
.panel-float { top: 5rem; bottom: auto; max-height: calc(100% - 12rem); overflow-y: auto; width: min(30rem, calc(100% - 2 * var(--gutter))); }

/* ---------- Comments over the picture (danmaku.js) ---------- */
/* Lanes in the top part of the picture, below the title (danmaku.js measures where that ends)
   and clear of subtitles. Each comment scrolls right to left in a soft pill. */
.danmaku { position: absolute; left: 0; right: 0; top: calc(max(0.75rem, env(safe-area-inset-top, 0px)) + 3.4rem); height: 22%; z-index: 1; overflow: hidden; pointer-events: none;
  font: 500 clamp(0.85rem, 1.25vw, 1.35rem)/1.25 var(--font-body); color: rgba(255, 255, 255, 0.9); }
.danmaku.area-half { height: 42%; }
.danmaku.area-most { height: 64%; }
.danmaku[hidden] { display: none; }
.dm { position: absolute; left: 0; white-space: nowrap; padding: 0.2em 0.75em; border-radius: 999px; background: rgba(0, 0, 0, 0.35); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); will-change: transform; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .dm { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); } }
.dm-who { margin-right: 0.5em; font-size: 0.8em; color: rgba(255, 255, 255, 0.6); }
/* Live party chat is a little firmer, so it reads over any picture; your own name is in your colour. */
.dm.live { background: rgba(0, 0, 0, 0.5); color: #fff; }
.dm.live .dm-who { color: rgba(255, 255, 255, 0.72); }
.dm.mine .dm-who { color: var(--accent); }
/* With motion reduced, a comment fades in and out in the middle of its lane. */
.dm.still { left: 50%; transform: translateX(-50%); }
.danmaku-reacts { position: absolute; right: clamp(0.75rem, 3vw, 2rem); bottom: 7.5rem; width: 6rem; height: 45%; z-index: 1; pointer-events: none; }
.dm-react { position: absolute; bottom: 0; font-size: clamp(1.6rem, 2.6vw, 2.6rem); line-height: 1; }
/* Where people commented and reacted most, faintly above the timeline. */
.tl-heat { position: absolute; left: 0; right: 0; bottom: calc(50% + 0.25rem); height: 0.85rem; display: flex; align-items: flex-end; gap: 1px; opacity: 0.5; pointer-events: none; }
.tl-heat:empty { display: none; }
.tl-heat span { flex: 1; background: var(--accent); border-radius: 1px 1px 0 0; }

/* ---------- The subtitle editor beside the picture (subedit.js), on computers and tablets ---------- */
/* In the top part of the stage, so the subtitles being edited still show on the picture below it. */
.subedit { position: absolute; z-index: 5; top: max(1rem, env(safe-area-inset-top, 0px)); right: var(--gutter); bottom: max(11rem, 36%); width: min(28rem, calc(100% - 2 * var(--gutter)));
  display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem 1.1rem; background: color-mix(in srgb, var(--surface) 97%, transparent); border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); color: var(--paper); }
.se-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 0.6rem; }
.se-head h2 { margin: 0; font: var(--title-weight) 1.15rem/1.25 var(--font-display); }
.se-head .muted { margin: 0.1rem 0 0; font-size: var(--type-caption); }
.se-timing { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.45rem 0.6rem; }
.se-label { font-weight: 600; }
.se-timing select { min-width: 0; }
.se-move { grid-column: 2; display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.se-secs { display: inline-flex; align-items: center; gap: 0.25rem; margin-right: auto; }
.se-secs input { width: 4.5rem; }
.se-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 6rem; overflow-y: auto; display: grid; align-content: start; gap: 0.15rem; overscroll-behavior: contain; }
.se-row { display: grid; grid-template-columns: 4.6rem 1fr; gap: 0.5rem; align-items: start; padding: 0.35rem 0.4rem; border-radius: var(--radius); }
.se-row.is-now { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.se-row.is-selected { background: color-mix(in srgb, var(--paper) 9%, transparent); }
.se-time { padding: 0.15rem 0.3rem; min-height: 0; border: 0; background: none; color: var(--mist); font: 500 var(--type-caption)/1.3 var(--font-body); font-variant-numeric: tabular-nums; text-align: left; cursor: pointer; }
.se-time:hover, .se-time:focus-visible { color: var(--paper); }
.se-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; cursor: text; }
.se-edit { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.se-foot { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.se-status { margin: 0; color: var(--mist); font-size: var(--type-caption); }
.se-foot .actions { margin-left: auto; display: flex; gap: 0.45rem; flex-wrap: wrap; }
html.tv .subedit { display: none; }

/* ---------- The comments panel in the player (talk.js) ---------- */
.talk-panel { width: min(24rem, calc(100% - 1.5rem)); gap: 0.75rem; }
.talk-panel label.check { font-weight: 500; }
.talk-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.talk-choices[hidden] { display: none; }
#ctl-talk { position: relative; }
#ctl-talk.is-on svg { color: var(--accent); }
#ctl-talk.has-new::after { content: ""; position: absolute; top: 0.45rem; right: 0.45rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); }
.talk-log { list-style: none; margin: 0; padding: 0; max-height: 12.5rem; overflow-y: auto; display: grid; gap: 0.35rem; align-content: start; font-size: var(--type-small); }
.talk-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.45rem; }
.talk-who { font-weight: 600; }
.talk-line.is-mine .talk-who { color: var(--accent); }
.talk-line.is-earlier .talk-who { color: var(--muted); font-weight: 500; }
.talk-text { min-width: 0; overflow-wrap: anywhere; }
.talk-react { font-size: 1.15rem; line-height: 1; }
.talk-at { margin-left: auto; color: var(--muted); font-size: var(--type-tiny); font-variant-numeric: tabular-nums; white-space: nowrap; }
.talk-empty { color: var(--muted); font-size: var(--type-caption); }
.talk-reactions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.talk-reaction { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; min-height: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.3rem; line-height: 1; cursor: pointer; transition: transform 0.12s ease; }
.talk-reaction:hover, .talk-reaction:focus-visible { background: color-mix(in srgb, var(--text) 10%, transparent); border-color: var(--accent); outline: none; }
.talk-reaction:active { transform: scale(0.88); }
/* One column as wide as the box it's in, never as wide as the text box would like: on a 320 px phone the text box
   narrows and Send stays on the screen (an auto column took the text box's own width and pushed Send past the edge). */
.talk-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
.talk-send { display: flex; gap: 0.5rem; }
.talk-input { flex: 1; min-width: 0; min-height: 2.75rem; padding: 0.5rem 0.75rem; font: inherit; }
.talk-options { display: flex; flex-wrap: wrap; gap: 0 1.1rem; }
.talk-options label.check { align-items: center; min-height: 2.25rem; font-weight: 400; }
.talk-options label.check input { margin-top: 0; }
.talk-check[hidden] { display: none; }
.talk-note { margin: 0; color: var(--muted); font-size: var(--type-caption); line-height: 1.45; }

/* ---------- Ratings and reviews (reviews.js) ---------- */
.stars-input { display: inline-flex; align-items: center; gap: 0.1rem; padding: 0.2rem 0.35rem; margin-left: -0.35rem; border-radius: var(--radius); cursor: pointer; touch-action: manipulation; }
.stars-input:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.star { position: relative; display: inline-block; font-size: 2rem; line-height: 1; color: color-mix(in srgb, var(--text) 28%, transparent); }
.star-fill { position: absolute; left: 0; top: 0; width: 0; overflow: hidden; color: var(--accent); pointer-events: none; }
.stars-words { margin-left: 0.6rem; color: var(--muted); font-size: var(--type-small); font-variant-numeric: tabular-nums; }
.review-form { display: grid; gap: 0.6rem; }
.review-more { display: grid; gap: 0.5rem; }
.review-more[hidden], .review-check[hidden] { display: none; }
.review-text { width: 100%; min-height: 5rem; padding: 0.6rem 0.75rem; font: inherit; resize: vertical; }
.review-options { display: flex; flex-wrap: wrap; gap: 0 1.1rem; }
.review-options label.check { align-items: center; min-height: 2.25rem; font-weight: 400; }
.review-options label.check input { margin-top: 0; }
.review-note { margin: 0; color: var(--muted); font-size: var(--type-caption); }
.review-problem { margin: 0; color: var(--danger); font-size: var(--type-small); }
.review-problem:empty { display: none; }
.review-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.reviews .meta { margin: -0.25rem 0 1rem; }
.review-mine { margin-bottom: 1.25rem; max-width: 40rem; }
.review-list { display: grid; gap: 1.1rem; max-width: 46rem; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.75rem; margin: 0; }
.review-stars { color: var(--accent); letter-spacing: 0.05em; }
.rate-card.rate-inline { position: static; width: auto; max-width: none; margin-top: .75rem; padding: .75rem 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; box-shadow: none; }
.review-words { margin: 0.35rem 0 0; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.review-words.is-hidden { display: none; }
/* In the player, as the credits start: beside Up next, not on top of it. */
.rate-card { right: auto; left: var(--gutter); width: min(24rem, calc(100% - 2 * var(--gutter))); }
.rate-card[hidden] { display: none; }
@media (max-width: 44rem) { .rate-card { top: 5rem; bottom: auto; } }

.cast-slot .icon-button svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.bar.thin { max-width: none; margin: 0.35rem 0 0; }
.player-error { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 0.9rem; padding: var(--gutter); text-align: center; background: rgba(0, 0, 0, 0.86); color: #fff; }
.player-error h2 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.player-error p { max-width: 34rem; margin: 0; color: rgba(255, 255, 255, 0.85); line-height: 1.55; }
.player-error .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 0.5rem; }
.player-error a.ghost { display: inline-flex; align-items: center; text-decoration: none; }
@media (max-width: 44rem) {
  .top { flex-wrap: wrap; gap: 0.75rem 1rem; }
  .nav { order: 3; width: 100%; }
  .search-form { flex: 1 1 8rem; }
  .me a { display: none; }
  /* On a phone the backdrop carries the picture: the poster only shows when there is no backdrop. */
  .hero { min-height: clamp(18rem, 52vh, 26rem); }
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-top: 6rem; }
  .hero:not(.plain) .hero-inner > .art { display: none; }
  .hero.plain .hero-inner > .art { width: 8rem; }
  .play-row { width: 100%; }
  .play-main { flex: 1; justify-content: center; }
  .ep-row { grid-template-columns: 8.5rem minmax(0, 1fr) auto; gap: 0.35rem 0.75rem; padding: 0.5rem 0.25rem; contain-intrinsic-height: auto 6.5rem; }
  .ep-tools { flex-direction: column; }
  .ep-overview { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.logview { max-height: 28rem; overflow: auto; margin: 0.75rem 0 0; padding: 0.75rem; background: var(--raised); border-radius: var(--radius); font: var(--type-tiny)/1.45 var(--font-mono); white-space: pre-wrap; word-break: break-word; }

/* ---------- Settings ---------- */
.settings { display: grid; margin: 0 auto; }
.settings-nav { top: 4.5rem; align-self: start; overflow-y: auto; padding-right: 0.5rem; }
.settings-group { margin-bottom: 1.25rem; }
.settings-group-title { margin: 0 0 0.35rem; font-size: var(--type-caption); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mist); }
.settings-nav a { display: block; padding: 0.4rem 0.75rem; border-radius: var(--radius); color: var(--paper); text-decoration: none; }
.settings-nav a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.settings-nav a[aria-current="page"] { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--lamp); font-weight: 600; }
.settings-main { min-width: 0; }
.settings-main h1 { margin-top: 0; }
.settings-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 1rem; border-radius: var(--radius-lg); }
.setting { padding: 1rem 0; border-bottom: 1px solid color-mix(in srgb, var(--text) 7%, transparent); }
.setting .help { margin: 0.35rem 0 0; color: var(--mist); font-size: var(--type-small); }
.setting .help.locked { color: var(--lamp); }
.setting h2 { margin: 0 0 0.5rem; font-size: var(--type-sub, 1.0625rem); }
/* A setting's name reads the same over a field as beside a switch. */
.setting .field > span { font-size: 1rem; font-weight: 500; }
.setting input:not([type="checkbox"]):not([type="radio"]), .setting select { max-width: 28rem; width: 100%; }
.control-row { display: flex; gap: 0.5rem; align-items: center; }
.lib-list { display: grid; gap: 0.75rem; margin: 1rem 0; }
.lib-row { display: flex; justify-content: space-between; align-items: flex-start; }
.lib-row p { margin: 0.15rem 0; }
.lib-info { min-width: 0; overflow-wrap: anywhere; }
.scan-running { display: flex; gap: 0.75rem; align-items: center; }
.spinner { width: 1.1rem; height: 1.1rem; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 20%, transparent); border-top-color: var(--lamp); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.restarting { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 1rem; background: rgba(10, 12, 18, 0.88); }

/* Dialogs */
/* A dialog's look is in material.css. */
.browser { border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); border-radius: var(--radius-lg); padding: 0.75rem; }
.browser-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.browser-head .path { font-family: var(--font-mono); font-size: var(--type-caption); overflow-wrap: anywhere; }
.folder-list { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow-y: auto; }
button.folder { display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 2.5rem; text-align: left; padding: 0.45rem 0.6rem; background: none; border: 0; border-radius: var(--radius); color: var(--paper); cursor: pointer; }
/* A folder, drawn in the icons' own line rather than an emoji. */
button.folder::before { content: ""; flex: none; width: 1.25rem; height: 1.25rem; background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3.5 6.5a1 1 0 0 1 1-1h4.6l2 2.2h8.4a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3.5 6.5a1 1 0 0 1 1-1h4.6l2 2.2h8.4a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat; }
button.folder:hover, button.folder:focus-visible { background: color-mix(in srgb, var(--text) 8%, transparent); }
.inline-form.net { margin-top: 0.25rem; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
fieldset.choices legend { font-weight: 600; margin-bottom: 0.4rem; }

/* Messages */
/* Its own width (up to the screen's): placed at left: 50%, a fixed box would otherwise only have the
   right half of the screen to fit in, and a phone's toasts wrapped a word or two to a line. */
.toasts { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 0.5rem; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 2rem); }
/* A message's look is in material.css. */
.toast { max-width: min(34rem, calc(100vw - 2rem)); }
/* Something that went wrong: in the danger colour, kept up longer, and closed with a tap (util.js toast). */
.toast-error { display: flex; align-items: center; gap: 0.75rem; pointer-events: auto; }
.toast-action { display: flex; align-items: center; gap: 1rem; pointer-events: auto; }
.toast-action button { flex: none; }
.toast-close { flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; opacity: 0.7; }
.toast-close:hover { opacity: 1; background: color-mix(in srgb, var(--text) 12%, transparent); }
/* In the player in full screen (util.js moves them in there), above the controls; and so whenever the player is open. */
.stage > .toasts, #player:not([hidden]) ~ .toasts { bottom: calc(7rem + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 760px) {
  .settings { grid-template-columns: 1fr; gap: 1rem; }
  .settings-nav { position: static; max-height: none; gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
  .settings-group { margin: 0; flex: none; }
  .settings-nav a { white-space: nowrap; }
  .lib-row { flex-direction: column; }
}

/* Settings polish */
.settings { padding-inline: var(--gutter); }
.settings-select { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.setting input:disabled, .setting select:disabled { opacity: 0.45; cursor: not-allowed; }
.setting label.check:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
fieldset.choices label.check { font-weight: 400; }
fieldset.choices strong { font-weight: 700; color: var(--paper); }
@media (max-width: 760px) {
  .settings-nav { display: none; }
  .settings-select { display: block; width: 100%; margin-bottom: 1rem; }
}

/* ---------- Editing ---------- */
dialog.modal.wide { width: min(56rem, calc(100vw - 2rem)); }
/* Tabs across a dialog (Edit's Details, Poster and Background): words, the chosen one underlined. */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tab { min-height: var(--control-h, 2.75rem); margin-bottom: -1px; padding: 0 0.9rem; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--mist);
  cursor: pointer; font: 500 var(--type-note)/1.2 var(--font-body); white-space: nowrap; transition: color 0.15s ease, border-color 0.15s ease; }
.tab:hover { color: var(--paper); }
.tab[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.tabs .tab:active:not(:disabled) { transform: none; }
.edit-body { min-height: 16rem; }
.edit-body textarea { width: 100%; font: inherit; }
.lock { color: var(--lamp); font-weight: 600; font-size: 0.85em; }
.art-top { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.art-current { margin: 0; }
.art-current img { display: block; max-width: 12rem; max-height: 14rem; border-radius: var(--radius); background: var(--booth); }
.art-current figcaption { color: var(--mist); font-size: var(--type-caption); margin-top: 0.3rem; }
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.75rem; }
.art-grid.wide { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.art-choice { padding: 0; border: 2px solid transparent; border-radius: var(--radius); background: var(--booth); cursor: pointer; overflow: hidden; }
.art-choice:hover, .art-choice:focus-visible { border-color: var(--lamp); }
.art-choice img { display: block; width: 100%; height: auto; }

/* ---------- Playlists ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.pl-tile { color: var(--paper); text-decoration: none; }
.pl-tile h3 { margin: 0.6rem 0 0.1rem; font-family: var(--marquee); font-size: 1.15rem; }
.pl-tile p { margin: 0; font-size: var(--type-small); }
.pl-tile { display: block; min-width: 0; }
.pl-tile .collage { transition: transform 0.4s var(--ease-out, ease), box-shadow 0.4s var(--ease-out, ease); }
.pl-tile:hover .collage { transform: translateY(-4px); box-shadow: 0 12px 22px -12px rgb(0 0 0 / 0.7), 0 0 0 2px color-mix(in srgb, var(--text) 75%, transparent); }
.pl-tile:focus-visible { outline: none; }
.pl-tile:focus-visible .collage { outline: 2px solid var(--ring); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .pl-tile .collage { transition: none; } .pl-tile:hover .collage { transform: none; } }
/* Your playlists, then From <server name>: the ones admins shared with everyone. */
.pl-group { margin: 1.5rem 0 0; font-size: calc(var(--type-section, 1.25rem) * var(--type-scale, 1)); }
.collage { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; background: var(--booth); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.collage.single img { grid-column: 1 / -1; grid-row: 1 / -1; }
.collage.single .pl-missing { grid-column: 1 / -1; grid-row: 1 / -1; }
.collage img, .collage .empty { width: 100%; height: 100%; max-width: none; margin: 0; padding: 0; border-radius: 0; object-fit: cover; background: var(--rule); }
.pl-head { display: flex; gap: 1.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.75rem; }
.pl-head .collage { width: 11rem; }
.pl-head-text { flex: 1 1 18rem; min-width: 0; }
.pl-head-text > p { margin: 0.25rem 0; }
.pl-head h1 { margin: 0.1rem 0; font-family: var(--marquee); font-size: clamp(2rem, 5vw, 3.2rem); }
.pl-about { max-width: 42rem; }
.pl-head-text :is(.play-row, .detail-row) { margin-top: 0.9rem; }
.pl-head-text .play-row + .detail-row { margin-top: 0.5rem; }
/* The row above a list's grid: Select, and what a library's toolbar has beside it. */
.list-bar { display: flex; justify-content: flex-end; margin: 0 0 1rem; }
.list-bar:empty { display: none; }
/* A row whose picture wouldn't load (an episode with no still): its name in the box instead. */
.pl-missing { display: grid; place-items: center; width: 7rem; aspect-ratio: 16 / 9; padding: 0.3rem; overflow: hidden; border-radius: var(--radius); background: var(--booth);
  color: var(--mist); font-size: var(--type-tiny); line-height: 1.2; text-align: center; }
.collage .pl-missing { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; font-size: 2.5rem; }
.collage .pl-missing svg { width: 2rem; height: 2rem; fill: currentColor; }
.pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.pl-row { display: grid; grid-template-columns: 2rem 7rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 0.5rem; border-radius: var(--radius-lg); }
.pl-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.pl-num { color: var(--mist); text-align: right; font-variant-numeric: tabular-nums; }
.pl-art img { display: block; width: 7rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--booth); }
.pl-info a, .pl-art { color: var(--paper); text-decoration: none; }
.pl-info p { margin: 0.2rem 0 0; }
.pl-tools { display: flex; gap: 0.35rem; }
.pl-tools .pill-action.icon-only { width: var(--control-h-sm); min-height: var(--control-h-sm); }
.pl-choices { display: grid; gap: 0.4rem; max-height: 18rem; overflow-y: auto; }
.playlist-visibility { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; }
/* A list to pick from (which playlist, which collection): rows as tall as a button, quiet until pointed at. */
.pl-choice { display: flex; align-items: center; gap: 0.5rem; min-height: var(--control-h, 2.75rem); text-align: left; padding: 0.5rem 0.9rem; border-radius: var(--field-radius, var(--radius));
  border: 1px solid var(--line); background: none; color: var(--paper); cursor: pointer; font: inherit; }
.pl-choice:hover { border-color: var(--muted); background: color-mix(in srgb, var(--text) 5%, transparent); }
.pl-choice:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.pl-choice:active:not(:disabled) { transform: none; }
@media (max-width: 760px) {
  .pl-row { grid-template-columns: 5rem minmax(0, 1fr) auto; gap: 0.75rem; }
  .pl-num { display: none; }
  .pl-art img, .pl-missing { width: 5rem; }
  .pl-tools { gap: 0.15rem; }
  .pl-head .collage { width: 8rem; }
}

/* The player sits on black in every theme, so it always uses the theme's night colours. So does
   the game player's stage, with its bar and menus. */
.player, .player dialog, .game-stage {
  --bg: var(--night-bg); --surface: var(--night-surface); --raised: var(--night-raised); --line: var(--night-line);
  --text: var(--night-text); --muted: var(--night-muted); --accent: var(--night-accent); --on-accent: var(--night-on-accent);
  --container: var(--night-container, var(--night-surface)); --on-container: var(--night-on-container, var(--night-text));
  --tonal: var(--night-tonal, var(--night-raised)); --on-tonal: var(--night-on-tonal, var(--night-text));
  --danger: var(--night-danger); --warn: var(--night-warn); --paper: var(--text); --mist: var(--muted); --rule: var(--line); --lamp: var(--accent);
  /* These are worked out from the day colours at the page root, so set them again here. */
  --night: var(--night-bg); --booth: var(--night-surface);
  --ring: var(--focus, var(--accent));
  color: var(--text); color-scheme: dark;
}
/* Fields (input, select, textarea) are drawn in material.css. */

/* ---------- Appearance ---------- */
/* Day or night (.mode-pick) is a segmented control, and the theme pickers' cards and swatches
   are at the end of material.css. */
.editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.6rem 1rem; }
.color-field { display: flex; align-items: center; gap: 0.6rem; }
.color-field input[type="color"] { width: 2.6rem; height: 2rem; padding: 0.1rem; border-radius: var(--radius); }
.editor-section { border: 1px solid var(--line); padding: 0.8rem 1rem; }
.editor-section legend { font-weight: 600; padding: 0 0.3rem; }
.contrast-notes { color: var(--warn); font-size: var(--type-small); margin: 0; padding-left: 1.2rem; }

/* "More" menus: material.css (Menus). */

/* ---------- Filters, collections, home layout ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.25rem 0 1.25rem; }
@media (max-width: 640px) {
  html:not(.tv) .section > .filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding: 0.2rem var(--gutter); scroll-padding-inline: var(--gutter);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
  html:not(.tv) .section > .filter-bar::-webkit-scrollbar { display: none; }
  html:not(.tv) .section > .filter-bar > *, html:not(.tv) .section > .filter-bar .chips { flex: none; flex-wrap: nowrap; }
}
.filter-bar select { width: auto; }
.toolbar .sort { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: var(--type-small); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
/* The filters a page has on, as chips with Clear filters (view-chips.js), and the genre control wherever it is a field (genre-picker.js). */
.view-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: -0.5rem 0 1rem; }
/* A chip that only says what is on (a TV's: the remote's one stop is Clear filters) has no close mark. */
.view-chips span.chip::after { display: none; }
.genre-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.genre-picker select { width: auto; max-width: 100%; }
/* A library's bar (views.js libraryBar): Sort, then the filters, on the left on every kind of
   library. On a phone the filters fold behind Filters, so the bar is one line within the screen. */
.lib-bar .sort { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: var(--type-small); }
.lib-bar .lib-filters-toggle { display: none; }
@media (max-width: 640px) {
  html:not(.tv) .section > .filter-bar.lib-bar { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  html:not(.tv) .section > .filter-bar.lib-bar > * { flex: 0 1 auto; min-width: 0; }
  /* With large text, Sort's choice goes under its label rather than being cut. */
  html:not(.tv) .lib-bar .sort { flex-wrap: wrap; }
  html:not(.tv) .lib-bar .sort select { max-width: min(100%, 11.5rem); min-width: min(100%, 9em); }
  html:not(.tv) .lib-bar .lib-filters-toggle { display: inline-flex; }
  .lib-bar .lib-filters-toggle[aria-expanded="true"] { background-color: var(--tonal); color: var(--on-tonal); }
  html:not(.tv) .section > .filter-bar.lib-bar .chips { flex-wrap: wrap; }
}
/* Search's groups (views.js renderSearch): a heading with how many. */
.search-group > h2 { display: flex; align-items: baseline; gap: 0.6rem; }
.search-group > h2 .count { color: var(--mist); font: 500 var(--type-note)/1 var(--font-body); }
.search-group + .search-group { padding-top: 0.25rem; }
/* People in search: the cast's round cards in the grid's columns, a face never wider than its column. */
.grid.people .face { max-width: 100%; height: auto; aspect-ratio: 1; }
.preview-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.4rem; }
.preview-strip img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--raised); border-radius: var(--radius); }
.move { display: inline-flex; gap: 0.25rem; }
.brand-welcome { max-width: 32rem; white-space: pre-line; }
@media (max-width: 760px) {
  .preview-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Hand-picked collections ---------- */
.kind-choices { display: grid; gap: 0.75rem; }
.kind-choice { display: grid; gap: 0.25rem; text-align: left; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--text) 4%, transparent); color: var(--text); cursor: pointer; font: inherit; }
.kind-choice strong { font: var(--title-weight) 1.35rem/1.1 var(--font-display); font-style: var(--title-style); letter-spacing: var(--title-tracking); }
.kind-choice:hover { border-color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); }
.kind-choice:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kind-choice:active:not(:disabled) { transform: none; }
.arrange-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 2px; max-width: 52rem; }
.arrange-list .pl-row { grid-template-columns: 2rem 3.4rem minmax(0, 1fr) auto; }
.arrange-list .pl-art img, .add-row img { width: 3.4rem; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); background: var(--raised); display: block; }
.arrange-list .pl-info p, .add-row p { margin: 0.1rem 0 0; }
.add-results { display: grid; gap: 2px; max-height: min(26rem, 55vh); overflow-y: auto; margin-top: 0.25rem; }
.add-row { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; padding: 0.4rem; border-radius: var(--radius); }
.add-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
label.add-row { grid-template-columns: auto 3.4rem minmax(0, 1fr); cursor: pointer; }
.topic-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0.4rem; }
.topic-head p { margin: 0; }
.editor-section input[type="search"] { width: 100%; }
.topic-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 0.5rem; }
.topic-foot p { margin: 0; flex: 1 1 18rem; }
.missing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: min(22rem, 45vh); overflow-y: auto; }
.missing-list li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: baseline; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line); }
.missing-code { font-variant-numeric: tabular-nums; color: var(--mist); }
.pl-choice[aria-pressed="true"] { border-color: var(--tonal); background: var(--tonal); color: var(--on-tonal); }
@media (max-width: 640px) {
  .arrange-list .pl-row { grid-template-columns: 3.4rem minmax(0, 1fr) auto; }
}

/* ---------- Rails: rows without scrollbars ---------- */
.rail { position: relative; }
.rail:not(.at-end) .row { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 5rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 5rem), transparent); }
.rail:not(.at-start):not(.at-end) .row { -webkit-mask-image: linear-gradient(to right, transparent, #000 5rem, #000 calc(100% - 5rem), transparent); mask-image: linear-gradient(to right, transparent, #000 5rem, #000 calc(100% - 5rem), transparent); }
.rail:not(.at-start).at-end .row { -webkit-mask-image: linear-gradient(to right, transparent, #000 5rem); mask-image: linear-gradient(to right, transparent, #000 5rem); }
.rail-btn { position: absolute; top: calc((100% - 3.2rem) / 2 - 1.4rem); z-index: 2; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; opacity: 0; }
.rail-btn[hidden] { display: none; }
.rail-btn.prev { left: 0.5rem; }
.rail-btn.next { right: 0.5rem; }
.rail-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.rail-btn .chev { width: 0.6rem; height: 0.6rem; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(-45deg); margin-right: 0.2rem; }
.rail-btn.prev .chev { transform: rotate(135deg); margin: 0 0 0 0.2rem; }
.rail:has(.row.people) .rail-btn { top: calc((100% - 2.4rem) / 2 - 1.4rem); }
/* A touch screen swipes its rows, hero rows included, so the arrows are only for a mouse or a
   trackpad: a touch-only tablet has none, and a tablet with a trackpad attached (any-hover)
   keeps them. TVs hide them too (tv.css). */
@media not (any-hover: hover) { .rail-btn { display: none; } }
@media (prefers-reduced-motion: reduce) { .rail-btn { transition: none; } }
/* Pages kept up to date (live.js): a title or row that arrives fades in (not with less motion,
   nor on a TV: live.js leaves the class off). */
.live-new { animation: live-in 0.6s ease-out both; }
@keyframes live-in { from { opacity: 0; } }

/* ---------- Live TV (channels.js) ---------- */
/* A channel's picture, or its number (or short text) in a box. */
.ch-badge { display: inline-grid; place-items: center; flex: none; min-width: 2.6rem; height: 1.9rem; padding: 0 0.45rem; border-radius: 6px; background: var(--raised); color: var(--text);
  font: 700 var(--type-caption)/1 var(--font-body); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
/* Its one row is the badge's height, so a logo is held within it: left to grow to the picture, the row ran out of the
   badge's bottom (and the logo with it) for any logo less than about three times as wide as it is tall. */
.ch-badge.has-logo { grid-template-rows: minmax(0, 1fr); padding: 0.15rem 0.3rem; background: transparent; }
.ch-badge.has-logo img { display: block; max-width: 5rem; max-height: 100%; object-fit: contain; }
.ch-badge.large { min-width: 4rem; height: 2.8rem; font-size: 1rem; }
.ch-badge.on-art { position: absolute; left: 0.5rem; top: 0.5rem; background: color-mix(in srgb, var(--bg) 86%, transparent); }
/* A channel's tile without a picture (Starting soon) is its badge alone: the name the tile would
   spell out is beside or under it already, and on a phone's small tile it ran behind the badge. */
.art:has(> .ch-badge.on-art) > .placeholder { color: transparent; }
.ch-number { margin-right: 0.45rem; color: var(--mist); font-weight: 600; font-variant-numeric: tabular-nums; }
/* "On now": red, as broadcast TV marks what's live. */
.live-pill { display: inline-block; margin-right: 0.45rem; padding: 0.05rem 0.45rem; border-radius: 4px; background: var(--live); color: #fff; font-size: var(--type-tiny); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; vertical-align: middle; }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.live-head h1 { margin: 0; }
/* The guide: channels stay at the left and times at the top while it scrolls either way. */
.guide { --guide-col: 12rem; border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.guide-scroll { position: relative; max-height: calc(100vh - 13rem); overflow: auto; overscroll-behavior: contain; scroll-padding: 2.5rem 0 0 var(--guide-col);
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) transparent; }
.guide-inner { position: relative; }
.guide-times { position: sticky; top: 0; z-index: 3; display: flex; height: 2.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.guide-corner { position: sticky; left: 0; z-index: 1; flex: none; display: flex; align-items: center; width: var(--guide-col); padding: 0 0.75rem; background: var(--surface); color: var(--mist); font-size: var(--type-caption); }
.guide-ticks, .guide-progs { position: relative; flex: none; }
/* A channel's programmes off the screen are left for when they are scrolled to (or the keyboard goes to one): with
   hundreds of channels the browser styled and laid out every programme of every channel as the guide opened and each
   time it was drawn again (30,000 boxes for 300 channels). The strip's width is set as it is drawn (channels.js) and
   its height is its row's, so nothing moves as strips come and go; the channel at the left is outside it, always drawn. */
.guide-progs { content-visibility: auto; }
.guide-tick { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; border-left: 1px solid var(--line); color: var(--mist); font-size: var(--type-caption); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A half hour's label keeps clear of the channels while its stretch scrolls under them. */
.gt-label { position: sticky; left: var(--guide-col); padding-left: 0.4rem; }
.guide-row { display: flex; height: 4.25rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.guide-channel { position: sticky; left: 0; z-index: 2; flex: none; display: flex; align-items: center; gap: 0.5rem; width: var(--guide-col); padding: 0 0.75rem; background: var(--surface); border-right: 1px solid var(--line); text-decoration: none; }
.guide-channel:hover .gc-name { text-decoration: underline; text-underline-offset: 3px; }
.gc-number { color: var(--mist); font-size: var(--type-caption); font-variant-numeric: tabular-nums; }
.gc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* Clipped, not hidden: overflow hidden would make each programme a scroller of its own, and its
   words (sticky) would then stay put in it instead of in view as the guide scrolls. */
.guide-prog { position: absolute; top: 0.3rem; bottom: 0.3rem; display: grid; align-content: center; min-width: 0; padding: 0.25rem 0.55rem; overflow: hidden; overflow: clip;
  border: 0; border-radius: 6px; background: var(--raised); color: var(--text); text-align: left; cursor: pointer; }
.gp-label { position: sticky; left: calc(var(--guide-col) + 0.55rem); display: grid; gap: 0.1rem; justify-self: start; min-width: 0; max-width: 100%; }
.guide-prog strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--type-small); font-weight: 600; }
.guide-prog .gp-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mist); font-size: var(--type-tiny); }
.guide-prog.on { background: var(--tonal); color: var(--on-tonal); }
.guide-prog.on .gp-sub { color: inherit; opacity: 0.85; }
/* What's on now may take two lines for its title, where the whole title then fits (channels.js measures it); its
   start time and episode give way to it, as the details say them. Not on a TV's page, whose rows are lower. */
html:not(.tv) .guide-prog.on { padding-inline: 0.4rem; }
html:not(.tv) .guide-prog.on .gp-label { left: calc(var(--guide-col) + 0.4rem); }
html:not(.tv) .guide-prog.on.wrap strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; line-height: 1.2; overflow-wrap: normal; }
html:not(.tv) .guide-prog.on.wrap .gp-sub { display: none; }
.guide-prog.filler { background: transparent; border: 1px dashed var(--line); }
/* Recording (dvr.rs): a red dot, hollow when no tuner is free for it. */
.rec-dot { display: inline-block; flex: none; width: 0.55rem; height: 0.55rem; margin-right: 0.35rem; border-radius: 50%; background: var(--live, #e0443e); vertical-align: 0.05em; }
.guide-prog.rec-conflict .rec-dot, .rec-state.conflict .rec-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--live, #e0443e); }
.new-pill { display: inline-block; margin-left: 0.45rem; padding: 0.05rem 0.45rem; border-radius: 4px; background: var(--tonal); color: var(--on-tonal); font-size: var(--type-tiny); font-weight: 700; vertical-align: middle; }
.prog-rec { display: grid; gap: 0.4rem; margin: 0.6rem 0; }
.prog-rec p { margin: 0; }
.rec-state { display: flex; align-items: center; font-weight: 600; }
/* Favourite channels. */
.fav-btn { display: inline-grid; place-items: center; min-width: 2.2rem; padding: 0.3rem; }
.fav-btn svg { width: 1.2rem; height: 1.2rem; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.live-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.fav-filter[aria-pressed="true"] { background: var(--tonal); color: var(--on-tonal); }
.live-name { display: flex; align-items: center; gap: 0.3rem; }
.live-name h2 { margin: 0; }
.guide-prog:hover { filter: brightness(1.12); }
.guide-prog:focus-visible, .guide-channel:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
/* Now: a thin line down the grid, drawn under the programmes (before the rows) so it shows between them; each one on
   now carries it as a stripe of its own background (--now-x, where now is from its left edge, where every one on now
   starts), under its words, so it never cuts a title. A dot marks it on the times. */
.guide-now { position: absolute; top: 2.5rem; bottom: 0; width: 2px; margin-left: -1px; background: var(--live); pointer-events: none; }
.guide-prog.on { background-image: linear-gradient(var(--live), var(--live)); background-repeat: no-repeat; background-size: 2px 100%; background-position: calc(var(--now-x, 0px) - 1px) 0; }
.guide-prog.on .gp-label { --halo: var(--tonal); text-shadow: 0 0 1px var(--halo), 0 0 2px var(--halo), 0 0 2px var(--halo), 0 0 3px var(--halo), 0 0 4px var(--halo); }
/* A card or trailers on now has no background of its own: its words keep clear of the line in the guide's. */
.guide-prog.on.filler .gp-label { --halo: var(--surface); }
.guide-now-mark { position: absolute; bottom: -4px; z-index: 1; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--live); pointer-events: none; }
/* The programme whose details are open beside the guide: outlined in the accent, as focus is, and its channel lit. */
.guide-prog.picked { box-shadow: inset 0 0 0 2px var(--accent); }
.guide-row.picked-row .guide-channel { background: color-mix(in srgb, var(--tonal) 38%, var(--surface)); }
/* A programme's details beside the guide, on a computer's screen (channels.js): at the left, under the page's title,
   and the guide (channels, then the times) in the rest. With none open the guide has the whole width, as before. The
   details are at least as tall as the guide, and the guide keeps its own height. */
.live-split { display: flex; align-items: stretch; gap: 1rem; }
.live-split > .guide { flex: 1 1 0; min-width: 0; align-self: flex-start; }
.guide-detail { position: relative; flex: none; display: flex; flex-direction: column; box-sizing: border-box; width: clamp(22rem, 30vw, 27.5rem);
  max-height: calc(100vh - 13rem); padding: 1.5rem 1.5rem 0.75rem; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  background: var(--container); color: var(--on-container); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); border-radius: var(--radius); }
.guide-detail:focus { outline: none; }
.guide-detail:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* The picture: the programme's still or backdrop with the channel's logo at its corner; without one, a soft wash with
   the logo (or the channel's number) in the middle. */
.gd-pic { position: relative; flex: none; aspect-ratio: 16 / 9; border-radius: var(--media-radius); overflow: hidden;
  background:
    radial-gradient(90% 75% at 22% 18%, color-mix(in srgb, var(--tonal) 95%, transparent), transparent 70%),
    radial-gradient(70% 70% at 88% 105%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    linear-gradient(155deg, var(--raised) 0%, color-mix(in srgb, var(--raised) 45%, var(--bg)) 55%, var(--bg) 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 55%, transparent); }
.gd-pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / 0.28), transparent 45%); pointer-events: none; }
.gd-pic > .art { position: absolute; inset: 0; border-radius: 0; }
.ch-badge.gd-mark { position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; height: 2.8rem; min-width: 4rem; font-size: 1.2rem; }
.ch-badge.gd-mark.has-logo { inset: 0; translate: none; width: 47%; height: 47%; margin: auto; padding: 0; }
.ch-badge.gd-mark.has-logo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; filter: drop-shadow(0 10px 22px rgb(0 0 0 / 0.55)); }
.gd-pic .gd-close { position: absolute; z-index: 1; top: 0.6rem; right: 0.6rem; color: var(--text); border-color: transparent;
  background-color: color-mix(in srgb, var(--bg) 62%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.gd-pic .gd-close:hover { background-color: color-mix(in srgb, var(--bg) 80%, transparent); }
.gd-channel { display: flex; align-items: center; margin: 1rem 0 0.3rem; color: var(--muted); font-size: var(--type-caption); }
.gd-channel .ch-number { margin-right: 0.4rem; }
.gd-title { margin: 0; font-size: 1.6rem; line-height: 1.2; overflow-wrap: anywhere; }
.gd-sub { margin: 0.3rem 0 0; color: var(--muted); font-size: var(--type-note); }
.gd-when { display: flex; align-items: center; flex-wrap: wrap; margin: 0.95rem 0 0; font-size: var(--type-small); font-variant-numeric: tabular-nums; }
.gd-when .live-pill { margin-right: 0.6rem; }
.gd-left { margin-left: auto; padding-left: 0.75rem; color: var(--muted); white-space: nowrap; }
.gd-bar { position: relative; flex: none; height: 4px; margin-top: 0.55rem; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--text) 13%, transparent); }
.gd-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--accent); }
.gd-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; flex: none; overflow: hidden; margin: 0.95rem 0 0;
  color: color-mix(in srgb, var(--text) 88%, transparent); font-size: var(--type-note); line-height: 1.5; }
.gd-desc:empty, .gd-more:empty { display: none; }
.guide-detail .prog-rec { margin: 0.8rem 0 0; }
.gd-actions { display: flex; align-items: center; gap: 0.5rem; margin: 1.1rem 0 0.75rem; }
.gd-actions .primary { padding-inline: 1.15rem 1.4rem; }
.gd-actions .fav-btn { margin-left: auto; }
.gd-actions .fav-btn svg { width: 1.25rem; height: 1.25rem; }
/* Later on this channel: the next three, at the foot, their times in one column as wide as the widest. Choosing one
   shows it here. */
.gd-later { margin-top: auto; padding-top: 0.85rem; border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.gd-later h3 { margin: 0 0 0.35rem; color: var(--muted); font: 600 var(--type-overline)/1.4 var(--font-body); letter-spacing: 0.07em; text-transform: uppercase; }
.gd-later ul { display: grid; grid-template-columns: minmax(3.4rem, max-content) minmax(0, 1fr) max-content; column-gap: 0.5rem; list-style: none; margin: 0 -0.6rem; padding: 0; }
.gd-later li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
.gd-next { position: relative; display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; align-content: center; width: 100%; min-height: 2.5rem;
  padding: 0 0.6rem; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: 400 var(--type-small)/1.3 var(--font-body); }
/* The rules between the rows line up with the one above the list (the rows reach out a little for their hover). */
li + li > .gd-next::before { content: ""; position: absolute; top: 0; left: 0.6rem; right: 0.6rem; height: 1px; background: color-mix(in srgb, var(--line) 45%, transparent); }
.gd-next:hover { background: var(--hover); }
.gd-next:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.gd-next-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gd-next-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gd-next-sub { color: var(--muted); font-size: var(--type-caption); white-space: nowrap; }
/* A shorter window: a shorter picture and description, so the next three stay in sight. */
@media (max-height: 56rem) {
  .gd-pic { aspect-ratio: 2 / 1; }
  .gd-desc { -webkit-line-clamp: 3; }
}
@media (max-width: 640px) { .guide { --guide-col: 7.5rem; } .guide-channel .ch-badge { display: none; } }
/* On now as a list: each channel's picture, what's on and what's next. What phones start with. */
.live-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.live-item { display: grid; grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr); gap: 1rem; align-items: center; }
.live-tune { display: block; text-decoration: none; }
.live-tune .art { aspect-ratio: 16 / 9; }
.live-tune:focus-visible { outline: none; }
.live-tune:focus-visible .art { outline: 2px solid var(--ring); outline-offset: 3px; }
.live-text { min-width: 0; }
.live-text h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.live-text h2 a { text-decoration: none; }
.live-text p { margin: 0.15rem 0; overflow-wrap: anywhere; }
.live-on .muted { white-space: nowrap; }
.live-title { color: var(--text); font-size: var(--type-note); text-align: left; }
@media (max-width: 30rem) { .live-item { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.75rem; } .live-text h2 { font-size: 1rem; } }
/* A programme's details, from the guide. */
.prog-pic .art { aspect-ratio: 16 / 9; margin-bottom: 1rem; }
.prog-sub { margin: 0.1rem 0 0.4rem; color: var(--mist); }
.prog-overview { margin: 0.75rem 0 1rem; }
.prog-overview:empty { display: none; }

/* ---------- Storage, graphics cards, library folders ---------- */
.gpu-list { display: grid; gap: 0.4rem; margin-top: 0.35rem; }
.gpu-option { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.gpu-option > span { display: grid; }
.gpu-option.off { opacity: 0.6; cursor: not-allowed; }
.gpu-option input { margin-top: 0.2rem; accent-color: var(--accent); }
.help.folders span { display: block; overflow-wrap: anywhere; }
.lib-folders { list-style: none; margin: 0.35rem 0 0.5rem; padding: 0; display: grid; gap: 2px; }
.lib-folders li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.45rem 0.6rem; background: var(--raised); border-radius: var(--radius); overflow-wrap: anywhere; }
.lib-folders li > span:first-child { flex: 1; min-width: 0; }
.lib-folders li.pending-remove > span:first-child { text-decoration: line-through; color: var(--mist); }
.folder-browser { margin-top: 0.5rem; }

/* ---------- Home banner ---------- */
/* A wide, not letterbox, shape: tall enough on big screens that people's heads stay in frame. */
.banner { position: relative; margin: 0 var(--gutter) 2.5rem; border-radius: var(--radius-lg);
  display: grid; width: auto; }
/* Sideways swipes are the banner's own (views.js); up and down still scroll the page. */
.banner { touch-action: pan-y pinch-zoom; }
/* Stack slides in one grid cell, but keep their content in layout. The tallest slide
   reserves room, including when text wraps or a logo loads, without jumping on rotation. */
.banner-slide { position: relative; grid-area: 1 / 1; min-width: 0; display: grid; align-items: end; }
.banner-slide[hidden] { display: none; }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.banner-slide::after { content: ""; position: absolute; inset: 0; }
.banner-text { position: relative; z-index: 1; display: grid; padding: clamp(1.25rem, 4vw, 3rem); padding-bottom: 4.5rem; }
.banner-label { margin: 0; }
.banner-title { font: var(--title-weight) clamp(2rem, 4.5vw, 3.6rem)/1.02 var(--font-display); font-style: var(--title-style); }
.banner-meta { margin: 0; }
.banner-overview { margin: 0.25rem 0 0.5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.banner-dot { padding: 0; cursor: pointer; }
@media (max-width: 640px) {
  .banner { margin: 0 0 2rem; border-radius: 0; min-height: 26rem; }
}

/* ---------- A start-up that can't finish (boot-watch.js) ---------- */
.boot-wait { background: var(--bg); color: var(--text); }
.boot-wait h1 { margin: 0; font: var(--title-weight, 600) 1.6rem/1.2 var(--font-display); }
.boot-wait p { margin: 0; max-width: 32rem; color: var(--muted); }

/* ---------- Trailers ---------- */
/* A card that starts with a hidden label (.visually-hidden is absolute) is that label's box: left to the
   row's wrapper, the row that scrolls can't clip it and every card past the edge widens the page. */
.extra-card, .trailer-card { position: relative; }
.trailer-card { padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.trailer-card:focus-visible { outline: none; }
.trailer-card:focus-visible .art { outline: 2px solid var(--ring); outline-offset: 3px; }
.play-badge { position: absolute; left: 50%; top: 50%; width: 3.2rem; height: 3.2rem; margin: -1.6rem 0 0 -1.6rem; border-radius: 50%; background: rgba(8, 7, 6, 0.62); border: 2px solid rgba(255, 255, 255, 0.85); }
.play-badge::after { content: ""; position: absolute; left: 1.2rem; top: 0.9rem; border-style: solid; border-width: 0.7rem 0 0.7rem 1.1rem; border-color: transparent transparent transparent #fff; }
.trailer-card:hover .play-badge { background: var(--accent); border-color: var(--accent); }
/* The trailer player (trailers.js, trailer.html): the whole screen, like the video player, over
   the page it was started from. */
dialog.trailer-screen { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: #000; overflow: hidden; }
dialog.trailer-screen::backdrop { background: #000; }
.trailer-screen-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
/* Coming soon: a trailer card with its My list button in the picture's corner (the card itself
   is a button, so the two sit side by side in a wrapper), and what its details dialog says. */
.upcoming-card { position: relative; }
.upcoming-open { display: block; width: 100%; }
.upcoming-save { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 1; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); background: rgba(8, 7, 6, 0.62); color: #fff; cursor: pointer; }
.upcoming-save svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.upcoming-save:hover { background: rgba(8, 7, 6, 0.85); }
.upcoming-save[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.upcoming-save:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.upcoming-save:disabled { opacity: 0.6; cursor: progress; }
.trailer-about { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
dialog.modal.upcoming-dialog { width: min(40rem, 94vw); }
.trailer-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; margin: 0; color: var(--mist); font-size: var(--type-note); }
.trailer-overview { margin: 0; max-width: 60rem; line-height: 1.5; }
.upcoming-saved { margin-top: 2rem; }
.upcoming-saved h2 { margin: 0 0 1rem; }
.chip.preset { font-size: var(--type-caption); }

/* ---------- Player controls ---------- */
/* Two quick taps seek (controls.js), so they mustn't zoom the page on a phone. */
.stage { position: relative; touch-action: manipulation; }
.stage video { cursor: pointer; }
/* How far a double tap has gone, on the side tapped, fading out as the next tap would stop
   adding to it. */
.seek-bubble { position: absolute; top: 50%; left: 16.7%; z-index: 2; min-width: 4.5rem; padding: 0.6rem 1rem; transform: translate(-50%, -50%);
  border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font: 600 1.05rem/1 var(--font-body); font-variant-numeric: tabular-nums; text-align: center; pointer-events: none; }
.seek-bubble[data-side="on"] { left: 83.3%; }
/* A held skip on Live TV (controls.js): the distance scrubbed so far, up until it's let go. */
.seek-bubble.hold { animation: none; }
.seek-bubble.pop { animation: seek-pop 0.7s ease both; }
@keyframes seek-pop { from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } 15%, 70% { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { .seek-bubble.pop { animation: none; } }
.stage.idle, .stage.idle video { cursor: none; }
/* The controls are quiet: a light scrim, small translucent icons and a thin timeline that grows when
   it's touched, hovered or focused. They fade after 3 seconds without a movement (controls.js). */
.controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 2rem max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.22) 62%, transparent); color: #fff; transition: opacity 0.35s ease, transform 0.35s ease; }
.stage.idle .controls { opacity: 0; transform: translateY(0.5rem); pointer-events: none; }
.timeline { position: relative; height: 1.5rem; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.tl-track { position: relative; width: 100%; height: 3px; background: rgba(255, 255, 255, 0.4); border-radius: 2px; overflow: hidden; transition: height 0.15s ease; }
.timeline:hover .tl-track, .timeline.dragging .tl-track, .timeline:focus-visible .tl-track { height: 6px; }
.tl-buffered, .tl-played { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); }
.tl-buffered { background: rgba(255, 255, 255, 0.3); }
.tl-played { background: var(--accent); }
.tl-marks span { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(0, 0, 0, 0.55); }
/* Ad breaks, as stretches of the timeline. */
.tl-ads span { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, #f2c14e 70%, transparent); }
.tl-thumb { position: absolute; top: 50%; width: 0.75rem; height: 0.75rem; margin: -0.375rem 0 0 -0.375rem; border-radius: 50%; background: #fff; transform: scale(0); transition: transform 0.15s ease; pointer-events: none; }
.timeline:hover .tl-thumb, .timeline.dragging .tl-thumb, .timeline:focus-visible .tl-thumb { transform: scale(1); }
.timeline:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }
.ctl-row { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.35rem; }
.ctl { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, 0.9); cursor: pointer; transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease; }
.ctl[aria-expanded="true"] { background: rgba(255, 255, 255, 0.2); }
.ctl-labelled { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; padding: 0 0.9rem 0 0.6rem; border-radius: var(--control-radius); font: 500 var(--type-small) var(--font-body); white-space: nowrap; }
.ctl-labelled svg { width: 1.35rem; height: 1.35rem; }
.ctl-main { width: 2.75rem; height: 2.75rem; }
.ctl-volume-group { display: flex; align-items: center; }
.ctl svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
.ctl svg text { font: 700 6.5px var(--font-body); fill: currentColor; }
.ctl:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.ctl:active { transform: scale(0.92); }
.ctl:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; color: #fff; }
/* A watch party where only the host can play, pause and skip (controls.js lockTransport): greyed out, as other
   controls that are turned off are. */
.ctl:disabled, .timeline[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.ctl:disabled:hover { background: transparent; color: rgba(255, 255, 255, 0.9); }
.ctl:disabled:active { transform: none; }
/* Back and Forward are pressed and held (a hold scrubs, seek.js; #rew and #fwd are the trailer
   player's): a long press mustn't select the icon or offer a menu. */
#ctl-back, #ctl-fwd, #rew, #fwd { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
#ctl-play svg { width: 1.7rem; height: 1.7rem; }
.ctl-time { min-height: 2.5rem; margin-left: 0.25rem; padding: 0 0.6rem; border: 0; border-radius: var(--control-radius); background: transparent; color: rgba(255, 255, 255, 0.88); font: var(--type-small) var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.ctl-time:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.ctl-time:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ctl-gap { flex: 1; }
.ctl-volume { width: 6rem; accent-color: #fff; padding: 0; background: transparent; border: 0; }
@media (max-width: 640px) {
  .ctl-labelled span { display: none; }
  .ctl-labelled { width: 2.75rem; padding: 0; justify-content: center; }
  .ctl-row { gap: 0.1rem; }
  .ctl-time { font-size: var(--type-caption); padding: 0 0.35rem; }
}
/* Phones and touch tablets (the header's own test, look.css; controls.js compactPlayer says the
   same): the bar keeps the core controls, play, the jumps, the time, Next episode, Audio and
   subtitles and Full screen, and the rest is More, a menu of big rows with their words, each only
   where it applies. The phone's own buttons set the volume, and the playback info for the
   curious stays on computers. */
#ctl-more { display: none; }
@media (max-width: 640px), (pointer: coarse) and (hover: none) and (max-width: 1366px) {
  html:not(.tv) :is(.ctl-volume-group, #ctl-talk, #chapter-pics-btn, #ctl-settings, #ctl-audio-only, #ctl-pip, #ctl-airplay, #party-btn:not(.in-party), #info-choice) { display: none; }
  html:not(.tv) #ctl-more { display: grid; }
  /* Full screen is how a phone gets the whole picture, turned on its side, without auto-rotate:
     a little larger than the rest, and at the end of the bar where a thumb finds it. */
  html:not(.tv) #ctl-full svg { width: 1.8rem; height: 1.8rem; }
}
/* A finger: buttons of 44 px, and a timeline with room to hold it that stays thin (4 px, 8 px while
   held) with a small thumb always showing (the header's own test for a touch device, look.css). */
@media (pointer: coarse) and (hover: none) and (min-width: 30.01rem) {
  html:not(.tv) .ctl:not(.ctl-labelled) { width: 2.75rem; }
  html:not(.tv) .ctl { height: 2.75rem; }
  html:not(.tv) .ctl-main { width: 3rem; height: 3rem; }
}
@media (pointer: coarse) and (min-width: 641px) {
  html:not(.tv) .ctl-row .ctl:not(.ctl-labelled) { width: 3rem; height: 3rem; }
}
@media (pointer: coarse) and (hover: none) {
  html:not(.tv) .timeline { height: 2.25rem; }
  html:not(.tv) .tl-track { height: 4px; }
  html:not(.tv) .timeline.dragging .tl-track { height: 8px; }
  html:not(.tv) .tl-thumb { transform: scale(1); width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem; }
  html:not(.tv) .timeline.dragging .tl-thumb { transform: scale(1.5); }
}
/* Narrow phones: the time moves up beside the timeline so every button fits on one row. */
@media (max-width: 30rem) {
  .ctl { width: 2.5rem; height: 2.5rem; }
  .ctl-main, html:not(.tv) #ctl-full { width: 2.75rem; height: 2.75rem; }
  .ctl-time { position: absolute; left: clamp(0.75rem, 3vw, 2rem); top: 0.75rem; min-height: 0; margin: 0; padding: 0.1rem 0; font-size: var(--type-caption); }
  /* What opens above the controls clears the time, which sits above the timeline here. */
  html:not(.tv) .player-menu { bottom: 8.25rem; max-height: calc(100% - 10rem); }
  html:not(.tv) :is(.up-next:not(.picker, .panel-float, .party, .rate-card), .skip) { bottom: 8.25rem; }
  html:not(.tv) .chapter-pics { bottom: 7.75rem; }
}
/* Phones on their side: keep the picture clear. */
@media (max-height: 30rem) {
  .player-bar { padding-bottom: 1.5rem; }
  .now-sub { display: none; }
  .controls { padding-top: 1.25rem; }
  .ctl-row { margin-top: 0.1rem; }
  .player-menu { bottom: 4.75rem; max-height: calc(100% - 5.5rem); }
  .up-next, .skip { bottom: 4.5rem; }
}
@media (prefers-reduced-motion: reduce) { .controls, .player-bar, .tl-track, .tl-thumb, .ctl, .player-menu, .player-state { transition: none; animation: none; } .stage.idle .controls, .stage.idle .player-bar { transform: none; } }

/* ---------- Live TV in the player (channel-player.js) ---------- */
.live-bar { display: flex; align-items: center; gap: 0.25rem; flex: none; }
.live-id { display: flex; align-items: center; flex: none; }
.live-fav .fav-btn { color: #fff; }
/* The channel is its icon beside the title: no "Live" pill (the controls under the picture say
   it) and no name (said to screen readers only). What can be done sits beside Watch together,
   all in the player's own plain controls rather than a mix of dark pills, bare icons and text. */
.live-channel { display: inline-flex; align-items: center; margin: 0; }
.live-channel > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.live-bar :is(.ghost, .fav-btn) { display: inline-grid; place-items: center; min-height: 2.75rem; padding: 0 0.9rem; border: 0; border-radius: var(--control-radius); background: transparent; color: #fff; font: 500 var(--type-small) var(--font-body); box-shadow: none; transition: background 0.15s ease; }
.live-bar .fav-btn { min-width: 2.75rem; padding: 0; border-radius: 50%; }
.live-bar .fav-btn svg { width: 1.45rem; height: 1.45rem; }
.live-bar :is(.ghost, .fav-btn):hover { background: rgba(255, 255, 255, 0.14); }
.live-bar :is(.ghost, .fav-btn):focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.live-bar .fav-btn[aria-pressed="true"] svg path { fill: currentColor; }
/* On a computer, tablet or TV the bar is one row: Back, the channel's icon, the programme's title,
   then Watch together and the channel's controls. */
@media (min-width: 641px) {
  .stage.live .player-bar { align-items: center; }
  .stage.live .player-bar > .live-id { order: 1; }
  .stage.live .player-bar > .now { order: 2; }
  .stage.live .player-bar > .choices { order: 3; }
  .stage.live .player-bar > .live-bar { order: 4; }
  .stage.live .cast-slot { display: inline-grid; place-items: center; }
  .stage.live .cast-slot google-cast-launcher { width: 1.6rem; height: 1.6rem; }
}
/* Live TV has no file to move through: no timeline or time of the file, chapters, comments,
   speed, Skip intro, Skip credits or Next episode. The programme's start and end instead, how far through it
   live is and where the viewer is, and Live, or how far behind it with Go live. */
.stage.live :is(.timeline, .ctl-time, .scrub, #next-ep, #chapter-pics-btn, #chapter-pics, #skip-intro, #skip-credits, #skip-ad, #up-next,
  #speed-choice, #chapter-choice, #subs-timing, #subs-edit, #subs-find, #more-speed, #more-chapters) { display: none; }
/* Comments belong to a file's timeline: on a channel, the button is only for a party's chat. */
.stage.live:not(.live-party) :is(#ctl-talk, #talk-panel, #more-comments) { display: none; }
/* A tuner's channel is one stream for everyone: no quality of its own, and nothing measured to
   even out or delivery to show. */
.stage.live-tv :is(#quality-choice, #level-choice, #info-choice, #playback-info, #more-quality, #more-level) { display: none; }
.live-times { align-items: center; gap: 0.8rem; }
.live-times .lt-bar { position: relative; flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.live-times .lt-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.live-times .lt-live { background: rgba(255, 255, 255, 0.45); }
.live-times .lt-here { background: var(--live, #e0443e); }
.live-state { display: inline-flex; align-items: center; gap: 0.6rem; margin-left: 0.3rem; min-width: 0; color: #fff; font-size: var(--type-small); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-at { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: var(--type-tiny); }
.live-at::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--live, #e0443e); }
.live-state .go-live { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.live-channel .ch-badge { height: 1.6rem; }
.live-ch svg { width: 1.4rem; height: 1.4rem; }
.live-guide-btn { color: #fff; }
/* The programme's start and end either side of its bar. */
.live-times { display: flex; justify-content: space-between; color: rgba(255, 255, 255, 0.8); font-size: var(--type-tiny); font-variant-numeric: tabular-nums; }
/* Between programmes: the card or a trailer in place of the video and its controls. */
.stage.live-filler .controls, .stage.live-filler .player-state, .stage.live-filler .skip { display: none; }
.live-filler-box { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 5rem var(--gutter) 2rem; background: radial-gradient(circle at 50% 40%, #1d2520, #000 70%); color: #fff; }
.live-card { display: grid; justify-items: center; gap: 0.6rem; max-width: 32rem; text-align: center; }
.live-card h2 { margin: 0.4rem 0 0; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.live-card p { margin: 0; }
.live-card-next { display: grid; gap: 0.15rem; }
.live-count { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.live-trailer { display: grid; gap: 0.6rem; width: min(100%, calc((100vh - 9rem) * 16 / 9)); }
.live-trailer iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: #000; }
.live-trailer .live-card-next { display: block; }
/* The small guide, over the right of the picture. */
.mini-guide { position: absolute; top: 4.5rem; right: clamp(0.75rem, 3vw, 2rem); bottom: 6.5rem; z-index: 5; display: flex; flex-direction: column; gap: 0.6rem; width: min(24rem, calc(100% - 1.5rem));
  padding: 1rem; overflow: hidden; background: var(--surface); color: var(--text); border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); }
.mg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mg-head h2 { margin: 0; font-size: 1.1rem; }
.mg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; overflow-y: auto; }
.mg-channel { display: flex; align-items: flex-start; gap: 0.6rem; width: 100%; padding: 0.55rem 0.6rem; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.mg-channel:hover, .mg-channel:focus-visible { background: var(--raised); }
.mg-channel.current { border-color: var(--accent); }
.mg-text { display: grid; gap: 0.15rem; min-width: 0; font-size: var(--type-caption); }
.mg-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-bar { display: block; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mg-bar span { display: block; height: 100%; background: var(--accent); }
/* Phones: the channel's icon and its controls go on a line under the title, which keeps the room it needs. */
@media (max-width: 640px) {
  .stage.live .player-bar { flex-wrap: wrap; row-gap: 0.4rem; }
  .stage.live .player-bar::after { content: ""; order: 2; flex: 0 0 100%; height: 0; }
  .stage.live .player-bar > .live-id { order: 3; }
  .stage.live .player-bar > .live-bar { order: 4; flex: 1; justify-content: flex-end; }
  .live-bar .live-guide-btn { padding-inline: 0.6rem; }
  /* The small guide and playback info start under that second line, not over its buttons. */
  .mini-guide { top: var(--live-header-bottom, 7.25rem); bottom: 5rem; }
  .stage.live .playback-info { top: var(--live-header-bottom, 7.5rem); }
}
/* Narrow phones: Live, or how far behind it with Go live, on a line of its own over the buttons. */
@media (max-width: 30rem) {
  .stage.live .ctl-row { flex-wrap: wrap; row-gap: 0.2rem; }
  .stage.live .live-state { order: -1; flex: 1 0 100%; margin: 0 0 0 0.4rem; min-height: 2.25rem; }
}

/* ---------- Alerts and what's new ---------- */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; max-width: 52rem; }
/* Its panel and the stripe of its kind's colour are in material.css (Messages). */
.alert { display: flex; gap: 1rem; justify-content: space-between; align-items: center; padding: 0.85rem 1rem 0.85rem 1.25rem; }
.alert p { margin: 0.15rem 0 0; color: var(--muted); overflow-wrap: anywhere; }
.changelog { max-height: 60vh; overflow-y: auto; }
.changelog h3 { margin: 1rem 0 0.35rem; font: 600 1rem/1.3 var(--font-body); }
.changelog section:first-child h3 { margin-top: 0; }
.changelog h4 { margin: 0.6rem 0 0.2rem; font: 600 var(--type-small)/1.3 var(--font-body); opacity: 0.8; }
.changelog ul { margin: 0; padding-left: 1.2rem; }
.changelog li { margin: 0.2rem 0; }

/* ---------- Motion ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
dialog[open] { animation: pop-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
dialog[open]::backdrop { animation: fade-in 0.22s ease; }
.toast { animation: rise-in 0.25s ease both; transition: opacity 0.4s ease, transform 0.4s ease; }
.toast.gone { opacity: 0; transform: translateY(6px); }
.card .art { transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.22s ease; }
.card:hover .art, .card:focus-visible .art { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); }
.card .art img { transition: filter 0.2s ease; }
button, .pl-choice, .kind-choice, .gpu-option { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease; }
button:active:not(:disabled) { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop, .toast { animation: none; }
  .card .art, button, a.ghost, a.primary { transition: none; }
  .card:hover .art { transform: none; }
  button:active:not(:disabled) { transform: none; }
}

/* ---------- Library options ---------- */
.lib-options { display: grid; gap: 0.6rem; }
.check.opt { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start; }
.check.opt > span { display: grid; gap: 0.1rem; }
.check.opt input { margin-top: 0.25rem; accent-color: var(--accent); }
.field.sub { margin-left: 1.6rem; }

/* ---------- Chapter pictures ---------- */
.chapter-pics { position: absolute; left: 0; right: 0; bottom: 6.5rem; z-index: 3; display: flex; gap: 0.75rem; overflow-x: auto; padding: 0.75rem clamp(0.75rem, 3vw, 2rem);
  scrollbar-width: none; background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent); animation: rise-in 0.2s ease both; }
.chapter-pics::-webkit-scrollbar { display: none; }
.cp { flex: none; display: grid; gap: 0.25rem; padding: 0; border: 0; background: none; color: #fff; text-align: left; cursor: pointer; font: inherit; }
.cp-img { display: block; border-radius: 0.35rem; background-color: #111; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); transition: transform 0.15s ease, outline-color 0.15s ease; outline: 2px solid transparent; }
.cp:hover .cp-img, .cp:focus-visible .cp-img { transform: translateY(-2px); outline-color: var(--ring); }
.cp:focus-visible { outline: none; }
.cp-title { font-size: var(--type-caption); max-width: 11rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-time { font-size: var(--type-tiny); opacity: 0.75; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .chapter-pics { animation: none; } .cp-img { transition: none; } }

/* ---------- Casting ---------- */
.cast-panel { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 0.75rem; padding: 2rem; text-align: center;
  background: rgba(8, 7, 6, 0.9); color: #f4efe6; animation: fade-in 0.2s ease both; }
.cast-device { margin: 0; font: var(--title-weight) clamp(1.4rem, 3vw, 2rem)/1.2 var(--font-display); font-style: var(--title-style); }
.cast-text { margin: 0; max-width: 36rem; color: rgba(244, 239, 230, 0.8); }
.cast-seek { width: min(36rem, 80vw); accent-color: var(--accent); }
.cast-time { margin: 0; font-variant-numeric: tabular-nums; opacity: 0.8; }
.cast-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.cast-panel .ghost { color: #f4efe6; }
.audio-cast-dialog { width: min(38rem, calc(100vw - 2rem)); }
.audio-cast-dialog > .icon-button { display: block; margin-left: auto; }
.audio-cast-controls.cast-panel { position: static; padding: 1rem 0; background: transparent; color: var(--text); animation: none; }
.audio-cast-controls .cast-text, .audio-cast-controls .ghost { color: var(--text); }
.audio-cast-controls .cast-seek { width: 100%; }
.cast-slot google-cast-launcher { display: block; width: 2rem; height: 2rem; cursor: pointer; --disconnected-color: var(--text); --connected-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .cast-panel { animation: none; } }

/* ---------- Scan progress, quicker pages ---------- */
.scan-lines { display: grid; gap: 0.35rem; flex: 1; min-width: 0; }
.scan-bar { width: 100%; height: 0.5rem; accent-color: var(--accent); }
.scan-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Games ---------- */
.game-card .art img { object-fit: cover; }
.tag.ok { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--text); }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.game-system-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.game-system { border: 0; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--text) 5%, transparent); padding: 1rem 1.1rem; }
.game-system .actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.game-system .tag { margin-left: 0; }
.bios-list { list-style: none; margin: 0.6rem 0 0; padding: 0.5rem 0 0; border-top: 1px solid var(--line); display: grid; gap: 0.4rem; }
.bios-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.75rem; align-items: center; }
.more-systems { margin-top: 0.9rem; }
.more-systems summary { cursor: pointer; margin-bottom: 0.6rem; }
@media (max-width: 700px) { .bios-row { grid-template-columns: 1fr; } }
/* The controls editor (Your settings, Controllers, and a game's menu): what is connected and which player, then the
   buttons in groups, two groups to a row where there's room. */
.controls-editor { display: grid; gap: 1.25rem; }
.controls-editor .card-panel { margin: 0; }
.bind-status { display: flex; align-items: center; gap: .9rem 1rem; flex-wrap: wrap; }
.bind-found { flex: 1 1 14rem; min-width: 0; display: grid; gap: .1rem; }
.bind-found .help { margin: 0; }
.bind-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.25rem; align-items: start; }
.bind-table { display: grid; }
.bind-row { display: grid; grid-template-columns: minmax(5.5rem, 1fr) minmax(5.5rem, 1fr) minmax(8rem, 1.5fr) auto; gap: 0.6rem; align-items: center; padding: 0.45rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.bind-row:last-child { border-bottom: 0; padding-bottom: 0; }
.bind-head { font-weight: 600; font-size: var(--type-tiny); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 0; }
.bind-name { display: grid; min-width: 0; }
.bind-row > span { min-width: 0; }
/* A long name ("Bottom button (A, Cross)") takes a second line inside its button, not the next column's room. */
.bind-row .bind { width: 100%; height: auto; min-height: 2.25rem; padding-block: .3rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.15; text-transform: none; letter-spacing: 0; justify-content: center; text-align: center; }
.bind-row .bind-clear { width: 2.25rem; height: 2.25rem; color: var(--muted); }
.bind-row .bind-clear svg { width: 1.1rem; height: 1.1rem; }
dialog .bind-groups { max-height: min(60vh, 34rem); overflow-y: auto; }
.bind.listening { border-color: var(--accent); color: var(--accent); }
/* A phone: the button's name on a line of its own, its key, controller button and clear under it. */
@media (max-width: 640px) {
  .bind-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 2.25rem; gap: .35rem .5rem; }
  .bind-row > .bind-name { grid-column: 1 / -1; }
  .bind-head > :first-child { display: none; }
}

/* The player page. EmulatorJS's own bar and menus are hidden: Reel's control bar does their jobs.
   The game's frame is centred, so a shape (pixel perfect, stretched) can size it. */
.game-body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
.game-stage { position: fixed; inset: 0; background: #000; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
.game-stage #game { width: 100%; height: 100%; }
.game-stage.shape-pixel canvas { image-rendering: pixelated; }
.game-stage .ejs_menu_bar, .game-stage .ejs_context_menu { display: none !important; }
.game-start { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: var(--gutter); background: var(--bg); color: var(--text); overflow-y: auto; }
.game-start[hidden] { display: none; }
.game-start-inner { display: grid; grid-template-columns: minmax(8rem, 14rem) minmax(0, 32rem); gap: 2rem; align-items: center; }
.game-start h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); }
.game-back { position: absolute; top: 1rem; left: 1rem; color: var(--text); text-decoration: none; }
.game-back:hover { background: color-mix(in srgb, var(--text) 12%, transparent); }
.game-cover { aspect-ratio: 2 / 3; }
.game-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) { .game-start-inner { grid-template-columns: 1fr; } .game-cover { max-width: 10rem; } }
/* The game player's bar: the video player's (Player controls above), with buttons that act or
   open a small menu above it. A pressed button (fast-forward, rewinding) is lit. */
.gp-controls { padding-top: 2rem; }
.gp-controls .ctl[aria-pressed="true"] { background: rgba(255, 255, 255, 0.2); color: var(--accent); }
.gp-menu { bottom: 4.75rem; width: min(26rem, calc(100% - 1.5rem)); }
.gp-menu-body { display: grid; gap: 0.8rem; }
.gp-group { display: grid; gap: 0.4rem; }
.gp-label { margin: 0; font-size: var(--type-caption); color: var(--muted); }
.gp-choices { display: flex; flex-wrap: wrap; gap: 0.35rem; }
/* Its choices are chips (material.css). */
.gp-item { width: 100%; justify-content: flex-start; }
.gp-volume-row { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; }
.gp-volume { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.gp-menu .slot-grid { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
/* Narrow screens: the settings go on a second row under the playing buttons. */
@media (max-width: 40rem) {
  .gp-controls .ctl-row { flex-wrap: wrap; justify-content: center; }
  .gp-controls .ctl-gap { flex-basis: 100%; height: 0; }
  .gp-menu { bottom: 7.5rem; max-height: calc(100% - 9rem); }
}
@media (max-height: 30rem) { .gp-menu { bottom: 4rem; } }
@media (prefers-reduced-motion: reduce) { .gp-choice { transition: none; } }
/* An emulator that can't play the game here: chosen, it says why (game-player.js whyNot). */
.gp-choice[aria-disabled="true"] { opacity: 0.55; }
/* Said the way this device works: touch screens (game-player.js marks them) or a mouse. */
html:not(.touch) .touch-only, html.touch .not-touch { display: none; }
/* The picture waits until the game is known to be running (game-player.js playing), so neither
   RetroArch's own menu nor EmulatorJS's error text ever shows. */
.game-stage.starting canvas, .game-stage.starting .ejs_error_text { visibility: hidden; }
/* EmulatorJS's on-screen controller, on phones and tablets. Its Fast, Slow and Rewind and its
   menu button go: the bar has fast-forward and rewinding, and the menu is Reel's. Its halves
   keep clear of a phone's rounded corners and camera when it's on its side. */
.game-stage :is(.b_speed_fast, .b_speed_slow, .b_speed_rewind, .ejs_virtualGamepad_open) { display: none !important; }
.game-stage .ejs_virtualGamepad_left { margin-left: env(safe-area-inset-left, 0px); }
.game-stage .ejs_virtualGamepad_right { margin-right: env(safe-area-inset-right, 0px); }
/* With the controller (game-player.js layoutPad), the bar joins the title at the top, clear of
   it: the playing buttons, then the settings. Only the buttons take touches, so the controller
   under its shade still works. On a phone on its side, the bar keeps between the controller's
   halves, without the title. */
.game-stage.pad .gp-controls { display: none; }
.game-stage.pad .gp-top { flex-wrap: wrap; align-items: center; row-gap: 0.15rem; padding-bottom: 1.75rem; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.6) 65%, transparent); }
.game-stage.pad .gp-top .ctl { pointer-events: auto; }
.game-stage.pad .gp-top .ctl-row { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; row-gap: 0.15rem; margin: 0; }
.game-stage.pad .gp-top .ctl-gap { flex: 0 0 0.75rem; }
.game-stage.pad-side .gp-top { flex-wrap: nowrap; align-items: flex-start; gap: 0.1rem; padding: max(0.35rem, env(safe-area-inset-top, 0px)) calc(var(--pad-r, 0px) + 0.25rem) 1.25rem calc(var(--pad-l, 0px) + 0.25rem); }
.game-stage.pad-side .gp-top .now, .game-stage.pad-side .gp-top .ctl-labelled span { display: none; }
.game-stage.pad-side .gp-top .ctl { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; }
.game-stage.pad-side .gp-top .ctl-row { flex: 1 1 0; justify-content: center; gap: 0.1rem; }
.game-stage.pad-side .gp-top .ctl-gap { flex-basis: 0.35rem; }
@media (max-width: 40rem) { .game-stage.pad:not(.pad-side) .gp-top .ctl-gap { flex-basis: 100%; height: 0; } }
/* The handle that brings the bar back once it's tucked away: on a touch screen only a tap along
   the top does (game-player.js), and this small, quiet mark says so. */
.gp-handle { display: none; position: absolute; top: calc(env(safe-area-inset-top, 0px) + 0.25rem); left: 50%; z-index: 3; width: 3.25rem; height: 1.6rem; min-height: 0; padding: 0;
  place-items: center; transform: translateX(-50%); border: 0; border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: #fff; opacity: 0.55; cursor: pointer; }
.gp-handle svg { width: 1.1rem; height: 1.1rem; }
.gp-handle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; opacity: 1; }
.game-stage.pad.idle .gp-handle, html.touch .game-stage.idle .gp-handle { display: grid; }
/* Messages sit mid-screen there, off the controller and the bar. */
html.pad-play .toasts { top: 42%; bottom: auto; }
/* A phone on its side: the start screen fits without scrolling, clear of Back. */
@media (max-height: 30rem) and (orientation: landscape) {
  .game-start { padding-top: 3.25rem; padding-bottom: 0.75rem; }
  .game-start-inner { grid-template-columns: minmax(0, 7.5rem) minmax(0, 36rem); gap: 1.5rem; }
  .game-start .stack { gap: 0.6rem; }
  .game-start :is(h1, p) { margin: 0; }
  .game-start h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
}
/* The pause menu, for controllers and the keyboard, in groups; and its Screen and Sound. */
.game-menu { width: min(22rem, calc(100vw - 2rem)); }
.game-menu .menu-label { margin: 0.5rem 0 0; }
dialog.game-panel { width: min(28rem, calc(100vw - 2rem)); }
.game-menu-items { display: grid; gap: 0.4rem; }
.game-menu-items button { width: 100%; justify-content: flex-start; }
.online-link { display: flex; gap: 0.5rem; align-items: center; }
.online-link input { flex: 1 1 auto; min-width: 0; font: inherit; }

/* Games: a game with several versions is one card, drawn as a stack of boxes. */
.row.posters:has(.game-card.stacked) { padding-top: 1rem; }
.game-card.stacked { position: relative; isolation: isolate; }
.game-card.stacked::before, .game-card.stacked::after {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 2 / 3; z-index: -1; pointer-events: none;
  border-radius: max(var(--radius), 0.5rem); background: var(--raised); border: 1px solid var(--line);
  transform: translateY(-7px) scale(0.9); transform-origin: top center;
}
.game-card.stacked::after { transform: translateY(-13px) scale(0.8); opacity: 0.55; }
.game-card.stacked:hover::before, .game-card.stacked:focus-visible::before { background: color-mix(in srgb, var(--raised) 80%, var(--text)); }
/* A library's systems, each a tile with a picture: its console (the owner's own, or a photo from
   Wikipedia), else a few of its covers fanned out, and for Every system a mosaic of the consoles
   or a drawing of its own (games.js systemTiles). The picture area is a box of its own that
   every picture fits inside, centred, whatever its shape: a wide photo never spills into the
   next tile, and the tile's column never grows to fit one. */
.systems { margin-bottom: 0.5rem; }
/* A games library: its name and bar first (as every library has them), then its systems. */
.games-top { padding-bottom: 0; }
.games-top + .systems { padding-top: 0.25rem; margin-bottom: 0; }
.games-top + .systems + .section { padding-top: 0.25rem; }
.row.systems { grid-auto-columns: clamp(10rem, 16vw, 12.5rem); gap: 1rem; }
.system-tile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.1rem; padding: 0.75rem; border: 1px solid transparent; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); text-decoration: none; min-width: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease; }
.system-tile:hover { border-color: var(--line); background: color-mix(in srgb, var(--text) 8%, transparent); }
.system-tile.chosen { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.system-tile:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.system-tile strong { font-size: var(--type-note); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.system-covers { position: relative; display: flex; align-items: flex-end; justify-content: center; min-width: 0; height: 5.5rem; margin-bottom: 0.45rem; padding: 0.3rem; overflow: hidden; border-radius: 4px; }
.system-covers:empty { background: var(--raised); }
/* Covers: up to three fanned out from the middle, the first in front. */
.system-covers img { flex: none; position: relative; height: 100%; width: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); transform-origin: bottom center; }
.system-covers img + img { margin-left: -1.4rem; }
.system-covers img:nth-child(1) { z-index: 3; }
.system-covers img:nth-child(2) { z-index: 2; transform: scale(0.92); }
.system-covers img:nth-child(3) { z-index: 1; transform: scale(0.84); }
/* A console: as large as fits the box, never cropped or stretched. */
.system-covers.system-consoles img:nth-child(n), .system-covers.system-mosaic img:nth-child(n) {
  flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; height: 100%; margin: 0; aspect-ratio: auto; object-fit: contain; border-radius: 0; box-shadow: none; transform: none; }
/* Every system: two to four of the consoles, a cell each. */
.system-covers.system-mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 0.2rem 0.4rem; }
.system-covers.system-mosaic.mosaic-2 { grid-template-rows: minmax(0, 1fr); }
.system-covers.system-mosaic.mosaic-3 img:nth-child(3) { grid-column: 1 / -1; }
/* Every system, when fewer than two consoles have a picture: a stack of controllers. */
.system-covers.system-every { align-items: center; }
.every-system-art { width: 100%; height: 100%; }
.every-system-art .esa-body { stroke-width: 2; stroke-linejoin: round; }
.every-system-art .esa-back .esa-body { fill: color-mix(in srgb, var(--mist) 22%, var(--surface)); stroke: color-mix(in srgb, var(--mist) 70%, transparent); }
.every-system-art .esa-back .esa-mark, .every-system-art .esa-back .esa-key { fill: color-mix(in srgb, var(--mist) 75%, transparent); }
.every-system-art .esa-front .esa-body { fill: var(--raised); stroke: var(--text); }
.every-system-art .esa-front .esa-mark { fill: var(--text); }
.every-system-art .esa-front .esa-key { fill: var(--accent); }
/* A game's page. */
.resume-note { margin: 0.1rem 0 0; color: var(--mist); font-size: var(--type-small); }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
/* A game's versions: rows to pick from, as a playlist's are (.pl-choice). */
.version-choice { width: 100%; display: grid; justify-items: start; gap: 0.15rem; padding: 0.7rem 0.9rem; text-align: left; text-transform: none; letter-spacing: 0;
  border: 1px solid var(--line); border-radius: var(--field-radius, var(--radius)); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.version-choice:hover { border-color: var(--muted); background: color-mix(in srgb, var(--text) 5%, transparent); }
.version-choice:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.version-choice.preferred { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.game-saves > .actions { margin: 0.25rem 0 1rem; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1.25rem; }
.state-card { display: grid; gap: 0.35rem; justify-items: start; }
.state-card .card { width: 100%; }
.state-card .art img { image-rendering: pixelated; }
.history-list, .hidden-games { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.history-list li, .hidden-games li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
/* The player's menu and its dialogs. */
.game-menu { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.slot { display: grid; gap: 0.25rem; justify-items: start; padding: 0.5rem; text-align: left; text-transform: none; letter-spacing: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.slot:hover:not(:disabled), .slot:focus-visible { border-color: var(--accent); }
.slot:disabled { opacity: 0.5; }
.slot-pic { width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 4px; overflow: hidden; display: grid; place-items: center; color: var(--mist); font-size: var(--type-caption); }
.slot-pic img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.cheat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.cheat-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 14rem) auto; gap: 0.6rem; align-items: center; }
.cheat-list code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cheat-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.4rem; }
@media (max-width: 640px) { .cheat-add, .cheat-list li { grid-template-columns: 1fr; } }
/* Optional game streaming stays in the same app, with controls reachable on TV. */
.game-stream-player { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: 1rem; background: var(--bg); color: var(--text); }
.game-stream-player[open] { display: flex; flex-direction: column; gap: 0.75rem; }
.game-stream-player header, .game-stream-player footer { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.game-stream-player header p { margin: 0; }
.game-stream-screen { flex: 1; min-height: 0; background: black; overflow: hidden; }
.game-stream-screen > div { height: 100%; width: 100%; }
.game-stream-screen video, .game-stream-screen canvas { width: 100%; height: 100%; object-fit: contain; }
.game-stream-menu { width: min(25rem, calc(100vw - 2rem)); }
.game-stream-menu[open] { display: grid; gap: .75rem; }
.game-stream-menu > :is(h2, p) { margin: 0; }
.game-stream-menu .actions { display: grid; gap: .5rem; }
.game-stream-menu .actions button { justify-content: flex-start; text-align: left; }

.game-stream-touch { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; touch-action: none; user-select: none; }
.game-stream-touch:empty { display: none; }
.game-stream-touch button { min-width: 3rem; min-height: 3rem; touch-action: none; }
/* The page behind a stream doesn't scroll, so no bar of its own is left showing beside it. */
html.streaming { overflow: hidden; }
/* Why a stream didn't start or ended, where Stream game is (game-streaming.js): one message, kept
   until it is tried again, with its way on. */
.stream-problem { display: grid; gap: 0.6rem; max-width: 34rem; margin-top: 0.5rem; }
.stream-problem:empty { display: none; }
.stream-problem p, .stream-problem .note { margin: 0; }

/* Audio-only keeps the shared transport and timeline; the stream contains no picture. */
.stage.audio-only #video { opacity: 0; }
.stage.audio-only :is(#subs-layer, #ass-layer, #scrub-preview) { visibility: hidden; }
#ctl-audio-only[aria-pressed="true"] { color: var(--accent); }

/* Prepared channel frames keep the existing transport; no second card renderer. */
.stage.live-interstitial .controls { display: block; z-index: 3; }
.stage.live-interstitial :is(#ctl-subs, #menu-subs, #ctl-settings, #menu-settings, #more-quality, #more-level, #more-picture, #more-audio-only, #ctl-pip, #more-pip, #ctl-airplay, #more-airplay) { display: none; }
.stage.live-interstitial .live-filler-box { padding-top: var(--live-header-bottom, 5rem); padding-bottom: 6rem; }
.live-interstitial-frame { width: 100%; height: 100%; max-height: 100%; min-height: 0; object-fit: contain; position: absolute; inset: 0; pointer-events: none; }
.live-interstitial-frame[hidden] { display: none; }
.live-interstitial-sound { position: absolute; left: 50%; bottom: 6rem; transform: translateX(-50%); color: #fff; background: #101725; border: 1px solid #8997aa; z-index: 4; }
