/* Anikrait — one stylesheet, no framework.
   Poster rules come straight from the study: 2:3, cover, fixed box, no stretching.
   The brand is the krait: mint (#51FEAE) on a near-black green, one accent only. */

:root {
  --bg: #070b09;
  --bg-2: #0b1210;
  --panel: #101917;
  --panel-2: #16211d;
  --line: #1e2b26;
  --line-strong: #2b3b34;
  --text: #ecf4f0;
  --text-dim: #c2d1ca;
  --muted: #8da29a;
  --accent: #51feae;
  --accent-soft: #8affca;
  --accent-ink: #03130c;
  --accent-dim: rgba(81, 254, 174, 0.13);
  --good: #51feae;
  --bad: #ff7a85;
  --radius: 12px;
  --radius-lg: 20px;
  --poster-w: 176px;
  --header-h: 68px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.32);
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f7f5;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #edf3f0;
  --line: #dee7e2;
  --line-strong: #c7d6cf;
  --text: #07130f;
  --text-dim: #263831;
  --muted: #5b6f67;
  --accent: #0b8f63;
  --accent-soft: #12a874;
  --accent-ink: #ffffff;
  --accent-dim: rgba(11, 143, 99, 0.11);
  --good: #0b8f63;
  --bad: #c0392b;
  --shadow: 0 16px 38px rgba(8, 22, 16, 0.12);
  --shadow-soft: 0 8px 18px rgba(8, 22, 16, 0.08);
}

* { box-sizing: border-box; }

/* A component display rule such as `.btn { display:inline-flex }` otherwise beats the
   browser's built-in [hidden] rule. Every hidden control must really be hidden. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 84% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(900px 520px at -12% 4%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* Thin dark rails match the artwork instead of the OS grey slabs. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

a { color: inherit; text-decoration: none; }

a:hover { color: var(--accent); }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding: 10px 14px;
  z-index: 10;
}

.skip:focus { left: 12px; top: 12px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: var(--header-h);
  padding: 10px clamp(14px, 2.4vw, 30px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.25);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.topbar.is-scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom-color: var(--line);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  flex: 0 0 auto;
}

/* The artwork's body is light and its hood is mint, so it lives on its own dark
   tile: it reads the same on the dark theme and on the white one. */
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 30% 10%, #14241d 0%, #060f0b 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand-mark img { display: block; width: 100%; height: 100%; }

.brand:hover .brand-mark {
  transform: translateY(-1px) rotate(-3deg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 8px 22px rgba(81, 254, 174, 0.28);
}

.brand-word {
  background: linear-gradient(94deg, var(--text) 24%, var(--accent) 135%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav a { white-space: nowrap; }

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.005em;
  transition: color 140ms ease, background 140ms ease;
}

.nav a:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text);
}

.nav a[aria-current="page"] {
  background: var(--accent-dim);
  color: var(--accent);
}

.search { position: relative; margin-left: auto; }

/* A magnifier drawn as a data URI: no icon font, no extra request. */
.search::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 15px;
  height: 15px;
  margin-top: -8px;
  pointer-events: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238da29a' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E");
  opacity: 0.9;
}

.search input {
  width: 236px;
  max-width: 34vw;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: width 200ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.search input::placeholder { color: var(--muted); }

.search input:hover { border-color: var(--line-strong); }

.search input:focus {
  width: 292px;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--panel);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-dim);
}

/* ---------- layout ---------- */

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px clamp(14px, 2.4vw, 30px) 72px;
  min-height: 60vh;
}

main:focus { outline: none; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 12px; }

h1 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.025em; font-weight: 800; }

h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 750;
}

.lede { color: var(--muted); max-width: 62ch; margin: 0 0 26px; font-size: 15px; }

.muted { color: var(--muted); }

.section { margin: 40px 0; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h2 { margin: 0; }

/* "See all" reads as a control, not as body copy: it nudges right on hover. */
.section-head a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 140ms ease;
}

.section-head a::after {
  content: "›";
  font-size: 16px;
  line-height: 1;
  transition: transform 160ms ease;
}

.section-head a:hover { color: var(--accent); }
.section-head a:hover::after { transform: translateX(3px); }

/* ---------- poster grid (2:3, never stretched) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--poster-w), 1fr));
  gap: 22px 18px;
}

.card {
  display: block;
  min-width: 0;
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--panel-2), var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

/* Lift on hover, the way a shelf of covers behaves under a cursor. The preview
   overlay is inside the poster, so it travels with the artwork. */
.card:hover .poster {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.52), 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.card:focus-visible .poster { border-color: var(--accent); }

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Resume bar: the thin strip a streaming shelf uses to say "you are this far in".
   It sits under the SUB/DUB tags and never intercepts a click. */
.card-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 4px;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.card-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: width 180ms linear;
}

/* Hover preview: the real first episode paints over the poster, muted and looping, only
   while the pointer rests on this one card. Nothing here is visible until it has a frame,
   so a source that does not answer leaves the artwork untouched. */
.card-preview {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  border-radius: inherit;
  background: #000;
  opacity: 0;
  transition: opacity 180ms ease;
}

.card-preview[data-state="playing"] { opacity: 1; }

/* While the source is being resolved the poster stays visible under a soft scrim, so the
   hover reads as "starting" within half a second instead of nothing happening. */
.card-preview[data-state="loading"] {
  opacity: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.72));
}

.preview-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  animation: preview-spin 0.8s linear infinite;
}

@keyframes preview-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .preview-spinner { animation: none; }
}

.card-preview[hidden] { display: none; }

.card-preview video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
  /* Hidden until a frame exists: an unattached video is a black rectangle. */
  opacity: 0;
  transition: opacity 220ms ease;
}

.card-preview[data-state="playing"] video {
  background: #000;
  opacity: 1;
}

.preview-chip {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  margin: 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.74);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(4px);
}

.card.previewing .poster { border-color: var(--accent); }

.poster .badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(3, 10, 7, 0.78);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  backdrop-filter: blur(6px);
}

.poster .badge::before {
  content: "★";
  font-size: 0.82em;
  line-height: 1;
  transform: translateY(-0.5px);
}

/* 18+ flag: top-left of the cover, the same corner language as SUB/DUB but never mixed
   with them. Red so it reads as a restriction, not a quality score. */
.poster .adult-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 5px;
  background: #c0392b;
  color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

