/* VB Aggregator web client.
   Hand written, no build step, so a deploy stays "rebuild and restart". */

:root {
  --bg: #0e0f12;
  --bg-2: #16181d;
  --bg-3: #21242b;
  --line: #2b3039;
  --fg: #eceef2;
  --muted: #9aa1ad;
  --accent: #dfe7f8;
  --accent-2: #8bc6a9;
  --warn: #f0bf6a;

  /* One radius language. Pills for controls, soft rectangles for surfaces:
     the page used to mix 8, 12, 16 and 18 with no rule behind it. */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --pill: 999px;

  /* A real scale. Section headings used to be within a hair of body text,
     and then the page jumped straight to three rem in the banner. */
  --text-xs: .76rem;
  --text-sm: .86rem;
  --text: 1rem;
  --text-lg: clamp(1.12rem, 1.6vw, 1.35rem);
  --text-xl: clamp(1.5rem, 2.6vw, 2.1rem);
  --text-2xl: clamp(2rem, 4.4vw, 3.2rem);

  --gap: 1rem;
  --pad: clamp(1rem, 3vw, 2rem);
  /* Rows stretching the full width of a wide monitor are unreadable. */
  --page: 108rem;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Thin and self-coloured wherever something scrolls vertically. The default
   chrome scrollbar is the loudest thing on a dark page. */
* { scrollbar-width: thin; scrollbar-color: #3a4049 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--pill);
  background-clip: content-box;
  background-color: #3a4049;
}
*::-webkit-scrollbar-thumb:hover { background-color: #4a515c; }

button, input, select { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
button { cursor: pointer; }
[hidden] { display: none !important; }

.primary {
  padding: .7em 1.4em;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #14161a;
  font-weight: 600;
}
.primary:hover { filter: brightness(1.08); }

.ghost {
  padding: .55em 1.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
}
.ghost:hover { background: var(--bg-2); }

:focus-visible { outline: 2px solid #6ea8ff; outline-offset: 2px; }

/* -- header ------------------------------------------------------------ */

/* Never wraps. On a phone it used to break into two rows, which cost a
   third of the visible page before anything was shown. */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .7rem;
  /* The bar itself spans the window, but its contents line up with the
     page, so the brand is not stranded at the far edge of a wide monitor
     while the tabs below start a hundred pixels in. */
  padding: .7rem max(var(--pad), calc((100vw - var(--page)) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top__brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35em .7em .35em .5em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
  transition: background .16s ease;
}
.top__brand:hover { background: var(--bg-2); }
.top__mark { flex: 0 0 auto; opacity: .9; }
.who { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.search { position: relative; flex: 1 1 10rem; min-width: 6rem; margin-left: auto; }
.search__input {
  width: 100%;
  padding: .6em 2.2em .6em 1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}
.search__input::-webkit-search-cancel-button { display: none; }


/* -- tabs -------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: .5rem;
  max-width: var(--page);
  margin: 0 auto;
  padding: .9rem var(--pad) 0;
  overflow-x: auto;
  scrollbar-width: none;
  /* A fade at the far end, so a strip that continues past the edge reads as
     scrollable rather than as a word chopped in half. Only the far end:
     fading the left would dim the selected tab while it sits first. */
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: .5em 1.1em;
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: transparent;
  white-space: nowrap;
  font-size: var(--text-sm);
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.tab:hover { background: var(--bg-2); }
.tab[aria-selected="true"] { background: var(--accent); color: #14161a; border-color: transparent; }

/* -- content ----------------------------------------------------------- */

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.1rem var(--pad) 4rem;
}
/* The artwork comes from the catalogue, so the height follows a real
   image rather than a fixed block of decoration. */
.hero {
  position: relative;
  display: flex;
  align-items: end;
  min-height: clamp(11rem, 26vw, 19rem);
  margin: 0 0 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--bg-2), var(--bg-3));
  isolation: isolate;
}
.hero__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .85;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(10,11,13,.96) 0%, rgba(10,11,13,.72) 45%, rgba(10,11,13,.25) 100%),
    linear-gradient(0deg, rgba(10,11,13,.9), transparent 60%);
}
.hero__body { padding: clamp(1.1rem, 3vw, 2.2rem); max-width: 40rem; }
.hero__kicker {
  margin: 0 0 .35rem;
  color: var(--accent-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero__title {
  margin: 0;
  font-size: var(--text-2xl);
  line-height: 1.05;
  text-wrap: balance;
}
.hero__meta { margin: .5rem 0 0; color: var(--muted); font-size: var(--text-sm); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.row { position: relative; }
.row__head { display: flex; align-items: center; gap: .8rem; justify-content: space-between; }
.row__title { font-size: var(--text-lg); font-weight: 650; margin: 1.5rem 0 .7rem; letter-spacing: -.01em; }

/* The strip itself carries no visible scrollbar. It is driven by the
   arrows, by a drag, or by a wheel, and a slim progress line under it says
   where you are. The native bar was the oldest looking thing on the page. */
.row__strip {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  padding-bottom: .35rem;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
}
.row__strip::-webkit-scrollbar { display: none; }
.row__strip > * { scroll-snap-align: start; }
.row__strip .card { flex: 0 0 var(--card, clamp(7.5rem, 15vw, 11rem)); }
/* A strip's placeholder needs a width of its own: inside a flex row an
   aspect-ratio alone measures zero and the skeletons collapse to nothing. */
.row__strip .skeleton { flex: 0 0 var(--card, clamp(7.5rem, 15vw, 11rem)); }

/* Both ends faded once there is something to scroll back to. */
.strip--start .row__strip {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}
.strip--end .row__strip {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 100%);
  mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 100%);
}
.strip--none .row__strip { -webkit-mask-image: none; mask-image: none; }

.strip__arrow {
  position: absolute;
  top: calc(50% - .6rem);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(8px);
  color: var(--fg);
  opacity: 0;
  transform: translateY(-50%) scale(.9);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.strip__arrow--prev { left: -.4rem; }
.strip__arrow--next { right: -.4rem; }
.row:hover .strip__arrow, .strip__arrow:focus-visible { opacity: 1; transform: translateY(-50%) scale(1); }
.strip__arrow:hover { background: var(--bg-3); }
.strip__arrow[disabled] { opacity: 0 !important; pointer-events: none; }

/* The modern part: a track that only shows how far along you are. */
.strip__progress {
  position: relative;
  height: 3px;
  margin: .45rem 0 .1rem;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--line) 70%, transparent);
  opacity: 0;
  transition: opacity .25s ease;
}
.row:hover .strip__progress, .strip--scrolling .strip__progress { opacity: 1; }
.strip__progress > i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 20%;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--fg) 55%, transparent);
  transition: transform .12s linear;
}
.strip--none .strip__progress { display: none; }

