/* =============================================================
   AniStream — stylesheet
   1. tokens & reset      5. home page
   2. primitives          6. watch page / player
   3. header & search     7. comments, footer, misc
   4. cards & rails       8. responsive
   ============================================================= */

/* ---------- 1. tokens & reset ---------- */
:root {
  --bg:        #08080e;
  --bg-2:      #0e0e17;
  --surface:   #14141e;
  --surface-2: #1b1b28;
  --surface-3: #23233312;
  --line:      rgba(255, 255, 255, .075);
  --line-2:    rgba(255, 255, 255, .14);
  --text:      #eaeaf2;
  --muted:     #9797ae;
  --dim:       #6f6f85;

  --accent:    #a78bfa;
  --accent-2:  #7c4dff;
  --accent-sh: rgba(167, 139, 250, .28);
  --sub:       #6fe3b4;
  --dub:       #ffc46b;
  --score:     #ffd166;
  --danger:    #ff7a7a;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --shadow: 0 18px 46px -18px rgba(0, 0, 0, .85);
  --ease: cubic-bezier(.22, .8, .3, 1);
  --header-h: 66px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background:
    radial-gradient(1200px 620px at 78% -8%, rgba(124, 77, 255, .17), transparent 62%),
    radial-gradient(900px 520px at 8% 4%, rgba(111, 227, 180, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 15px/1.6 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.22; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--accent); }

img { display: block; max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

/* Icon set spec: 24×24 viewBox, 1.6px stroke, round caps/joins.
   Symbols that are meant to be solid (play, pause, tag dot) carry their own
   fill/stroke presentation attributes, which win over these inherited values. */
.ico {
  width: 1em; height: 1em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico--sm { width: .85em; height: .85em; stroke-width: 1.9; }
.ico--lg { width: 1.35em; height: 1.35em; stroke-width: 1.45; }

/* `.knockout` shapes punch through to the surface behind the icon. CSS can't
   select into a <use> shadow tree, but custom properties inherit into it. */
:root { --icon-knockout: #14141e; }
.controls, .player-shell { --icon-knockout: #000; }
.btn--primary, .srv.is-active, .ep.is-current { --icon-knockout: #a78bfa; }

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

/* The `hidden` attribute only sets `display: none` at user-agent priority, so
   any component rule with its own `display` silently defeats it. */
[hidden] { display: none !important; }

::selection { background: var(--accent); color: #14101f; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3a3a4d transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #33334a; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #46466a; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.wrap { width: min(1480px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- 2. primitives ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .66em 1.15em; border-radius: 99px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: transform .16s var(--ease), background .18s, box-shadow .18s, border-color .18s;
}
.btn svg { width: 1.15em; height: 1.15em; }
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #130f24;
  box-shadow: 0 10px 24px -10px var(--accent-sh);
}
.btn--primary:hover { color: #130f24; box-shadow: 0 14px 30px -10px var(--accent-sh); }
.btn--ghost { border-color: var(--line-2); background: rgba(255, 255, 255, .04); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(167, 139, 250, .09); }
.btn--ghost.is-on { border-color: var(--accent); background: var(--accent); color: #130f24; }

.link-btn {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--accent); font-size: 13px; font-weight: 600;
}
.link-btn:hover { color: var(--accent); }
.link-btn:hover .ico { transform: translateX(2px); }
.link-btn .ico { transition: transform .16s var(--ease); }

/* icon-bearing text elements */
.main-nav a, .drawer a { display: inline-flex; align-items: center; gap: 7px; }
.drawer a .ico { font-size: 17px; color: var(--accent); }
.section__head h2, .side-box__title, .comments__head h2 {
  display: flex; align-items: center; gap: 9px;
}
.section__head h2 .ico, .side-box__title .ico, .comments__head h2 .ico {
  font-size: .92em; color: var(--accent);
}
.ep-head__actions { display: flex; gap: 9px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .2em .6em; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .07);
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.chip--rating { background: rgba(255, 255, 255, .92); color: #14141e; }
.chip--score  { background: rgba(255, 209, 102, .14); color: var(--score); }
.chip--filler { background: rgba(255, 122, 122, .15); color: var(--danger); }
.chip--canon  { background: rgba(111, 227, 180, .13); color: var(--sub); }
.chip--muted  { background: none; color: var(--dim); padding-inline: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: .28em;
  padding: .16em .45em; border-radius: 5px;
  font-size: 11.5px; font-weight: 700; line-height: 1.5;
}
.badge svg { width: 1em; height: 1em; stroke-width: 2.2; }
.badge--sub   { background: var(--sub); color: #06251a; }
.badge--dub   { background: var(--dub); color: #2a1a00; }
.badge--score { background: rgba(0, 0, 0, .62); color: var(--score); backdrop-filter: blur(4px); }

.pill {
  display: inline-block; min-width: 22px; padding: 1px 7px;
  border-radius: 99px; background: var(--accent); color: #14101f;
  font-size: 12px; font-weight: 700; text-align: center;
}

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 10px; margin-left: 8px;
  border: 1px solid var(--line-2); border-radius: 99px;
  font-size: 12.5px; color: var(--muted);
}
.tag a, .tag button {
  display: inline-grid; place-items: center;
  color: var(--dim); font-size: 13px; line-height: 1;
}
.tag a:hover, .tag button:hover { color: var(--danger); }

.genre {
  display: inline-block; padding: .34em .74em;
  border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  transition: .16s var(--ease);
}
.genre:hover { color: var(--accent); border-color: var(--accent); background: rgba(167, 139, 250, .1); }
.genre.is-active { background: var(--accent); border-color: var(--accent); color: #130f24; font-weight: 600; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: -1px; }
.dot--cur { background: var(--accent); }
.dot--seen { background: #3d3d55; }
.dot--filler { background: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 900;
  transform: translate(-50%, 22px);
  padding: 11px 20px; border-radius: 99px;
  background: rgba(20, 20, 30, .96); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
  font-size: 13.5px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 3. header & search ---------- */
.site-header {
  position: sticky; top: 0; z-index: 500;
  height: var(--header-h);
  background: rgba(8, 8, 14, .78);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }

.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 20px; font-weight: 800; letter-spacing: -.03em; flex-shrink: 0;
}
.logo:hover { color: inherit; }
.logo span { color: var(--accent); }
.logo__mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #150f26; font-size: 17px;
  box-shadow: 0 6px 16px -6px var(--accent-sh);
}

.nav-toggle { display: none; flex-direction: column; gap: 4.5px; padding: 6px 2px; }
.nav-toggle span { display: block; width: 21px; height: 2px; border-radius: 2px; background: var(--text); }

.search { position: relative; flex: 1; max-width: 560px; }
.search input {
  width: 100%; height: 42px; padding: 0 46px 0 16px;
  border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: 14px; transition: border-color .18s, background .18s;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.search > button {
  position: absolute; right: 5px; top: 5px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px;
  background: var(--accent); color: #130f24;
}
.search > button:hover { background: #c0aaff; }

.search__results {
  position: absolute; top: calc(100% + 9px); left: 0; right: 0; z-index: 60;
  max-height: 68vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 6px;
}
.search-hit {
  display: grid; grid-template-columns: 46px 1fr; gap: 12px;
  padding: 8px; border-radius: var(--r-sm);
}
.search-hit img { width: 46px; height: 64px; object-fit: cover; border-radius: 5px; }
.search-hit:hover, .search-hit.is-active { background: var(--surface-2); color: inherit; }
.search-hit__body { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.search-hit__body strong { font-size: 14px; }
.search-hit__body em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.search-hit__meta { font-size: 12px; color: var(--dim); }
.search-all {
  display: block; width: 100%; padding: 10px; margin-top: 4px;
  border-top: 1px solid var(--line); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.search-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; }

.main-nav { display: flex; gap: 22px; margin-left: auto; font-size: 14px; font-weight: 500; }
.main-nav a { color: var(--muted); }
.main-nav a:hover { color: var(--text); }

.drawer {
  position: fixed; inset: var(--header-h) 0 auto 0; z-index: 400;
  display: none; flex-direction: column;
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.drawer.is-open { display: flex; }
.drawer a { padding: 15px 22px; border-bottom: 1px solid var(--line); font-weight: 500; }

/* ---------- 4. cards & rails ---------- */
.section { margin-top: 46px; }
.section__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.section__head h2 { font-size: 21px; position: relative; padding-left: 14px; }
.section__head h2::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2));
  flex-shrink: 0;
}
.section__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.rail-nav { display: flex; gap: 6px; }
.rail-nav button, .top-tabs button, .type-tabs button, .ep-view button {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: var(--r-sm);
  transition: .16s var(--ease);
}
.rail-nav button { width: 32px; height: 32px; font-size: 16px; line-height: 1;
  display: grid; place-items: center; }
.rail-nav button:hover { color: var(--accent); border-color: var(--accent); }

.type-tabs, .top-tabs, .ep-view { display: inline-flex; gap: 4px; }
.type-tabs button, .top-tabs button { padding: 5px 12px; font-size: 13px; font-weight: 600; }
.type-tabs button.is-active, .top-tabs button.is-active {
  background: var(--accent); border-color: var(--accent); color: #130f24;
}
.type-tabs button:hover, .top-tabs button:hover { color: var(--text); }
.type-tabs button.is-active:hover, .top-tabs button.is-active:hover { color: #130f24; }

select {
  height: 32px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13px;
}
select:focus { outline: none; border-color: var(--accent); }

/* poster card */
.card-grid {
  display: grid; gap: 20px 14px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.card__poster {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--r); aspect-ratio: 5 / 7;
  background: var(--surface-2);
}
.card__poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.card:hover .card__poster img { transform: scale(1.06); }
.card__poster::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 40%, rgba(0,0,0,.1));
  opacity: 0; transition: opacity .25s;
}
.card:hover .card__poster::after { opacity: 1; }
.card__play {
  position: absolute; inset: 0; margin: auto;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: var(--accent); color: #130f24;
  opacity: 0; transform: scale(.8); transition: .25s var(--ease); z-index: 2;
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .8);
}
.card:hover .card__play { opacity: 1; transform: scale(1); }
.card__badges { position: absolute; left: 7px; bottom: 7px; display: flex; gap: 4px; z-index: 2; }
.badge--score { position: absolute; right: 7px; top: 7px; z-index: 2; }
.card__title {
  font-size: 14px; font-weight: 600; margin-top: 9px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.card__meta { display: flex; gap: 6px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--dim); }
/* Separator dots are drawn, not typed — no dependency on a font carrying • */
.card__meta i, .entry__meta i {
  display: inline-block; width: 3px; height: 3px; border-radius: 50%;
  background: currentColor; opacity: .45; flex-shrink: 0;
}
.grid-empty { grid-column: 1 / -1; padding: 46px; text-align: center; color: var(--muted); }
.grid-status {
  display: flex; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px; font-size: 13px; color: var(--dim);
}

/* rank list (sidebars) */
.rank-list { display: flex; flex-direction: column; }
.rank {
  display: grid; grid-template-columns: 26px 46px 1fr; gap: 11px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.rank:last-child { border-bottom: 0; }
.rank__n { font-size: 15px; font-weight: 800; color: var(--dim); text-align: center; }
.rank__n--top {
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent-sh);
}
.rank__thumb img { width: 46px; height: 62px; object-fit: cover; border-radius: 5px; }
.rank__body { min-width: 0; }
.rank__body h4 {
  font-size: 13.5px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.rank__meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.rank__type { font-size: 11.5px; color: var(--dim); }

.side-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; margin-bottom: 22px;
}
.side-box__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.side-box__title { font-size: 17px; margin-bottom: 6px; }
.side-box__head .side-box__title { margin-bottom: 0; }
.side-box__head + .rank-list { margin-top: 8px; }
.genre-cloud { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

/* ---------- 5. home page ---------- */
.spotlight { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.spot-track { display: flex; transition: transform .6s var(--ease); }
.spot { position: relative; flex: 0 0 100%; min-height: 480px; display: flex; align-items: flex-end; }
.spot__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* A portrait cover standing in for a missing banner: blur and over-scale so
   the crop reads as a deliberate backdrop rather than a stretched poster. */
.spot__bg--poster {
  filter: blur(26px) saturate(135%);
  transform: scale(1.18);
  object-position: center 28%;
}
.spot::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(8,8,14,.96) 12%, rgba(8,8,14,.72) 45%, rgba(8,8,14,.25)),
              linear-gradient(0deg, var(--bg), transparent 55%);
}
.spot__inner { position: relative; z-index: 2; padding: 56px 0 52px; max-width: 660px; margin-inline: auto; width: min(1480px, 100% - 2.5rem); }
.spot__rank { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.spot__title { font-size: clamp(30px, 4.6vw, 52px); margin: 10px 0 14px; letter-spacing: -.035em; }
.spot__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.spot__desc {
  color: var(--muted); font-size: 14.5px; max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  line-clamp: 3; overflow: hidden;
}
.spot__cta { display: flex; gap: 11px; margin-top: 24px; flex-wrap: wrap; }

.spot-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 20, 30, .6); border: 1px solid var(--line-2);
  color: var(--text); font-size: 19px; line-height: 1;
  backdrop-filter: blur(8px); transition: .18s var(--ease); opacity: 0;
}
.spotlight:hover .spot-arrow { opacity: 1; }
.spot-arrow:hover { background: var(--accent); color: #130f24; border-color: var(--accent); }
.spot-arrow--prev { left: 18px; }
.spot-arrow--next { right: 18px; }

.spot-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; }
.spot-dots button {
  width: 8px; height: 8px; border-radius: 99px; background: var(--line-2);
  transition: .25s var(--ease);
}
.spot-dots button.is-active { width: 26px; background: var(--accent); }

.home { padding-bottom: 70px; }
.home__grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 34px; align-items: start; }
.home__side { position: sticky; top: calc(var(--header-h) + 20px); margin-top: 46px; }

/* trending rail */
.trend-rail {
  display: flex; gap: 14px; overflow-x: auto;
  padding-bottom: 8px; scroll-snap-type: x mandatory;
}
.trend { position: relative; flex: 0 0 172px; scroll-snap-align: start; }
.trend img { width: 100%; aspect-ratio: 5/7; object-fit: cover; border-radius: var(--r); }
.trend__n {
  position: absolute; left: -4px; top: -8px; z-index: 2;
  font-size: 34px; font-weight: 800; letter-spacing: -.06em;
  color: var(--bg); -webkit-text-stroke: 2px var(--accent);
  text-shadow: 0 4px 20px rgba(0, 0, 0, .8);
}
.trend__title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
  overflow: hidden; margin-top: 9px; font-size: 13.5px; font-weight: 600;
}
.trend:hover img { outline: 2px solid var(--accent); outline-offset: 2px; }

/* continue watching + latest (16:9 tiles) */
.cont-rail { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 8px; }
.cont { flex: 0 0 268px; }
.cont__thumb, .latest__thumb {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--r); aspect-ratio: 16/9; background: var(--surface-2);
}
.cont__thumb img, .latest__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.cont:hover img, .latest:hover img { transform: scale(1.05); }
.cont__play {
  position: absolute; inset: 0; margin: auto;
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: rgba(10, 10, 18, .66); color: #fff;
  backdrop-filter: blur(4px); border: 1px solid rgba(255, 255, 255, .3);
  opacity: 0; transform: scale(.85); transition: .22s var(--ease);
}
.cont:hover .cont__play, .latest:hover .cont__play { opacity: 1; transform: scale(1); }
.cont__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .22); }
.cont__bar i { display: block; height: 100%; background: var(--accent); }
.cont__title, .latest__title {
  display: block; margin-top: 9px; font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cont__ep, .latest__sub {
  display: block; margin-top: 2px; font-size: 12.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.latest-grid { display: grid; gap: 22px 15px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.latest__badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  padding: 3px 8px; border-radius: 5px;
  background: rgba(10, 10, 18, .8); backdrop-filter: blur(6px);
  font-size: 11.5px; font-weight: 700; color: var(--accent);
}

/* ---------- 6. watch page ---------- */
.watch { padding-bottom: 70px; }
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 18px 0; font-size: 13px; color: var(--dim); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-current] { color: var(--text); }

.watch__grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 30px; align-items: start; }
.watch__side { position: sticky; top: calc(var(--header-h) + 18px); }

/* --- player --- */
.player-shell {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: #000; border-radius: var(--r-lg);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .95);
  border: 1px solid var(--line);
}
.player-shell video, .player-shell iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000;
}
.player-click { position: absolute; inset: 0; z-index: 3; }
.player-shell.is-empty .player-click { pointer-events: none; }

.player-fallback {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  padding: 24px; text-align: center;
  background:
    radial-gradient(700px 340px at 50% 34%, rgba(124, 77, 255, .2), transparent 70%),
    repeating-linear-gradient(45deg, #0c0c14 0 12px, #0a0a11 12px 24px);
}
.player-fallback__card { max-width: 430px; }
.player-fallback h3 { font-size: 18px; margin-bottom: 9px; }
.player-fallback p { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.player-fallback code {
  padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .09);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; color: var(--accent);
}

.overlay-btn {
  position: absolute; z-index: 7; right: 22px; bottom: 78px;
  padding: 9px 17px; border-radius: 7px;
  background: rgba(12, 12, 20, .84); border: 1px solid var(--line-2);
  backdrop-filter: blur(8px); color: var(--text);
  font-size: 13.5px; font-weight: 600;
  transition: .18s var(--ease);
}
.overlay-btn:hover { background: var(--accent); color: #130f24; border-color: var(--accent); }
.overlay-btn--next { background: rgba(167, 139, 250, .92); color: #130f24; border-color: transparent; }

/* controls */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
  padding: 34px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78) 46%);
  opacity: 1; transform: translateY(0);
  transition: opacity .25s, transform .25s var(--ease);
}
.player-shell.is-idle .controls { opacity: 0; transform: translateY(10px); pointer-events: none; }
.player-shell.is-idle { cursor: none; }
.player-shell.is-empty .controls { opacity: .35; pointer-events: none; }

.seek { position: relative; height: 16px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek__track { position: relative; width: 100%; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; transition: height .15s; }
.seek:hover .seek__track { height: 6px; }
.seek__buffered { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, .3); }
.seek__played { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.seek__knob {
  position: absolute; top: 50%; left: 0; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%) scale(0);
  transition: transform .15s var(--ease); box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
.seek:hover .seek__knob { transform: translate(-50%, -50%) scale(1); }
.seek__hover {
  position: absolute; bottom: 20px; transform: translateX(-50%);
  padding: 3px 7px; border-radius: 4px; background: rgba(0, 0, 0, .85);
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.seek:hover .seek__hover { opacity: 1; }

.controls__row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.controls__spacer { flex: 1; }
.ctl {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  font-size: 19px; color: #fff; opacity: .9; transition: .16s var(--ease);
}
.ctl:hover { opacity: 1; background: rgba(255, 255, 255, .13); }
#btnPlay { font-size: 22px; }
.time { font-size: 12.5px; color: rgba(255, 255, 255, .82); font-variant-numeric: tabular-nums; margin-left: 4px; }

.volume { display: flex; align-items: center; }
.volume input {
  width: 0; opacity: 0; height: 4px; margin-left: 0;
  transition: width .22s var(--ease), opacity .22s, margin-left .22s;
  -webkit-appearance: none; appearance: none;
  background: rgba(255, 255, 255, .3); border-radius: 99px; cursor: pointer;
}
.volume:hover input, .volume input:focus { width: 78px; opacity: 1; margin-left: 6px; }
.volume input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff;
}
.volume input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }

.ctl-menu { position: relative; }
.menu {
  position: absolute; right: 0; bottom: calc(100% + 10px);
  min-width: 208px; padding: 12px;
  background: rgba(18, 18, 26, .97); border: 1px solid var(--line-2);
  border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.menu__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); margin-bottom: 9px; }