/* SUB / DUB marker: sits in the same corner row as the score so it reads before play. */
.audio-tags {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.audio-tags .a {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(3, 10, 7, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(6px);
}

/* The holder must keep a box (even at zero size) so the availability observer can see
   it; hiding it with display:none would stop the fetch before it starts. */
.audio-tags:empty { pointer-events: none; }

.audio-tags .sub { color: #a9f0cc; }

.audio-tags .dub.yes {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
  font-weight: 800;
}

/* Detail header uses the same marker, without the absolute corner placement. */
.detail-meta .audio-tags {
  position: static;
  font-size: 11px;
}

/* Only the SUB tag borrows the page surface here; DUB keeps its mint fill, or the
   dark ink on a dark chip disappears against the artwork. */
.detail-meta .audio-tags .a:not(.dub) {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.audio-md .a { padding: 5px 8px; }

.card-title {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
  transition: color 140ms ease;
}

.card:hover .card-title { color: var(--accent); }

.card-meta { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Genre line under the title. Three genres at most; the active filter is first. */
.card-genres {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- empty / placeholder states ---------- */

.empty {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}

.skeleton-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--poster-w), 1fr)); gap: 22px 18px; }

.skeleton {
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--panel) 20%, var(--bg-2) 40%, var(--panel) 60%);
  border: 1px solid var(--line);
  animation: shimmer 1.6s linear infinite;
  background-size: 220% 100%;
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ---------- buttons, chips, panels ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease,
    transform 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  background: var(--accent-dim);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 26%, transparent);
}

.btn.primary:hover {
  color: var(--accent-ink);
  filter: brightness(1.05);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 38%, transparent);
}

.btn[disabled],
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  font-size: 12px;
  font-weight: 550;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

a.chip { color: var(--muted); }

a.chip:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-dim);
}

.chip-adult,
a.chip-adult {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  font-weight: 750;
}

a.chip-adult:hover {
  color: #fff;
  border-color: #fff;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

/* ---------- browse filter bar ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
  align-items: end;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin: 0 0 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > span {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-search { grid-column: span 2; }

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  font-size: 14px;
  appearance: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field input:hover,
.field select:hover { border-color: var(--line-strong); }

.field select {
  /* A tiny chevron so the select reads as a select without shipping an icon font. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.field-actions {
  flex-direction: row;
  gap: 8px;
}

.field-actions .btn { flex: 1; }

@media (max-width: 720px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-search { grid-column: span 2; }
  .field-actions { grid-column: span 2; }
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.result-bar p { margin: 0; font-size: 14px; }

#results[aria-busy="true"] .grid { opacity: 0.45; transition: opacity 120ms; }

.more-wrap {
  display: flex;
  justify-content: center;
  margin: 22px 0 0;
}

.more-wrap[hidden] { display: none; }

.more-wrap .btn { min-width: 180px; }

/* ---------- hero: one billboard, art under a scrim, copy at the bottom left ---------- */

.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: #040806;
  color: #fff;
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
  box-shadow: var(--shadow);
}

/* The artwork always sits under a near-black scrim, so the copy stays white in both
   themes instead of turning dark letters on dark art. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--hero);
  background-size: cover;
  background-position: center 24%;
  opacity: 0.92;
  filter: saturate(1.04);
  z-index: -2;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 9, 7, 0.97) 0%, rgba(4, 9, 7, 0.88) 26%, rgba(4, 9, 7, 0.4) 57%, rgba(4, 9, 7, 0.02) 84%),
    linear-gradient(0deg, rgba(4, 9, 7, 0.96) 0%, rgba(4, 9, 7, 0.42) 30%, transparent 60%),
    linear-gradient(180deg, rgba(4, 9, 7, 0.6) 0%, transparent 24%);
  z-index: -1;
}

.hero-inner {
  padding: 34px 40px 36px;
  max-width: 660px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: rgba(5, 12, 9, 0.55);
  border: 1px solid rgba(81, 254, 174, 0.32);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #51feae;
  backdrop-filter: blur(8px);
}

.hero-kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #51feae;
  box-shadow: 0 0 0 3px rgba(81, 254, 174, 0.18);
}

.hero-title {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.03;
  font-weight: 800;
  letter-spacing: -0.032em;
  text-wrap: balance;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.45);
}

.hero-meta {
  margin: 14px 0 16px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-meta .score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(81, 254, 174, 0.14);
  border: 1px solid rgba(81, 254, 174, 0.28);
  color: #8affca;
  font-weight: 800;
  font-size: 13px;
}

.hero .chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
}

.hero .chip:hover { color: #fff; border-color: rgba(81, 254, 174, 0.6); }

/* The SUB/DUB marker is corner-pinned for posters, so un-pin it inside the hero's chip row. */
.hero .audio-tags {
  position: static;
  font-size: 11px;
}

@media (max-width: 720px) {
  .hero { min-height: 300px; }
  .hero::after {
    background:
      linear-gradient(0deg, rgba(4, 9, 7, 0.97) 4%, rgba(4, 9, 7, 0.5) 46%, rgba(4, 9, 7, 0.12) 80%),
      linear-gradient(180deg, rgba(4, 9, 7, 0.5) 0%, transparent 28%);
  }
  .hero-inner { padding: 20px 18px 30px; }
}

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

.hero-rotator {
  display: block;
  padding: 0;
  min-height: clamp(430px, 44vw, 560px);
}

.hero-rotator .hero-slides {
  position: absolute;
  inset: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  isolation: isolate;
}

/* Only one slide is ever visible, so a rotation can never show two titles stacked. The
   incoming slide fades in over the dark backdrop instead of crossfading with the old one. */
.hero-slide.on {
  opacity: 1;
  visibility: visible;
  animation: hero-in 460ms ease both;
}

@keyframes hero-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* A very slow push on the artwork. It reads as a moving still, not as a zoom. */
.hero-slide.on::before { animation: hero-drift 14s ease-out both; }

@keyframes hero-drift {
  from { transform: scale(1.02); }
  to { transform: scale(1.075); }
}

.hero-slide.on .hero-inner { animation: hero-copy 560ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }

@keyframes hero-copy {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide.on,
  .hero-slide.on::before,
  .hero-slide.on .hero-inner { animation: none; }
}

.hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--hero);
  background-size: cover;
  background-position: center 24%;
  opacity: 0.92;
  filter: saturate(1.04);
  transform-origin: 60% 40%;
  z-index: -2;
}

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 9, 7, 0.97) 0%, rgba(4, 9, 7, 0.88) 26%, rgba(4, 9, 7, 0.4) 57%, rgba(4, 9, 7, 0.02) 84%),
    linear-gradient(0deg, rgba(4, 9, 7, 0.96) 0%, rgba(4, 9, 7, 0.42) 30%, transparent 60%),
    linear-gradient(180deg, rgba(4, 9, 7, 0.6) 0%, transparent 24%);
  z-index: -1;
}

.hero-slide .hero-inner {
  position: relative;
  z-index: 1;
  padding-bottom: 64px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* Buttons on artwork: the primary is mint, the secondary is glass, and neither uses the
   page surface colours, so they read on the darkest and brightest banners. */
.hero-slide .btn {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.hero-slide .btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.42);
  color: #fff;
  transform: translateY(-1px);
}

