/* Every colour, font and shape comes from the active theme (js/theme.js sets these from a theme
   file). The values below are Forest's colours, used until the theme loads. */
:root {
  --bg: #111713; --surface: #0A100D; --raised: #28322A; --line: #414B41; --text: #E1E6DF; --muted: #BDC8BC;
  --accent: #CDBB87; --on-accent: #382E0B; --danger: #EE958A; --warn: #CDB477;
  --container: #1C241E; --on-container: #E1E6DF; --tonal: #384C3D; --on-tonal: #D7ECDA;
  --night-bg: #111713; --night-surface: #0A100D; --night-raised: #28322A; --night-line: #414B41; --night-text: #E1E6DF;
  --night-muted: #BDC8BC; --night-accent: #CDBB87; --night-on-accent: #382E0B; --night-danger: #EE958A; --night-warn: #CDB477;
  --font-display: Geist, system-ui, sans-serif; --font-body: Geist, system-ui, sans-serif; --font-mono: ui-monospace, Consolas, monospace;
  --radius: 12px; --radius-lg: 24px; --control-radius: 24px; --media-radius: 16px;
  --button-case: none; --button-tracking: 0em; --title-weight: 600; --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: var(--live); --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); outline-offset: 3px; }
[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: 0.875rem; }

/* 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; gap: 1.25rem; 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 0.88rem/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; font-size: 1.45rem; }
.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 { grid-auto-columns: clamp(14rem, 24vw, 19rem); }
.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); border-radius: max(var(--radius), 0.5rem); 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); }
/* No artwork: the title set large, like a card at the box office */
.art .placeholder {
  position: absolute; inset: 0; display: flex; align-items: flex-end; 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 { margin: 0.5rem 0 0; font: 600 0.95rem/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: 0.85rem; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  position: absolute; top: 0.4rem; right: 0.4rem; min-width: 1.6rem; padding: 0.1rem 0.45rem;
  font-size: 0.8rem; text-align: center; background: color-mix(in srgb, var(--bg) 88%, transparent); border-radius: 3px; color: var(--paper);
}
.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: 0.95rem; white-space: normal; }
.person p { white-space: normal; }
.person-head { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2rem; }
.person-head h1 { margin: 0 0 0.3rem; font-size: 2.2rem; }
.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; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1.2rem; }
/* 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: 0.95rem; }
.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 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 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(20rem, 56vh, 36rem); 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; color: var(--mist); }
.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: 0.75rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; vertical-align: 1px; }
.rating-box { margin-right: 0.75rem; }
.up-next-line { margin: 0; font-size: 0.95rem; }
.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: 0.85rem; }
.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: 0.9rem; 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 other buttons (.pill-action, the tonal button in material.css) in a row. */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* 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); }
@media (max-width: 640px) {
  /* A phone's buttons are one row of tiles, each its icon over its label, so four or five fit
     with their words whole. A row of two or three stays at its tiles' own size. */
  .hero .pill-row { flex-wrap: nowrap; width: 100%; gap: 0.4rem; }
  .hero .pill-row > .pill-action, .hero .pill-row > details.more { flex: 0 1 6.5rem; min-width: 0; }
  .hero .pill-row .pill-action { flex-direction: column; justify-content: center; gap: 0.3rem; min-height: 3.75rem; padding: 0.5rem 0.3rem;
    font-size: 0.75rem; line-height: 1.2; text-align: center; white-space: normal; }
  .hero .pill-row .pill-action > span { max-width: 100%; overflow-wrap: anywhere; }
  .hero .pill-row > details.more { display: flex; }
  .hero .pill-row details.more > summary.pill-action { display: flex; flex: 1; }
}
details.more.compact .more-menu, .pill-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; }
.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 */
.season-section { margin-top: 2rem; }
.season-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.season-bar > .pill-action { margin-left: auto; }
.seasons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.season-count { 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); }
/* 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; }
.watched-mark { position: absolute; top: 0.4rem; right: 0.4rem; width: 1.6rem; height: 1.6rem; color: var(--accent); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6)); }
.watched-mark svg { width: 100%; height: 100%; fill: currentColor; }
.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: 0.75rem; font-weight: 500; }
.ep-meta { margin: 0.2rem 0 0; color: var(--mist); font-size: 0.9rem; }
.ep-meta:empty { display: none; }
.ep-overview { margin: 0.4rem 0 0; color: var(--mist); font-size: 0.9rem; 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: inherit; 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), Who's watching and its PIN pad (profiles.js), and the Android app's own
   server picker (android/ui, which copies this file): 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: 0.8125rem; }
.auth .form-error { min-height: 0; color: var(--danger); font-size: 0.9rem; }
/* Kept for screen readers while empty, without taking room. */
.auth .form-error:empty { position: absolute; }
/* 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: 0.875rem; }
.auth-host { overflow-wrap: anywhere; }
.auth-server .text-button { font-size: 0.875rem; }
/* 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 0.875rem/1.4 var(--font-body); letter-spacing: 0; text-align: left; color: var(--muted); }
/* A list of servers: this browser's (Change server), or those found and used before (android/ui). */
.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: 0.8125rem; 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: 0.9rem; }
.code-status { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0; color: var(--muted); font-size: 0.875rem; }
.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, .profile-tile:focus-visible { color: var(--text); outline: none; }
.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: 0.9rem; }
.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: 0.9rem; 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%; }
.avatar.initial { background: hsl(var(--avatar-hue, 150) 32% 38%); color: #fff; }
.avatar.small { width: 1.75rem; height: 1.75rem; font-size: 0.8rem; }
.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; }
.person-cell { display: flex; align-items: center; gap: 0.65rem; }
/* Your picture, in settings. */
.avatar-choices { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.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: 0.9rem; }
.stack { display: grid; gap: 1rem; }
.stack.narrow { max-width: 24rem; }
.stack .primary { justify-self: start; }
.field { display: grid; gap: 0.35rem; }
.field > span { font-size: 0.9rem; color: var(--mist); }
.field small { font-size: 0.8rem; }
.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: 0.9rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.checks label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; 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: 0.95rem; }
th { text-align: left; font-weight: 600; color: var(--mist); font-size: 0.85rem; 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: 0.85rem; 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 { position: relative; height: 100%; overflow: hidden; }
.stage video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
/* 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.72), rgba(0, 0, 0, 0.3) 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: 0.9rem; 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: 0.85rem; color: var(--mist); }
.choices { display: flex; gap: 0.5rem; align-items: center; flex: none; }
.choice { display: grid; gap: 0.35rem; font-size: 0.85rem; 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; }
/* 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: 0.95rem; }
.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: 0.8rem/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; }
.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: 0.8rem; 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 0.72rem/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: 0.85rem; }
.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 0.82rem/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: 0.85rem; }
.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: 0.9rem; }
.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: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.talk-empty { color: var(--muted); font-size: 0.85rem; }
.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); }
.talk-form { display: grid; 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: 0.8rem; 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: 0.9rem; 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: 0.85rem; }
.review-problem { margin: 0; color: var(--danger); font-size: 0.9rem; }
.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; }
.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 google-cast-launcher { display: inline-block; width: 1.75rem; height: 1.75rem; cursor: pointer; --connected-color: var(--lamp); --disconnected-color: var(--paper); }
.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; }
  .ep-tools { flex-direction: column; }
  .ep-overview { display: none; }
  .season-bar > .pill-action { margin-left: 0; }
}
@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: 0.78rem/1.45 var(--font-mono); white-space: pre-wrap; word-break: break-word; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; max-width: 72rem; margin: 0 auto; }
.settings-nav { position: sticky; top: 4.5rem; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; padding-right: 0.5rem; }
.settings-group { margin-bottom: 1.25rem; }
.settings-group-title { margin: 0 0 0.35rem; font-size: 0.8rem; 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; max-width: 46rem; }
.settings-main h1 { margin-top: 0; }
.settings-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; margin-bottom: 1rem; background: color-mix(in srgb, var(--text) 4%, transparent); border-radius: var(--radius-lg); }
.settings-list { display: grid; }
.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: 0.9rem; }
.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; gap: 1rem; justify-content: space-between; align-items: flex-start; padding: 1rem; background: color-mix(in srgb, var(--text) 4%, transparent); border-radius: var(--radius-lg); }
.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: 0.85rem; 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 */
.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; }
/* A message's look is in material.css. */
.toast { transition: opacity 0.5s; max-width: min(34rem, calc(100vw - 2rem)); }
.toast.gone { opacity: 0; }
/* 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-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. */
.stage > .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; display: flex; 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 0.9375rem/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: 0.85rem; 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: 0.9rem; }
.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 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-actions { margin-top: 0.9rem; }
/* 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: 0.72rem; line-height: 1.2; text-align: center; }
.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; }
/* 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); border-radius: var(--radius-lg); padding: 0.8rem 1rem; }
.editor-section legend { font-weight: 600; padding: 0 0.3rem; }
.contrast-notes { color: var(--warn); font-size: 0.9rem; 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: 0.9rem; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.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); width: 2.8rem; height: 2.8rem; z-index: 2; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.rail-btn[hidden] { display: none; }
.rail-btn.prev { left: 0.5rem; }
.rail-btn.next { right: 0.5rem; }
.rail:hover .rail-btn, .rail-btn:focus-visible { opacity: 1; }
.rail-btn:hover { border-color: var(--accent); color: var(--accent); }
.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), and one that's gone fades where it is, keeping
   its place, until it's out of sight. */
