/* ── CaughtUp · Design v6 "Spotlight" ────────────────────────────────
   Concept: a theater just before the next episode. Dark "After Dark" =
   violet-black stage + warm spotlight amber (the single CTA color — warm
   on dark reads cozy/binge, gold reads premium). Light "Matinee" = warm
   paper + ink + deep amber. Per-series atmosphere triplets unchanged.
   v7 (2026-06-12): BORDERLESS pass — no 1px enclosures around content
   groups; grouping via tonal fields (surface/surface-2), whitespace and
   posters. --line remains only for scrollbars. Sven's
   standing rule (borderless-design skill) — don't reintroduce boxes.
   Open-source ingredients: easing curves from Open Props (MIT,
   github.com/argyleink/open-props); display font Bricolage Grotesque
   (SIL OFL), self-hosted — Google-Fonts CDN would be a GDPR violation. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root, [data-theme="dark"] {
  --bg: #0d0b12;
  --surface: #161320;
  --surface-2: #1e1a2b;
  --text: #f0ecf4;
  --muted: #9a93a8;
  --line: #2a2438;
  --accent: #f0a738;          /* spotlight amber */
  --accent-ink: #221503;      /* text on amber */
  --halo: rgba(13, 11, 18, 0.88);
  --atmos-amt: 58%;
  --atmos-1: #3a4a66; --atmos-2: #2a3a55; --atmos-3: #1f2c44;
  /* easing tokens (Open Props, MIT) */
  --ease-out-4: cubic-bezier(0, 0, 0.1, 1);
  --ease-squish: cubic-bezier(0.5, -0.3, 0.1, 1.5);
  --ease-spring: cubic-bezier(0.2, 1.4, 0.4, 1);
  --font-display: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont,
                  "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efe9dd;
  --text: #201b16;
  --muted: #6e6557;
  --line: #ddd4c4;
  --accent: #b3700e;          /* deep amber, AA on paper */
  --accent-ink: #fffdf8;
  --halo: rgba(246, 243, 236, 0.9);
  --atmos-amt: 32%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* The `hidden` attribute must always win — class rules like `.gate{display:flex}`
   would otherwise override the UA `[hidden]{display:none}` and keep it visible. */
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.25s, color 0.25s;
}

button { font-family: inherit; color: inherit; }
svg text { font-family: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }

/* ── masthead ──────────────────────────────────────────────────────── */
/* Borderless v7: the masthead shares the page's color field — no seam. */
.masthead {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.65rem 1rem;
  background: transparent;
  z-index: 30; flex-shrink: 0;
}
.mast-spacer { flex: 1; }

.brand {
  display: flex; align-items: center; gap: 0.55rem;
  background: none; border: none; cursor: pointer; padding: 0.2rem;
  border-radius: 8px; transition: opacity 0.15s;
}
.brand:hover { opacity: 0.78; }
.brand-web { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; }
.brand h1 {
  font-family: var(--font-display); font-weight: 800; font-size: 1.02rem;
  letter-spacing: 0.01em; white-space: nowrap;
}
.brand h1 span { color: var(--accent); }

.mast-nav { display: flex; gap: 0.2rem; }
.mast-nav button {
  background: none; border: none; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; color: var(--muted);
  padding: 0.4rem 0.65rem; border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}
.mast-nav button:hover { color: var(--text); background: var(--surface-2); }
.mast-nav button.active { color: var(--accent); }

