/* embygo web client
 * Hand-written, dependency-free. Every rule here ships to the browser, so the
 * sheet stays small enough to inline-parse in one frame on a TV browser. */

:root {
  color-scheme: dark;
  --bg: #07080d;
  --bg-elev: #13161f;
  --bg-elev-2: #1b1f2b;
  --bg-elev-3: #262c3c;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #eceef4;
  --text-dim: #9aa3b7;
  --text-faint: #6a7387;
  --accent: #64d2ff;
  --accent-2: #a78bfa;
  --accent-ink: #04121c;
  --accent-soft: color-mix(in oklab, var(--accent) 15%, transparent);
  --danger: #fb7185;
  --ok: #4ade80;
  --warn: #fbbf24;
  /* Layered rather than one blur: a tight contact shadow keeps an edge crisp
     while the wide one gives the surface somewhere to sit. */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -12px rgba(0, 0, 0, .7);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .5), 0 28px 70px -20px rgba(0, 0, 0, .8);
  --glow: 0 14px 40px -14px color-mix(in oklab, var(--accent) 55%, transparent);
  /* The 1px top highlight that makes a dark surface read as a surface. */
  --hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --bar-h: 64px;
  --pad: clamp(16px, 4.2vw, 56px);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef1f7;
  --bg-elev-3: #e2e7f0;
  --line: rgba(12, 18, 32, 0.09);
  --line-strong: rgba(12, 18, 32, 0.18);
  --text: #0e1420;
  --text-dim: #4a5468;
  --text-faint: #78829a;
  --accent: #0a84c9;
  --accent-2: #6d4aec;
  --accent-ink: #ffffff;
  --danger: #e11d48;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 26px -14px rgba(16, 24, 40, .3);
  --shadow-2: 0 2px 6px rgba(16, 24, 40, .07), 0 26px 60px -22px rgba(16, 24, 40, .38);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .9);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}

body::before {
  /* One fixed, cheap ambient wash instead of per-view gradients. The mixes are
     strong enough to actually reach the eye over a near-black page — at half
     these values the whole thing reads as flat grey, which is the difference
     between "dark theme" and "unpainted". */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1400px 820px at 4% -18%, color-mix(in oklab, var(--accent) 30%, transparent), transparent 66%),
    radial-gradient(1150px 720px at 99% -6%, color-mix(in oklab, var(--accent-2) 32%, transparent), transparent 62%),
    radial-gradient(1000px 800px at 52% 122%, color-mix(in oklab, var(--accent-2) 18%, transparent), transparent 64%);
}

/* A vignette on top of the wash keeps the middle of the page calm, so content
   sits on something quiet while the edges still carry colour. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(120% 90% at 50% 42%, transparent 30%, color-mix(in oklab, var(--bg) 72%, transparent) 100%);
}

#app { position: relative; z-index: 1; min-height: 100%; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

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

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 99px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

.muted { color: var(--text-faint); }
.good { color: var(--ok); }
.bad { color: var(--danger); }
.spacer { flex: 1; }
.sentinel { height: 1px; }

/* ---------- boot ---------- */

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 20px; }
.boot-mark {
  width: 48px; height: 48px; border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--glow);
  animation: pulse 1.5s var(--ease) infinite;
}
.boot-text { color: var(--text-dim); margin: 0; font-size: 14px; }
@keyframes pulse {
  0%, 100% { opacity: .38; transform: scale(.88) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(10deg); }
}
.noscript {
  position: fixed; inset-inline: 0; top: 0; padding: 14px var(--pad);
  background: var(--bg-elev-2); color: var(--text); text-align: center;
}

/* ---------- shell ---------- */

.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--bar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 var(--pad);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: saturate(170%) blur(22px);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
  border-bottom: 1px solid var(--line);
  transition: background .25s var(--ease), border-color .25s var(--ease),
              backdrop-filter .25s var(--ease);
}

/* Over a featured banner the bar is part of the artwork, not a shelf sitting on
   top of it: an opaque strip cuts a hard line across the image and is the one
   thing that makes an otherwise cinematic header look like a web page. It earns
   its background back as soon as the banner scrolls away. */
.shell.has-featured .topbar {
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent);
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.shell.has-featured .topbar.solid {
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(170%) blur(22px);
  -webkit-backdrop-filter: saturate(170%) blur(22px);
}