.live-new { animation: live-in 0.6s ease-out both; }
@keyframes live-in { from { opacity: 0; } }
.live-gone { opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0s linear 0.4s; }
@media (prefers-reduced-motion: reduce) { .live-gone { transition: none; } }
html.tv .live-gone { transition: none; }

/* ---------- 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 0.8rem/1 var(--font-body); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.ch-badge.has-logo { 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: 0.72rem; 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; }
.live-note { margin: 0.4rem 0 1rem; }
/* 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: 0.8rem; }
.guide-ticks, .guide-progs { position: relative; flex: none; }
.guide-tick { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; border-left: 1px solid var(--line); color: var(--mist); font-size: 0.8rem; 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: 0.85rem; 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: 0.88rem; font-weight: 600; }
.guide-prog .gp-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mist); font-size: 0.75rem; }
.guide-prog.on { background: var(--tonal); color: var(--on-tonal); }
.guide-prog.on .gp-sub { color: inherit; opacity: 0.85; }
.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: 0.72rem; 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; }
.guide-now { position: absolute; top: 2.5rem; bottom: 0; z-index: 1; width: 2px; margin-left: -1px; background: var(--live); pointer-events: none; }
@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: 0.95rem; 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; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.gpu-option > span { display: grid; gap: 0.1rem; }
.gpu-option:has(input:checked) { border-color: var(--tonal); }
.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; }

/* ---------- Now playing ---------- */
.np-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 1.25rem; margin-bottom: 0.75rem; }
.np-card { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.np-top { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; padding: 1rem; }
.np-poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: max(var(--radius), 0.4rem); background: var(--raised); }
.np-title { display: grid; align-content: start; gap: 0.2rem; min-width: 0; }
.np-title strong { font: var(--title-weight) 1.25rem/1.2 var(--font-display); font-style: var(--title-style); overflow-wrap: anywhere; }
.np-bar { height: 4px; margin-top: 0.5rem; background: var(--raised); border-radius: 2px; overflow: hidden; }
.np-bar span { display: block; height: 100%; background: var(--accent); }
.np-who { display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.75rem; align-items: center; padding: 0.75rem 1rem; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.np-who > div, .np-way > div { display: grid; gap: 0.1rem; min-width: 0; }
.np-avatar { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.np-ways { display: grid; }
.np-way { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 0.6rem 1rem; border-top: 1px solid var(--line); }
.np-label { color: var(--muted); font-size: 0.85rem; padding-top: 0.1rem; }
.np-how { font-size: 0.85rem; }
.np-how.direct { color: var(--text); }
.np-how.direct::before, .np-how.converting::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.45rem; vertical-align: 0.05rem; }
.np-how.direct::before { background: var(--ok-dot); }
.np-how.converting::before { background: var(--warn); }
.np-why { margin: 0; padding: 0.6rem 1rem 0.8rem; color: var(--muted); border-top: 1px solid var(--line); }
.bw { max-width: 52rem; }
/* The keys and the words: one line on a computer, two on a phone. Each key keeps its line and
   its name together. */
.bw-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; align-items: center; margin-bottom: 0.5rem; }
.bw-key { white-space: nowrap; }
.bw-key::before { content: ""; display: inline-block; width: 0.9rem; height: 3px; margin-right: 0.4rem; vertical-align: 0.2rem; border-radius: 2px; }
.bw-key-home::before { background: var(--accent); }
.bw-key-away::before { background: var(--away); }
.bw-graph { width: 100%; height: auto; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bw-rule { stroke: var(--line); stroke-width: 1; }
.bw-tick { fill: var(--muted); font: 11px var(--font-body); }
.bw-graph polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.bw-graph polygon { stroke: none; }
.bw-local { stroke: var(--accent); }
.bw-local.fill { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.bw-remote { stroke: var(--away); }
.bw-remote.fill { fill: color-mix(in srgb, var(--away) 16%, transparent); }

/* ---------- 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); overflow: hidden;
  aspect-ratio: 21 / 8; min-height: 20rem; max-height: min(42rem, 68vh); 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; }
.banner-slide { position: absolute; inset: 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% 22%; }
.banner-slide::after { content: ""; position: absolute; inset: 0; }
.banner-text { position: relative; z-index: 1; display: grid; gap: 0.5rem; max-width: 36rem; padding: clamp(1.25rem, 4vw, 3rem); padding-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.banner-label { margin: 0; font-size: 0.9rem; font-weight: 600; }
.banner-title { margin: 0; font: var(--title-weight) clamp(2rem, 4.5vw, 3.6rem)/1.02 var(--font-display); font-style: var(--title-style); letter-spacing: var(--title-tracking); }
.banner-meta { margin: 0; font-size: 0.95rem; }
.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; }
}

/* ---------- Trailers ---------- */
.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); }
.trailer-dialog { width: min(64rem, 94vw); max-width: none; }
.trailer-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.trailer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* 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 the trailer dialog says. */
.upcoming-card { position: relative; }
.upcoming-open { display: block; width: 100%; }
.upcoming-save { position: absolute; top: 0.45rem; right: 0.45rem; 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; }
/* Room under the picture for the words, so the dialog still fits the screen's height. */
dialog.modal.trailer-dialog:has(.trailer-about) { width: min(96vw, calc((100vh - 17rem) * 16 / 9), 64rem); }
.trailer-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; margin: 0; color: var(--mist); font-size: 0.95rem; }
.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: 0.85rem; }