.hero-slide .btn.primary {
  background: linear-gradient(180deg, #8affca, #51feae);
  border-color: transparent;
  color: #03130c;
  box-shadow: 0 10px 30px rgba(81, 254, 174, 0.3);
}

.hero-slide .btn.primary:hover {
  color: #03130c;
  filter: brightness(1.05);
  box-shadow: 0 14px 38px rgba(81, 254, 174, 0.42);
}

.play-icon {
  display: inline-block;
  margin-right: 7px;
  font-size: 10px;
  transform: translateY(-1px);
}

/* Progress bars, bottom-left, the way a streaming billboard marks its carousel. */
.hero-dots {
  position: absolute;
  left: 40px;
  bottom: 22px;
  display: flex;
  gap: 4px;
  z-index: 3;
}

.hero-dot {
  position: relative;
  width: 22px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: width 240ms ease;
}

.hero-dot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 7px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  transition: background 240ms ease, box-shadow 240ms ease;
}

.hero-dot:hover::before { background: rgba(255, 255, 255, 0.62); }

.hero-dot.on { width: 40px; }

.hero-dot.on::before {
  background: #51feae;
  box-shadow: 0 0 12px rgba(81, 254, 174, 0.45);
}

.hero-dot:focus-visible {
  outline: 2px solid #51feae;
  outline-offset: 3px;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .hero-dots { left: 18px; bottom: 14px; }
}

/* ---------- ranked (Top 10) charts ---------- */

.rail-wrap {
  position: relative;
}

.top10-rail {
  list-style: none;
  margin: 0;
  padding: 6px 2px 18px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 288px;
  gap: 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  /* Paging is done with the arrow buttons; a bar under the posters was the broken bit. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.top10-rail::-webkit-scrollbar { display: none; }

/* Continue Watching uses the same pager as the charts but a narrower card, so more
   titles fit on one screen and the arrows have somewhere useful to go. */
.history-rail { grid-auto-columns: 196px; }
.history-rail .card-title { font-size: 13.5px; }
.history-rail .card-meta { font-size: 12px; }

.top10-item {
  scroll-snap-align: start;
  min-width: 0;
  /* The screen-reader rank inside each card is absolutely positioned; without a
     containing block here it would anchor to the rail wrapper, escape the scroller
     and stretch the whole page sideways. */
  position: relative;
}

/* The numeral shares a flex row with the artwork and is bottom-aligned to it, so it sits at
   the poster's baseline. Titles live below that row and can never meet the numeral. */
.top10-face {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.top10-rank {
  flex: 0 0 auto;
  width: 64px;
  text-align: right;
  margin-bottom: 14px;
  font-size: 76px;
  line-height: 0.72;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.07em;
  color: transparent;
  -webkit-text-stroke: 2.5px rgba(81, 254, 174, 0.5);
  pointer-events: none;
  user-select: none;
  transition: -webkit-text-stroke-color 180ms ease;
}

/* The outline fills in on hover, so the chart reacts as one card. */
.top10-card:hover .top10-rank { -webkit-text-stroke-color: rgba(81, 254, 174, 0.95); }

.top10-face .poster {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 16px;
}

.top10-card .card-title,
.top10-card .card-meta {
  min-width: 0;
}

.top10-card .card-title {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.35;
}

.top10-card .card-meta { font-size: 12.5px; }

/* A bigger cover earns a legible score badge. */
.top10-card .poster .badge {
  left: 10px;
  bottom: 10px;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 8px;
}

/* ---------- rail arrows (Netflix-style paging) ---------- */

.rail-arrow {
  position: absolute;
  top: 33%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0 0 3px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel-2) 90%, transparent);
  color: var(--text);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  opacity: 0.95;
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease,
    transform 160ms ease, border-color 160ms ease;
}

.rail-arrow.prev { left: -16px; }
.rail-arrow.next { right: -16px; }

.rail-wrap:hover .rail-arrow,
.rail-arrow:focus-visible { opacity: 1; }

.rail-arrow:hover,
.rail-arrow:focus-visible {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  transform: scale(1.07);
  box-shadow: 0 12px 32px rgba(81, 254, 174, 0.32);
}

.rail-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.rail-arrow[disabled] {
  opacity: 0;
  pointer-events: none;
  transform: none;
}

@media (max-width: 720px) {
  .hero-rotator { min-height: 340px; }
  .hero-slide .hero-inner { padding-bottom: 52px; }
  .top10-rail { grid-auto-columns: 196px; gap: 16px; }
  .top10-face { gap: 6px; }
  .top10-rank { width: 46px; font-size: 50px; -webkit-text-stroke-width: 1.6px; margin-bottom: 9px; }
  .top10-card .poster { border-radius: 13px; }
  .top10-card .card-title { font-size: 13px; }
  /* A 144 px poster cannot hold the score and SUB/DUB side by side along the bottom.
     Keep audio at bottom-right and move the score to top-right, where the 18+ flag
     (top-left) cannot meet it. */
  .top10-card .poster .badge {
    left: auto;
    right: 8px;
    top: 8px;
    bottom: auto;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 6px;
  }
  /* Touch screens swipe, but the arrows stay visible so paging is obvious without
     hover; they sit at mid-poster height where the score and audio chips are not. */
  .rail-arrow {
    display: grid;
    width: 38px;
    height: 38px;
    font-size: 21px;
    top: 40%;
    opacity: 0.95;
  }
  .rail-arrow.prev { left: 4px; }
  .rail-arrow.next { right: 4px; }
}

/* Screen-reader-only text, used for the spoken rank beside each chart position. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- detail screen ---------- */

.crumbs {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  margin: 0 0 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.crumbs a { color: var(--muted); transition: color 140ms ease; }
.crumbs a:hover { color: var(--accent); }

.detail-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: var(--panel);
  isolation: isolate;
  box-shadow: var(--shadow);
}

.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--hero);
  background-size: cover;
  background-position: center 30%;
  opacity: 0.5;
  filter: saturate(1.05);
  z-index: -2;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 90%, transparent) 42%, color-mix(in srgb, var(--bg) 30%, transparent) 100%),
    linear-gradient(0deg, var(--bg) 4%, color-mix(in srgb, var(--bg) 42%, transparent) 34%, transparent 72%);
  z-index: -1;
}

.detail-hero-inner {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 30px;
  padding: clamp(20px, 2.4vw, 30px);
  align-items: start;
}

.detail-poster {
  width: 100%;
  /* The width/height attributes are presentational hints; without this they would win
     over the 2:3 box and the poster would render at the attribute height. */
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  background: var(--bg-2);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
}