.brand {
  display: flex; align-items: center; gap: 10px; flex: none;
  font-weight: 700; letter-spacing: -.025em; font-size: 17.5px; margin-inline-end: 8px;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--hi), 0 4px 14px -6px color-mix(in oklab, var(--accent) 70%, transparent);
}

.nav { display: flex; gap: 3px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 14px; border-radius: 99px; white-space: nowrap;
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav a.on {
  color: var(--text); font-weight: 600;
  background: color-mix(in oklab, var(--accent) 14%, var(--bg-elev-2));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent);
}

.topbar-actions { display: flex; align-items: center; gap: 7px; flex: none; }

.icon-btn {
  width: 37px; height: 37px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 11px;
  cursor: pointer; color: var(--text-dim); flex: none;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }

.avatar {
  width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 700; font-size: 13px; cursor: pointer;
  border: none; flex: none; box-shadow: var(--hi);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; cursor: default; }

.main { flex: 1; padding: 0 0 84px; }

.page-head { padding: 34px var(--pad) 4px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; font-weight: 700; }
.page-head .hint { margin: 7px 0 0; color: var(--text-faint); font-size: 13.5px; }
.narrow { max-width: 940px; margin: 0 auto; }
.narrow .page-head { padding-inline: 0; }

/* ---------- menus ---------- */

.menu {
  position: fixed; z-index: 60; min-width: 214px; max-width: 320px; padding: 6px;
  background: color-mix(in oklab, var(--bg-elev) 94%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-2), var(--hi);
  animation: pop .14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  padding: 9px 11px; border: 0; background: none; border-radius: 9px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.menu button:hover:not(:disabled) { background: var(--bg-elev-2); }
.menu button:disabled { opacity: .4; cursor: not-allowed; }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover:not(:disabled) { background: color-mix(in oklab, var(--danger) 14%, transparent); }
.menu .sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu .label {
  padding: 8px 11px 4px; font-size: 11.5px; color: var(--text-faint);
  letter-spacing: .04em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.menu svg { width: 16px; height: 16px; flex: none; color: var(--text-dim); }
.menu-gap { width: 16px; flex: none; }

/* ---------- forms & buttons ---------- */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; font-weight: 500; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--text-faint); }

.input, select.input {
  width: 100%; padding: 11px 14px; font-size: 14.5px;
  background: color-mix(in oklab, var(--bg) 70%, var(--bg-elev));
  color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 11px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: color-mix(in oklab, var(--text-faint) 60%, transparent); }
.input:focus {
  outline: none; border-color: var(--accent); background: var(--bg-elev);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: var(--bg-elev-2); color: var(--text); box-shadow: var(--hi);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .13s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--bg-elev-3); border-color: var(--text-faint); }
.btn:active:not(:disabled) { transform: scale(.975); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); border-color: transparent; font-weight: 700;
  box-shadow: var(--hi), var(--glow);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.btn-danger {
  background: color-mix(in oklab, var(--danger) 86%, black); color: #fff;
  border-color: transparent; font-weight: 700;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); background: color-mix(in oklab, var(--danger) 86%, black); }
.btn-on {
  background: color-mix(in oklab, var(--accent) 18%, var(--bg-elev-2));
  border-color: color-mix(in oklab, var(--accent) 44%, transparent);
  color: color-mix(in oklab, var(--accent) 74%, var(--text));
}
.btn-ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-sm svg { width: 15px; height: 15px; }
/* Icon-only, sized to line up beside a text button of the same height. */
.btn-icon { padding: 10px; width: 42px; }
.btn-icon.btn-lg { padding: 12px; width: 46px; }
.btn-icon svg { width: 18px; height: 18px; }

.error-note {
  margin: 0 0 14px; padding: 11px 13px; border-radius: 10px; font-size: 13px;
  background: color-mix(in oklab, var(--danger) 15%, transparent);
  border: 1px solid color-mix(in oklab, var(--danger) 38%, transparent);
  color: color-mix(in oklab, var(--danger) 80%, var(--text));
}

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: color-mix(in oklab, var(--bg) 68%, transparent);
  backdrop-filter: blur(12px); animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(440px, 100%); padding: 26px;
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-2), var(--hi);
  animation: rise .2s var(--ease);
}
.modal h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.015em; }
.modal .hint { margin: 0 0 18px; color: var(--text-faint); font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%);
  background: color-mix(in oklab, var(--bg-elev) 88%, transparent);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  padding: clamp(28px, 5vw, 40px); box-shadow: var(--shadow-2), var(--hi);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.login h1 { margin: 18px 0 5px; font-size: 27px; letter-spacing: -.03em; }
