/* jf-canvas — "the art is the light source".
   A dark screening room: the UI stays quiet and colour comes from artwork,
   which glows into the page (the same idea as the player's ambient light).
   One family, Archivo, using its width axis: titles ultra-condensed like a
   poster billing block, body at normal width. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/vendor/fonts/archivo-latin-wdth-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/vendor/fonts/archivo-latin-ext-wdth-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --ink: #14162a;        /* screen-room ink: the page */
  --ink-2: #1e2136;      /* raised surface */
  --ink-3: #2a2e47;      /* hover / selected surface */
  --line: rgb(237 231 218 / 0.12);
  --text: #ede7da;       /* projected light */
  --text-dim: #9c99ae;
  --lamp: #f0a93c;       /* tungsten: primary actions and progress only */
  --lamp-ink: #2a1700;
  --signal: #e86a5c;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --display: clamp(2.6rem, 7.5vw, 7rem);

  --gutter: clamp(16px, 4vw, 56px);
  --radius: 4px;
  --header-h: 64px;
  font-family: var(--font);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-size: var(--step-0);
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.1; }
p { margin: 0; }

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

.muted { color: var(--text-dim); }
.error { color: var(--signal); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -48px; z-index: 50;
  padding: 8px 14px; border-radius: var(--radius);
  background: var(--lamp); color: var(--lamp-ink); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---- Condensed display type ------------------------------------------- */

.display {
  font-stretch: 62%;
  font-weight: 800;
  font-size: var(--display);
  line-height: 0.88;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink-3);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #363b5a; }
.btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn-primary { background: var(--lamp); color: var(--lamp-ink); }
.btn-primary:hover { background: #f5b95c; }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: rgb(237 231 218 / 0.06); }
.btn-icon { padding: 0; width: 44px; justify-content: center; }
.btn[aria-pressed="true"] { color: var(--lamp); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---- Header -------------------------------------------------------------- */

.topnav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 32px);
  padding: 0 var(--gutter);
  transition: background-color 0.2s;
}
.topnav.is-solid, .topnav.is-static { background: rgb(20 22 42 / 0.92); backdrop-filter: blur(12px); }
.wordmark {
  font-stretch: 62%;
  font-weight: 850;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  line-height: 1;
}
.topnav nav { display: flex; gap: 4px; }
.topnav nav a {
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 550;
  text-decoration: none;
}
.topnav nav a:hover { color: var(--text); }
.topnav nav a[aria-current="page"] { color: var(--text); background: rgb(237 231 218 / 0.08); }
.topnav .search { margin-left: auto; position: relative; }
.topnav .search input {
  width: clamp(160px, 22vw, 300px);
  height: 40px;
  padding: 0 14px 0 38px;
  border: 0;
  border-radius: var(--radius);
  background: rgb(237 231 218 / 0.08);
}
.topnav .search input::placeholder { color: var(--text-dim); }
.topnav .search svg { position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; fill: var(--text-dim); pointer-events: none; }

.user-menu { position: relative; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  border: 0; padding: 0; cursor: pointer;
  background: var(--ink-3); font-weight: 700; font-stretch: 80%;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px; padding: 6px;
  border-radius: 8px; background: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px rgb(0 0 0 / 0.45);
}
.menu-name { padding: 10px 12px 8px; font-weight: 650; }
.menu-name small { display: block; color: var(--text-dim); font-weight: 400; }
.menu a, .menu button {
  display: block; width: 100%; padding: 10px 12px;
  border: 0; border-radius: 6px; background: none;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--ink-3); }

@media (max-width: 720px) {
  :root { --header-h: 108px; }
  .topnav { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 8px; row-gap: 6px; }
  .topnav nav { order: 3; width: 100%; margin-left: -12px; }
  .topnav .search input { width: 44vw; }
}

/* ---- Page frame ------------------------------------------------------------ */

.page { padding: calc(var(--header-h) + 24px) var(--gutter) 64px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-stretch: 62%; font-weight: 800; font-size: clamp(2.4rem, 5vw, 4rem); line-height: 0.9; }