.detail-head h1 {
  margin: 6px 0 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.detail-alt {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

.detail-meta {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.detail-meta .score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 800;
}

.detail-actions {
  margin: 20px 0 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Secondary actions sit on artwork, so they use a scrim of the page surface plus a
   visible edge instead of the flat panel colour used on plain pages. */
.detail-actions .btn:not(.primary) {
  background: color-mix(in srgb, var(--bg) 52%, transparent);
  border-color: color-mix(in srgb, var(--text) 26%, transparent);
  backdrop-filter: blur(10px);
}

.detail-actions .btn:not(.primary):hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.next-ep { margin: 14px 0 0; font-size: 13px; }

.synopsis {
  max-width: 72ch;
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.72;
}

.meta-table {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  max-width: 760px;
  background: var(--panel);
}

.meta-table dt,
.meta-table dd {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.meta-table dt {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  font-weight: 600;
}

.meta-table dd { color: var(--text); }

.meta-table dt:last-of-type,
.meta-table dd:last-of-type { border-bottom: 0; }

/* ---------- manga detail + chapter list ---------- */

.manga-note { font-size: 13px; align-self: center; }

/* Licensed title with an empty feed: say why, show what exists, link the official one. */
.manga-fallback {
  border: 1px solid #6d2f2f;
  border-left: 3px solid #c0392b;
  background: rgba(192, 57, 43, 0.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 14px;
}

.manga-fallback p { margin: 0; }
.manga-fallback p + p { margin-top: 10px; }
#manga-fallback:empty { display: none; }

.manga-chapter-tools {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.manga-chapter-tools p { margin: 0; font-size: 13px; }

.manga-group { margin: 0 0 20px; }

.manga-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 15px;
}

.manga-group-name { font-weight: 700; }

.manga-rows {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}

.manga-ch {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: baseline;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.manga-ch:last-child { border-bottom: 0; }

.manga-ch:hover { background: var(--panel); }

.manga-ch-num {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.manga-ch-title { min-width: 0; overflow-wrap: anywhere; }

.manga-ch-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

@media (max-width: 720px) {
  .manga-ch { grid-template-columns: 1fr; gap: 4px; }
  .manga-ch-meta { white-space: normal; }
}

/* ---------- manga reader ---------- */

.reader-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.reader-title { min-width: 0; }

.reader-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reader-title h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 33px);
  overflow-wrap: anywhere;
}

.reader-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reader-step {
  height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.reader-step[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.reader-status {
  min-height: 18px;
  margin: 0 0 14px;
  font-size: 12.5px;
}

.reader-status.is-error { color: var(--bad); }

/* The strip is the page: one column, fit to the available width. A 2:3 placeholder
   holds the scroll position while a lazily loaded page is still arriving. */
.reader-strip {
  max-width: 900px;
  margin: 0 auto;
  background: #050706;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.reader-page {
  position: relative;
  margin: 0;
  min-height: 120px;
  background: #080b0a;
  scroll-margin-top: calc(var(--header-h) + 14px);
}

.reader-page:not(.is-loaded) { aspect-ratio: 2 / 3; }

.reader-page + .reader-page { border-top: 1px solid #131816; }

.reader-page img {
  display: block;
  width: 100%;
  height: auto;
}

.reader-page:not(.is-loaded) img { opacity: 0; }

.reader-page-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #5c6f67;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.reader-page.is-loaded .reader-page-state { display: none; }

.reader-page.is-error {
  aspect-ratio: auto;
  min-height: 30vh;
  border: 1px solid #7a2b2b;
}

.reader-page.is-error .reader-page-state {
  display: grid;
  color: var(--bad);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.reader-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 18px auto 92px;
}

/* A floating page counter survives the whole strip without taking a row of artwork. */
.reader-pill {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

.reader-pill span {
  min-width: 92px;
  text-align: center;
  font-weight: 650;
}

.reader-jump {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.reader-jump:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-dim);
  color: var(--accent);
}

.reader-start-over[hidden] { display: none; }

@media (max-width: 720px) {
  .reader-head { align-items: flex-start; }
  .reader-actions { width: 100%; }
  .reader-actions .btn { flex: 1 1 auto; }
  .reader-strip { border-radius: 0; border-left: 0; border-right: 0; }
  .reader-page { scroll-margin-top: 104px; }
  .reader-pill { bottom: 12px; }
}

.jump {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.jump label { font-size: 13px; color: var(--muted); }

.jump input {
  width: 96px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  font-size: 14px;
}

.jump input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  max-width: 960px;
}

.ep {
  display: grid;
  place-items: center;
  padding: 12px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease,
    transform 140ms ease;
}

.ep:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: var(--accent-dim);
  color: var(--accent);
  transform: translateY(-1px);
}

.ep.last {
  border-color: transparent;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  font-weight: 800;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 24%, transparent);
}

.ep-window-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  margin-top: 14px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .detail-hero-inner { grid-template-columns: 132px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .detail-actions .btn { flex: 1 1 auto; }
  .meta-table { grid-template-columns: 120px minmax(0, 1fr); }
}

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

.watch-head { margin: 0 0 18px; }

.watch-head h1 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.watch-head p { margin: 5px 0 0; font-size: 13.5px; color: var(--muted); }

.player-shell {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  /* Replaced with the real video ratio once metadata arrives; 16:9 while idle. */
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  overflow: hidden;
  background: #000 center / cover no-repeat;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}

.player {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  object-fit: contain;
}

/* Fill crops the sides of a 4:3 episode to a 16:9 box; Fit shows the whole frame.
   Fit is the default because cropping old anime cuts off art and signs. */
.player-shell[data-fit="fill"] {
  aspect-ratio: 16 / 9;
  max-width: 1040px;
}

.player-shell[data-fit="fill"] .player {
  object-fit: cover;
}

/* Fullscreen is the screen, not the page column: drop the 1040 px cap and ratio. */
.player-shell:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  aspect-ratio: auto !important;
  border: 0;
  border-radius: 0;
}

.player-shell:fullscreen .player {
  width: 100%;
  height: 100%;
}

.player::cue {
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: var(--font);
}

/* Site-style player overlay: our own controls, so the browser chrome never shows. */
.pv-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.20) 0%, rgba(0, 0, 0, 0) 28%, rgba(0, 0, 0, 0.72) 100%);
  opacity: 1;
  transition: opacity 180ms ease;
  z-index: 2;
}

.pv-overlay.idle {
  opacity: 0;
  pointer-events: none;
}

/* The controls fade out, so the pointer must go with them: a visible arrow parked on
   the video is exactly the thing the user has to shoo away. Any mouse move restores it. */
.player-shell.is-idle,
.player-shell.is-idle .player,
.player-shell.is-idle .pv-overlay {
  cursor: none;
}

.pv-overlay.idle .pv-bottom,
.pv-overlay.idle .pv-skip,
.pv-overlay.idle .pv-big {
  pointer-events: none;
}

.pv-big {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(6, 12, 9, 0.66);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease, background 140ms ease, color 140ms ease,
    box-shadow 140ms ease;
}

.pv-big:hover {
  background: var(--accent);
  border-color: transparent;
  color: #03130c;
  transform: scale(1.06);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--accent) 35%, transparent);
}
.pv-big.playing { opacity: 0; pointer-events: none; }
.player-shell:hover .pv-big.playing { opacity: 1; pointer-events: auto; }

.pv-skip {
  position: absolute;
  right: 18px;
  bottom: 96px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(10, 12, 16, 0.82);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pv-skip:hover { border-color: var(--accent); color: var(--accent); }
.pv-skip[hidden] { display: none; }

.pv-bottom {
  width: 100%;
  padding: 8px 14px 10px;
  color: #fff;
}

.pv-seekwrap {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
}

.pv-loaded {
  position: absolute;
  left: 0;
  top: 7px;
  height: 4px;
  width: 0;
  border-radius: 999px;
  background: rgba(81, 254, 174, 0.3);
  pointer-events: none;
}

.pv-seek {
  position: relative;
  width: 100%;
  margin: 0;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  cursor: pointer;
}

.pv-seek::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.pv-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}

.pv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.pv-btn {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
}

.pv-btn:hover { background: rgba(255, 255, 255, 0.14); }

.pv-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}