.login .sub { margin: 0 0 26px; color: var(--text-dim); font-size: 14px; }
.login .brand-mark { width: 46px; height: 46px; border-radius: 14px; }

/* ---------- sections, rows, grids ---------- */

.section { padding: 34px var(--pad) 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; font-weight: 680; }
.section-head .count {
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; background: var(--bg-elev-2);
}
.section-head .more { margin-inline-start: auto; color: var(--text-dim); font-size: 13px; font-weight: 500; }
.section-head .more:hover { color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar.flush { padding: 0; }
.toolbar .input { width: auto; min-width: 190px; }

.row {
  display: grid; grid-auto-flow: column; gap: 16px;
  grid-auto-columns: clamp(130px, 15vw, 176px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: var(--pad);
  padding-block: 4px 14px; margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad);
  scrollbar-width: thin;
}
.row > * { scroll-snap-align: start; }
.row.wide { grid-auto-columns: clamp(236px, 30vw, 340px); }

.grid {
  display: grid; gap: 24px 16px;
  grid-template-columns: repeat(auto-fill, minmax(clamp(126px, 14vw, 172px), 1fr));
}
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(clamp(224px, 26vw, 328px), 1fr)); }

/* ---------- featured banner ---------- */

.featured {
  position: relative;
  min-height: clamp(320px, 46vw, 560px);
  display: flex; align-items: flex-end;
  margin-top: calc(var(--bar-h) * -1);
  padding: calc(var(--bar-h) + 40px) var(--pad) clamp(28px, 4vw, 56px);
  overflow: hidden;
  isolation: isolate;
}
.featured-art { position: absolute; inset: 0; z-index: -1; }
.featured-art img {
  width: 100%; height: 100%; object-fit: cover;
  /* Slightly over-scaled so the blur at the edges never shows the page behind. */
  transform: scale(1.04);
  filter: saturate(1.1);
}
/* Two scrims, not one: a vertical fade so the rows below it start on the page
   colour rather than on artwork, and a horizontal one so the text has a dark
   side to sit on regardless of what the frame happens to contain. */
.featured-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 2%, color-mix(in oklab, var(--bg) 55%, transparent) 34%, transparent 72%),
    linear-gradient(to right, color-mix(in oklab, var(--bg) 88%, transparent), transparent 62%);
}
.featured-body { position: relative; max-width: min(680px, 92%); }
.featured-title {
  margin: 0 0 12px; font-size: clamp(28px, 5vw, 56px);
  font-weight: 760; letter-spacing: -.04em; line-height: 1.05;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .55);
}
.featured-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.featured-overview {
  margin: 0 0 22px; max-width: 62ch; color: var(--text-dim);
  font-size: 15px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* The banner supplies the page's top spacing, so the first row must not add
   another screenful of its own. */
.featured + .section { padding-top: 8px; }

@media (max-width: 640px) {
  .featured { min-height: 300px; }
  .featured-overview { -webkit-line-clamp: 2; }
}

/* ---------- library tiles ---------- */

.lib-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.lib-tile {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 13px; padding: 18px 20px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(125deg,
    color-mix(in oklab, hsl(var(--h1) 68% 50%) 46%, var(--bg-elev)),
    color-mix(in oklab, hsl(var(--h2) 68% 48%) 22%, var(--bg-elev)));
  box-shadow: var(--hi);
  font-weight: 650; font-size: 15px; letter-spacing: -.01em;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.lib-tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 100% 0%, rgba(255, 255, 255, .1), transparent 55%);
}
.lib-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-1), var(--hi); border-color: var(--line-strong); }
.lib-tile svg { width: 22px; height: 22px; flex: none; color: #fff; opacity: .92; }

/* ---------- card ---------- */

.card {
  display: flex; flex-direction: column; gap: 9px;
  cursor: pointer; text-align: start;
  content-visibility: auto; contain-intrinsic-size: auto 268px;
}
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elev-2);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  transition: transform .26s var(--ease), box-shadow .26s var(--ease);
  isolation: isolate;
}
.poster.wide { aspect-ratio: 16 / 9; }
.card:hover .poster, .card:focus-visible .poster {
  transform: translateY(-6px) scale(1.025);
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line-strong),
              0 20px 44px -22px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* Generated fallback art: deterministic hue from the item id, plus initials.
   No network request, no placeholder file, and it never looks broken. */