.notice {
  max-width: 60ch;
  padding: 16px 18px;
  border-radius: 8px;
  background: var(--ink-2);
}
.notice .btn { margin-top: 12px; }

/* ---- Art glow (focus/hover) --------------------------------------------- */
/* The card's own image, blurred, glows behind it: it lights up rather than lifts. */

.art { position: relative; isolation: isolate; border-radius: var(--radius); }
.art::before {
  content: "";
  position: absolute;
  inset: 6%;
  z-index: -1;
  background: var(--art, none) center / cover;
  filter: blur(22px) saturate(1.7);
  opacity: 0;
  transition: opacity 0.25s;
}
.art-frame { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--ink-2); }
.art-frame img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .art::before, .card:focus-visible .art::before { opacity: 0.9; }
.card:focus-visible { outline: none; }
.card:focus-visible .art-frame { outline: 2px solid var(--lamp); outline-offset: 3px; }

/* ---- Cards --------------------------------------------------------------- */

.card { display: block; min-width: 0; text-decoration: none; color: inherit; }
.card .art-frame { aspect-ratio: 2 / 3; }
.card.is-wide .art-frame { aspect-ratio: 16 / 9; }
.card-title { margin-top: 10px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--text-dim); font-size: var(--step--1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  font-stretch: 62%; font-weight: 800; font-size: 1.4rem; line-height: 1; text-align: center;
  color: var(--text-dim);
}
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(0 0 0 / 0.55); }
.progress::after { content: ""; display: block; height: 100%; width: var(--pct, 0%); background: var(--lamp); }
.watched {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgb(20 22 42 / 0.85); color: var(--lamp);
}
.watched svg { width: 14px; height: 14px; fill: currentColor; }
.card.is-skeleton .art-frame { background: var(--ink-2); }
.card.is-skeleton .card-title { width: 70%; height: 1em; background: var(--ink-2); border-radius: 2px; }

/* ---- Shelves --------------------------------------------------------------- */

.shelf { margin-top: 40px; }
.shelf-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.shelf-head h2 { font-size: var(--step-1); font-weight: 650; }
.shelf-head a { color: var(--text-dim); font-size: var(--step--1); text-decoration: none; }
.shelf-head a:hover { color: var(--text); }
.shelf-nav { margin-left: auto; display: flex; gap: 6px; }
.shelf-nav button {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--ink-2); cursor: pointer; display: grid; place-items: center;
}
.shelf-nav button:hover { background: var(--ink-3); }
.shelf-nav svg { width: 18px; height: 18px; fill: currentColor; }
.shelf-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--col, 168px);
  gap: 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  margin: 0 calc(var(--gutter) * -1);
  padding: 14px var(--gutter) 18px;
  scrollbar-width: none;
}
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track > * { scroll-snap-align: start; }
.shelf-track.is-wide { --col: 300px; }
@media (max-width: 600px) {
  .shelf-track { --col: 128px; gap: 12px; }
  .shelf-track.is-wide { --col: 240px; }
  .shelf-nav { display: none; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 28px 18px;
}
.grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 20px 12px; } }

/* ---- Hero (home and detail) ------------------------------------------------- */