.menu__rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.menu__rates button {
  padding: 6px; border-radius: 6px; background: rgba(255, 255, 255, .06);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.menu__rates button:hover { color: var(--text); background: rgba(255, 255, 255, .13); }
.menu__rates button.is-active { background: var(--accent); color: #130f24; }

/* toolbar */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-top: 12px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.toolbar__left, .toolbar__right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tgl {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  border: 1px solid transparent; transition: .16s var(--ease);
}
.tgl:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.tgl:disabled { opacity: .34; cursor: not-allowed; }
.tgl.is-on { color: var(--accent); background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .3); }
.tgl__state { font-size: 11.5px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.tgl.is-on .tgl__state { background: var(--accent); color: #130f24; }

.now-playing { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.now-playing strong { color: var(--accent); }

/* servers */
.servers-box {
  display: grid; grid-template-columns: 232px minmax(0, 1fr);
  margin-top: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.servers-box__note {
  display: grid; align-content: center; gap: 4px; padding: 18px;
  background: linear-gradient(150deg, rgba(124, 77, 255, .16), rgba(124, 77, 255, .03));
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
.servers-box__note strong { display: block; color: var(--text); font-size: 13.5px; }
.servers { padding: 12px 16px; }
.srv-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; flex-wrap: wrap; }
.srv-row + .srv-row { border-top: 1px solid var(--line); }
.srv-row__label { display: flex; align-items: center; gap: 7px; min-width: 74px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.srv-row__icon { font-size: 15px; color: var(--accent); }
.srv-row__list { display: flex; gap: 7px; flex-wrap: wrap; }
.srv {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: .16s var(--ease);
}
.srv:hover { color: var(--text); border-color: var(--line-2); }
.srv.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #130f24;
  box-shadow: 0 8px 18px -8px var(--accent-sh);
}
.srv-row.is-disabled { opacity: .5; }
.srv-row__none { font-size: 12.5px; color: var(--dim); font-style: italic; }

/* episode header */
.ep-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-top: 30px;
}
.ep-head h1 { font-size: clamp(20px, 2.4vw, 26px); }
.ep-head__sub { margin-top: 5px; color: var(--muted); font-size: 14px; }

/* episode panel */
.ep-panel {
  margin-top: 22px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.ep-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 15px;
}
.ep-panel__head h2 { font-size: 17px; }
.ep-panel__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ep-search { position: relative; display: flex; align-items: center; }
.ep-search svg { position: absolute; left: 10px; font-size: 14px; color: var(--dim); }
.ep-search input {
  height: 32px; width: 172px; padding: 0 12px 0 31px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 13px;
}
.ep-search input:focus { outline: none; border-color: var(--accent); }
.ep-view button { width: 32px; height: 32px; display: grid; place-items: center; font-size: 15px; }
.ep-view button.is-active { color: var(--accent); border-color: var(--accent); background: rgba(167, 139, 250, .1); }

.ep-list {
  display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  max-height: 424px; overflow-y: auto; padding-right: 4px;
}
.ep {
  position: relative; display: grid; place-items: center;
  height: 38px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: .14s var(--ease);
}
.ep:hover { background: #2a2a3d; color: var(--text); transform: translateY(-1px); }
.ep__title { display: none; }
.ep__flag { position: absolute; top: 2px; right: 4px; font-size: 9px; font-weight: 800; color: var(--danger); }
.ep.is-watched { color: var(--dim); background: #16161f; }
.ep.is-watched::after {
  content: ''; position: absolute; left: 6px; right: 6px; bottom: 5px;
  height: 2px; border-radius: 2px; background: #3d3d55;
}
.ep.is-current {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  color: #130f24 !important; box-shadow: 0 8px 20px -8px var(--accent-sh);
}
.ep.is-current .ep__flag { color: #4a1616; }
.ep.is-current::after { display: none; }

.ep-list--rows { grid-template-columns: 1fr; }
.ep-list--rows .ep {
  height: auto; padding: 10px 13px; justify-items: stretch;
  grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
}
.ep-list--rows .ep__n {
  padding: 2px 0; border-radius: 5px; background: rgba(255, 255, 255, .07);
  text-align: center; font-size: 12px;
}
.ep-list--rows .ep.is-current .ep__n { background: rgba(0, 0, 0, .18); }
.ep-list--rows .ep__title {
  display: block; text-align: left; font-weight: 500; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ep-list--rows .ep__flag { position: static; }
.ep-list--rows .ep:hover { transform: none; }

.ep-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; color: var(--dim); }
.ep-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ep-empty { grid-column: 1/-1; padding: 30px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* detail block */
.detail {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px;
  margin-top: 26px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.detail__poster { width: 100%; border-radius: var(--r); box-shadow: var(--shadow); }
.detail__title { font-size: 24px; }
.detail__alt { margin-top: 4px; color: var(--dim); font-size: 13.5px; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail__synopsis {
  margin-top: 14px; color: var(--muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  line-clamp: 3; overflow: hidden;
}
.detail__synopsis.is-open { -webkit-line-clamp: unset; line-clamp: unset; }
.detail__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 9px 22px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line);
}
.detail__facts > div { display: flex; gap: 8px; font-size: 13px; }
.detail__facts dt { color: var(--dim); min-width: 78px; }
.detail__facts dd { color: var(--text); }
.detail__genres { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }

/* ---------- 7. comments, footer, modes ---------- */
.comments {
  margin-top: 26px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.comments__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.comments__head h2 { font-size: 17px; display: flex; align-items: center; gap: 9px; }

.comment-form { display: grid; gap: 9px; margin-bottom: 24px; }
.comment-form input, .comment-form textarea {
  padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font-size: 14px; resize: vertical;
}
.comment-form input { max-width: 240px; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--dim); }
.hint code { color: var(--accent); font-family: ui-monospace, Consolas, monospace; }

.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment { display: grid; grid-template-columns: 38px 1fr; gap: 12px; }
.comment__avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--h, 260) 48% 42%); color: #fff; font-weight: 700; font-size: 15px;
}
.comment__head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; font-size: 13.5px; }
.comment__head time { color: var(--dim); font-size: 11.5px; }
.comment__text { margin-top: 4px; font-size: 14px; color: var(--muted); transition: filter .2s; }
.hide-spoilers .comment__text { filter: blur(5px); }
.hide-spoilers .comment__text:hover { filter: none; }
.comment-empty { padding: 26px; text-align: center; color: var(--dim); font-size: 13.5px;
  border: 1px dashed var(--line-2); border-radius: var(--r); }

.keys { display: grid; gap: 9px; margin-top: 12px; font-size: 12.5px; }
.keys li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.keys span { margin-left: auto; color: var(--dim); }
kbd {
  display: inline-block; min-width: 22px; padding: 2px 6px;
  border-radius: 5px; background: var(--surface-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px;
  font-family: inherit; font-size: 11.5px; font-weight: 600; text-align: center; color: var(--text);
}

.site-footer { margin-top: 40px; padding: 40px 0 46px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .35); }
.site-footer .wrap { display: grid; gap: 12px; justify-items: center; text-align: center; }
.site-footer__note { max-width: 54ch; font-size: 13px; color: var(--dim); }
.site-footer__copy { font-size: 12.5px; color: var(--dim); }

/* =============================================================
   List manager: page head, status tabs, entries, stats
   ============================================================= */
.list-page, .anime-page { padding-bottom: 70px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; padding: 30px 0 22px;
}
.page-head h1 { font-size: clamp(24px, 3.4vw, 34px); }
.page-head__sub { margin-top: 6px; color: var(--muted); font-size: 14px; }
.page-head__actions { display: flex; gap: 9px; flex-wrap: wrap; }

.main-nav a.is-active { color: var(--accent); }

.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: .45em .85em; font-size: 12.5px; }

/* status tabs */
.status-tabs {
  display: flex; gap: 7px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.status-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: .16s var(--ease);
}
.status-tab:hover { color: var(--text); border-color: var(--line-2); }
.status-tab.is-active {
  color: var(--st, var(--accent));
  border-color: var(--st, var(--accent));
  background: color-mix(in srgb, var(--st, #a78bfa) 14%, transparent);
}
.status-tab__n {
  min-width: 20px; padding: 1px 6px; border-radius: 99px;
  background: rgba(255, 255, 255, .09); font-size: 11.5px; text-align: center;
}
.status-tab.is-active .status-tab__n { background: var(--st, var(--accent)); color: #12101c; }

.list-tools {
  display: flex; align-items: center; gap: 9px;
  flex-wrap: wrap; margin: 18px 0;
}
.list-tools .ep-search { flex: 1; min-width: 180px; }
.list-tools .ep-search input { width: 100%; }

.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--st, var(--accent)); margin-right: 6px; vertical-align: 0;
}

/* entry rows */
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 60px minmax(0, 1fr) auto auto auto;
  padding: 10px 14px 10px 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); transition: border-color .16s var(--ease);
}
.entry:hover { border-color: var(--line-2); }
.entry__cover img { width: 60px; height: 84px; object-fit: cover; border-radius: 7px; background: var(--surface-2); }
.entry__main { min-width: 0; }
.entry__title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry__meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px; font-size: 12.5px; color: var(--dim);
}
.meta-score { display: inline-flex; align-items: center; gap: 3px; color: var(--score); }
.entry__bar { margin-top: 9px; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.entry__bar i { display: block; height: 100%; border-radius: 99px; background: var(--st, var(--accent)); transition: width .25s var(--ease); }

.entry__progress { display: flex; align-items: center; gap: 8px; }
.step {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: 15px; line-height: 1;
  transition: .14s var(--ease);
}
.step:hover { color: var(--accent); border-color: var(--accent); background: rgba(167, 139, 250, .1); }
.entry__count { min-width: 56px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.entry__count strong { color: var(--text); font-size: 15px; }
.entry__count span { color: var(--dim); margin-left: 3px; }

.entry__score select, .entry__actions select { height: 32px; }
.entry__score select { width: 62px; }
.entry__actions { display: flex; align-items: center; gap: 7px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  color: var(--dim); font-size: 15px; transition: .14s var(--ease);
}
.icon-btn:hover { color: var(--danger); background: rgba(255, 122, 122, .12); }

.badge--eps { background: rgba(255, 255, 255, .16); color: var(--text); backdrop-filter: blur(4px); }
.badge--status { background: var(--st, var(--accent)); color: #12101c; }

/* empty state */
.empty {
  display: grid; justify-items: center; gap: 12px;
  padding: 60px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg);
}
.empty__icon { font-size: 34px; color: var(--accent); opacity: .55; }
.empty h3 { font-size: 19px; }
.empty p { max-width: 46ch; color: var(--muted); font-size: 14px; }
.empty .btn { margin-top: 6px; }

/* stats */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
  display: grid; justify-items: center; gap: 3px; padding: 22px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.stat__icon { font-size: 20px; color: var(--accent); margin-bottom: 4px; }
.stat__value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; }
.stat__label { font-size: 12.5px; color: var(--dim); }

.stat-split { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 16px; }
.stat-panel {
  padding: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.stat-panel h3 { font-size: 15px; margin-bottom: 14px; }
.bar { display: grid; grid-template-columns: 100px 1fr 34px; align-items: center; gap: 11px; margin-bottom: 9px; }
.bar__label { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar__track i { display: block; height: 100%; border-radius: 99px; background: var(--st, var(--accent)); transition: width .3s var(--ease); }
.bar__value { font-size: 12.5px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }

/* tracking panel on the detail page */
.detail--page { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.detail__side { display: grid; gap: 14px; }
.track {
  display: grid; gap: 12px; padding: 16px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
}
.track__head { font-size: 13px; font-weight: 600; color: var(--muted); }
.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--dim); }
.field select, .field input, .field textarea {
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 13.5px; width: 100%; resize: vertical;
}
.field select:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field__stepper { display: grid; grid-template-columns: 32px 1fr 32px; gap: 6px; }
.field__stepper button {
  border-radius: var(--r-sm); border: 1px solid var(--line);
  display: grid; place-items: center;
  background: var(--surface); color: var(--muted); font-size: 15px;
}
.field__stepper button:hover { color: var(--accent); border-color: var(--accent); }
.field__stepper input { text-align: center; -moz-appearance: textfield; }
.field__stepper input::-webkit-outer-spin-button,
.field__stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cont__thumb--poster { aspect-ratio: 5 / 7; }
.cont__next { margin-top: 8px; width: 100%; justify-content: center; }

.toast__undo {
  margin-left: 12px; color: var(--accent); font-weight: 700;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
}
.toast__undo:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .detail--page { grid-template-columns: 1fr; }
  .detail--page .detail__poster { max-width: 200px; }
  .entry {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    grid-template-areas: 'cover main progress' 'cover actions actions';
    row-gap: 10px;
  }
  .entry__cover { grid-area: cover; }
  .entry__main { grid-area: main; }
  .entry__progress { grid-area: progress; }
  .entry__score { display: none; }
  .entry__actions { grid-area: actions; justify-content: flex-start; }
  .entry__cover img { width: 52px; height: 73px; }
}

/* =============================================================
   Detail page: banner, rail, tabs, cast
   ============================================================= */
.logo__mark--img { background: none; box-shadow: none; padding: 0; }
.logo__mark--img img { width: 30px; height: 30px; }

.hero { position: relative; height: 300px; overflow: hidden; background: var(--surface); }
.hero__bg { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.hero__bg--poster { filter: blur(30px) saturate(140%); transform: scale(1.25); }
.hero__fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,8,14,.35) 0%, rgba(8,8,14,.7) 55%, var(--bg) 100%);
}

.page-anime__main { padding-bottom: 70px; }
.anime-layout {
  display: grid; grid-template-columns: 290px minmax(0, 1fr);
  gap: 34px; align-items: start;
  margin-top: -110px; position: relative; z-index: 2;
}
.anime-layout .offline-note { grid-column: 1 / -1; margin-top: 0; }

/* --- left rail --- */
.rail { display: grid; gap: 12px; position: sticky; top: calc(var(--header-h) + 16px); }
.rail__poster {
  width: 100%; border-radius: var(--r-lg);
  box-shadow: 0 24px 54px -22px rgba(0, 0, 0, .95);
  border: 1px solid var(--line);
}

.rail__actions { display: grid; grid-template-columns: 1fr 38px 42px; gap: 7px; }
.rail__add { justify-content: center; border-radius: var(--r-sm); padding-inline: .8em; }
.rail__caret, .rail__fav {
  display: grid; place-items: center; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--muted); font-size: 16px; transition: .16s var(--ease);
}
.rail__caret .ico { transform: rotate(90deg); }
.rail__caret:hover, .rail__fav:hover { color: var(--accent); border-color: var(--accent); }
.rail__fav.is-on { background: var(--danger); border-color: var(--danger); color: #2a0b0b; }

.rail__menu {
  display: grid; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.rail__menu button {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--muted); text-align: left;
}
.rail__menu button .ico { color: var(--st, var(--accent)); }
.rail__menu button:hover { background: var(--surface-2); color: var(--text); }
.rail__menu button.is-danger .ico { color: var(--danger); }

.rail__track {
  display: grid; gap: 11px; padding: 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
}

.rail__ranks { display: grid; gap: 6px; }
.rank-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.rank-chip--score .ico { color: var(--score); }
.rank-chip--pop .ico { color: var(--danger); }

.rail__facts {
  display: grid; gap: 13px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.rail__facts dt { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.rail__facts dd { font-size: 13.5px; color: var(--text); }
.rail__facts dd.is-live { color: var(--sub); font-variant-numeric: tabular-nums; }
.rail__genres { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- tabs --- */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: .16s var(--ease);
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tab.is-active { color: #130f24; background: var(--accent); }
.tab__n {
  padding: 1px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .12); font-size: 11.5px;
}
.tab.is-active .tab__n { background: rgba(0, 0, 0, .18); }

.anime-title { font-size: clamp(23px, 3.2vw, 33px); }
.anime-alt { margin-top: 5px; color: var(--dim); font-size: 14px; margin-bottom: 16px; }

.block { margin-top: 34px; }
.block__title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 17px; margin-bottom: 14px;
}

/* --- relations --- */
.rel-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.rel {
  display: block; padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); transition: .16s var(--ease);
}
a.rel:hover { border-color: var(--accent); color: inherit; transform: translateY(-2px); }
.rel__body { display: grid; gap: 3px; }
.rel__kind { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.rel strong { font-size: 13.5px; font-weight: 600; }
.rel__type { font-size: 12px; color: var(--dim); text-transform: capitalize; }

/* --- cast --- */
.cast-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.cast {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  transition: border-color .16s var(--ease);
}
.cast:hover { border-color: var(--line-2); }
.cast__side { display: flex; gap: 11px; min-width: 0; flex: 1; }
.cast__side--right { justify-content: flex-end; text-align: right; }
.cast img { width: 52px; height: 74px; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.cast__text { display: grid; align-content: center; gap: 3px; padding: 8px 0; min-width: 0; }
.cast__text strong {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cast__text span { font-size: 11.5px; color: var(--dim); }
.cast__text--right { padding-right: 0; }

.card-grid--tight { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }

/* --- score histogram --- */
.score-hist {
  display: grid; grid-template-columns: repeat(10, 1fr);
  gap: 6px; align-items: end; height: 150px; margin-top: 6px;
}
.score-bar { display: grid; align-content: end; justify-items: center; gap: 6px; height: 100%; }
.score-bar i {
  display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 0 0;
  background: linear-gradient(var(--accent), var(--accent-2));
  transition: height .35s var(--ease);
}
.score-bar span { font-size: 11.5px; color: var(--dim); }
.stat-panel + .stat-panel { margin-top: 16px; }
.stat-panel h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

@media (max-width: 1080px) {
  .anime-layout { grid-template-columns: 1fr; margin-top: -70px; }
  .rail {
    position: static;
    grid-template-columns: 190px minmax(0, 1fr);
    grid-template-areas: 'poster facts' 'actions facts' 'menu facts' 'track facts' 'ranks facts';
    align-items: start;
  }
  .rail__poster { grid-area: poster; }
  .rail__actions { grid-area: actions; }
  .rail__menu { grid-area: menu; }
  .rail__track { grid-area: track; }
  .rail__ranks { grid-area: ranks; }
  .rail__facts { grid-area: facts; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
@media (max-width: 620px) {
  .hero { height: 200px; }
  .rail { grid-template-columns: 1fr; grid-template-areas: none; }
  .rail__poster { max-width: 180px; justify-self: center; }
  .cast-grid { grid-template-columns: 1fr; }
}

/* =============================================================
   Skip link, filters, skeletons
   ============================================================= */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 900;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--accent); color: #130f24; font-weight: 700; font-size: 13px;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; color: #130f24; }

/* --- filter panel --- */
.filters {
  display: grid; gap: 16px; padding: 18px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.filters__row {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}
.filters__field { display: grid; gap: 5px; font-size: 12px; color: var(--dim); }
.filters__field select { height: 34px; width: 100%; }
.filters__field--check {
  grid-template-columns: auto 1fr; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.filters__field--check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.filters__label {
  display: block; margin-bottom: 9px;
  font-size: 12px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: .07em;
}
.filters__genres { padding-top: 14px; border-top: 1px solid var(--line); }
.filters__foot { display: flex; justify-content: flex-end; }

.grid-more { display: flex; justify-content: center; margin-top: 26px; }
.grid-empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: 14px;
  padding: 50px 24px; text-align: center; color: var(--muted);
}

/* --- skeletons --- */
@keyframes sk-pulse { 0%, 100% { opacity: .55; } 50% { opacity: .95; } }
.sk { animation: sk-pulse 1.4s ease-in-out infinite; }
.sk__poster, .sk__line, .sk__thumb {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  border-radius: var(--r-sm);
}
.sk--card .sk__poster { aspect-ratio: 5 / 7; border-radius: var(--r); }
.sk--trend { flex: 0 0 172px; }
.sk--trend .sk__poster { aspect-ratio: 5 / 7; border-radius: var(--r); }
.sk__line { height: 11px; margin-top: 9px; }
.sk__line--short { width: 55%; }
.sk--row {
  display: grid; grid-template-columns: 46px 1fr; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.sk--row .sk__thumb { width: 46px; height: 62px; }
.sk--row .sk__body { align-self: center; width: 100%; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* API states */
.offline-note {
  margin: 16px 0 0; padding: 11px 15px; border-radius: var(--r);
  background: rgba(255, 196, 107, .1); border: 1px solid rgba(255, 196, 107, .3);
  color: var(--dub); font-size: 13px;
}
body.is-loading { cursor: progress; }
body.is-loading::after {
  content: ''; position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 999;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loadbar 1.1s linear infinite;
}
@keyframes loadbar { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* remote cover art: tint the box with AniList's dominant colour while it loads */
.card__poster { background: var(--cover, var(--surface-2)); }
.card__poster img, .rank__thumb img, .detail__poster, .trend img { background: var(--surface-2); }

/* lights-off + expanded modes */
.lights-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .9);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
body.lights-off .lights-overlay { opacity: 1; pointer-events: auto; }
body.lights-off .player-shell { position: relative; z-index: 320; }
body.lights-off .site-header { z-index: 280; }

body.expanded .watch__grid { grid-template-columns: minmax(0, 1fr); }
body.expanded .watch__side {
  position: static;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 22px; align-items: start;
}
body.expanded .wrap { width: min(1740px, 100% - 2.5rem); }

/* ---------- 8. responsive ---------- */
@media (max-width: 1180px) {
  .watch__grid, .home__grid { grid-template-columns: minmax(0, 1fr); }
  .watch__side, .home__side { position: static; margin-top: 34px; }
  .watch__side, body.expanded .watch__side {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; align-items: start;
  }
}

@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .servers-box { grid-template-columns: 1fr; }
  .spot { min-height: 420px; }
  .spot__inner { padding: 40px 0; }
  .detail { grid-template-columns: 128px minmax(0, 1fr); gap: 18px; padding: 16px; }
}

@media (max-width: 620px) {
  :root { --header-h: 58px; }
  .wrap, body.expanded .wrap { width: calc(100% - 1.6rem); }
  .header__inner { gap: 12px; }
  .logo { font-size: 17px; }
  .logo span { display: none; }
  .search input { height: 38px; font-size: 13px; }
  .search > button { top: 3px; }

  .spot { min-height: 380px; }
  .spot__desc { -webkit-line-clamp: 2; line-clamp: 2; }
  .spot-arrow { display: none; }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 16px 10px; }
  .latest-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .trend { flex-basis: 132px; }
  .cont { flex-basis: 212px; }

  .player-shell { border-radius: var(--r); }
  .controls { padding: 28px 8px 8px; }
  .ctl { width: 32px; height: 32px; font-size: 17px; }
  .time { font-size: 11.5px; }
  .volume input, .volume:hover input { width: 0; opacity: 0; margin-left: 0; }
  .overlay-btn { right: 12px; bottom: 66px; padding: 7px 13px; font-size: 12.5px; }

  .toolbar { padding: 8px; }
  .tgl { padding: 5px 8px; font-size: 12px; }
  .ep-panel, .comments { padding: 14px; }
  .ep-search input { width: 128px; }
  /* :not() keeps the rows view from being clobbered by the narrow grid */
  .ep-list:not(.ep-list--rows) { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .ep-list { max-height: 330px; }
  .ep-list--rows .ep { grid-template-columns: 38px 1fr auto; gap: 9px; padding: 9px 10px; }
  .detail { grid-template-columns: 1fr; }
  .detail__poster { max-width: 172px; }
}

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