.series-context { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.ctx-back {
  background: var(--surface-2); border: none; border-radius: 9px;
  width: 34px; height: 34px; font-size: 1.3rem; line-height: 1; cursor: pointer;
  flex-shrink: 0; transition: background 0.15s, color 0.15s;
}
.ctx-back:hover { background: var(--surface); color: var(--accent); }
.ctx-title {
  font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
}
.ep-chip {
  display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0;
  background: var(--surface-2); border: none; border-radius: 999px;
  padding: 0.36rem 0.75rem; font-size: 0.76rem; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ep-chip:hover { background: var(--surface); color: var(--text); }
.shield-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #3dbb74; box-shadow: 0 0 8px #3dbb74;
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

.icon-btn {
  background: var(--surface-2); border: none; border-radius: 9px;
  width: 36px; height: 36px; cursor: pointer; font-size: 1rem; line-height: 1;
  flex-shrink: 0; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface); color: var(--accent); }

/* ── page system + transitions ─────────────────────────────────────── */
.viewport { position: relative; flex: 1; min-height: 0; }
.page { position: absolute; inset: 0; }
.page[hidden] { display: none !important; }
.page-home, .page-char, .page-all-series, .page-all-chars { overflow-y: auto; }
.page-series { display: flex; flex-direction: column; overflow: hidden; }

.page-in { animation: page-in 0.32s var(--ease-out-4) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(5px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .page-in, .series-card, .cw-card, .browse-row, .cr-row, .char-portrait-ring,
  .gate, .gate-card { animation: none !important; }
}

/* ── HOME ──────────────────────────────────────────────────────────── */
/* hero: centered, open composition — the live web is the centerpiece,
   content grouped by whitespace, no boxes */
.home-inner { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 2.8rem 1.3rem 4rem; }
.hero-center { max-width: 820px; text-align: center; }
.hero-kicker {
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 0.7rem;
}
.home-title {
  font-family: var(--font-display); font-size: 2.5rem; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.05;
}
.home-title em { color: var(--accent); }
.home-sub {
  color: var(--muted); margin: 0.7rem auto 0; font-size: 0.98rem;
  line-height: 1.6; max-width: 580px;
}
.hero-center .home-search { max-width: 560px; margin-left: auto; margin-right: auto; display: block; }
.hero-center .char-results { max-width: 560px; margin-left: auto; margin-right: auto; text-align: left; }

/* live mini web (real first-episode data, tap a face) */
.hero-stage { margin: 1.6rem auto 0; max-width: 600px; color: var(--accent); }
.hw-tag {
  display: inline-flex; align-items: center; gap: 0.45rem; margin-bottom: 0.2rem;
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.hw-live {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.5s ease-in-out infinite;
}
.hero-stage svg { width: 100%; height: auto; display: block; }
.hw-backdrop { opacity: 0.09; }
.hw-edge { stroke: var(--accent); stroke-opacity: 0.4; stroke-width: 1.3; }
.hw-ring { fill: var(--surface); stroke-width: 2.4; }
.hw-node { cursor: pointer; }
.hw-node text {
  fill: var(--text); font-size: 13px; font-weight: 600;
  paint-order: stroke; stroke: var(--halo); stroke-width: 3px;
}
.hw-bob { animation: hw-bob 5.5s ease-in-out infinite alternate; }
@keyframes hw-bob { to { transform: translateY(-7px); } }
.hw-node:hover .hw-ring { stroke-width: 4; }
@media (prefers-reduced-motion: reduce) { .hw-bob { animation: none; } }

.hero-stage-cap { color: var(--muted); font-size: 0.92rem; margin-top: 0.5rem; }
.hero-stage-cap strong { color: var(--text); }
.hero-map-cta {
  display: block; margin: 1.1rem auto 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 999px 999px 999px 4px; padding: 0.5rem 1.15rem;
  font-family: var(--font-display); font-weight: 800; font-size: 0.88rem;
  transition: transform 0.2s var(--ease-spring), filter 0.15s;
}
.hero-map-cta:hover { transform: translateY(-2px); filter: brightness(1.06); }
.hero-map-cta:active { transform: translateY(0) scale(0.97); }

/* character search results: borderless rows, separated by rhythm only */
.char-results { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.15rem; }
.cr-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left;
  background: none; border: none; border-radius: 10px;
  padding: 0.45rem 0.45rem; cursor: pointer;
  animation: rise 0.35s ease both;
  transition: background 0.15s, transform 0.15s;
}
.cr-row:hover { background: var(--surface); transform: translateX(4px); }
.cr-img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  flex-shrink: 0; background: var(--surface-2);
}
.cr-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-series {
  color: var(--muted); font-size: 0.8rem; margin-left: auto; flex-shrink: 0;
  padding-right: 0.2rem; max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* hero links to the two index pages */
.hero-links { display: flex; gap: 2rem; margin-top: 1.8rem; flex-wrap: wrap; justify-content: center; }
.hero-links a {
  color: var(--accent); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  transition: opacity 0.15s;
}
.hero-links a span { transition: margin-left 0.2s var(--ease-out-4); }
.hero-links a:hover { opacity: 0.85; }
.hero-links a:hover span { margin-left: 0.3rem; }

/* ── INDEX pages (All series / All characters) ─────────────────────── */
.index-inner { max-width: 1080px; margin: 0 auto; padding: 2rem 1.3rem 4rem; }
.index-title {
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 800;
  letter-spacing: -0.015em;
}
.index-sub { color: var(--muted); margin-top: 0.35rem; font-size: 0.92rem; }
.filter-row { display: flex; gap: 0.6rem; margin-top: 1.3rem; flex-wrap: wrap; }
.filter-search {
  flex: 1; min-width: 200px;
  background: var(--surface); color: var(--text);
  border: none; border-radius: 999px;
  font-size: 0.95rem; padding: 0.7rem 1.1rem; outline: none;
  transition: background 0.15s, box-shadow 0.2s;
}
.filter-search::placeholder { color: var(--muted); }
.filter-search:focus {
  background: var(--surface-2);
  box-shadow: 0 10px 34px -18px color-mix(in srgb, var(--accent) 55%, transparent);
}
.filter-select {
  background: var(--surface-2); color: var(--text);
  border: none; border-radius: 999px;
  font-size: 0.88rem; padding: 0.7rem 0.95rem; cursor: pointer; outline: none;
  max-width: 230px; transition: background 0.15s;
}
.filter-select:hover, .filter-select:focus {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}
.filter-select option { background: var(--surface); }

.az-strip { display: flex; flex-wrap: wrap; gap: 0.1rem; margin-top: 1.1rem; }
.az-strip button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 0.82rem;
  padding: 0.25rem 0.45rem; border-radius: 7px;
  transition: color 0.12s, background 0.12s;
}
.az-strip button:hover { color: var(--accent); background: var(--surface-2); }

.index-list { margin-top: 0.8rem; max-width: 760px; }
.index-group[hidden] { display: none; }
.index-letter {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  color: var(--accent); padding: 0.7rem 0.45rem 0.3rem;
}
.index-group .cr-row { animation: none; }
.home-search {
  width: 100%; margin-top: 1.5rem;
  background: var(--surface); color: var(--text);
  border: none; border-radius: 999px;
  font-size: 1rem; padding: 0.9rem 1.25rem; outline: none;
  transition: background 0.15s, box-shadow 0.2s;
}
.home-search::placeholder { color: var(--muted); }
.home-search:focus {
  background: var(--surface-2);
  box-shadow: 0 10px 34px -18px color-mix(in srgb, var(--accent) 55%, transparent);
}

.row-label {
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 1.8rem 0 0.7rem;
}
.cw-row { margin-top: 0.5rem; }
.cw-cards { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.cw-card {
  text-align: left; cursor: pointer; border: none; border-radius: 12px;
  background: var(--surface-2); padding: 0.7rem 0.95rem; min-width: 190px;
  display: flex; flex-direction: column; gap: 0.2rem;
  animation: rise 0.4s ease both; transition: background 0.15s, transform 0.15s;
}
.cw-card:hover { background: var(--surface); transform: translateY(-2px); }
.cw-name { font-weight: 700; font-size: 0.95rem; }
.cw-ep { font-size: 0.78rem; color: var(--accent); font-weight: 600; }

.series-grid {
  margin-top: 1.8rem;
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.series-card {
  position: relative; overflow: hidden; cursor: pointer; text-align: left;
  border: none; border-radius: 14px;
  padding: 0.75rem 0.85rem; aspect-ratio: 2 / 3;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.2rem;
  /* atmosphere gradient shows through when a card has no cover poster */
  background:
    radial-gradient(120% 95% at 0% 0%, color-mix(in srgb, var(--atmos-1) 50%, transparent), transparent 72%),
    radial-gradient(120% 95% at 100% 100%, color-mix(in srgb, var(--atmos-3) 44%, transparent), transparent 72%),
    var(--surface-2);
  animation: rise 0.5s var(--ease-out-4) both;
  transition: transform 0.3s var(--ease-spring), border-color 0.2s, box-shadow 0.25s;
}
.series-card:hover {
  transform: translateY(-5px) scale(1.012);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
}
.sc-cover {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  z-index: 0; transition: transform 0.3s ease;
}
.series-card:hover .sc-cover { transform: scale(1.04); }
.sc-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 30%, rgba(0,0,0,0) 58%);
}
.sc-glow {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(90% 55% at 50% 120%, color-mix(in srgb, var(--atmos-2) 55%, transparent), transparent 72%);
}
.series-card:hover .sc-glow { opacity: 1; }
.sc-title {
  position: relative; z-index: 2; color: #fff;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1rem; line-height: 1.15;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
}
.sc-meta {
  position: relative; z-index: 2; font-size: 0.7rem; color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
.series-card[hidden] { display: none; }
.home-about {
  margin: 4rem auto 0;
  color: var(--muted); font-size: 0.88rem; line-height: 1.6; max-width: 640px;
}
.home-about h3 { color: var(--text); font-size: 0.95rem; margin-bottom: 0.5rem; }
.home-about p + p { margin-top: 0.7rem; }
.home-about a { color: var(--accent); text-decoration: none; }
.home-legal { margin-top: 1rem; font-size: 0.74rem; opacity: 0.75; }
.home-guides { margin-top: 2.2rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.home-guides a { color: var(--accent); text-decoration: none; }
.home-guides a:hover { text-decoration: underline; }

/* ── SERIES page ───────────────────────────────────────────────────── */
.series-toolbar {
  flex-shrink: 0; display: flex; justify-content: center;
  padding: 0.6rem 1rem; background: transparent;
}
.seg { display: flex; background: var(--surface-2); border-radius: 10px 10px 10px 2px; overflow: hidden; }
.seg-btn {
  position: relative;
  background: transparent; color: var(--muted); border: none;
  padding: 0.45rem 1.4rem; cursor: pointer; font-size: 0.86rem; font-weight: 700;
  transition: background 0.25s var(--ease-out-4), color 0.2s;
}
.seg-btn.active {
  background: var(--accent); color: var(--accent-ink);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}

.subview { flex: 1; min-height: 0; }
.subview[hidden] { display: none; }
.subview-browse { overflow-y: auto; }
.subview-map { display: flex; position: relative; }

/* episode gate */
.gate {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(7px); animation: page-in 0.2s ease both;
}
.gate-card {
  position: relative; width: min(440px, 100%); text-align: center;
  background: var(--surface); border: none;
  border-radius: 18px 18px 18px 4px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  padding: 2.1rem 1.6rem 2rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: gate-pop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.gate-card::before {            /* spotlight thread along the top edge */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent) 35%, var(--accent) 65%, transparent);
}
.gate-card::after {             /* web node in the notch */
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
@keyframes gate-pop { from { opacity: 0; transform: translateY(18px) scale(0.94); } to { opacity: 1; transform: none; } }
.gate-card { animation-timing-function: var(--ease-squish) !important; }
.gate-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; }
.gate-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }
.gate-selects { display: flex; gap: 0.6rem; margin: 1.5rem 0; justify-content: center; flex-wrap: wrap; }
.ep-select {
  background: var(--surface-2); color: var(--text);
  border: none; border-radius: 10px;
  font-size: 0.92rem; padding: 0.6rem 0.7rem; cursor: pointer; outline: none; max-width: 100%;
  transition: background 0.15s;
}
.ep-select:hover, .ep-select:focus { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.ep-select-wide { flex: 1; min-width: 0; max-width: 280px; }
.ep-select option { background: var(--surface); }
/* ── Thread-Notch button art (own design language) ──
   A cut corner with a web-node dot sitting in the notch; on hover a light
   sweep crosses the face like a spotlight, the node pulses on press. */
.gate-go {
  position: relative; overflow: hidden;
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 12px 12px 12px 2px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  padding: 0.75rem 2.2rem; font-size: 0.95rem; font-weight: 800; cursor: pointer;
  font-family: var(--font-display); letter-spacing: 0.01em;
  transition: transform 0.2s var(--ease-spring), filter 0.15s;
}
.gate-go::before {                 /* spotlight sweep */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  transform: translateX(-110%); transition: transform 0.5s var(--ease-out-4);
}
.gate-go::after {                  /* web node in the notch */
  content: ""; position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-ink); opacity: 0.55;
}
.gate-go:hover { transform: translateY(-2px); }
.gate-go:hover::before { transform: translateX(110%); }
.gate-go:active { transform: translateY(0) scale(0.98); }

/* ── BROWSE sub-view ───────────────────────────────────────────────── */
.browse-inner { max-width: 760px; margin: 0 auto; padding: 1.3rem 1.1rem 4rem; }
.browse-search {
  width: 100%; background: var(--surface); color: var(--text);
  border: none; border-radius: 999px;
  font-size: 1rem; padding: 0.8rem 1.2rem; outline: none;
  transition: background 0.15s, box-shadow 0.2s;
}
.browse-search::placeholder { color: var(--muted); }
.browse-search:focus {
  background: var(--surface-2);
  box-shadow: 0 10px 34px -18px color-mix(in srgb, var(--accent) 55%, transparent);
}

.browse-group { margin-top: 1.6rem; }
.browse-group[hidden] { display: none; }
.browse-group-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 0.5rem;
}
.browse-rows { display: flex; flex-direction: column; gap: 0.15rem; }
.browse-row {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; text-align: left;
  background: none; border: none; border-radius: 12px;
  padding: 0.6rem 0.8rem; cursor: pointer;
  animation: rise 0.4s ease both; transition: transform 0.15s, background 0.15s;
}
.browse-row[hidden] { display: none; }
.browse-row:hover {
  transform: translateX(4px);
  background: var(--surface);
  box-shadow: -3px 0 0 var(--ring, var(--accent));
}
.browse-row:hover .br-img { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring, var(--accent)) 35%, transparent); }
.br-img { transition: box-shadow 0.25s var(--ease-out-4); }
.br-img {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--ring, var(--line)); background: var(--surface-2);
}
.br-text { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; flex: 1; }
.br-name { font-weight: 700; font-size: 0.95rem; }
.br-epithet { font-size: 0.74rem; color: var(--muted); }
.br-status {
  font-size: 0.82rem; color: var(--muted); line-height: 1.4; margin-top: 0.15rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.br-go { color: var(--muted); font-size: 1.3rem; flex-shrink: 0; }
.departed-mark { color: var(--muted); }

/* ── CHARACTER page ────────────────────────────────────────────────── */
.page-char::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 45% at 18% 0%, color-mix(in srgb, var(--atmos-1) var(--atmos-amt), transparent), transparent 72%),
    radial-gradient(60% 50% at 90% 12%, color-mix(in srgb, var(--atmos-2) var(--atmos-amt), transparent), transparent 72%);
  filter: blur(60px); opacity: 0.6;
}
.char-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 2rem 1.3rem 4rem; }