/* An empty shelf explains itself in place, not as a centred full-page note. */
.row .note { text-align: left; padding: .2rem 0 1rem; }

.collections__title { font-size: var(--text-xl); margin: 2.2rem 0 .2rem; letter-spacing: -.02em; }
#collections .row__title { margin-top: 1.1rem; }

.suggestions { margin-bottom: .2rem; }
.suggestions__strip { display: flex; gap: .55rem; overflow-x: auto; padding: .1rem 0 .8rem; scrollbar-width: none; }
.suggestions__strip::-webkit-scrollbar { display: none; }
/* A search of the viewer's own, which can be removed again. */
.suggestion--mine { padding-right: .55rem; display: inline-flex; align-items: center; gap: .45rem; }
.suggestion__drop { opacity: .5; font-size: 1.05em; line-height: 1; padding: 0 .15rem; }
.suggestion__drop:hover { opacity: 1; }

.suggestion {
  flex: 0 0 auto;
  padding: .58rem .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg);
  white-space: nowrap;
}
.suggestion:hover { border-color: var(--accent); background: var(--bg-3); }

.grid {
  display: grid;
  /* Column width follows the tile shape, so a landscape catalogue does not
     end up as a row of thin strips and a portrait one does not end up with
     giant cards. The tuner sets --col from the artwork it measured. */
  grid-template-columns: repeat(auto-fill, minmax(var(--col, clamp(7rem, 15vw, 10.5rem)), 1fr));
  gap: var(--gap);
}