.hero {
  position: relative;
  min-height: min(82vh, 760px);
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 40px) var(--gutter) 48px;
  isolation: isolate;
}
.hero-glow {
  position: absolute;
  inset: -12% -6% 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
  z-index: -2;
  background: var(--art, none) center / cover;
  filter: blur(90px) saturate(1.4);
  opacity: 0.32;
  pointer-events: none;
}
/* Scrim: whatever the artwork, the text side and the bottom edge stay ink. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgb(20 22 42 / 0.7) 0%, transparent calc(var(--header-h) + 60px)),
    linear-gradient(90deg, var(--ink) 0%, rgb(20 22 42 / 0.88) 28%, rgb(20 22 42 / 0.35) 58%, transparent 78%),
    linear-gradient(0deg, var(--ink) 0%, rgb(20 22 42 / 0.6) 22%, transparent 48%);
}
.hero-art {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(100%, 78vw);
  z-index: -1;
  -webkit-mask-image: linear-gradient(to left, #000 45%, transparent), linear-gradient(to top, transparent, #000 35%);
  mask-image: linear-gradient(to left, #000 45%, transparent), linear-gradient(to top, transparent, #000 35%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.hero-body { max-width: 640px; }
.hero-logo { max-width: min(460px, 80vw); max-height: 180px; object-fit: contain; object-position: left bottom; margin-bottom: 18px; }
.hero h1 { margin-bottom: 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-dim); font-size: var(--step--1); margin-bottom: 14px; }
.facts .rating { padding: 0 6px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.overview { max-width: 62ch; color: rgb(237 231 218 / 0.86); line-height: 1.6; }
.hero .overview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-items: center; }
.resume-meter { width: 120px; height: 4px; border-radius: 2px; background: rgb(237 231 218 / 0.18); overflow: hidden; }
.resume-meter span { display: block; height: 100%; background: var(--lamp); }

@media (prefers-reduced-motion: no-preference) {
  .hero-body { animation: rise 0.5s ease-out both; }
  .hero-glow { animation: lamp-on 1.2s ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes lamp-on { from { opacity: 0; } }

/* ---- Detail page --------------------------------------------------------- */

.detail .hero { min-height: min(72vh, 680px); }
.detail-grid { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: end; }
.detail-poster { width: 220px; }
.detail-poster .art-frame { aspect-ratio: 2 / 3; }
.detail-poster.is-wide { width: 320px; }
.detail-poster.is-wide .art-frame { aspect-ratio: 16 / 9; }
.detail-grid:has(.detail-poster.is-wide) { grid-template-columns: 320px 1fr; }
.series-link { display: inline-block; margin-bottom: 8px; color: var(--text-dim); font-weight: 600; text-decoration: none; }
.series-link:hover { color: var(--text); }
@media (max-width: 760px) {
  .detail-grid, .detail-grid:has(.detail-poster.is-wide) { grid-template-columns: 1fr; gap: 20px; }
  .detail-poster { width: 140px; }
  .detail-poster.is-wide { width: 100%; max-width: 360px; }
}

.detail-body { padding: 8px var(--gutter) 64px; }
.detail .hero .overview { display: block; -webkit-line-clamp: unset; max-height: 12lh; overflow-y: auto; }
.detail .hero-logo { max-height: 140px; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; max-width: 70ch; }
.info-list dt { color: var(--text-dim); }
.info-list dd { margin: 0; }

.seasons { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.seasons button {
  padding: 8px 14px; border: 0; border-radius: var(--radius);
  background: var(--ink-2); color: var(--text-dim); font-weight: 600; cursor: pointer;
}
.seasons button:hover { color: var(--text); }
.seasons button[aria-pressed="true"] { background: var(--text); color: var(--ink); }

.episodes { display: grid; gap: 4px; max-width: 1100px; }
.episode {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 12px;
  margin: 0 -12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
.episode:hover { background: var(--ink-2); }
.episode .art-frame { aspect-ratio: 16 / 9; }
.episode-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.episode-number { font-stretch: 62%; font-weight: 800; font-size: var(--step-2); line-height: 1; color: var(--text-dim); min-width: 2ch; }
.episode-title { font-weight: 650; font-size: var(--step-1); text-decoration: none; }
a.episode-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.episode > a { display: block; border-radius: var(--radius); }
.episode > a:focus-visible .art-frame { outline: 2px solid var(--lamp); outline-offset: 3px; }
.episode .overview { font-size: var(--step--1); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) {
  .episode { grid-template-columns: 132px 1fr; gap: 12px; }
  .episode .overview { -webkit-line-clamp: 2; }
}

.cast { --col: 132px; }
.person .art-frame { aspect-ratio: 1; border-radius: 50%; }
.person .art { border-radius: 50%; }

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

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 6px; }
.chips button {
  padding: 8px 14px; border: 0; border-radius: 999px;
  background: var(--ink-2); color: var(--text-dim); font-weight: 600; cursor: pointer;
}
.chips button:hover { color: var(--text); }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--ink); }
.select-field select {
  height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: var(--ink-2);
}
.load-more { display: flex; justify-content: center; padding: 32px 0; }
.result-count { color: var(--text-dim); }