.pv-grow { flex: 1; }

/* Phones lose the desktop extras so the remaining controls never run past the
   player edge: hardware volume, a double-tap for ±10s and the OS handles PiP. */
@media (max-width: 720px) {
  .pv-bottom { padding: 6px 10px 8px; }
  .pv-row { gap: 4px; }
  .pv-btn { height: 28px; min-width: 26px; padding: 0 4px; font-size: 13px; }
  .pv-time { font-size: 11px; }
  #pv-back,
  #pv-fwd,
  #pv-vol,
  #pv-pip { display: none; }
}

.pv-vol {
  width: 72px;
  height: 3px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  cursor: pointer;
}

.pv-vol::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 0;
}

.pv-menu {
  position: absolute;
  right: 14px;
  bottom: 58px;
  width: 220px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(6, 12, 9, 0.97);
  color: #fff;
  max-height: 320px;
  overflow: auto;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
}

.pv-menu[hidden] { display: none; }
.pv-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 4px 0 6px; }
.pv-menu-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pv-menu-list button {
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.pv-menu-list button:hover { border-color: var(--accent); color: var(--accent); }
.pv-menu-list button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.pv-muted { color: var(--muted); font-size: 12px; }

/* Trailer uses the same 16:9 box, but the video belongs to YouTube's player. */
iframe.trailer {
  border: 0;
  height: auto;
}

.trailer-facade {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  color: #fff;
}

.trailer-facade img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 140ms ease;
}

.trailer-facade:hover img,
.trailer-facade:focus-visible img { opacity: 1; }

.trailer-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 44px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.trailer-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  pointer-events: none;
}

.trailer-empty {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: var(--bg-2);
  color: var(--text);
}

.trailer-empty p { max-width: 42ch; }

.player-status {
  position: absolute;
  left: 14px;
  top: 14px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  background: rgba(5, 11, 8, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.player-status[hidden] { display: none; }

.player-status[data-tone="bad"] { background: rgba(122, 43, 43, 0.92); color: #ffe9e9; }

.player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  max-width: 1040px;
  margin: 14px 0 0;
  font-size: 13px;
}

.player-bar .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-inline select {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.field-inline select:hover { border-color: var(--line-strong); }

.field-inline select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.field-inline select:disabled { opacity: 0.55; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.demo-note {
  max-width: 1040px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 62%, transparent);
}

.demo-note code { color: var(--text); }

#player-hint { font-size: 12px; }

/* ---------- comments (local store, under the player) ---------- */

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.comments-head .section-title {
  margin: 0;
  font-size: 18px;
}

.comments-head .section-title .muted {
  font-size: 13px;
  font-weight: 400;
}

.comment-form {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 18px;
}

/* Sign-in bar: comments belong to a profile, so signed-out readers get a door, not a
   "write your name" field. */
.comment-signin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 760px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
}

.comment-signin p { margin: 0; }
.comment-signin .btn { flex: 0 0 auto; }

.comment-as {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--muted);
}

.comment-as strong { color: var(--text); }

.comment-as img,
.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.comment-avatar { width: 26px; height: 26px; }

.linklike {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.comment-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.comment-form textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.comment {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.comment-meta strong { color: var(--accent); font-weight: 600; }

.comment-meta .comment-del,
.reply-meta .comment-del,
.admin-announce-meta .comment-del {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.comment-meta .comment-del:hover,
.reply-meta .comment-del:hover,
.admin-announce-meta .comment-del:hover { color: var(--text); border-color: var(--muted); }
.comment-meta .comment-del:disabled,
.reply-meta .comment-del:disabled,
.admin-announce-meta .comment-del:disabled { opacity: 0.5; cursor: default; }

.comment-body {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .comments-head { flex-wrap: wrap; }
  .comment-actions { flex-direction: column; align-items: flex-start; }
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 34px 22px 42px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--panel) 40%, transparent));
}

.footer p { margin: 4px 0; }

.footer strong { color: var(--accent); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  margin: 0 0 14px;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}

.footer-links a:hover { color: var(--accent); }

/* ---------- legal pages (terms, dmca, contact) ---------- */

.legal {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 10px 0 30px;
}

.legal-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legal-updated {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12.5px;
}

.legal .lede { margin-bottom: 30px; }

.legal section { margin: 28px 0; }

.legal h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.legal p,
.legal li { color: var(--text-dim); }

.legal p { margin: 0 0 10px; }

.legal ul,
.legal ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}

.legal li { margin: 6px 0; }

.legal a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal a:hover { color: var(--accent-soft); }

.legal code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.legal-note {
  margin: 18px 0 26px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
}

.legal-note p { margin: 0 0 6px; }
.legal-note p:last-child { margin-bottom: 0; }

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.legal-nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.legal-nav a:hover { color: var(--accent); }

/* ---------- account chip and panel ---------- */

.account-slot { position: relative; display: flex; align-items: center; }

.account-btn {
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--accent-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 24%, transparent);
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.account-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 34%, transparent);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 13px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  max-width: 190px;
  transition: border-color 140ms ease, background 140ms ease;
}

.account-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-dim);
}

.account-chip img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}

.account-initial {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
}

.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 2px;
}

.account-menu-head {
  margin: 4px 8px 8px;
  font-size: 12px;
  color: var(--muted);
}

.account-menu-head strong { color: var(--text); }

.account-menu button {
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.account-menu button:hover { background: var(--bg-2); color: var(--accent); }

/* The sign-in / create-profile panel. Netflix-style: pick a face first, then a name. */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: start center;
  padding: 6vh 16px 4vh;
  overflow: auto;
  background: rgba(2, 6, 4, 0.78);
  backdrop-filter: blur(10px);
}