.card { border: 0; background: none; padding: 0; text-align: left; }
.card__thumb {
  position: relative;
  /* Not a fixed 2:3. Sources differ wildly in what shape their artwork is,
     and this one ships wide banners, so a portrait tile left them floating in
     grey. The grid measures what actually arrived and sets --tile; the value
     here is only the fallback before the first image lands. */
  aspect-ratio: var(--tile, 2 / 3);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-3));
  box-shadow: var(--shadow);
}
.card__thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  /* Sources hand back posters of every shape. `cover` cropped the sides off,
     which on this catalogue meant slicing the title straight off the artwork.
     `contain` shows the whole poster; the blurred copy behind it fills the
     tile so the grid still reads as one even row. */
  /* Filling the tile is the default and looks sharp. `contain` and the
     blurred backdrop are the fallback for artwork whose shape is nothing
     like the tile, where cropping would cut the title off the poster. */
  object-fit: cover;
  display: block;
}
.card__thumb--fit img { object-fit: contain; }

.card__thumb::before { content: none; }
.card__thumb--fit::before {
  content: "";
  position: absolute;
  inset: -6%;
  background-image: var(--poster, none);
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(.6) brightness(.45);
  transform: scale(1.06);
}

.card__count, .card__quality, .card__bar { z-index: 2; }

.card__thumb, .card__title { transition: transform .16s ease, outline-color .16s ease; }
.card:hover .card__thumb,
.card:focus-visible .card__thumb {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-4px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .45);
}
.card__count {
  position: absolute; top: .5rem; right: .5rem;
  min-width: 1.7rem; height: 1.7rem; padding: 0 .4rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: rgba(0,0,0,.78);
  font-size: .8rem; font-weight: 600;
}
.card__quality {
  position: absolute; left: .5rem; top: .5rem;
  padding: .18rem .46rem;
  border-radius: 999px;
  background: rgba(16,17,19,.82);
  color: var(--warn);
  font-size: .72rem;
  font-weight: 700;
}
/* Only on the cards that carry one, and only worth showing when the card
   is under a pointer: a delete button on every tile is a page of crosses. */