.char-hero { display: flex; align-items: center; gap: 1.3rem; }
.char-portrait-ring {
  width: 116px; height: 116px; flex-shrink: 0; border-radius: 50%; padding: 4px;
  background: var(--ring, var(--accent));
  animation: ring-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ring-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
.char-portrait {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  display: block; background: var(--surface-2);
}
.char-name {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 800;
  letter-spacing: -0.015em;
}
.char-epithet { color: var(--muted); font-size: 0.95rem; margin-top: 0.2rem; }
.char-faction {
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; margin-top: 0.55rem; color: var(--ring, var(--accent));
}
.char-map-link {
  display: inline-block; margin-top: 0.9rem; cursor: pointer;
  background: var(--surface-2); color: var(--accent); border: none;
  border-radius: 999px 999px 999px 4px; padding: 0.5rem 1rem;
  font-family: var(--font-display); font-weight: 800; font-size: 0.85rem;
  transition: background 0.15s, transform 0.2s var(--ease-spring);
}
.char-map-link:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  transform: translateY(-2px);
}
.char-map-link span:last-child { transition: margin-left 0.2s var(--ease-out-4); }
.char-map-link:hover span:last-child { margin-left: 0.25rem; }

.char-section { margin-top: 2rem; }
.char-sub {
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 0.7rem;
}