.auth-card {
  position: relative;
  width: min(560px, 100%);
  padding: 34px 34px 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--bg-2));
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.6);
}

/* A thin mint edge, the same accent language as the logo tile. */
.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.65;
}

.auth-brand {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-card h2 { margin: 0 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -0.025em; }

.auth-lede { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.auth-close:hover { background: var(--panel); border-color: var(--line); color: var(--text); }

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 5px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.auth-tabs button {
  flex: 1;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.auth-tabs button:hover { color: var(--text); }

.auth-tabs button.on {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

.auth-form { display: grid; gap: 14px; }

.auth-credentials { display: grid; gap: 14px; }

.auth-credentials[hidden],
.auth-avatar-block[hidden],
.auth-name-field[hidden],
.auth-tabs[hidden] { display: none; }

.auth-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 10px;
  max-height: 264px;
  overflow: auto;
  padding: 3px;
}

/* Character icons, not poster art: square crop, round frame, face kept near the top. */
.avatar-pick {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-2);
  aspect-ratio: 1;
  cursor: pointer;
  line-height: 0;
}

.avatar-pick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.avatar-pick:hover { border-color: var(--muted); transform: scale(1.04); }

.avatar-pick.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  transform: scale(1.04);
}

.avatar-pick { transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease; }

.auth-field {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.auth-field input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.auth-error {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: #ff8f8f;
}

.auth-submit { justify-self: start; padding: 11px 22px; }

.auth-signout { justify-self: start; }

.auth-google {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-google-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
}

.auth-google-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-g {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.auth-google p { margin: 8px 0 0; font-size: 12px; line-height: 1.5; }

.auth-foot { margin: 16px 0 0; font-size: 12px; }

/* Tablets: tighten the nav before it starts clipping, then let search take its own row. */
@media (max-width: 1120px) {
  .nav a { padding: 8px 9px; font-size: 13px; }
  .search input { width: 200px; }
  .topbar { gap: 14px; }
}

@media (max-width: 940px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 2; }
  .account-slot { order: 3; margin-left: auto; }
  .search { order: 4; width: 100%; margin-left: 0; }
  .search input,
  .search input:focus { width: 100%; max-width: none; }
}

@media (max-width: 720px) {
  :root { --poster-w: 140px; }

  /* Phone header: brand, search and account share one row; nav scrolls beneath it.
     The old stacked flow cost 203px, which is half the phone viewport. */
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "brand search account"
      "nav nav nav";
    align-items: center;
    gap: 8px 10px;
    min-height: 0;
    padding: 9px 14px 7px;
  }

  .brand { grid-area: brand; font-size: 15.5px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-word { white-space: nowrap; }

  .nav {
    grid-area: nav;
    gap: 0;
    width: 100%;
    padding-bottom: 1px;
    overflow-x: auto;
  }

  .nav a { padding: 7px 8px; font-size: 12.5px; }

  .search {
    grid-area: search;
    margin: 0;
    min-width: 0;
  }

  .search::before { left: 11px; width: 14px; height: 14px; margin-top: -7px; }

  .search input,
  .search input:focus {
    width: 100%;
    max-width: none;
    padding: 8px 12px 8px 32px;
    font-size: 13px;
  }

  .account-slot { grid-area: account; min-width: 0; margin: 0; }
  .account-chip { max-width: 132px; }
  .account-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-btn { padding: 8px 13px; font-size: 13px; }

  main { padding: 20px 14px 56px; }
  .section { margin: 32px 0; }
  h1 { font-size: clamp(24px, 6vw, 30px); }
  .section-head h2 { font-size: 17px; }
}

/* Very narrow phones: drop the wordmark so the search field keeps a usable width. */
@media (max-width: 380px) {
  .brand-word { display: none; }
}

/* Very narrow phones: the detail art column must not squeeze the title. */
@media (max-width: 460px) {
  .detail-hero-inner { grid-template-columns: 104px minmax(0, 1fr); gap: 13px; padding: 14px; }
  .detail-head h1 { font-size: 24px; }
  .meta-table { grid-template-columns: 96px minmax(0, 1fr); }
  .meta-table dt,
  .meta-table dd { padding: 10px 12px; font-size: 13px; }
}

/* ---------- settings ---------- */

.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.settings-head h1 { margin-bottom: 4px; }
.settings-head .lede { margin-bottom: 0; }
.settings-version { margin: 0; font-size: 12px; letter-spacing: 0.04em; white-space: nowrap; }

.settings-shell {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
}

.settings-tab {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.settings-tab:hover { color: var(--text); background: var(--panel-2); }

.settings-tab.on {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  font-weight: 800;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}

.settings-body { min-width: 0; display: grid; gap: 16px; }
.settings-panel { display: grid; gap: 16px; min-width: 0; }
.settings-panel[hidden] { display: none; }
#account-settings { display: grid; gap: 16px; min-width: 0; }

.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  min-width: 0;
}

.settings-card h2 { margin: 0 0 10px; font-size: 19px; letter-spacing: -0.01em; }
.settings-card h3 { margin: 20px 0 10px; font-size: 16px; }
.settings-card h3:first-of-type { margin-top: 0; }
.settings-card p { line-height: 1.6; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  cursor: pointer;
}

.settings-card h2 + .setting-row,
.settings-card h3 + .setting-row { border-top: 0; padding-top: 4px; }

.setting-copy { display: grid; gap: 3px; min-width: 0; }
.setting-copy strong { font-size: 14px; font-weight: 700; }
.setting-copy small { font-size: 12.5px; line-height: 1.5; color: var(--muted); }

.settings-select { flex: 0 0 auto; }
.settings-select select {
  min-width: 132px;
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.settings-select select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.switch { position: relative; display: inline-flex; flex: 0 0 auto; width: 44px; height: 26px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  border: 1px solid color-mix(in srgb, var(--line-strong) 82%, transparent);
  pointer-events: none;
  transition: background 150ms ease, border-color 150ms ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.32);
  transition: transform 150ms ease, background 150ms ease;
}
.switch input:checked + .switch-track { background: color-mix(in srgb, var(--accent) 82%, var(--panel)); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: 0.5; }

.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.settings-actions .btn { padding: 9px 14px; font-size: 13.5px; }

.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 48%, var(--line)); color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.settings-foot { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; }
.settings-form { display: grid; gap: 13px; margin-top: 14px; }
.settings-form .auth-field input { width: 100%; }

.settings-flow {
  margin-top: 14px;
  padding: 16px;
  border: 1px dashed color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-2) 76%, transparent);
}