/* ---------- 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%; }
.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; } }
/* Reel's Android app gives the player the whole screen by itself (js/app.js on its branch). */
html.in-app #ctl-full { display: none; }
.stage.idle, .stage.idle video { cursor: none; }
.controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 2.5rem 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.78), rgba(0, 0, 0, 0.35) 60%, 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.4rem; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.tl-track { position: relative; width: 100%; height: 4px; background: rgba(255, 255, 255, 0.22); border-radius: 2px; overflow: hidden; transition: height 0.15s ease; }
.timeline:hover .tl-track, .timeline.dragging .tl-track, .timeline:focus-visible .tl-track { height: 7px; }
.tl-buffered, .tl-played { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); }
.tl-buffered { background: rgba(255, 255, 255, 0.35); }
.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.9rem; height: 0.9rem; margin: -0.45rem 0 0 -0.45rem; 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.75rem; height: 2.75rem; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; transition: background 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 0.9rem var(--font-body); white-space: nowrap; }
.ctl-labelled svg { width: 1.35rem; height: 1.35rem; }
.ctl-main { width: 3.25rem; height: 3.25rem; }
.ctl-volume-group { display: flex; align-items: center; }
.ctl svg { width: 1.55rem; height: 1.55rem; fill: currentColor; }
.ctl svg text { font: 700 6.5px var(--font-body); fill: currentColor; }
.ctl:hover { background: rgba(255, 255, 255, 0.14); }
.ctl:active { transform: scale(0.92); }
.ctl:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
#ctl-play svg { width: 2rem; height: 2rem; }
.ctl-time { min-height: 2.75rem; margin-left: 0.25rem; padding: 0 0.6rem; border: 0; border-radius: var(--control-radius); background: transparent; color: #fff; font: 0.95rem var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.ctl-time:hover { background: rgba(255, 255, 255, 0.14); }
.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-volume, .ctl-labelled span, #ctl-pip { display: none; }
  .ctl-labelled { width: 2.75rem; padding: 0; justify-content: center; }
  .ctl-row { gap: 0.1rem; }
  .ctl-time { font-size: 0.85rem; padding: 0 0.35rem; }
}
/* 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 { 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: 0.8rem; }
  /* 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.5rem; }
  .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.3rem; flex: none; }
.live-fav .fav-btn { color: #fff; }
/* A tuner's channel is one live stream: no timeline, skipping or per-title menus, and the
   programme's progress between its start and end times instead. */