.poster .fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(155deg, hsl(var(--h1) 62% 42%), hsl(var(--h2) 66% 19%));
  color: rgba(255, 255, 255, .92); font-weight: 700; letter-spacing: .04em;
  font-size: clamp(20px, 3.4vw, 30px); text-shadow: 0 2px 14px rgba(0, 0, 0, .5);
}
.poster .fallback.long { font-size: clamp(15px, 2.3vw, 22px); letter-spacing: .01em; }
.poster .fallback::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, .17), transparent 60%);
}

/* Absolute, and above the fallback: a positioned sibling paints over a static
   one regardless of DOM order, which would otherwise hide every real poster. */
.poster img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .34s var(--ease);
}
.poster img.ready { opacity: 1; }

.poster .play-hint {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2;
  background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, .04) 58%);
  opacity: 0; transition: opacity .22s var(--ease);
}
.card:hover .play-hint, .card:focus-within .play-hint,
.ep:hover .play-hint, .ep:focus-within .play-hint { opacity: 1; }
.play-fab {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5), var(--hi); border: 0; cursor: pointer;
  transform: scale(.8); transition: transform .22s var(--ease), filter .18s var(--ease);
}
.card:hover .play-fab, .ep:hover .play-fab { transform: scale(1); }
.play-fab:hover { filter: brightness(1.1); }
.play-fab.ghost { background: rgba(255, 255, 255, .94); color: #0b0d12; }
.play-fab svg { width: 21px; height: 21px; margin-inline-start: 2px; }
.play-fab.ghost svg { margin-inline-start: 3px; }

.badge-tick, .badge-fav {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.badge-tick { background: color-mix(in oklab, var(--ok) 85%, black); color: #04140a; }
.badge-fav { background: color-mix(in oklab, var(--danger) 88%, black); color: #fff; top: 35px; }
.badge-tick svg, .badge-fav svg { width: 13px; height: 13px; }
.badge-count {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.badge-src {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 3;
  padding: 2px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; background: rgba(0, 0, 0, .6); color: #fff;
  backdrop-filter: blur(8px);
}

.progress-strip {
  position: absolute; inset-inline: 0; bottom: 0; height: 4px; z-index: 3;
  background: rgba(0, 0, 0, .55);
}
.progress-strip i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.card-title {
  font-size: 13.5px; font-weight: 560; line-height: 1.4; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .card-title { color: var(--accent); }
.card-sub { font-size: 12px; color: var(--text-faint); }

/* ---------- hero ---------- */

.hero { position: relative; padding: 0 0 8px; }
.hero-bg {
  position: absolute; inset: 0; overflow: hidden; z-index: 0;
  mask-image: linear-gradient(to bottom, #000 20%, transparent 100%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to right, var(--bg) 2%, color-mix(in oklab, var(--bg) 55%, transparent) 55%, transparent);
}
.hero-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .36; filter: saturate(1.15); }
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: clamp(154px, 20vw, 238px) 1fr; gap: clamp(20px, 3vw, 40px);
  padding: clamp(30px, 5.5vw, 62px) var(--pad) 8px; align-items: end;
}
.hero .poster { box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line-strong); }
.hero-meta h1 {
  margin: 0 0 10px; font-size: clamp(25px, 4.2vw, 44px);
  letter-spacing: -.035em; line-height: 1.1; font-weight: 750;
}
.hero-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.crumbs { display: flex; flex-wrap: wrap; gap: 7px; font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { color: var(--text-faint); }

.pill {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: color-mix(in oklab, var(--bg-elev-2) 80%, transparent);
  border: 1px solid var(--line); color: var(--text-dim);
  white-space: nowrap; backdrop-filter: blur(6px);
}
.pill.accent {
  background: color-mix(in oklab, var(--accent) 15%, transparent);
  border-color: color-mix(in oklab, var(--accent) 36%, transparent);
  color: color-mix(in oklab, var(--accent) 72%, var(--text));
}
.pill.good {
  background: color-mix(in oklab, var(--ok) 14%, transparent);
  border-color: color-mix(in oklab, var(--ok) 34%, transparent);
  color: color-mix(in oklab, var(--ok) 70%, var(--text));
}
.pill.bad {
  background: color-mix(in oklab, var(--danger) 14%, transparent);
  border-color: color-mix(in oklab, var(--danger) 36%, transparent);
  color: color-mix(in oklab, var(--danger) 74%, var(--text));
}

@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 120px 1fr; align-items: start; }
}

/* ---------- episode list ---------- */

.tabs { display: flex; gap: 7px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 99px; cursor: pointer; font-size: 13.5px;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.tab:hover { color: var(--text); background: var(--bg-elev); }
.tab.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); border-color: transparent; font-weight: 650;
  box-shadow: var(--hi);
}
.tab-count {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: color-mix(in oklab, currentColor 20%, transparent);
}

.ep-list { display: flex; flex-direction: column; gap: 6px; }
.ep {
  display: grid; grid-template-columns: 34px 156px 1fr auto; gap: 15px; align-items: center;
  padding: 9px; border-radius: 14px; border: 1px solid transparent; cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.ep:hover { background: var(--bg-elev); border-color: var(--line); }
.ep .poster { aspect-ratio: 16 / 9; border-radius: var(--radius-sm); box-shadow: var(--shadow-1); }
.ep .play-fab { width: 38px; height: 38px; }
.ep .play-fab svg { width: 16px; height: 16px; }
.ep-body { min-width: 0; }
.ep-name { font-size: 14.5px; font-weight: 600; margin-bottom: 3px; letter-spacing: -.01em; }
.ep-sub { font-size: 12.5px; color: var(--text-faint); }
.ep-num { font-variant-numeric: tabular-nums; color: var(--text-faint); font-size: 12px; font-weight: 700; }
.ep.watched .ep-name { color: var(--text-dim); }

@media (max-width: 620px) {
  .ep { grid-template-columns: 112px 1fr auto; }
  .ep .ep-num { display: none; }
}

.neighbours { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(246px, 1fr)); }
.neighbour {
  display: flex; align-items: center; gap: 13px; padding: 15px 17px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev);
  box-shadow: var(--hi);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.neighbour:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.neighbour.end { justify-content: flex-end; text-align: end; }
.neighbour svg { width: 18px; height: 18px; flex: none; color: var(--text-faint); }

/* ---------- panels & tables ---------- */

.panel {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; margin-bottom: 18px; box-shadow: var(--hi);
}
.panel h3 { margin: 0 0 5px; font-size: 16px; font-weight: 660; letter-spacing: -.015em; }
.panel .hint { margin: 0 0 16px; color: var(--text-faint); font-size: 13px; line-height: 1.6; }
.panel-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head > div:first-child { flex: 1; min-width: 200px; }
.panel-head .hint { margin-bottom: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.kv { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 10px 18px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; margin-inline: -6px; padding-inline: 6px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
.table th, .table td { padding: 12px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th {
  color: var(--text-faint); font-weight: 650; font-size: 11.5px; white-space: nowrap;
  letter-spacing: .05em; text-transform: uppercase;
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: color-mix(in oklab, var(--bg-elev-2) 70%, transparent); }
.table tr:last-child td { border-bottom: 0; }
.table td.row-actions { text-align: end; width: 1%; white-space: nowrap; }
.path { color: var(--text-dim); font-size: 12.5px; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell > svg { width: 20px; height: 20px; flex: none; color: var(--text-faint); }
.user-name { font-weight: 600; }
.user-id { font-size: 11.5px; color: var(--text-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.now-playing { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.now-playing svg { width: 14px; height: 14px; color: var(--accent); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.page-label { font-size: 13px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* Episode page chips carry numeric ranges, so tabular figures keep every chip
   the same width and the strip does not re-flow as the current page moves. */
.ep-pages .tabs { font-variant-numeric: tabular-nums; }
.ep-pages .input { width: auto; min-width: 200px; }
.ep-pages + .ep-list { margin-top: 0; }

/* ---------- admin ---------- */

.admin { padding: 0 var(--pad); max-width: 1280px; margin: 0 auto; }
.admin .page-head { padding-inline: 0; }
.admin-tabs {
  display: flex; gap: 4px; margin: 22px 0 24px; overflow-x: auto;
  scrollbar-width: none; border-bottom: 1px solid var(--line);
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 12px 16px; font-size: 14px; font-weight: 560; color: var(--text-dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.admin-tab:hover { color: var(--text); }
.admin-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.admin-tab svg { width: 17px; height: 17px; }
.admin-body { min-height: 320px; }
.admin-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); margin-bottom: 22px; }
.stat {
  display: flex; align-items: center; gap: 15px; padding: 18px 20px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--hi);
}
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: color-mix(in oklab, var(--accent) 15%, transparent);
  color: color-mix(in oklab, var(--accent) 80%, var(--text));
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-value { font-size: 23px; font-weight: 720; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--text-dim); }
.stat-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px;
  border-radius: 12px; font-size: 13px; line-height: 1.6; margin-top: 14px;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.warn {
  background: color-mix(in oklab, var(--warn) 13%, transparent);
  border: 1px solid color-mix(in oklab, var(--warn) 34%, transparent);
  color: color-mix(in oklab, var(--warn) 72%, var(--text));
}
.notice.ok {
  background: color-mix(in oklab, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--ok) 30%, transparent);
  color: color-mix(in oklab, var(--ok) 70%, var(--text));
}

.issue-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.issue-list li {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px 13px;
  background: var(--bg-elev-2); border-radius: 10px; font-size: 13px;
}
.issue-list svg { width: 16px; height: 16px; flex: none; color: var(--warn); margin-top: 1px; }
.issue-list.mono li { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- empty / loading ---------- */

.empty { padding: 64px 20px; text-align: center; color: var(--text-faint); }
.empty h3 { color: var(--text-dim); margin: 0 0 7px; font-size: 16.5px; font-weight: 650; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* A travelling highlight reads as "loading" where a fading block reads as
   "broken", and one background-position animation is as cheap as opacity. */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(100deg,
    var(--bg-elev-2) 32%,
    color-mix(in oklab, var(--bg-elev-3) 80%, var(--text-faint)) 50%,
    var(--bg-elev-2) 68%);
  background-size: 300% 100%;
  animation: shimmer 1.5s var(--ease) infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
.load-center { display: grid; place-items: center; padding: 44px; }
.load-center .pl-spinner { border-top-color: var(--accent); }

/* ---------- search overlay ---------- */

.search-overlay {
  position: fixed; inset: 0; z-index: 70; padding: 8vh 20px 20px;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px); overflow-y: auto;
}
.search-box { max-width: 760px; margin: 0 auto; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field svg {
  position: absolute; inset-inline-start: 18px; width: 20px; height: 20px;
  color: var(--text-faint); pointer-events: none;
}
.search-field .input {
  font-size: 18px; padding: 16px 18px 16px 50px; border-radius: 16px;
  box-shadow: var(--shadow-1);
}
.search-results { margin-top: 20px; display: flex; flex-direction: column; gap: 4px; }
.search-hit {
  display: grid; grid-template-columns: 54px 1fr; gap: 13px; align-items: center;
  padding: 8px; border-radius: 12px; cursor: pointer;
}
.search-hit:hover, .search-hit.on { background: var(--bg-elev); }
.search-hit .poster { border-radius: 7px; box-shadow: none; }

/* ---------- external player handoff ---------- */

.handoff-overlay {
  position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 20px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px); animation: fade .16s var(--ease);
}
.handoff {
  width: min(520px, 100%); max-height: min(88vh, 760px); overflow-y: auto;
  padding: 22px; background: var(--bg-elev);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2), var(--hi); animation: rise .2s var(--ease);
}
.handoff-loading {
  display: grid; place-items: center; gap: 16px; padding: 46px;
  width: min(320px, 100%);
}
.handoff-loading .pl-spinner { border-top-color: var(--accent); }
.handoff-loading p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

.handoff-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.handoff-icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  color: color-mix(in oklab, var(--accent) 82%, var(--text));
}
.handoff-icon svg { width: 19px; height: 19px; }
.handoff-title { flex: 1; min-width: 0; }
.handoff-title h3 { margin: 0 0 4px; font-size: 16.5px; font-weight: 660; letter-spacing: -.015em; }
.handoff-title p { margin: 0; font-size: 12.5px; color: var(--text-faint); line-height: 1.6; }

.handoff-item {
  padding: 13px 15px; border-radius: 13px; margin-bottom: 16px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
}
.handoff-name { font-size: 14px; font-weight: 620; margin-bottom: 3px; }
.handoff-meta { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.handoff-note { margin-top: 8px; font-size: 12px; color: var(--warn); opacity: .9; line-height: 1.55; }

.handoff-players { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.handoff-player {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: start; padding: 10px 13px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.handoff-player:hover { background: var(--bg-elev-2); border-color: var(--line-strong); }
.handoff-player.on {
  border-color: color-mix(in oklab, var(--accent) 42%, transparent);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}
.handoff-player-name { font-size: 13.5px; font-weight: 620; }
.handoff-player-note { font-size: 11.5px; color: var(--text-faint); }

.handoff-link, .handoff-subs { margin-bottom: 16px; }
.handoff-link label, .handoff-subs label {
  display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 7px; font-weight: 500;
}
.handoff-link-row { display: flex; gap: 8px; align-items: center; }
.handoff-url {
  flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; padding: 9px 11px;
}
.handoff-sub-list { display: flex; flex-wrap: wrap; gap: 7px; }
.handoff-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- playback preference ---------- */

.player-choices { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.player-choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  padding: 12px 14px; cursor: pointer; background: transparent;
  border: 1px solid var(--line); border-radius: 13px;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.player-choice:hover { background: var(--bg-elev-2); border-color: var(--line-strong); }
.player-choice.on {
  border-color: color-mix(in oklab, var(--accent) 44%, transparent);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}
.player-choice-mark {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-strong); color: transparent;
}
.player-choice.on .player-choice-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: var(--accent-ink);
}
.player-choice-mark svg { width: 12px; height: 12px; }
.player-choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player-choice-name { font-size: 14px; font-weight: 620; }
.player-choice-note { font-size: 12px; color: var(--text-faint); }

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

.player { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; align-items: center; justify-content: center; }
.player video { width: 100%; height: 100%; background: #000; }
.player.idle { cursor: none; }
.player.idle .pl-bar, .player.idle .pl-top { opacity: 0; pointer-events: none; }

.pl-top, .pl-bar {
  position: absolute; inset-inline: 0; z-index: 2;
  transition: opacity .28s var(--ease); padding: 18px clamp(14px, 3vw, 36px);
}
.pl-top {
  top: 0; display: flex; align-items: center; gap: 14px; color: #fff;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .82), transparent);
}
.pl-title { font-size: 16px; font-weight: 660; letter-spacing: -.015em; }
.pl-sub { font-size: 12.5px; opacity: .7; }

.pl-bar { bottom: 0; background: linear-gradient(to top, rgba(0, 0, 0, .9), transparent); color: #fff; }
.pl-seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.pl-seek .track {
  position: relative; height: 4px; width: 100%; border-radius: 99px;
  background: rgba(255, 255, 255, .26); overflow: hidden; transition: height .15s var(--ease);
}
.pl-seek:hover .track { height: 7px; }
.pl-seek .buf { position: absolute; inset-block: 0; inset-inline-start: 0; background: rgba(255, 255, 255, .32); }
.pl-seek .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.pl-seek .knob {
  position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transform: translate(-50%, 0); opacity: 0; transition: opacity .15s var(--ease);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .7); pointer-events: none;
}
.pl-seek:hover .knob { opacity: 1; }
.pl-tip {
  position: absolute; bottom: 26px; transform: translateX(-50%);
  padding: 4px 9px; border-radius: 7px; background: rgba(0, 0, 0, .88);
  font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none;
  opacity: 0; transition: opacity .13s var(--ease);
}
.pl-seek:hover .pl-tip { opacity: 1; }

.pl-controls { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.pl-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px;
  background: transparent; border: 0; cursor: pointer; color: #fff;
  transition: background .16s var(--ease);
}
.pl-btn:hover { background: rgba(255, 255, 255, .15); }
.pl-btn svg { width: 21px; height: 21px; }
.pl-btn.big svg { width: 27px; height: 27px; }
.pl-time { font-size: 13px; font-variant-numeric: tabular-nums; opacity: .85; padding: 0 8px; }
.pl-vol { display: flex; align-items: center; gap: 6px; }
.pl-vol input { width: 84px; accent-color: var(--accent); }

.pl-center { position: absolute; z-index: 1; pointer-events: none; display: grid; place-items: center; }
.player.buffering .pl-center { display: grid; }
.pl-spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .18); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pl-error {
  position: absolute; z-index: 3; max-width: 500px; text-align: center; color: #fff;
  background: rgba(12, 14, 19, .97); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-2);
}
.pl-error h3 { margin: 0 0 9px; font-size: 18px; letter-spacing: -.02em; }
.pl-error p { margin: 0 0 18px; font-size: 13.5px; opacity: .78; line-height: 1.65; }
.pl-versions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.pl-error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

video::cue {
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: clamp(17px, 2.4vw, 27px); line-height: 1.35;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
}

/* ---------- toast ---------- */

.toast-host {
  position: fixed; z-index: 100; inset-inline: 0; bottom: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  padding: 11px 18px; border-radius: 12px; font-size: 13.5px;
  background: color-mix(in oklab, var(--bg-elev) 94%, transparent);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2), var(--hi); animation: rise .22s var(--ease);
}
.toast.err { border-color: color-mix(in oklab, var(--danger) 48%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

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

/* Merge report: several source folders per row, each on its own line. */
.folder-list { display: flex; flex-direction: column; gap: 3px; max-width: 460px; }
.folder-list code { display: block; overflow-wrap: anywhere; }

.hero-original { color: var(--text-faint); font-size: 14px; margin-bottom: 10px; }
.hero-overview {
  max-width: 74ch; margin: 0 0 18px; color: var(--text-dim);
  font-size: 14.5px; line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.pill.rating {
  background: color-mix(in oklab, var(--warn) 15%, transparent);
  border-color: color-mix(in oklab, var(--warn) 36%, transparent);
  color: color-mix(in oklab, var(--warn) 76%, var(--text));
}
.merge-note {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 16px;
  font-size: 12.5px; color: var(--text-faint);
}
.merge-note svg { width: 15px; height: 15px; }

/* ---------- library inventory ---------- */

.lib-list { display: flex; flex-direction: column; gap: 11px; }
.lib-row { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lib-head {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 13px 15px; background: var(--bg-elev-2);
}
.lib-head > svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.lib-title { flex: 1; min-width: 140px; }
.lib-head .btn { margin-inline-start: auto; }
.lib-folders { display: flex; flex-direction: column; }
.lib-folder {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 15px; border-top: 1px solid var(--line); font-size: 13px;
}
.lib-folder code { flex: 1; min-width: 200px; }
.lib-folder.bad-row { background: color-mix(in oklab, var(--danger) 8%, transparent); }

.code-block {
  margin: 0; padding: 15px 17px; border-radius: 12px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.75; color: var(--text-dim); white-space: pre;
}

/* ---------- library management ---------- */

.modal.wide { width: min(620px, 100%); }
.modal.picker { width: min(560px, 100%); }
.picker-path { padding: 10px 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.picker-list {
  margin-top: 11px; max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px;
}
.picker-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  padding: 10px 13px; background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 13.5px; color: var(--text);
}
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: var(--bg-elev-2); }
.picker-row svg { width: 16px; height: 16px; flex: none; color: var(--text-faint); }
.picker-empty { padding: 22px; text-align: center; color: var(--text-faint); font-size: 13px; }

.folder-editor { display: flex; flex-direction: column; gap: 6px; }
.folder-edit-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.folder-edit-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.input.sm { width: auto; padding: 6px 9px; font-size: 12.5px; }
.folder-edit-row .input[type="number"] { width: 76px; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer; text-align: start;
  font-weight: 600; color: var(--text);
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.pill.warn {
  background: color-mix(in oklab, var(--warn) 14%, transparent);
  border-color: color-mix(in oklab, var(--warn) 36%, transparent);
  color: color-mix(in oklab, var(--warn) 74%, var(--text));
}

/* ---------- scheduled tasks ---------- */

.task-list { display: flex; flex-direction: column; gap: 11px; }
.task-row {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-elev-2);
}
.task-row.off { opacity: .62; }
.task-main { flex: 1; min-width: 240px; }
.task-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.task-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grant-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.grant-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border-radius: 9px; cursor: pointer; font-size: 13.5px;
}
.grant-row:hover { background: var(--bg-elev-2); }
.grant-row input { accent-color: var(--accent); }

/* Folder-level watch switch, sized to sit inline with the folder's pills. */
.watch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-faint);
  cursor: pointer;
  user-select: none;
}
.watch-toggle input { accent-color: var(--accent); cursor: pointer; }