/* ---- Sign in ------------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  /* One lamp overhead: the only light in the room. */
  background:
    radial-gradient(60% 55% at 50% -8%, rgb(240 169 60 / 0.22), transparent 70%),
    radial-gradient(40% 40% at 50% 0%, rgb(237 231 218 / 0.08), transparent 70%),
    var(--ink);
}
.login {
  width: min(380px, 100%);
}
.login .wordmark { display: block; font-size: clamp(3.5rem, 14vw, 5.5rem); margin-bottom: 6px; }
.login-server { color: var(--text-dim); margin-bottom: 32px; }
.login-server strong { color: var(--text); font-weight: 600; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field span { font-weight: 550; font-size: var(--step--1); }
.field input {
  height: 48px; padding: 0 14px;
  border: 0; border-radius: var(--radius);
  background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
.field input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--lamp); }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 24px; color: var(--text-dim); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--lamp); }
.login .btn { width: 100%; justify-content: center; }
.form-error { margin: -8px 0 16px; color: var(--signal); }
.login-foot { margin-top: 28px; color: var(--text-dim); font-size: var(--step--1); }

/* ---- Player -------------------------------------------------------------- */

.player-page { background: #000; overflow: hidden; }

.stage {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  user-select: none;
}
.stage.idle { cursor: none; }

#screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* canvas is a replaced element, so this letterboxes it */
}

.subtitles {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 12%;
  text-align: center;
  pointer-events: none;
  transition: bottom 0.2s;
}
.stage:not(.idle) .subtitles { bottom: calc(12% + 56px); }
.subtitles p {
  display: inline-block;
  margin: 2px 0;
  padding: 2px 10px;
  background: rgb(0 0 0 / 0.6);
  border-radius: 4px;
  font-size: clamp(16px, 2.6vw, 34px);
  line-height: 1.3;
  white-space: pre-line;
  text-shadow: 0 1px 2px #000;
}
.subtitles p + p { display: block; width: fit-content; margin-inline: auto; }

.topbar, .controls {
  position: absolute;
  left: 0;
  right: 0;
  padding: 16px 20px;
  transition: opacity 0.25s;
}
.stage.idle .topbar, .stage.idle .controls { opacity: 0; pointer-events: none; }

.topbar {
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(rgb(0 0 0 / 0.7), transparent);
}
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: #fff; text-decoration: none; background: rgb(255 255 255 / 0.1);
}
.back:hover { background: rgb(255 255 255 / 0.2); }
.back svg { width: 22px; height: 22px; fill: currentColor; }
.titles h1 { margin: 0; font-stretch: 75%; font-weight: 750; font-size: 1.35rem; line-height: 1.15; }
.titles p { margin: 2px 0 0; font-size: 0.85rem; color: #bbb; }

.controls {
  bottom: 0;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.8));
  padding-top: 40px;
}
.control-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.time { font-variant-numeric: tabular-nums; font-size: 0.9rem; margin-left: 4px; white-space: nowrap; }

.controls button {
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.1);
  cursor: pointer;
  font-size: 0.85rem;
}
.controls button:hover { background: rgb(255 255 255 / 0.2); }
.controls button[aria-pressed="true"] { background: var(--lamp); color: #000; }
.controls svg { width: 22px; height: 22px; fill: currentColor; display: block; margin: auto; }
#play .icon-pause, #play.is-playing .icon-play { display: none; }
#play.is-playing .icon-pause { display: block; }

.select { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #bbb; }
.select select {
  max-width: 180px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgb(255 255 255 / 0.2);
  background: rgb(0 0 0 / 0.6);
  color: #fff;
}
.volume { width: 90px; accent-color: var(--lamp); }

.seek {
  --played: 0%;
  --buffered: 0%;
  width: 100%;
  height: 18px;
  margin: 0 0 6px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--lamp) var(--played), rgb(255 255 255 / 0.45) var(--played) var(--buffered), rgb(255 255 255 / 0.2) var(--buffered));
}
.seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--lamp) var(--played), rgb(255 255 255 / 0.45) var(--played) var(--buffered), rgb(255 255 255 / 0.2) var(--buffered));
}
.seek::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border: 4px solid rgb(255 255 255 / 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  cursor: pointer;
}
.big-play svg { width: 44px; height: 44px; fill: currentColor; margin-left: 4px; }
.big-play:hover { background: var(--lamp); color: #000; }

.message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
  padding: 20px 24px;
  border-radius: 10px;
  background: rgb(20 22 42 / 0.94);
  text-align: center;
}
.message p { margin: 0 0 12px; }
.message a { color: var(--lamp); margin-left: 12px; }
.message button, .toast button {
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--lamp);
  color: #000;
  font-weight: 600;
  cursor: pointer;
}