.stage.live-tv .timeline, .stage.live-tv .ctl-time, .stage.live-tv #ctl-back, .stage.live-tv #ctl-fwd,
.stage.live-tv #ctl-talk, .stage.live-tv #ctl-subs, .stage.live-tv #ctl-settings, .stage.live-tv #next-ep { display: none; }
.live-times .lt-bar { display: none; }
.stage.live-tv .live-times { align-items: center; gap: 0.8rem; }
.stage.live-tv .live-times .lt-bar { display: block; flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); }
.live-times .lt-bar span { display: block; height: 100%; border-radius: 2px; background: var(--live, #e0443e); }
.live-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.55rem; border-radius: 4px; background: var(--live); color: #fff; font: 700 0.78rem/1.4 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; }
.live-badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: #fff; }
.live-channel { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0 0.3rem; font-weight: 600; white-space: nowrap; }
.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 over the timeline, and a mark where the channel is now. */
.live-times { display: flex; justify-content: space-between; color: rgba(255, 255, 255, 0.8); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.live-edge { position: absolute; top: 50%; width: 3px; height: 1rem; margin: -0.5rem 0 0 -1.5px; border-radius: 2px; background: var(--live); pointer-events: none; }
/* 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: 0.85rem; }
.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 bar goes 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 .live-bar { order: 3; width: 100%; }
  .live-channel { flex: 1; min-width: 0; margin-inline: 0.15rem; }
  /* Two lines rather than a few letters and an ellipsis. */
  .live-channel > span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; line-height: 1.2; font-size: 0.9rem; }
  .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: 7.25rem; bottom: 5rem; }
  .stage.live .playback-info { top: 7.5rem; }
}