.card__drop {
  position: absolute;
  top: .4rem;
  right: .4rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, .72);
  color: var(--fg);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
  transition: opacity .16s ease, background .16s ease;
}
.card:hover .card__drop, .card__drop:focus-visible { opacity: 1; }
.card__drop:hover { background: #b4413f; }
@media (hover: none) { .card__drop { opacity: 1; } }

.card__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.2); }
.card__bar > i { display: block; height: 100%; background: var(--accent); }
.card__title {
  margin-top: .55rem;
  font-size: var(--text-sm);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta { display: flex; min-height: 1.1rem; align-items: center; gap: .45rem; color: var(--muted); font-size: var(--text-xs); }
.card__sources { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.skeleton { aspect-ratio: var(--tile, 2 / 3); border-radius: var(--radius); background: var(--bg-2); }

.more { display: flex; justify-content: center; padding: 2rem 0; }
.note { color: var(--muted); text-align: center; padding: 2rem 0; }

/* -- proxies ------------------------------------------------------------ */

.proxies { display: grid; gap: .5rem; margin-bottom: .9rem; }
.proxy {
  display: flex;
  align-items: center;
  gap: .8rem;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
/* The state is the first thing to read, so it is the edge of the row. */
.proxy--ok { border-left-color: var(--accent-2); }
.proxy--bad { border-left-color: #b4413f; }
.proxy--unknown { border-left-color: var(--line); }
.proxy--active { background: var(--bg-3); }
.proxy__copy { display: grid; gap: .1rem; min-width: 0; }
.proxy__name { font-weight: 600; overflow-wrap: anywhere; }
.proxy__copy small { color: var(--muted); font-size: var(--text-xs); }
.proxy__actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* -- diagnostics -------------------------------------------------------- */

.diag { display: grid; gap: .35rem; }
.diag__row {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  justify-content: space-between;
  padding: .45rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  font-size: var(--text-sm);
}
.diag__row--bad { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.diag__name { font-weight: 600; }
.diag__value { color: var(--muted); text-align: right; overflow-wrap: anywhere; }

/* -- the log ----------------------------------------------------------- */

.log__filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; align-items: center; }
.log__filters .select { flex: 0 1 auto; }
.log__filters input {
  flex: 1 1 12rem;
  min-width: 8rem;
  padding: .5em .8em;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
}

/* A log is read by scanning down one column at a time, so the columns are
   fixed and the message takes whatever is left. */
.log { max-height: 26rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.log__row { border-bottom: 1px solid var(--line); }
.log__row:last-child { border-bottom: 0; }
.log__head {
  display: grid;
  grid-template-columns: 8.5rem 5.5rem 6rem 1fr 4.5rem;
  gap: .6rem;
  width: 100%;
  padding: .45rem .7rem;
  border: 0;
  background: none;
  color: var(--fg);
  text-align: left;
  font-size: .82rem;
  align-items: baseline;
}
.log__head:hover { background: var(--bg-2); }
.log__at, .log__kind, .log__who, .log__ms { color: var(--muted); font-variant-numeric: tabular-nums; }
.log__message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log__ms { text-align: right; }
.log__row--warning .log__message { color: #ffcf8f; }
.log__row--error .log__message { color: #ff8f8f; }
.log__detail {
  margin: 0;
  padding: .5rem .7rem .8rem;
  background: var(--bg-2);
  color: var(--muted);
  font-size: .78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 40rem) {
  .log__head { grid-template-columns: 6.5rem 1fr; }
  .log__kind, .log__who, .log__ms { display: none; }
}

/* -- sign in ----------------------------------------------------------- */

.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); z-index: 60; }
.gate__card { width: min(26rem, 100%); padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-2); text-align: center; }
.gate__title { margin: 0 0 .4rem; font-size: 1.4rem; }
.gate__text { margin: 0 0 1.4rem; color: var(--muted); }
.gate__input { width: 100%; padding: .75em 1em; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: center; letter-spacing: .08em; }
.gate__error { margin: 1rem 0 0; color: #ff8f8f; }

/* -- item sheet -------------------------------------------------------- */

.sheet { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.sheet__panel {
  position: relative;
  width: min(64rem, calc(100% - 2rem));
  max-height: min(92vh, 56rem);
  overflow-y: auto;
  /* The gesture stays in the sheet. Without this a finger that reaches the
     end of the panel hands the rest of its travel to the page underneath,
     which is fixed behind a backdrop and therefore looks like nothing
     moving at all. */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0 0 clamp(1rem, 2.4vw, 1.6rem);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
@media (min-width: 40rem) { .sheet { place-items: center; } .sheet__panel { border-radius: var(--radius-lg); } }

.sheet__close {
  position: absolute;
  top: .6rem;
  right: .7rem;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, .35);
  color: var(--fg);
  font-size: 1.6rem;
  line-height: 1;
}

/* One identity line, and it stays put while the body scrolls under it.
   The page used to introduce the film twice: a poster and title here, then
   a full backdrop with the same facts immediately below. */
.sheet__head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 0;
  padding: .7rem 3.2rem .7rem clamp(1rem, 2.4vw, 1.6rem);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.sheet__poster { width: 2.6rem; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: var(--bg); flex: 0 0 auto; }
.sheet__ident { min-width: 0; }
.sheet__title {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet__meta { margin: 0; color: var(--muted); font-size: var(--text-xs); }
.sheet__body { display: grid; gap: 1.1rem; padding: 0 clamp(1rem, 2.4vw, 1.6rem); }

.pick { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.pick__label { width: 100%; color: var(--muted); font-size: var(--text-sm); }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .55rem; }
.ep { min-height: 3rem; font-weight: 700; border-radius: var(--radius-sm); }

/* The artwork leads, the facts sit beside it and start at the top. They
   used to be centred against a tall image, which left the actions floating
   in the middle of nothing. */
.watch-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(17rem, 1fr);
  gap: 1.2rem;
  align-items: start;
  margin-top: 1.1rem;
}
.watch-detail__backdrop {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 20rem;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}
.watch-detail__content { min-width: 0; align-self: start; }

/* The thing you came here to do, first and largest. */
.watch-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: 0 0 .9rem; }
.watch-actions .primary { padding: .75em 1.6em; }
.watch-detail__meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .8rem; }
.watch-detail__meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: .25rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: .85rem;
}
.watch-detail__original { margin: 0 0 .8rem; color: var(--muted); }
.watch-detail__description { margin: 0; color: #c9ced8; }
.watch-section { padding-top: .2rem; }
.watch-section__title { margin: 0 0 .6rem; font-size: var(--text-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
/* A strip of thumbnails, not a wall. Full width frames pushed the episode
   list, which is what the viewer actually wants, off the screen. */
.watch-media { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: none; }
.watch-media::-webkit-scrollbar { display: none; }
.watch-media__frame {
  flex: 0 0 clamp(9rem, 22vw, 13rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  aspect-ratio: 16/9;
}
.watch-media__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 46rem) {
  .sheet__panel { width: 100%; max-height: 96vh; }
  .watch-detail { grid-template-columns: 1fr; }
}

/* -- player ------------------------------------------------------------ */

.player { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; }
.player__bar { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; background: #0b0c0e; flex-wrap: wrap; }
#player-next { flex: 0 0 auto; }
/* Native subtitle rendering is small and pinned to the very bottom on a
   large screen; this lifts it clear of the controls. */
#video::cue { font-size: 1rem; background: rgba(0, 0, 0, .65); }
.player__title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#video { flex: 1; width: 100%; min-height: 0; background: #000; }
.player__resume { position: absolute; left: 50%; bottom: 5.5rem; transform: translateX(-50%); display: flex; align-items: center; gap: .8rem; padding: .8rem 1.2rem; border-radius: 999px; background: rgba(20,22,26,.95); border: 1px solid var(--line); }

/* The attribution TMDB asks for: present and readable, and smaller than
   anything of ours, which is what their terms ask for. */
.attribution { display: flex; align-items: center; gap: .7em; }
.attribution__logo { width: 5.5em; height: auto; opacity: .85; flex: none; }

/* -- settings panel ---------------------------------------------------- */

.icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
}
.icon:hover { background: var(--bg-2); color: var(--fg); }

.small { padding: .35em .8em; font-size: .85rem; }

.panel { position: fixed; inset: 0; z-index: 55; overflow: auto; background: rgba(8,9,11,.72); backdrop-filter: blur(4px); }
.panel__inner {
  width: min(46rem, 100%);
  min-height: 100%;
  margin-left: auto;
  padding: 1.4rem clamp(1rem, 3vw, 2rem) 3rem;
  background: var(--bg);
  border-left: 1px solid var(--line);
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .4rem; }
.panel__title { margin: 0; font-size: 1.25rem; }

.sect { padding: 1.4rem 0; border-top: 1px solid var(--line); }
.sect__title { margin: 0 0 .9rem; font-size: .8rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.sect__note { margin: -.3rem 0 1rem; color: var(--muted); font-size: .9rem; }
.sect__error { margin: .6rem 0 0; color: #ff8f8f; font-size: .9rem; }

.field { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .5rem 0; }
.field__label { flex: 0 0 9rem; color: var(--muted); font-size: .9rem; }
.field__value { font-weight: 500; }
.field--form input {
  flex: 1 1 12rem;
  padding: .5em .9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}
#set-proxy-form { align-items: center; }
#set-proxy-input { min-width: min(19rem, 100%); }
.select {
  padding: .5em 2em .5em .9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}
.sect__note--tight { margin-top: .2rem; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }

.source-setting__health { color: var(--muted); font-size: .78rem; }
.source-setting__health[data-bad="1"] { color: var(--warn, #e0a34a); }

.admin__new { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1.2rem; }
.admin__new input:not([type="checkbox"]) { flex: 1 1 13rem; padding: .6em 1em; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); }
.check { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.admin__list { display: grid; gap: .6rem; }
.source-settings { display: grid; gap: .6rem; }
.source-setting {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2);
}
.source-setting__copy { display: grid; gap: .1rem; }
.source-setting__copy small { color: var(--muted); font-size: .8rem; }
.source-setting__toggle { width: 2.8rem; height: 1.5rem; accent-color: #6ea8ff; }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.trow__label { font-weight: 600; }
.trow__token { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); font-size: .9rem; }
.trow__tag { font-size: .72rem; padding: .15em .6em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.trow__spacer { margin-left: auto; }

/* -- the phone --------------------------------------------------------- */

@media (max-width: 46rem) {
  :root { --pad: .9rem; }

  /* Touch targets stay finger sized while the space between them shrinks. */
  .tab { padding: .5em .95em; }
  .row__title { margin: 1.1rem 0 .55rem; }
  .card__title { font-size: .82rem; }
  .grid { gap: .7rem; }
  .row__strip { gap: .7rem; }

  /* Arrows are a pointer affordance. A finger swipes. */
  .strip__arrow { display: none; }
  .strip__progress { opacity: 1; }

  /* Three columns rather than two. The tuner sizes tiles for a desktop
     grid; on a phone that left two enormous cards per row. */
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(var(--col, 8rem), 6.6rem), 1fr)); }
  .row__strip .card,
  .row__strip .skeleton { flex-basis: min(var(--card, 8rem), 7.4rem); }
}

@media (max-width: 34rem) {
  /* The brand keeps its mark and loses its word, which is what stopped the
     header wrapping onto a second row and eating the screen. */
  .top__name { display: none; }
  .top { gap: .5rem; padding: .6rem var(--pad); }
  .top__brand { padding: .35em; }
  .who { display: none; }
  .search { flex: 1 1 auto; }

  .hero { min-height: 15rem; border-radius: var(--radius); }
  .hero__body { padding: 1rem; }
  .hero__actions .primary { width: 100%; }

  .field__label { flex: 1 0 100%; }
  .panel__inner { border-left: 0; }
  .panel__head { position: sticky; top: 0; z-index: 2; padding: .2rem 0 .6rem; background: var(--bg); }

  /* A sheet on a phone is a page: full height, and its head stays put.
     `dvh` rather than `vh`, because a phone's address bar is inside `vh`
     and the last screenful of a film's description was therefore under it,
     unreachable however far anybody scrolled. */
  .sheet__panel {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .sheet__body { gap: .9rem; }
  .watch-detail { gap: .8rem; margin-top: .8rem; }
  .eps { grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr)); }
  .log__filters .select, .log__filters input { flex: 1 1 100%; }
}

/* Landscape phones and small tablets: the sheet is still a page. */
@media (max-height: 30rem) and (max-width: 60rem) {
  .sheet__panel {
    max-height: 100vh;
    height: 100vh;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
}

/* While a sheet or the player is open, the page behind must not scroll:
   two scrollable things under one finger is why the top one felt stuck. */
body.vb-locked { overflow: hidden; }

/* -- toast ------------------------------------------------------------- */

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 80; padding: .8rem 1.3rem; border-radius: 999px; background: #24272e; border: 1px solid var(--line); max-width: min(34rem, 92vw); }

/* The phone as the television's microphone, and the way to push what is
   typed onto the screen. One row inside the field, anchored right, so a
   button that is hidden takes its space with it. */
.search__input { padding-right: 5.6em; }

.search__tools {
  position: absolute;
  right: .45em;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: .1em;
}

.search__tool {
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.search__tool:hover,
.search__tool:focus-visible {
  color: var(--text);
  background: var(--bg);
}

/* While it is listening, so "speak now" and "nothing is happening" are not
   the same picture from across a room. */
.search__tool--live {
  color: var(--accent, #6ea8fe);
  animation: vb-listen 1.2s ease-in-out infinite;
}

@keyframes vb-listen {
  50% { opacity: .35; }
}