.char-bio { display: flex; flex-direction: column; gap: 1rem; }
.bio-stage {
  position: relative; padding-left: 1rem;
  border-left: 2px solid color-mix(in srgb, var(--ring, var(--accent)) 55%, var(--line));
}
.bio-when {
  display: block; font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ring, var(--accent)); font-weight: 700; margin-bottom: 0.25rem;
}
.bio-stage p { font-size: 0.98rem; line-height: 1.6; }

.char-ties { list-style: none; }
.char-ties { display: flex; flex-direction: column; gap: 0.1rem; }
.char-ties li {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.92rem; padding: 0.55rem 0.4rem; border-radius: 8px;
  cursor: pointer; transition: color 0.12s, background 0.15s;
}
.char-ties li:hover { background: var(--surface); }
.char-ties li:hover { color: var(--accent); }
.char-ties li.tie-empty { color: var(--muted); cursor: default; }
.tie-type { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tie-label { color: var(--muted); }

/* appearance grid (shared) */
.char-apps { display: flex; flex-direction: column; gap: 6px; }
.app-row { display: flex; align-items: flex-start; gap: 8px; }
.app-sn { flex-shrink: 0; width: 28px; padding-top: 3px; font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.app-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.app-chip {
  min-width: 24px; padding: 4px 7px; cursor: pointer;
  background: var(--surface-2); color: var(--accent);
  border: none; border-radius: 6px;
  font-size: 0.74rem; line-height: 1.2; transition: background 0.12s, color 0.12s;
}
.app-chip:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.app-chip.cur { background: var(--accent); color: var(--accent-ink); }
.app-summary { font-size: 0.86rem; color: var(--muted); }
.app-summary b { color: var(--text); font-weight: 600; }

/* ── MAP sub-view (sidebar + web) ──────────────────────────────────── */
.sidebar {
  width: 230px; flex-shrink: 0; overflow-y: auto;
  background: var(--surface);
  padding: 0.9rem 0.8rem 1.2rem; z-index: 25;
}
.side-label {
  font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 0.2rem 0 0.4rem 0.2rem;
}
.side-label + .chip-col { margin-bottom: 0.4rem; }
.chip-col { display: flex; flex-direction: column; gap: 0.25rem; }
.chip {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  background: var(--surface-2); border: none; border-radius: 8px;
  font-size: 0.84rem; text-align: left; padding: 0.46rem 0.6rem; cursor: pointer;
  transition: all 0.15s;
}
.chip:not(.active) { opacity: 0.4; filter: grayscale(0.9); }
.chip:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-swatch { width: 16px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.toggle {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; color: var(--muted);
  cursor: pointer; user-select: none; margin-top: 1.1rem; padding-left: 0.2rem;
}
.toggle input { accent-color: var(--accent); cursor: pointer; }
.filter-fab { display: none; }
.drawer-backdrop { display: none; }

#graph-wrap { position: relative; flex: 1; min-width: 0; }
#graph { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; position: relative; z-index: 1; }
#graph:active { cursor: grabbing; }

.episode-title-card {
  position: absolute; top: 1rem; left: 1.2rem; pointer-events: none; z-index: 2;
  animation: fadeup 0.6s ease both; max-width: 70%;
}
.etc-ep { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.etc-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; margin-top: 0.1rem; }
.hint {
  position: absolute; bottom: 0.8rem; left: 50%; transform: translateX(-50%); z-index: 2;
  font-size: 0.75rem; color: var(--muted); white-space: nowrap; pointer-events: none; opacity: 0.85;
}
.hint .attribution { pointer-events: auto; cursor: help; }
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* per-series atmosphere behind the web (blurred, abstract — never the literal web) */
#graph-wrap::before {
  content: ""; position: absolute; inset: -8%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 48% at 16% 20%, color-mix(in srgb, var(--atmos-1) var(--atmos-amt), transparent), transparent 70%),
    radial-gradient(46% 42% at 84% 26%, color-mix(in srgb, var(--atmos-2) var(--atmos-amt), transparent), transparent 70%),
    radial-gradient(58% 56% at 50% 98%, color-mix(in srgb, var(--atmos-3) var(--atmos-amt), transparent), transparent 72%);
  filter: blur(48px) saturate(1.05); transition: opacity 0.4s;
}

/* mood triplet per series (theme-independent; --atmos-amt tunes dark/light) */
[data-series="got"]                 { --atmos-1:#2f5d8a; --atmos-2:#102236; --atmos-3:#9c4a1f; }
[data-series="stranger-things"]     { --atmos-1:#b3121f; --atmos-2:#5a1a6b; --atmos-3:#0f3b4a; }
[data-series="breaking-bad"]        { --atmos-1:#4a8a2e; --atmos-2:#c79a1f; --atmos-3:#1e5e72; }
[data-series="narcos"]              { --atmos-1:#2f6b3a; --atmos-2:#b8862b; --atmos-3:#7a2420; }
[data-series="handmaids-tale"]      { --atmos-1:#a51e22; --atmos-2:#566070; --atmos-3:#c7cdd6; }
[data-series="wednesday"]           { --atmos-1:#241f33; --atmos-2:#37304f; --atmos-3:#1d4a4a; }
[data-series="squid-game"]          { --atmos-1:#d83b86; --atmos-2:#13837a; --atmos-3:#b3162b; }
[data-series="the-last-of-us"]      { --atmos-1:#b5651d; --atmos-2:#3a5f4a; --atmos-3:#2b2622; }
[data-series="house-of-the-dragon"] { --atmos-1:#8f1d1d; --atmos-2:#a8842b; --atmos-3:#23303a; }
[data-series="the-boys"]            { --atmos-1:#1f4ba0; --atmos-2:#c41e2a; --atmos-3:#d4a017; }
[data-series="reacher"]             { --atmos-1:#5a6b3a; --atmos-2:#23303f; --atmos-3:#7a2a22; }
[data-series="severance"]           { --atmos-1:#147b8a; --atmos-2:#aebfc0; --atmos-3:#1f5b4a; }
[data-series="ted-lasso"]           { --atmos-1:#1f4ba0; --atmos-2:#e0b020; --atmos-3:#3f7d4a; }
[data-series="andor"]               { --atmos-1:#9c5a2a; --atmos-2:#2a3744; --atmos-3:#3f5f4a; }
[data-series="the-mandalorian"]     { --atmos-1:#5a7488; --atmos-2:#b89a5a; --atmos-3:#2a3742; }
[data-series="landman"]             { --atmos-1:#b5732a; --atmos-2:#23211e; --atmos-3:#3f6b88; }
[data-series="tulsa-king"]          { --atmos-1:#a8842b; --atmos-2:#7a2424; --atmos-3:#2f4a6b; }
[data-series="the-sopranos"]        { --atmos-1:#6e2a1f; --atmos-2:#2a2a2e; --atmos-3:#b08a3e; }
[data-series="better-call-saul"]    { --atmos-1:#c46a2b; --atmos-2:#1f5e72; --atmos-3:#d8b13e; }
[data-series="succession"]          { --atmos-1:#233a55; --atmos-2:#8a97a3; --atmos-3:#c77b3a; }
[data-series="dark"]                { --atmos-1:#14424a; --atmos-2:#20303f; --atmos-3:#b87f1f; }
[data-series="peaky-blinders"]      { --atmos-1:#2a3540; --atmos-2:#7a3020; --atmos-3:#8a99a8; }
[data-series="the-wire"]            { --atmos-1:#2f5d8a; --atmos-2:#3a3a40; --atmos-3:#a84f2f; }
[data-series="chernobyl"]           { --atmos-1:#5b8a6e; --atmos-2:#3a3f35; --atmos-3:#8a2f2f; }
[data-series="fallout"]             { --atmos-1:#2f6ea8; --atmos-2:#a84f2f; --atmos-3:#8a6e2f; }
[data-series="slow-horses"]         { --atmos-1:#7a6a4a; --atmos-2:#2f3a45; --atmos-3:#9a8a5a; }
[data-series="the-bear"]            { --atmos-1:#2f6ea8; --atmos-2:#a83232; --atmos-3:#e8e4da; }
[data-series="shogun"]              { --atmos-1:#8a2f2f; --atmos-2:#2a3540; --atmos-3:#b8a468; }
[data-series="bridgerton"]          { --atmos-1:#5b8cbf; --atmos-2:#c7a23b; --atmos-3:#8a5b8a; }
[data-series="silo"]                { --atmos-1:#a8632f; --atmos-2:#2a3a45; --atmos-3:#5e7d6e; }
[data-series="euphoria"]            { --atmos-1:#7a5bd6; --atmos-2:#2a1a3f; --atmos-3:#d65b9a; }
[data-series="money-heist"]         { --atmos-1:#c0392b; --atmos-2:#2a2a2e; --atmos-3:#d4af37; }
[data-series="ozark"]               { --atmos-1:#1f3a4a; --atmos-2:#2f5d8a; --atmos-3:#5e7d4a; }
[data-series="the-witcher"]         { --atmos-1:#5b3d8a; --atmos-2:#2a2a30; --atmos-3:#b8a468; }
[data-series="the-crown"]           { --atmos-1:#7d6a9a; --atmos-2:#2a2a3a; --atmos-3:#c7a23b; }
[data-series="the-white-lotus"]     { --atmos-1:#2f7d6e; --atmos-2:#c77b3a; --atmos-3:#d65b9a; }
[data-series="the-night-agent"]     { --atmos-1:#2f5d8a; --atmos-2:#1a2030; --atmos-3:#8a2f2f; }
[data-series="yellowjackets"]       { --atmos-1:#c7a23b; --atmos-2:#2f4a35; --atmos-3:#5b3d8a; }
[data-series="mindhunter"]          { --atmos-1:#2f5d8a; --atmos-2:#26262a; --atmos-3:#7d8a99; }
[data-series="loki"]                { --atmos-1:#c77b3a; --atmos-2:#2f4a35; --atmos-3:#3a6e5e; }
[data-series="house-of-cards"]      { --atmos-1:#8a2f2f; --atmos-2:#1f2530; --atmos-3:#6e7d8a; }
[data-series="sherlock"]            { --atmos-1:#2f4a6e; --atmos-2:#23262e; --atmos-3:#6e7d8a; }
[data-series="dexter"]              { --atmos-1:#8a2f2f; --atmos-2:#2f6e78; --atmos-3:#b39a6e; }
[data-series="vikings"]             { --atmos-1:#3a5e6e; --atmos-2:#2a2d33; --atmos-3:#7d6a4a; }
[data-series="sons-of-anarchy"]     { --atmos-1:#3d4a5e; --atmos-2:#26262a; --atmos-3:#8a3d2f; }
[data-series="arcane"]              { --atmos-1:#3a8a7d; --atmos-2:#2a2030; --atmos-3:#b3548a; }
[data-series="the-expanse"]         { --atmos-1:#2f4a6e; --atmos-2:#1a1d26; --atmos-3:#8a6e2f; }
[data-series="band-of-brothers"]    { --atmos-1:#4a5e3a; --atmos-2:#2a2d2a; --atmos-3:#8a8a7d; }
[data-series="the-office"]          { --atmos-1:#3d5e8a; --atmos-2:#6e6a52; --atmos-3:#b3912f; }
[data-series="lost"]                { --atmos-1:#2f6e52; --atmos-2:#1f2a26; --atmos-3:#7d8a6e; }
[data-series="westworld"]           { --atmos-1:#8a6e3d; --atmos-2:#26262e; --atmos-3:#a85a3d; }
[data-series="how-i-met-your-mother"] { --atmos-1:#8a5e2f; --atmos-2:#3d2f4a; --atmos-3:#c7a23b; }
[data-series="friends"]             { --atmos-1:#8a5a8a; --atmos-2:#3d4a6e; --atmos-3:#c7a23b; }
[data-series="the-big-bang-theory"] { --atmos-1:#3d6e52; --atmos-2:#2a2d3a; --atmos-3:#b3912f; }
[data-series="brooklyn-nine-nine"]  { --atmos-1:#3d5e8a; --atmos-2:#2a2a2e; --atmos-3:#c79a2f; }
[data-series="mr-robot"]            { --atmos-1:#8a2f2f; --atmos-2:#16181f; --atmos-3:#3a6e5e; }
[data-series="house-md"]            { --atmos-1:#3d6e8a; --atmos-2:#2a2d33; --atmos-3:#7d8a99; }
[data-series="suits"]               { --atmos-1:#3d4a6e; --atmos-2:#26262a; --atmos-3:#8a7d5a; }
[data-series="modern-family"]       { --atmos-1:#6e8a3d; --atmos-2:#3d5e8a; --atmos-3:#c7a23b; }
[data-series="the-umbrella-academy"] { --atmos-1:#3d4a6e; --atmos-2:#2a2026; --atmos-3:#c73b3b; }
[data-series="the-walking-dead"]    { --atmos-1:#5e5a3d; --atmos-2:#2a2620; --atmos-3:#7d3a3a; }
[data-series="you"]                 { --atmos-1:#5e3d4a; --atmos-2:#1f1a20; --atmos-3:#8a6e3d; }
[data-series="greys-anatomy"]       { --atmos-1:#3d6e8a; --atmos-2:#2a2d33; --atmos-3:#8a4a6e; }
[data-series="only-murders"]        { --atmos-1:#7d5a2f; --atmos-2:#2a2330; --atmos-3:#b3548a; }
[data-series="the-leftovers"]       { --atmos-1:#3d5e6e; --atmos-2:#26262a; --atmos-3:#8a8a8a; }
[data-series="six-feet-under"]      { --atmos-1:#3d4a3d; --atmos-2:#22241f; --atmos-3:#7d5a6e; }
[data-series="true-detective"]      { --atmos-1:#5a5f3d; --atmos-2:#26241f; --atmos-3:#8a6e3d; }
[data-series="prison-break"]        { --atmos-1:#3d5e6e; --atmos-2:#2a2d33; --atmos-3:#b3702f; }
[data-series="the-100"]             { --atmos-1:#3d5e8a; --atmos-2:#26302a; --atmos-3:#5e6e3d; }
[data-series="the-good-place"]      { --atmos-1:#3d8a5e; --atmos-2:#2a3328; --atmos-3:#c7a23b; }
[data-series="downton-abbey"]       { --atmos-1:#6e5a3d; --atmos-2:#2d2a26; --atmos-3:#5e3d5a; }
[data-series="gossip-girl"]         { --atmos-1:#7d5a8a; --atmos-2:#2a2330; --atmos-3:#c7a23b; }
[data-series="sex-education"]       { --atmos-1:#c75b3a; --atmos-2:#2a3328; --atmos-3:#3d6e8a; }
[data-series="fleabag"]             { --atmos-1:#5e3d4a; --atmos-2:#26221f; --atmos-3:#b3912f; }
[data-series="big-little-lies"]     { --atmos-1:#3d6e8a; --atmos-2:#1f262e; --atmos-3:#6e8a99; }
[data-series="the-queens-gambit"]   { --atmos-1:#3d8a5e; --atmos-2:#2d2a33; --atmos-3:#b3702f; }
[data-series="narcos-mexico"]       { --atmos-1:#8a6e2f; --atmos-2:#2d2620; --atmos-3:#7d3a3a; }
[data-series="the-morning-show"]    { --atmos-1:#3d5e8a; --atmos-2:#1f2026; --atmos-3:#c7a23b; }
[data-series="mare-of-easttown"]    { --atmos-1:#3d4a5e; --atmos-2:#26282e; --atmos-3:#6e7d8a; }
[data-series="the-night-manager"]   { --atmos-1:#6e5a3d; --atmos-2:#1f2430; --atmos-3:#3d6e8a; }
[data-series="the-haunting-of-hill-house"] { --atmos-1:#3d4a5e; --atmos-2:#1c1e26; --atmos-3:#5e3d4a; }
[data-series="killing-eve"]         { --atmos-1:#8a2f3d; --atmos-2:#26222a; --atmos-3:#c7a23b; }
[data-series="the-marvelous-mrs-maisel"] { --atmos-1:#7d3a5e; --atmos-2:#2a2433; --atmos-3:#3d8a8a; }
[data-series="schitts-creek"]       { --atmos-1:#3d3d4a; --atmos-2:#2e2a26; --atmos-3:#c7b33b; }
[data-series="yellowstone"]         { --atmos-1:#5e4a2f; --atmos-2:#262420; --atmos-3:#8a6e3d; }
[data-series="cobra-kai"]           { --atmos-1:#7d3a2f; --atmos-2:#26262a; --atmos-3:#c7a23b; }
[data-series="daredevil"]           { --atmos-1:#7d2f2f; --atmos-2:#1c1c22; --atmos-3:#5e5a3d; }
[data-series="baby-reindeer"]       { --atmos-1:#3d4a5e; --atmos-2:#221f26; --atmos-3:#7d3a4a; }
[data-series="invincible"]          { --atmos-1:#3d5e8a; --atmos-2:#26222a; --atmos-3:#c7b33b; }
[data-series="beef"]                { --atmos-1:#7d3a2f; --atmos-2:#262a26; --atmos-3:#3d6e52; }
[data-series="alice-in-borderland"] { --atmos-1:#3d5e6e; --atmos-2:#1c1e24; --atmos-3:#8a2f3d; }
[data-series="the-diplomat"]        { --atmos-1:#3d4a6e; --atmos-2:#26262a; --atmos-3:#8a6e3d; }
[data-series="peacemaker"]          { --atmos-1:#7d2f2f; --atmos-2:#26222a; --atmos-3:#c7a23b; }
[data-series="ahsoka"]              { --atmos-1:#3d6e8a; --atmos-2:#26262e; --atmos-3:#c75b3a; }
[data-series="the-last-kingdom"]    { --atmos-1:#5e5a3d; --atmos-2:#26241f; --atmos-3:#7d3a2f; }
[data-series="the-sandman"]         { --atmos-1:#3d3d5e; --atmos-2:#1a1a24; --atmos-3:#8a6e2f; }
[data-series="broadchurch"]         { --atmos-1:#3d6e8a; --atmos-2:#26282a; --atmos-3:#c7a23b; }
[data-series="unorthodox"]          { --atmos-1:#3d3d4a; --atmos-2:#26242a; --atmos-3:#3d6e8a; }
[data-series="the-night-of"]        { --atmos-1:#3d4a5e; --atmos-2:#1c1e22; --atmos-3:#5e5a3d; }
[data-series="vikings-valhalla"]    { --atmos-1:#3d6e6e; --atmos-2:#22262a; --atmos-3:#7d3a2f; }

/* graph svg elements */
.web-backdrop { color: var(--text); }
.web-backdrop circle, .web-backdrop line { stroke: currentColor; }
.faction-label {
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  text-anchor: middle; opacity: 0.8; paint-order: stroke; stroke: var(--halo); stroke-width: 4px;
  transition: opacity 0.3s;
}
.edge { stroke-opacity: 0.45; transition: stroke-opacity 0.25s; }
.edge.dim { stroke-opacity: 0.06; }
.edge.lit { stroke-opacity: 0.95; }
.node { cursor: pointer; transition: opacity 0.3s; }
.node.dim { opacity: 0.22; }
.node.departed image { filter: grayscale(0.9) brightness(0.78); }
.node.departed .node-name { fill: var(--muted); }
.node-ring { fill: var(--surface); }
.node-name {
  /* 13px ≈ 7.8px/char — keep in sync with the anti-collision estimate in app.js */
  font-size: 13px; font-weight: 600; fill: var(--text);
  paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; pointer-events: none;
}

/* ── mobile (html[data-layout], follows screen width) ──────────────── */
html[data-layout="mobile"] .masthead { gap: 0.55rem; padding: 0.5rem 0.7rem; }
html[data-layout="mobile"] .brand h1 { display: none; }
html[data-layout="mobile"] .mast-nav button { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
html[data-layout="mobile"] .masthead:has(.series-context:not([hidden])) .mast-nav { display: none; }
html[data-layout="mobile"] .index-inner { padding: 1.4rem 1rem 3rem; }
html[data-layout="mobile"] .filter-select { max-width: 46vw; }
html[data-layout="mobile"] .ctx-title { max-width: 38vw; font-size: 0.92rem; }
html[data-layout="mobile"] .home-inner { padding: 1.6rem 1rem 3rem; }
html[data-layout="mobile"] .home-title { font-size: 1.75rem; }
html[data-layout="mobile"] .cr-series { max-width: 32%; }
html[data-layout="mobile"] .hero-links { gap: 1.1rem; }
html[data-layout="mobile"] .hero-stage { margin-top: 1.2rem; }
html[data-layout="mobile"] .hero-stage-cap { padding: 0 0.5rem; }
html[data-layout="mobile"] .series-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
html[data-layout="mobile"] .char-hero { flex-direction: column; text-align: center; gap: 0.9rem; }
html[data-layout="mobile"] .char-name { font-size: 1.35rem; }

/* map sidebar → off-canvas drawer */
html[data-layout="mobile"] .sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: 270px; max-width: 84vw;
  transform: translateX(-105%); transition: transform 0.3s ease;
  z-index: 70; box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3); padding-top: 1.2rem;
}
html[data-layout="mobile"] body.drawer-open .sidebar { transform: translateX(0); }
html[data-layout="mobile"] .drawer-backdrop {
  display: none; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.45);
}
html[data-layout="mobile"] body.drawer-open .drawer-backdrop { display: block; }
html[data-layout="mobile"] .filter-fab {
  display: block; position: absolute; bottom: 1rem; left: 1rem; z-index: 40;
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 999px 999px 999px 4px;
  padding: 0.6rem 1rem; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
html[data-layout="mobile"] .hint { display: none; }
html[data-layout="mobile"] .etc-title { font-size: 0.95rem; }