.toast {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 16px;
  border-radius: 8px;
  background: rgb(20 22 42 / 0.92);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Up next, at the end of an episode. */
.up-next {
  position: absolute;
  right: 24px;
  bottom: 120px;
  width: min(360px, calc(100% - 48px));
  padding: 14px;
  border-radius: 10px;
  background: rgb(20 22 42 / 0.94);
  box-shadow: 0 0 0 1px var(--line);
}
.up-next .art-frame { aspect-ratio: 16 / 9; margin-bottom: 12px; }
.up-next p { color: #bbb; font-size: 0.8rem; }
.up-next h2 { font-size: 1.05rem; font-weight: 650; margin: 2px 0 12px; }
.up-next .actions { margin: 0; }
.up-next .btn { min-height: 38px; padding: 0 14px; font-size: 0.9rem; }

/* ---- Effects panel ------------------------------------------------------ */

#effects-toggle { position: relative; }
#effects-toggle[aria-expanded="true"] { background: var(--lamp); color: #000; }
#effects-toggle.has-effects::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lamp);
}
#effects-toggle[aria-expanded="true"].has-effects::after { background: #000; }

.effects-panel {
  position: absolute;
  right: 16px;
  bottom: 104px;
  width: 300px;
  max-height: calc(100% - 200px);
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgb(20 22 42 / 0.94);
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
  user-select: none;
}
.effects-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.effects-header h2 { margin: 0; font-size: 0.95rem; }
.effects-close {
  width: 28px; height: 28px; border: 0; border-radius: 6px;
  background: transparent; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.effects-close:hover { background: rgb(255 255 255 / 0.12); }
.effects-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.effects-presets button {
  padding: 4px 10px;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
}
.effects-presets button:hover { border-color: rgb(255 255 255 / 0.4); }
.effects-presets button[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: #000; }
.effects-panel fieldset { border: 0; border-top: 1px solid rgb(255 255 255 / 0.1); margin: 8px 0 0; padding: 8px 0 0; }
.effects-panel legend { padding: 0; color: #bbb; font-size: 0.8rem; font-weight: 600; }
.effect-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 8px; margin-top: 4px; }
.effect-row input { width: 100%; accent-color: var(--lamp); }
.effect-row output { text-align: right; font-variant-numeric: tabular-nums; color: #bbb; }
.effects-footer { display: flex; justify-content: flex-end; margin-top: 10px; }
.effects-footer button {
  padding: 4px 12px;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.hud {
  position: absolute;
  top: 76px;
  right: 16px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgb(0 0 0 / 0.75);
  font: 12px/1.5 ui-monospace, 'SF Mono', Menlo, monospace;
  pointer-events: none;
}

@media (max-width: 700px) {
  .topbar, .controls { padding-left: 16px; padding-right: 16px; }
  .select span, #back10, #fwd30, .volume { display: none; }
  .select select { max-width: 110px; }
  .hud { left: 16px; right: 16px; top: 64px; font-size: 10px; white-space: pre-wrap; }
  .effects-panel { left: 8px; right: 8px; width: auto; bottom: 112px; max-height: calc(100% - 190px); }
  .up-next { right: 16px; left: 16px; width: auto; bottom: 112px; }
}

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