.settings-flow .settings-form { margin-top: 12px; }
.settings-sent { margin: 0; font-size: 14px; }
.settings-sent strong { color: var(--accent); font-weight: 700; }
.settings-flow-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.settings-flow-note .bad,
.settings-error.bad,
.settings-success.bad { color: var(--bad); }

.settings-error { min-height: 18px; margin: 0; font-size: 13px; color: var(--bad); }
.settings-success { margin: 0; font-size: 13px; color: var(--good); }
.settings-success.bad { color: var(--bad); }
.settings-current { margin: 0 0 4px; }
.settings-current strong { color: var(--accent); }

.settings-mail-note {
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 12.5px;
  line-height: 1.55;
}
.settings-mail-note.warn { border-color: color-mix(in srgb, #e0a13c 45%, var(--line)); }
.settings-mail-note.ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }

.storage-line { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.storage-meter { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.storage-meter span { display: block; width: 2%; height: 100%; background: var(--accent); transition: width 300ms ease; }

.account-card .account-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.account-head-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--bg-2);
}
.account-head-copy { min-width: 0; flex: 1; }
.account-head-copy h2 { margin: 0 0 1px; font-size: 20px; }
.account-head-copy p { margin: 0; font-size: 13px; color: var(--muted); }
.account-head-copy p:first-of-type { color: var(--text-dim); }
.account-signedout p { max-width: 64ch; }
.account-avatar-block { max-height: 242px; overflow: auto; padding: 2px; }

.about-card { display: flex; align-items: center; gap: 16px; }
.about-card h2 { margin: 0 0 2px; }
.about-card p { margin: 0; }
.about-mark {
  flex: 0 0 auto;
  border-radius: 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  background: radial-gradient(120% 120% at 30% 10%, #14241d 0%, #060f0b 70%);
  padding: 4px;
}

.settings-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.settings-details summary { cursor: pointer; font-weight: 650; color: var(--text-dim); }
.settings-details summary:hover { color: var(--accent); }
.settings-details ol { margin: 12px 0 8px; padding-left: 22px; font-size: 13px; line-height: 1.65; }
.settings-details p { font-size: 12.5px; color: var(--muted); }
.settings-details code { font-size: 12px; }
.settings-gate-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

/* Explicit reduced-motion preference; the OS media query below still applies too. */
html[data-motion="reduce"] { scroll-behavior: auto; }
html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

@media (max-width: 760px) {
  .settings-shell { grid-template-columns: 1fr; gap: 14px; }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-tab { width: auto; white-space: nowrap; text-align: center; }
  .settings-head { align-items: flex-start; flex-direction: column; gap: 6px; margin-bottom: 16px; }
  .settings-card { padding: 17px; }
  .setting-row { gap: 14px; }
  .setting-copy small { font-size: 12px; }
  .settings-select select { min-width: 112px; }
  .account-head-avatar { width: 54px; height: 54px; }
  .account-head-copy { flex-basis: calc(100% - 72px); }
  .account-head .btn { margin-left: auto; }
  .about-card { align-items: flex-start; }
  .settings-actions .btn { flex: 1 1 auto; }
}

/* ---------- community: announcements, forum, staff area ---------- */

.announcements {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px clamp(14px, 2.4vw, 30px) 0;
}

.announce-stack { display: grid; gap: 8px; }

.announce {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  box-shadow: var(--shadow-soft);
}

.announce-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.announce-copy { flex: 1; min-width: 0; }

.announce-copy p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announce-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.announce-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.announce-close:hover { color: var(--text); border-color: var(--line-strong); background: var(--bg-2); }

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.role-owner {
  background: linear-gradient(135deg, #fbe7a0, #e8a93a);
  color: #2a1a00;
  border: 1px solid color-mix(in srgb, #f9e08a 65%, #7a5a10);
  box-shadow: 0 0 10px color-mix(in srgb, #f7d774 28%, transparent);
}
.role-owner::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 4px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.2 7.2l4.6 3.1L12 4l4.2 6.3 4.6-3.1-2 10.1H5.2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.2 7.2l4.6 3.1L12 4l4.2 6.3 4.6-3.1-2 10.1H5.2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.role-mod,
.role-senior_mod,
.role-head_mod {
  --role: #38bdf8;
  border: 1px solid color-mix(in srgb, var(--role) 50%, transparent);
  background: color-mix(in srgb, var(--role) 13%, transparent);
  color: var(--role);
}

.role-senior_mod,
.role-head_mod {
  border-color: color-mix(in srgb, var(--role) 68%, transparent);
}

.role-admin,
.role-senior_admin,
.role-head_admin {
  --role: #a78bfa;
  border: 1px solid color-mix(in srgb, var(--role) 62%, transparent);
  background: color-mix(in srgb, var(--role) 18%, transparent);
  color: var(--role);
}

.role-head_admin,
.role-head_mod {
  font-weight: 900;
}

.form-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.form-note[data-tone="bad"], .form-note.bad, .forum-note { color: var(--bad); }

.field textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field textarea:hover { border-color: var(--line-strong); }

.field textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.forum-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.forum-head .lede { margin-bottom: 0; }
.forum-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.forum-search { display: flex; gap: 8px; max-width: 620px; margin: 0 0 16px; }

.forum-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.forum-search input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.forum-new { margin-bottom: 18px; }
.forum-new h2 { margin-bottom: 12px; }
.forum-new form { display: grid; gap: 12px; }

.forum-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.forum-form-actions .form-note { margin: 0; }

.forum-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.forum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  transition: border-color 140ms ease, background 140ms ease;
}

.forum-row:hover { border-color: var(--line-strong); background: var(--panel); }
.forum-row.is-pinned { border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }

.forum-row-main { min-width: 0; display: grid; gap: 4px; color: inherit; }
.forum-row-main:hover { color: inherit; }

.forum-row-title { font-size: 15.5px; font-weight: 700; color: var(--text); }
.forum-row-main:hover .forum-row-title { color: var(--accent); }

.forum-row-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.forum-row-meta {
  flex: none;
  display: grid;
  justify-items: end;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.forum-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.forum-chip.muted { border-color: var(--line); background: transparent; color: var(--muted); }

.forum-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }

.crumbs { margin: 0 0 14px; font-size: 13px; }

.thread {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.thread h1 { font-size: clamp(22px, 2.6vw, 30px); }

.thread-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.thread-meta strong { color: var(--accent); font-weight: 650; }

.thread-body, .reply-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-body { margin: 14px 0 0; font-size: 15px; line-height: 1.65; }

.thread-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.thread-tools .btn { height: 34px; padding: 0 13px; font-size: 13px; }

.replies { margin-top: 26px; }
.reply-list { list-style: none; display: grid; gap: 10px; margin: 0 0 20px; padding: 0; }

.reply {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.reply-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.reply-meta strong { color: var(--accent); font-weight: 600; }
.reply-body { margin: 6px 0 0; font-size: 14px; line-height: 1.55; }

.reply-form { display: grid; gap: 10px; max-width: 760px; margin-top: 16px; }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-head .lede { margin-bottom: 0; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.admin-stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
}

.admin-stat strong { display: block; font-size: 24px; line-height: 1.1; color: var(--accent); }
.admin-stat span { font-size: 12px; color: var(--muted); }

.admin-note { min-height: 18px; margin: 0 0 8px; }
.admin-announce-form { display: grid; gap: 12px; margin-bottom: 16px; }

.admin-announce-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.admin-announce {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.admin-announce-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.admin-announce-meta strong { color: var(--accent); font-weight: 600; }
.admin-announce p { margin: 6px 0 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.admin-table-wrap { padding: 0; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.admin-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }

.admin-member-name { display: block; font-weight: 650; color: var(--text); }
.admin-member-since { display: block; margin-top: 2px; font-size: 11.5px; }
.admin-email { color: var(--text-dim); font-size: 12.5px; overflow-wrap: anywhere; }
.admin-fixed { font-size: 11.5px; }

.role-select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.role-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.admin-gate { display: grid; justify-items: start; gap: 14px; max-width: 560px; }
.admin-gate .form-note, .admin-gate .muted { margin: 0; }

.admin-claim {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin: 0 0 16px;
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.admin-claim h2 { margin: 0; font-size: 18px; }
.admin-claim p { margin: 0; max-width: 680px; }
.admin-ban { color: var(--bad); }
.admin-ban-reason { display: block; margin-top: 2px; font-size: 11.5px; color: var(--bad); }
.admin-table tr.is-banned td { background: color-mix(in srgb, var(--bad) 5%, transparent); }

@media (max-width: 720px) {
  .announcements { padding-top: 10px; }
  .forum-head { align-items: flex-start; }
  .forum-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .forum-row-meta { justify-items: start; }
  .thread { padding: 17px; }
  .admin-table th, .admin-table td { padding: 10px 12px; }
}

/* ---- public profile ------------------------------------------------------- */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px;
  margin: 8px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
}
.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--panel-2);
}
.profile-avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
}
.profile-id h1 { margin: 0 0 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-joined { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.profile-actions, .account-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}
.profile-stat {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.profile-stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.profile-stat-label { font-size: 13px; color: var(--text-dim); }
.profile-stat-hint { font-size: 11.5px; color: var(--muted); }
.profile-genres { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.profile-genre {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
}
.profile-genre b { color: var(--accent); font-size: 12px; }
.profile-back { margin: 20px 0 8px; }

/* ---- titles (derived from watch stats, never stored) --------------------- */
/* The default sits first so every rarity class below overrides it by source order. */
.title-chip,
.title-card,
.title-goal { --tier: var(--accent); }

.title-rarity-common { --tier: #9fb0bd; }
.title-rarity-uncommon { --tier: #38bdf8; }
.title-rarity-rare { --tier: #a78bfa; }
.title-rarity-epic { --tier: #fb923c; }
.title-rarity-legendary { --tier: #fbbf24; }

.title-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1px solid color-mix(in srgb, var(--tier) 50%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tier) 12%, var(--panel));
  color: var(--tier);
  font-size: 12.5px;
  font-weight: 600;
  vertical-align: middle;
}
.title-chip-mark { width: 14px; height: 14px; flex: none; }
.title-mark { width: 18px; height: 18px; display: block; }
.title-granted {
  --tier: #f7d774;
  background: linear-gradient(135deg, color-mix(in srgb, #f7d774 22%, var(--panel)), color-mix(in srgb, #e8a93a 10%, var(--panel)));
  border-color: color-mix(in srgb, #f7d774 58%, var(--line));
  box-shadow: 0 0 14px color-mix(in srgb, #f7d774 18%, transparent);
}
.title-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
}
.title-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--tier) 26%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(150deg, var(--panel), var(--bg-2));
}
.title-medal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tier) 26%, var(--panel)), color-mix(in srgb, var(--tier) 7%, var(--panel)));
  border: 1px solid color-mix(in srgb, var(--tier) 40%, var(--line));
  color: var(--tier);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tier) 18%, transparent), 0 0 12px color-mix(in srgb, var(--tier) 16%, transparent);
}
.title-body { display: grid; gap: 1px; min-width: 0; }
.title-body b { font-size: 14px; color: var(--text); }
.title-body span { font-size: 12px; color: var(--muted); }
.title-next { margin-top: 16px; }
.title-next h3 { margin: 0 0 8px; font-size: 14px; color: var(--text-dim); font-weight: 600; }
.title-goals { list-style: none; display: grid; gap: 8px; padding: 0; margin: 0; }
.title-goal {
  padding: 11px 14px;
  border: 1px dashed color-mix(in srgb, var(--tier) 30%, var(--line-strong));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 65%, transparent);
}
.title-goal-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 7px; }
.title-goal-head b { display: inline-flex; align-items: center; gap: 7px; color: var(--text-dim); }
.title-goal-mark { width: 14px; height: 14px; flex: none; color: var(--tier); opacity: 0.8; }
.title-goal-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.title-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.title-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tier), color-mix(in srgb, var(--tier) 55%, var(--text)));
}

[data-theme="light"] .role-mod,
[data-theme="light"] .role-senior_mod,
[data-theme="light"] .role-head_mod { --role: #0369a1; }
[data-theme="light"] .role-admin,
[data-theme="light"] .role-senior_admin,
[data-theme="light"] .role-head_admin { --role: #6d28d9; }
[data-theme="light"] .title-rarity-common { --tier: #475569; }
[data-theme="light"] .title-rarity-uncommon { --tier: #0369a1; }
[data-theme="light"] .title-rarity-rare { --tier: #6d28d9; }
[data-theme="light"] .title-rarity-epic { --tier: #b45309; }
[data-theme="light"] .title-rarity-legendary { --tier: #a16207; }
[data-theme="light"] .title-granted { --tier: #a16207; }

/* ---- staff member search ------------------------------------------------- */
.admin-search { display: block; margin: 0 0 10px; }
.admin-search input {
  width: min(340px, 100%);
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.admin-search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.admin-title-cell { min-width: 150px; }
.admin-title-input {
  width: 100%;
  min-width: 120px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.admin-title-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.admin-title-input::placeholder { color: var(--muted); }
.admin-title-static { font-size: 13px; color: var(--text-dim); }
.author-link { color: inherit; text-decoration: none; border-bottom: 1px dotted color-mix(in srgb, var(--accent) 45%, transparent); }
.author-link:hover { color: var(--accent); }
.comment-avatar-link { display: inline-flex; }
@media (max-width: 720px) {
  .profile-hero { flex-direction: column; text-align: center; align-items: center; }
  .profile-id h1 { justify-content: center; }
  .profile-actions, .account-links { justify-content: center; }
}