/* ---------- 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; }
.alert-ok { color: var(--muted); }
.alert-ok::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.5rem; border-radius: 50%; background: var(--ok-dot); }
.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 0.9rem/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: 0.85rem; max-width: 11rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-time { font-size: 0.75rem; 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; }
.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; } }

/* ---------- Trailers large, scan progress, quicker pages ---------- */
dialog.modal.trailer-dialog { width: min(96vw, calc((100vh - 7rem) * 16 / 9)); max-width: none; padding: 0.75rem; }
.trailer-dialog .dialog-head { margin-bottom: 0.5rem; }
/* The trailer's Close is for screen readers, out of sight until the keyboard reaches it (a tap
   beside the dialog, Escape or Back close it otherwise). */
.trailer-close.visually-hidden:focus-visible { position: static !important; width: auto; height: auto; margin: 0; padding: 0.3rem 0.65rem; overflow: visible; clip: auto; clip-path: none;
  border: 1px solid var(--rule); }
.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-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; }
.game-system-head h3 { margin: 0; font-size: 1.15rem; }
.game-system-head p { margin: 0.1rem 0 0; }
.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; } }
.bind-table { display: grid; gap: 2px; max-height: min(60vh, 34rem); overflow-y: auto; margin: 0.5rem 0 1rem; }
.bind-row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(10rem, 1.3fr) auto; gap: 0.6rem; align-items: center; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--line); }
.bind-head { font-weight: 600; font-size: 0.85rem; color: var(--muted); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.bind-row .bind { width: 100%; text-transform: none; letter-spacing: 0; justify-content: flex-start; text-align: left; }
.bind.listening { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) { .bind-row { grid-template-columns: 1fr 1fr; } }

/* 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: 0.85rem; 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. */
.gp-handle { display: none; position: absolute; top: calc(env(safe-area-inset-top, 0px) + 0.3rem); left: 50%; z-index: 3; width: 3.5rem; height: 2rem; min-height: 0; padding: 0;
  place-items: center; transform: translateX(-50%); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; background: rgba(0, 0, 0, 0.5); color: #fff; opacity: 0.8; cursor: pointer; }
.gp-handle svg { width: 1.3rem; height: 1.3rem; }
.gp-handle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; opacity: 1; }
.game-stage.pad.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; }
.badge.badge-start { right: auto; left: 0.4rem; }
.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; }
.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: 0.95rem; 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: 0.9rem; }
.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: 0.8rem; }
.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; } }
