/* ==========================================================================
   The Wire Case Board: sodium-vapor night, fluorescent precinct light.
   Single deliberate dark theme.
   ========================================================================== */

:root {
  color-scheme: dark;

  --night: #0a0f15;
  --night-2: #0d131b;
  --asphalt: #121a24;
  --asphalt-2: #18222e;
  --asphalt-3: #202d3c;
  --wire: #243140;
  --wire-2: #33445a;

  --paper: #ede7da;
  --paper-2: #cdc7ba;
  --dim: #97a1ad;
  --faint: #677485;

  --sodium: #f3a536;
  --fluoro: #6fc8ce;
  --rose: #ec7482;
  --violet: #a99cf2;
  --stone: #bdb3a4;
  --blood: #ff5b5e;
  --pink: #e39ac0;
  --sage: #9dc4a4;
  --steel: #7d8b9b;
  --sky: #8fb8ff;

  /* reserved for organizations added in later seasons (see schema.js FACTION_COLORS) */
  --harbor: #4f8ef2;
  --orchid: #d68ae0;
  --mint: #69d3a5;
  --olive: #b5c25f;

  --f-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --ease: cubic-bezier(.2, .7, .15, 1);
  --ease-back: cubic-bezier(.3, 1.4, .5, 1);
  --radius: 10px;
  --dossier-w: 400px;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 6% -12%, rgba(243, 165, 54, .11), transparent 62%),
    radial-gradient(900px 640px at 104% 112%, rgba(111, 200, 206, .08), transparent 60%),
    var(--night);
  color: var(--paper);
  font: 14px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; color: inherit; }
::selection { background: rgba(243, 165, 54, .35); }
:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; border-radius: 4px; }

.app {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
}

/* film grain */
.app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- mono label ---------- */
.label {
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--wire);
  background: linear-gradient(to bottom, rgba(10, 15, 21, .92), rgba(10, 15, 21, .72));
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  font: 900 26px/1 var(--f-display);
  letter-spacing: .06em;
  white-space: nowrap;
}
.brand-mark span { color: var(--sodium); }
.brand-sub {
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-mark .typed { display: inline-block; }

.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: rgba(18, 26, 36, .7);
}
.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--dim);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: color .25s;
  white-space: nowrap;
}
.tab svg { width: 16px; height: 16px; flex: none; }
.tab:hover { color: var(--paper); }
.tab[aria-selected="true"] { color: #1a1206; }
.tab-ink {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--sodium);
  box-shadow: 0 0 24px rgba(243, 165, 54, .35);
  transition: transform .45s var(--ease), width .45s var(--ease);
}

.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

.season-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 3px 3px 10px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--asphalt);
}
.season-switch .label { margin-right: 6px; }
.season-switch button {
  min-width: 28px;
  height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--dim);
  font: 600 12px/1 var(--f-mono);
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.season-switch button:hover { color: var(--paper); background: var(--asphalt-2); }
.season-switch button[aria-pressed="true"] { color: var(--paper); background: var(--asphalt-3); box-shadow: inset 0 0 0 1px var(--sodium); }
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 12px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--asphalt);
  color: var(--dim);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.search-btn:hover { border-color: var(--wire-2); color: var(--paper); }
.search-btn svg { width: 15px; height: 15px; }
kbd {
  font: 500 11px/1 var(--f-mono);
  padding: 3px 6px;
  border: 1px solid var(--wire-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--dim);
  background: var(--night-2);
}

/* ==========================================================================
   Stage + views
   ========================================================================== */
.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(.995);
  transition: opacity .35s var(--ease), transform .5s var(--ease), visibility 0s linear .5s;
}
.view.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.view.is-active.swap-in { animation: swap-in .55s var(--ease) both; }
@keyframes swap-in { from { opacity: 0; transform: translateY(12px); } }

/* ----- shared canvas (board & web) ----- */
.canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.canvas:active { cursor: grabbing; }
.canvas-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(151, 161, 173, .13) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 40%, transparent 85%);
}

.overlay-top {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 20px;
  pointer-events: none;
}
.overlay-top > * { pointer-events: auto; }

.view-head { max-width: 460px; }
.view-kicker { margin-bottom: 4px; }
.view-title {
  margin: 0;
  font: 800 34px/1 var(--f-display);
  letter-spacing: .01em;
  text-wrap: balance;
}
.view-blurb {
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 13px;
  max-width: 52ch;
  text-wrap: pretty;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--wire);
  border-radius: 10px;
  background: rgba(18, 26, 36, .85);
  backdrop-filter: blur(8px);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.seg button:hover { color: var(--paper); background: var(--asphalt-2); }
.seg button[aria-pressed="true"] { background: var(--asphalt-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--wire-2); }
.seg .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fc, var(--dim)); box-shadow: 0 0 10px var(--fc, transparent); }

.zoom-ctl {
  position: absolute;
  z-index: 5;
  right: 20px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wire);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(18, 26, 36, .9);
  transition: transform .45s var(--ease);
}
.zoom-ctl button {
  width: 36px;
  height: 34px;
  border: 0;
  background: none;
  color: var(--dim);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.zoom-ctl button + button { border-top: 1px solid var(--wire); }
.zoom-ctl button:hover { color: var(--paper); background: var(--asphalt-2); }
.zoom-ctl svg { width: 16px; height: 16px; }
.dossier-open .zoom-ctl { transform: translateX(calc(-1 * var(--dossier-w))); }

.legend {
  position: absolute;
  z-index: 5;
  left: 20px;
  bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: min(640px, calc(100% - 100px));
  padding: 8px 12px;
  border: 1px solid var(--wire);
  border-radius: 10px;
  background: rgba(13, 19, 27, .86);
  backdrop-filter: blur(8px);
  font-size: 12px;
  color: var(--dim);
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--fc); box-shadow: 0 0 0 2px rgba(0,0,0,.3); }

.hint {
  font: 500 11px/1.4 var(--f-mono);
  color: var(--faint);
  letter-spacing: .04em;
}

/* ==========================================================================
   Avatars
   ========================================================================== */
.avatar {
  --size: 40px;
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 calc(var(--size) * .4)/1 var(--f-display);
  letter-spacing: .04em;
  color: var(--fc);
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--fc) 26%, transparent), transparent 70%),
    var(--night-2);
  box-shadow: inset 0 0 0 2px var(--fc), 0 0 0 3px rgba(10, 15, 21, .8);
  transition: filter .4s, opacity .4s;
}
.avatar.sm { --size: 26px; }
.avatar.xs { --size: 22px; font-size: 9.5px; }
.avatar.lg { --size: 72px; }
.is-dead .avatar, .avatar.is-dead { filter: grayscale(1) brightness(.75); }
.avatar.unit { color: var(--dim); box-shadow: inset 0 0 0 1px var(--wire-2); background: var(--asphalt); }

/* ==========================================================================
   Board (org charts)
   ========================================================================== */
.board-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.board-links { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.board-links path {
  fill: none;
  stroke: var(--wire-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .3s, opacity .3s;
}
.board-links path.draw { animation: draw 1s var(--ease) both; }
.board-links path.dotted { stroke-dasharray: 2 5; }
.board-links path.lit { stroke: var(--sodium); stroke-width: 2; }
.board-links path.pulse {
  stroke: #fff4dd;
  stroke-width: 2.4;
  stroke-dasharray: 6 26;
  animation: pulse-up 1.1s linear infinite;
  filter: drop-shadow(0 0 4px var(--sodium));
}
.board-links.has-sel path:not(.lit):not(.pulse) { opacity: .45; }
@keyframes draw { from { stroke-dashoffset: var(--len); stroke-dasharray: var(--len); } to { stroke-dashoffset: 0; stroke-dasharray: var(--len); } }
@keyframes pulse-up { to { stroke-dashoffset: 32; } }

.card {
  position: absolute;
  width: 220px;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  background: linear-gradient(to bottom, var(--asphalt-2), var(--asphalt));
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .8);
  cursor: pointer;
  text-align: left;
  transition: transform .3s var(--ease), border-color .25s, box-shadow .3s, opacity .4s;
}
.card.enter { animation: card-in .6s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.card:hover { border-color: var(--wire-2); transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .9); }
.card::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--fc);
  opacity: .85;
}
.card-body { min-width: 0; flex: 1; }
.card-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-role {
  margin-top: 2px;
  font: 500 10.5px/1.3 var(--f-mono);
  color: var(--dim);
  letter-spacing: .02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font: 600 9.5px/1.5 var(--f-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fc);
  background: color-mix(in srgb, var(--fc) 12%, transparent);
}
.card-body:has(.card-tag) .card-role { -webkit-line-clamp: 1; }
.card.is-sel {
  border-color: var(--sodium);
  box-shadow: 0 0 0 3px rgba(243, 165, 54, .22), 0 18px 34px -16px rgba(0, 0, 0, .9);
}
.card.in-chain:not(.is-sel) { border-color: rgba(243, 165, 54, .55); }
.has-sel .card:not(.is-sel):not(.in-chain):not(.is-report) { opacity: .6; }
.card.is-report { border-color: rgba(111, 200, 206, .5); }
.card.is-dead .card-name { text-decoration: line-through; text-decoration-color: var(--blood); text-decoration-thickness: 2px; }
.card.is-dead { background: linear-gradient(to bottom, #171c23, #12161c); }
.card.unseen { opacity: .32; border-style: dashed; }
.card.unseen:hover { opacity: .7; }

.card.unit-card {
  width: 220px;
  height: 34px;
  padding: 0 12px;
  justify-content: center;
  border-style: dashed;
  background: rgba(13, 19, 27, .6);
  cursor: default;
}
.card.unit-card::before { display: none; }
.card.unit-card:hover { transform: none; border-color: var(--wire); }
.unit-card .card-name { font: 600 10.5px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); text-align: center; }
.unit-card .card-role { text-align: center; }

/* stamps */
.stamp {
  position: absolute;
  top: -9px;
  right: 8px;
  padding: 2px 7px 1px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font: 800 11px/1.1 var(--f-display);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--st, var(--blood));
  background: var(--night);
  transform: rotate(-4deg);
  pointer-events: none;
  white-space: nowrap;
}
.stamp.slam { animation: slam .55s var(--ease-back) both; }
@keyframes slam {
  0% { opacity: 0; transform: rotate(-14deg) scale(2.2); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); }
}

/* ==========================================================================
   Web (network)
   ========================================================================== */
.web-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.web-link {
  fill: none;
  stroke-width: 1.3;
  stroke-linecap: round;
  opacity: .5;
  transition: opacity .3s, stroke-width .3s;
}
.web-link.g-command { stroke: var(--steel); }
.web-link.g-allies { stroke: var(--sage); stroke-dasharray: 9 4; }
.web-link.g-kin { stroke: var(--pink); }
.web-link.g-kin.t-romance { stroke-dasharray: 4 4; }
.web-link.g-wire { stroke: var(--paper); stroke-dasharray: 1.5 5; opacity: .6; animation: wire-flow 1.2s linear infinite; }
.web-link.g-violence { stroke: var(--blood); }
.web-link.g-violence.t-conflict { stroke-dasharray: 6 5; }
.web-link.g-violence.t-killed { stroke-width: 2.2; }
.web-link.g-law { stroke: var(--sky); stroke-dasharray: 12 3 2 3; }
@keyframes wire-flow { to { stroke-dashoffset: -13; } }
.web-svg.has-sel .web-link { opacity: .06; }
.web-svg.has-sel .web-link.hot { opacity: .95; stroke-width: 2; }
.web-svg.has-sel .web-link.hot.t-killed { stroke-width: 3; }

.web-node { cursor: pointer; }
.web-node circle.ring {
  fill: var(--night-2);
  stroke: var(--fc);
  stroke-width: 2;
  transition: r .3s var(--ease), stroke-width .3s;
}
.web-node circle.glow { fill: var(--fc); opacity: .12; transition: opacity .3s, r .3s; }
.web-node text.ini {
  font: 800 12px/1 var(--f-display);
  letter-spacing: .04em;
  fill: var(--fc);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.web-node text.name {
  font: 600 11px/1 var(--f-body);
  fill: var(--paper-2);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--night);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity .3s;
}
.web-node.minor text.name { opacity: 0; }
.zoomed .web-node.minor text.name, .web-node.minor:hover text.name { opacity: 1; }
.web-node:hover circle.ring { stroke-width: 3; }
.web-node.is-dead circle.ring { stroke-dasharray: 3 3; }
.web-node.is-dead { opacity: .62; }
.web-node.is-dead text.ini { fill: var(--faint); }
.web-node .x { fill: none; stroke: var(--blood); stroke-width: 2; stroke-linecap: round; }
.web-svg.has-sel .web-node { opacity: .14; }
.web-svg.has-sel .web-node.near { opacity: 1; }
.web-svg.has-sel .web-node.near.minor text.name { opacity: 1; }
.web-svg.has-sel .web-node.is-sel { opacity: 1; }
.web-node.is-sel circle.ring { stroke-width: 3.5; }
.web-node.is-sel circle.glow { opacity: .3; animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .1; } }
.web-node.is-sel text.name { fill: var(--paper); font-size: 13px; }

.web-label {
  font: 500 10px/1 var(--f-mono);
  fill: var(--paper-2);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--night);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
  animation: fade-in .4s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 560px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: rgba(18, 26, 36, .88);
  backdrop-filter: blur(8px);
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, color .2s, opacity .2s, background .2s;
}
.chip:hover { color: var(--paper); border-color: var(--wire-2); }
.chip[aria-pressed="false"] { opacity: .45; }
.chip[aria-pressed="false"] svg { filter: grayscale(1); }
.chip svg { width: 22px; height: 8px; flex: none; overflow: visible; }

/* ==========================================================================
   Ladders
   ========================================================================== */
.scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.ladder-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.ladder-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 20px;
}
.ladder-intro .view-head { max-width: 620px; }
.quick-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quick-picks .label { margin-right: 4px; }
.pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: var(--asphalt);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--paper-2);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.pick:hover { border-color: var(--wire-2); background: var(--asphalt-2); }
.pick[aria-pressed="true"] { border-color: var(--sodium); color: var(--paper); }

.ladders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.ladder {
  --lc: var(--sodium);
  position: relative;
  border: 1px solid var(--wire);
  border-radius: 14px;
  background: linear-gradient(to bottom, rgba(24, 34, 46, .75), rgba(18, 26, 36, .55));
  overflow: hidden;
}
.ladder.job { --lc: var(--fluoro); }
.ladder-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--wire);
  background: linear-gradient(135deg, color-mix(in srgb, var(--lc) 10%, transparent), transparent 60%);
}
.ladder-head h3 {
  margin: 2px 0 0;
  font: 800 30px/1 var(--f-display);
  letter-spacing: .01em;
}
.ladder-head h3 small { font: 600 12px/1 var(--f-mono); letter-spacing: .12em; color: var(--lc); text-transform: uppercase; margin-left: 10px; vertical-align: middle; }
.ladder-head p { margin: 8px 0 0; color: var(--dim); font-size: 13px; max-width: 62ch; }

.rungs-wrap { position: relative; }
.rungs { position: relative; list-style: none; margin: 0; padding: 10px 0 12px; }
.rail {
  position: absolute;
  top: 26px;
  bottom: 30px;
  left: 34px;
  width: 2px;
  background: var(--wire);
}
.rail-fill {
  position: absolute;
  left: 34px;
  width: 2px;
  background: var(--lc);
  box-shadow: 0 0 12px var(--lc);
  transform-origin: bottom;
  transition: top .6s var(--ease), height .6s var(--ease), opacity .3s;
}
.rung {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 0 4px;
  padding: 10px 18px 10px 0;
  transition: background .3s;
}
.rung-node {
  position: relative;
  z-index: 1;
  justify-self: center;
  margin-top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--night);
  border: 2px solid var(--wire-2);
  transition: border-color .3s, background .3s, box-shadow .3s, transform .3s var(--ease-back);
}
.rung-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font: 700 19px/1.1 var(--f-display);
  letter-spacing: .02em;
}
.rung-title .label { font-size: 10px; }
.rung-blurb { margin: 3px 0 0; font-size: 12.5px; color: var(--dim); max-width: 62ch; }
.rung-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rung-people:empty { display: none; }
.person {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 2px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: var(--night-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--paper-2);
  cursor: pointer;
  transition: border-color .2s, background .2s, opacity .3s, transform .3s var(--ease);
}
.person:hover { border-color: var(--wire-2); background: var(--asphalt-2); color: var(--paper); }
.person.is-dead { opacity: .55; }
.person.is-dead span.nm { text-decoration: line-through; text-decoration-color: var(--blood); }
.person.is-sel { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 14%, var(--night-2)); color: var(--paper); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 18%, transparent); }
.person .st { font: 600 9px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--st, var(--blood)); }

.rung.is-here { background: linear-gradient(90deg, color-mix(in srgb, var(--lc) 12%, transparent), transparent 70%); }
.rung.is-here .rung-node { border-color: var(--lc); background: var(--lc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--lc) 22%, transparent); transform: scale(1.15); }
.rung.is-above .rung-node { border-color: var(--lc); }
.rung.is-above .rung-title { color: var(--paper); }
.ladder.has-path .rung:not(.is-here):not(.is-above) { opacity: .55; }
.rung-none { margin-top: 6px; font: 500 11px/1.3 var(--f-mono); color: var(--faint); letter-spacing: .04em; }
.rung .blocker { font: 500 11px/1.3 var(--f-mono); color: var(--lc); margin-top: 6px; }

.path-card {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--wire);
  border-radius: 14px;
  background: var(--asphalt);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 18px;
  align-items: start;
}
.path-card h4 { margin: 0; font: 800 24px/1.05 var(--f-display); }
.path-card p { margin: 4px 0 0; color: var(--paper-2); font-size: 13.5px; max-width: 80ch; }
.path-steps { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.path-step {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 11px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--night-2);
  animation: step-in .45s var(--ease) both;
  animation-delay: var(--d, 0ms);
}
.path-step b { font: 700 14px/1.1 var(--f-display); letter-spacing: .03em; }
.path-step span { font-size: 11.5px; color: var(--dim); }
.path-step.here { border-color: var(--lc, var(--sodium)); }
.path-step.open { border-style: dashed; }
.path-step.open span { color: var(--lc, var(--sodium)); }
.path-arrow { color: var(--faint); font-size: 14px; }
@keyframes step-in { from { opacity: 0; transform: translateX(-8px); } }
.moves { grid-column: 1 / -1; display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.moves li { display: grid; grid-template-columns: 54px 22px 1fr; gap: 8px; align-items: baseline; font-size: 13px; color: var(--paper-2); }
.moves .mv-ep { font: 600 11px/1 var(--f-mono); color: var(--faint); letter-spacing: .06em; white-space: nowrap; }
.moves .dir { font-weight: 800; text-align: center; }
.dir.up { color: var(--sage); }
.dir.down { color: var(--blood); }
.dir.side { color: var(--dim); }

.levers {
  margin: 0;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--wire);
  list-style: none;
  display: grid;
  gap: 8px;
}
.levers li { font-size: 13px; color: var(--paper-2); display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.levers li::before { content: ""; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--lc); justify-self: center; }
.levers b { color: var(--paper); font-weight: 700; }

/* ==========================================================================
   Episodes
   ========================================================================== */
.eps-wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 48px; }
.eps-wrap .view-head { max-width: none; margin-bottom: 18px; }
.eps { position: relative; list-style: none; margin: 0; padding: 0 0 0 36px; }
.eps::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--wire); }
.ep {
  position: relative;
  margin-bottom: 14px;
  padding: 16px 20px 18px;
  border: 1px solid var(--wire);
  border-radius: 14px;
  background: rgba(18, 26, 36, .6);
  cursor: pointer;
  transition: border-color .3s, background .3s, opacity .3s;
}
.ep:hover { border-color: var(--wire-2); }
.ep::before {
  content: attr(data-n);
  position: absolute;
  left: -36px;
  top: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 11px/1 var(--f-mono);
  color: var(--dim);
  background: var(--night);
  border: 2px solid var(--wire-2);
  transition: all .3s;
}
.ep.is-current { border-color: var(--sodium); background: linear-gradient(135deg, rgba(243, 165, 54, .08), rgba(18, 26, 36, .6) 50%); }
.ep.is-current::before { background: var(--sodium); border-color: var(--sodium); color: #1a1206; box-shadow: 0 0 0 5px rgba(243, 165, 54, .2); }
.ep.is-future { opacity: .5; }
.ep-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.ep-title { margin: 0; font: 800 26px/1.05 var(--f-display); letter-spacing: .01em; }
.ep-meta { font: 500 11px/1.4 var(--f-mono); color: var(--faint); letter-spacing: .04em; }
.ep-quote {
  margin: 10px 0 0;
  font: 600 italic 18px/1.3 var(--f-body);
  color: var(--paper);
  text-wrap: balance;
}
.ep-quote::before { content: "\201C"; color: var(--sodium); }
.ep-quote::after { content: "\201D"; color: var(--sodium); }
.ep-quote cite { font: 500 normal 12px/1 var(--f-mono); color: var(--dim); margin-left: 8px; letter-spacing: .04em; }
.ep-summary { margin: 10px 0 0; color: var(--paper-2); font-size: 13.5px; max-width: 72ch; }
.ep-events { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.ep-events li { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: start; font-size: 13px; color: var(--paper-2); }
.ev-type {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 4px;
  font: 600 9.5px/1.5 var(--f-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tc, var(--dim));
  background: color-mix(in srgb, var(--tc, var(--dim)) 13%, transparent);
}
.ev-who { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.ev-who button {
  padding: 0 7px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: var(--night-2);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  color: var(--fc, var(--paper-2));
  cursor: pointer;
}
.ev-who button:hover { border-color: var(--fc); }

/* ==========================================================================
   Dossier
   ========================================================================== */
.dossier {
  position: absolute;
  z-index: 15;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--dossier-w), 100%);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--wire);
  background: linear-gradient(to bottom, rgba(18, 26, 36, .97), rgba(13, 19, 27, .97));
  backdrop-filter: blur(14px);
  box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .8);
  transform: translateX(104%);
  transition: transform .5s var(--ease);
}
.dossier.open { transform: none; }
.dossier-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 22px 28px; }
.dossier-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--asphalt);
  color: var(--dim);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dossier-close:hover { color: var(--paper); border-color: var(--wire-2); }
.dossier-close svg { width: 14px; height: 14px; }

.dz-head {
  position: relative;
  margin: 0 -22px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--wire);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--fc) 16%, transparent), transparent 55%);
}
.dz-file { margin-bottom: 14px; }
.dz-id { display: flex; gap: 16px; align-items: center; }
.dz-name { margin: 0; font: 800 32px/.98 var(--f-display); letter-spacing: .01em; text-wrap: balance; }
.dz-alias { margin-top: 4px; font-size: 13px; color: var(--dim); }
.dz-alias i { color: var(--paper-2); font-style: normal; font-weight: 600; }
.dz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
/* actor photo (data/photos.js): beside the avatar in the dossier and Arcs headers, never instead of it */
.photo {
  flex: none;
  width: 76px;
  height: 95px;
  margin-left: auto;
  object-fit: cover;
  object-position: 50% 25%;
  border: 3px solid var(--paper-2);
  border-radius: 2px;
  background: var(--night-2);
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, .9);
  transform: rotate(2deg);
}
.photo-credit { margin: 12px 0 0; font: 500 10px/1.45 var(--f-mono); letter-spacing: .02em; color: var(--faint); }
.photo-credit a { color: var(--dim); text-decoration: underline; text-decoration-color: var(--wire-2); text-underline-offset: 2px; }
.photo-credit a:hover { color: var(--paper); }
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font: 600 10.5px/1.4 var(--f-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fc, var(--dim));
  background: color-mix(in srgb, var(--fc, var(--dim)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--fc, var(--dim)) 30%, transparent);
}
.fchip.status { --fc: var(--st, var(--sage)); }

.dz-sec { padding-top: 18px; }
.dz-sec h5 { margin: 0 0 9px; }
.dz-bio { margin: 0; font-size: 14px; color: var(--paper-2); line-height: 1.6; }
.dz-roles { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; }
.dz-roles dt { font: 500 10.5px/1.9 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.dz-roles dd { margin: 0; color: var(--paper-2); }

.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chain-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 2px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: var(--night-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-2);
  cursor: pointer;
}
.chain-link:hover { border-color: var(--wire-2); color: var(--paper); }
.chain-link.me { border-color: var(--sodium); color: var(--paper); cursor: default; }
.chain-sep { color: var(--faint); font-size: 12px; }

.rels { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
}
.rel:hover { background: var(--asphalt-2); }
.rel-name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.rel-label { font-size: 12px; color: var(--dim); line-height: 1.3; }
.rel-type { font: 600 9.5px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tc); white-space: nowrap; text-align: right; }
.rel-type small { display: block; color: var(--faint); letter-spacing: .04em; }

.moments { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.moments li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; font-size: 13px; color: var(--paper-2); }
.moments button {
  justify-self: start;
  align-self: start;
  padding: 2px 6px;
  border: 1px solid var(--wire);
  border-radius: 4px;
  background: var(--night-2);
  font: 600 10.5px/1.3 var(--f-mono);
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
}
.moments button:hover { color: var(--sodium); border-color: var(--sodium); }
.moments li.future { opacity: .45; }

.dz-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 18px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--asphalt);
  color: var(--paper-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.btn:hover { border-color: var(--sodium); color: var(--paper); }
.btn svg { width: 14px; height: 14px; }

/* ==========================================================================
   Episode scrubber
   ========================================================================== */
.scrubber {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(280px, 1fr) minmax(0, 380px);
  align-items: center;
  gap: 22px;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--wire);
  background: linear-gradient(to top, rgba(10, 15, 21, .96), rgba(10, 15, 21, .8));
  backdrop-filter: blur(10px);
}
.scrub-now { min-width: 0; }
.scrub-now .label { color: var(--sodium); }
.scrub-title {
  margin-top: 3px;
  font: 800 20px/1.05 var(--f-display);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scrub-title span { color: var(--faint); font-weight: 600; margin-right: 6px; }

.track {
  position: relative;
  height: 46px;
  touch-action: none;
  cursor: pointer;
  user-select: none;
}
.track-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  height: 2px;
  background: var(--wire);
  border-radius: 2px;
}
.track-fill {
  position: absolute;
  left: 0;
  bottom: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(243, 165, 54, .3), var(--sodium));
  transition: width .45s var(--ease);
}
.ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; }
.tick {
  position: relative;
  width: 26px;
  margin: 0 -13px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
.tick:first-child { margin-left: -13px; }
.tick-dot {
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--night);
  border: 2px solid var(--wire-2);
  transition: border-color .3s, background .3s;
}
.tick.past .tick-dot { border-color: var(--sodium); background: var(--sodium); }
.tick-num {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  text-align: center;
  font: 600 10.5px/1 var(--f-mono);
  color: var(--faint);
  transition: color .3s;
}
.tick.past .tick-num { color: var(--dim); }
.tick.current .tick-num { color: var(--paper); }
.tick-marks {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}
.tick-marks i { width: 3px; height: 7px; border-radius: 1px; background: var(--blood); }
.tick-marks i.arr { background: var(--sodium); }
.tick-marks i.shot { background: var(--rose); height: 5px; margin-top: 2px; }
.handle {
  position: absolute;
  bottom: 4px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: var(--sodium);
  box-shadow: 0 0 0 5px rgba(243, 165, 54, .2), 0 0 22px rgba(243, 165, 54, .6);
  transition: left .45s var(--ease);
  pointer-events: none;
}
.track.dragging .handle, .track.dragging .track-fill { transition: none; }

.scrub-quote {
  min-width: 0;
  font: italic 13px/1.4 var(--f-body);
  color: var(--paper-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scrub-quote cite { font: 500 normal 10.5px/1 var(--f-mono); color: var(--faint); letter-spacing: .06em; margin-left: 6px; white-space: nowrap; }
.scrub-quote.swap { animation: quote-swap .5s var(--ease); }
@keyframes quote-swap { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Search palette
   ========================================================================== */
.palette {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
  background: rgba(5, 8, 12, .6);
  backdrop-filter: blur(4px);
  animation: fade-in .2s both;
}
.palette-box {
  width: min(560px, 100%);
  border: 1px solid var(--wire-2);
  border-radius: 14px;
  background: var(--asphalt);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9);
  overflow: hidden;
  animation: pop-in .3s var(--ease) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--wire); }
.palette-input-row svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.palette input {
  flex: 1;
  min-width: 0;
  padding: 16px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--paper);
  font: 500 16px/1.2 var(--f-body);
}
.palette input::placeholder { color: var(--faint); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 440px); overflow: auto; }
.palette-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: var(--asphalt-3); }
.palette-list .p-name { font-weight: 600; }
.palette-list .p-role { font-size: 12px; color: var(--dim); }
.palette-list .p-fac { font: 600 9.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fc); }
.palette-empty { padding: 18px; color: var(--dim); font-size: 13px; }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--wire); font-size: 11.5px; color: var(--faint); }


/* ==========================================================================
   Arcs (cross-season progression)
   ========================================================================== */
.arcs-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.arcs-wrap .view-head { max-width: 720px; margin-bottom: 20px; }
.arcs-note { margin: 10px 0 0; font: 500 11.5px/1.5 var(--f-mono); color: var(--faint); letter-spacing: .02em; }
.arcs-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.arcs-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 230px);
  padding: 12px;
  border: 1px solid var(--wire);
  border-radius: 14px;
  background: rgba(18, 26, 36, .7);
}
.arcs-filter {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--wire);
  border-radius: 8px;
  background: var(--night-2);
  color: var(--paper);
  font: 500 13px/1.2 var(--f-body);
  outline: 0;
}
.arcs-filter:focus { border-color: var(--sodium); }
.arcs-list { overflow: auto; overscroll-behavior: contain; display: grid; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.arcs-group { padding: 10px 6px 4px; }
.arcs-empty { margin: 8px 6px; color: var(--dim); font-size: 13px; }
.arc-person {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.arc-person:hover { background: var(--asphalt-2); }
.arc-person.is-sel { background: var(--asphalt-3); border-color: var(--sodium); }
.ap-name { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--paper-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-person.is-sel .ap-name { color: var(--paper); }
.ap-dots { display: inline-flex; gap: 3px; }
.ap-dots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--wire-2); }
.ap-dots i.on { border-color: var(--fc); background: var(--fc); }

.arc-detail { min-width: 0; }
.arc-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid var(--wire);
  border-radius: 14px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--fc) 14%, transparent), rgba(18, 26, 36, .6) 55%);
  animation: step-in .45s var(--ease) both;
}
.arc-head .dz-name { font-size: 36px; }
.arc-head .photo-credit { margin-top: 8px; }
.arc-sec { margin-top: 22px; }
.arc-sec > h5 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 10px; }
.arc-key { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: .04em; }
.arc-key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.arc-key .k-start { border: 2px solid var(--dim); }
.arc-key .k-end { background: var(--dim); }

.arc-map-scroll { overflow-x: auto; padding-bottom: 4px; }
.arc-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(200px, 1fr));
  gap: 32px;
  min-width: min-content;
}
.arc-lines { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.arc-lines path { fill: none; stroke-width: 2; stroke-linecap: round; }
.arc-lines path.draw { animation: draw .9s var(--ease) both; }
.arc-link { stroke: var(--steel); stroke-dasharray: 5 5; }
.arc-lines path.arc-link.draw { animation: draw-dash .9s var(--ease) both; }
@keyframes draw-dash { from { opacity: 0; } }
.arc-move.up { stroke: var(--sage); }
.arc-move.down { stroke: var(--blood); }

.arc-col {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wire);
  border-radius: 12px;
  background: rgba(18, 26, 36, .65);
  animation: step-in .5s var(--ease) both;
  animation-delay: var(--d, 0ms);
}
.arc-col-head { display: grid; gap: 2px; padding: 12px 14px 10px; border-bottom: 1px solid var(--wire); }
.arc-col-head b { font: 800 20px/1.05 var(--f-display); letter-spacing: .02em; color: var(--lc, var(--paper)); }
.arc-col-head .sub { font-size: 11.5px; color: var(--dim); }
.arc-col.absent { opacity: .5; border-style: dashed; }
.arc-col.absent .arc-col-head b, .arc-col.off .arc-col-head b { color: var(--paper-2); }
.arc-rungs { list-style: none; margin: 0; padding: 8px 0; }
.arc-rung {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 12px 3px 50px;
  font: 500 11px/1.25 var(--f-mono);
  letter-spacing: .03em;
  color: var(--faint);
}
.arc-rung::before { content: ""; position: absolute; left: 29px; top: 0; bottom: 0; width: 2px; background: var(--wire); }
.arc-rung:first-child::before { top: 50%; }
.arc-rung:last-child::before { bottom: 50%; }
.arc-dot {
  position: absolute;
  left: 24px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--night);
  border: 2px solid var(--wire-2);
}
.arc-rung.start, .arc-rung.end { color: var(--paper); font-weight: 600; }
.arc-rung.start .arc-dot { border-color: var(--fc); background: var(--night); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fc) 18%, transparent); }
.arc-rung.end .arc-dot { border-color: var(--fc); background: var(--fc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fc) 22%, transparent), 0 0 14px var(--fc); }
.arc-rung.end.dead .arc-dot { background: var(--blood); border-color: var(--blood); box-shadow: 0 0 0 4px rgba(255, 91, 94, .2); }
.arc-rung.end.dead span { text-decoration: line-through; text-decoration-color: var(--blood); }
.arc-rung.end { background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 12%, transparent), transparent 80%); }
.arc-off { flex: 1; padding: 14px; font-size: 13px; color: var(--paper-2); }
.arc-off p { margin: 0; }
.arc-off .arc-off-title { font: 700 16px/1.2 var(--f-display); letter-spacing: .02em; color: var(--paper); margin-bottom: 6px; }
.arc-col.absent .arc-off { color: var(--dim); }
.arc-col-foot { padding: 10px 14px 12px; border-top: 1px solid var(--wire); }
.arc-stamp {
  display: inline-block;
  padding: 2px 7px 1px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font: 800 11px/1.2 var(--f-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--st, var(--blood));
  transform: rotate(-3deg);
}
.arc-stamp.quiet { border: 0; padding: 0; transform: none; font: 500 11px/1.3 var(--f-mono); letter-spacing: .04em; text-transform: none; color: var(--faint); }

.arc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.arc-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--wire);
  border-top: 3px solid var(--fc);
  border-radius: 14px;
  background: rgba(18, 26, 36, .6);
}
.arc-card h4 { margin: 0; font: 800 22px/1.05 var(--f-display); letter-spacing: .01em; }
.arc-card .btn { align-self: flex-start; margin-top: auto; }
.arc-moments li { grid-template-columns: 50px 1fr; }

.arc-changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.arc-changes > li { padding: 12px 16px; border: 1px solid var(--wire); border-radius: 12px; background: rgba(18, 26, 36, .5); }
.arc-step-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font: 700 15px/1.2 var(--f-display); letter-spacing: .03em; margin-bottom: 8px; }
.arc-gap { font: 500 11px/1.3 var(--f-mono); color: var(--faint); letter-spacing: .04em; }
.arc-diffs { display: flex; flex-wrap: wrap; gap: 6px; }
.arc-diff { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 5px 10px; border: 1px solid var(--wire); border-radius: 8px; background: var(--night-2); font-size: 12.5px; color: var(--paper-2); }
.arc-diff b { color: var(--paper); }
.arc-diff.quiet { color: var(--dim); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 761px) {
  .dossier-open .ladder-wrap, .dossier-open .eps-wrap, .dossier-open .arcs-wrap { padding-right: calc(var(--dossier-w) + 20px); }
}
@media (max-width: 1000px) {
  .arcs-grid { grid-template-columns: 1fr; }
  .arcs-side { position: static; max-height: 300px; }
}
@media (max-width: 1500px) {
  .dossier-open .ladders { grid-template-columns: 1fr; }
}

@media (max-width: 1180px) {
  .scrubber { grid-template-columns: minmax(150px, 200px) 1fr; }
  .scrub-quote { display: none; }
  .tab { padding: 7px 12px; }
}

@media (max-width: 1000px) {
  .ladders { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

@media (max-width: 760px) {
  :root { --dossier-w: 100%; }
  .topbar { grid-template-columns: 1fr auto; padding: 10px 16px; gap: 10px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .tab { flex: 1; justify-content: center; padding: 7px 6px; font-size: 12.5px; gap: 6px; }
  .tab svg { display: none; }
  .search-btn span, .search-btn kbd { display: none; }
  .season-switch { padding-left: 3px; }
  .season-switch .label { display: none; }
  .tab { font-size: 12px; padding: 7px 4px; }
  .arcs-wrap { padding: 16px 16px 32px; }
  .arc-head { padding: 16px; }
  .arc-head .dz-name { font-size: 28px; }
  .arc-map { grid-template-columns: repeat(var(--cols), minmax(190px, 78vw)); gap: 24px; }
  .brand-mark { font-size: 22px; }

  .overlay-top { left: 16px; right: 16px; top: 12px; }
  .view-title { font-size: 26px; }
  .view-blurb { display: none; }
  .legend { left: 16px; bottom: 12px; max-width: calc(100% - 84px); font-size: 11px; }
  .zoom-ctl { right: 16px; bottom: 12px; }
  .dossier-open .zoom-ctl { transform: none; }
  .filters { max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .chip { flex: none; }
  .legend { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg button { white-space: nowrap; }
  .overlay-top .view-head { width: 100%; }

  .overlay-top { transition: opacity .3s; }
  .dossier-open .overlay-top, .dossier-open .legend { opacity: 0; pointer-events: none; }
  .dossier {
    top: auto;
    left: 0;
    height: 70%;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--wire-2);
    border-radius: 18px 18px 0 0;
    transform: translateY(104%);
  }
  .dossier::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--wire-2);
  }
  .dossier-scroll { padding: 0 16px 24px; }
  .dz-head { margin: 0 -16px; padding: 24px 16px 16px; }

  .scrubber { grid-template-columns: 1fr; gap: 2px; padding: 8px 16px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .scrub-now { display: flex; align-items: baseline; gap: 10px; }
  .scrub-title { font-size: 16px; }
  .tick-num { font-size: 9.5px; }

  .ladder-wrap, .eps-wrap { padding: 16px 16px 32px; }
  .path-card { grid-template-columns: 1fr; }
  .ep-events li { grid-template-columns: 1fr; gap: 4px; }
  .ep { padding: 14px 14px 16px; }
  .eps { padding-left: 30px; }
  .ep::before { left: -30px; }
  .eps::before { left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .web-link.g-wire, .board-links path.pulse { animation: none !important; }
}

/* ==========================================================================
   Landing: the spoiler check
   A case board with every name blacked out, and one question.
   ========================================================================== */
.landing {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(900px 560px at -4% -12%, rgba(243, 165, 54, .16), transparent 62%),
    radial-gradient(760px 560px at 104% 108%, rgba(255, 91, 94, .10), transparent 60%),
    radial-gradient(640px 480px at 88% 6%, rgba(111, 200, 206, .07), transparent 60%),
    var(--night);
}
.landing::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.landing::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(151, 161, 173, .13) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 70% 50%, #000 30%, transparent 75%);
}
.landing > * { position: relative; z-index: 1; }
.landing:focus { outline: none; }
.landing.is-leaving { animation: landing-out .45s var(--ease) both; pointer-events: none; }
@keyframes landing-out { to { opacity: 0; transform: scale(1.03); } }

.landing-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--wire);
  background: linear-gradient(to bottom, rgba(10, 15, 21, .9), rgba(10, 15, 21, .55));
}
.landing-head-sub, .landing-head-file {
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
}
.landing-head-file { margin-left: auto; color: var(--blood); white-space: nowrap; }
.landing-head-file::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blood);
  box-shadow: 0 0 0 3px rgba(255, 91, 94, .2);
  vertical-align: 1px;
  animation: breathe 2.4s ease-in-out infinite;
}

.landing-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 590px) minmax(0, 480px);
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 6vw, 96px);
  padding: clamp(28px, 6vh, 72px) clamp(16px, 5vw, 64px);
}

.landing-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sodium);
  animation: swap-in .6s var(--ease) both;
}
.landing-kicker::before { content: ""; flex: none; width: 28px; height: 2px; background: currentColor; }
.landing-title {
  margin: 16px 0 0;
  font: 900 clamp(46px, 6.2vw, 86px)/.9 var(--f-display);
  letter-spacing: .005em;
  text-transform: uppercase;
  text-wrap: balance;
  animation: swap-in .7s var(--ease) 80ms both;
}
.landing-title em { font-style: normal; color: var(--blood); }
.landing-lede {
  margin: 20px 0 0;
  max-width: 50ch;
  font-size: clamp(15px, 1.25vw, 17px);
  line-height: 1.55;
  color: var(--paper-2);
  text-wrap: pretty;
  animation: swap-in .7s var(--ease) 160ms both;
}

.landing-ask { margin-top: 34px; }
.landing-ask > .label { margin-bottom: 12px; color: var(--dim); }
.landing-seasons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.season-pick {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  padding: 14px 14px 14px 20px;
  border: 1px solid var(--wire);
  border-radius: var(--radius);
  background: linear-gradient(to bottom, var(--asphalt-2), var(--asphalt));
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .8);
  text-align: left;
  cursor: pointer;
  transition: transform .3s var(--ease), border-color .25s, box-shadow .3s;
  animation: card-in .6s var(--ease) both;
  animation-delay: var(--d, 0ms);
}
.season-pick::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sodium);
}
.season-pick > :not(.sp-go) { grid-column: 1; white-space: nowrap; }
.sp-name { margin-top: 5px; font: 800 32px/1 var(--f-display); letter-spacing: .01em; }
.sp-meta { margin-top: 6px; font: 500 11px/1.3 var(--f-mono); color: var(--dim); letter-spacing: .04em; }
.sp-go {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--wire-2);
  border-radius: 50%;
  color: var(--dim);
  transition: background .25s, color .25s, border-color .25s, transform .3s var(--ease);
}
.sp-go svg { width: 16px; height: 16px; }
.season-pick:hover, .season-pick:focus-visible {
  border-color: var(--sodium);
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(243, 165, 54, .2), 0 18px 34px -16px rgba(0, 0, 0, .9);
  outline: none;
}
.season-pick:hover .sp-go, .season-pick:focus-visible .sp-go {
  background: var(--sodium);
  border-color: var(--sodium);
  color: #1a1206;
  transform: translateX(3px);
}

.landing-link {
  margin-top: 16px;
  padding: 4px 0;
  border: 0;
  background: none;
  font: 500 12px/1.4 var(--f-mono);
  letter-spacing: .04em;
  color: var(--dim);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--wire-2);
  text-underline-offset: 5px;
  transition: color .2s, text-decoration-color .2s;
}
.landing-link:hover { color: var(--paper); text-decoration-color: var(--sodium); }

.landing-hold { margin-top: 34px; animation: swap-in .5s var(--ease) both; }
.landing-quote {
  margin: 0;
  padding-left: 16px;
  border-left: 3px solid var(--sodium);
  font: 600 italic clamp(21px, 2vw, 27px)/1.25 var(--f-body);
}
.landing-quote::before { content: "\201C"; color: var(--sodium); }
.landing-quote cite {
  display: block;
  margin-top: 10px;
  font: 500 normal 10.5px/1.2 var(--f-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}
.landing-hold p { margin: 18px 0 0; max-width: 46ch; color: var(--paper-2); font-size: 15px; }

.landing-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--wire);
  font: 500 10.5px/1.5 var(--f-mono);
  letter-spacing: .04em;
  color: var(--faint);
}

/* the blacked-out board */
.landing-board svg { display: block; width: 100%; height: auto; overflow: visible; }
.lb-link {
  fill: none;
  stroke: var(--wire-2);
  stroke-width: 1.5;
  animation: draw .9s var(--ease) both;
  animation-delay: var(--d);
}
.lb-link.informal { stroke: var(--sodium); stroke-dasharray: 4 5; opacity: .75; animation: fade-in .6s ease both; animation-delay: var(--d); }
.lb-note { font: 500 9px var(--f-mono); letter-spacing: .06em; fill: var(--sodium); opacity: .8; animation: fade-in .6s ease both; animation-delay: var(--d); }
.lb-card { animation: card-in .6s var(--ease) both; animation-delay: var(--d); }
.lb-bg { fill: url(#lbCardFill); stroke: var(--wire); }
.lb-bar { fill: var(--fc); opacity: .85; }
.lb-av { fill: var(--night); stroke: var(--fc); stroke-width: 1.5; }
.lb-ini { font: 800 15px var(--f-display); fill: var(--fc); text-anchor: middle; }
.lb-redact {
  fill: var(--paper-2);
  transform-box: fill-box;
  transform-origin: left center;
  animation: redact .45s var(--ease) both;
  animation-delay: calc(var(--d) + 380ms);
}
@keyframes redact { from { transform: scaleX(0); } }
.lb-strike { fill: var(--blood); transform-box: fill-box; transform-origin: left center; animation: redact .35s var(--ease) both; animation-delay: 1.3s; }
.lb-card.is-dead .lb-bg { fill: #141920; }
.lb-role { font: 500 10.5px var(--f-mono); fill: var(--dim); }
.lb-stamp {
  --r: -4deg;
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(var(--r));
  animation: lb-slam .55s var(--ease-back) both;
  animation-delay: var(--sd);
}
.lb-stamp rect { fill: var(--night); stroke: var(--st); stroke-width: 1.6; }
.lb-stamp text { font: 800 10px var(--f-display); letter-spacing: .14em; fill: var(--st); text-anchor: middle; }
@keyframes lb-slam {
  0% { opacity: 0; transform: rotate(calc(var(--r) - 10deg)) scale(2.2); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--r)) scale(1); }
}

.lb-big {
  --r: -9deg;
  --st: var(--blood);
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(var(--r));
}
.lb-big.slam { animation: lb-slam .6s var(--ease-back) both; animation-delay: 1.55s; }
.landing.is-hold .lb-big { --st: var(--sodium); --r: 6deg; }
.landing.is-hold .lb-big.slam { animation-delay: 0s; }
.lb-big-outer { fill: rgba(10, 15, 21, .84); stroke: var(--st); stroke-width: 4; }
.lb-big-inner { fill: none; stroke: var(--st); stroke-width: 1.5; }
.lb-big text { font: 900 50px var(--f-display); letter-spacing: .12em; fill: var(--st); text-anchor: middle; }

@media (max-width: 900px) {
  .landing-main { grid-template-columns: minmax(0, 560px); gap: 8px; padding-top: 20px; }
  .landing-board { order: -1; width: min(100%, 340px); justify-self: center; }
}
@media (max-width: 760px) {
  .landing-head { padding: 12px 16px; }
  .landing-head-sub { display: none; }
  .landing-main { padding: 12px 16px 28px; }
  .landing-title { font-size: clamp(38px, 11vw, 52px); }
  .landing-ask { margin-top: 26px; }
  .landing-seasons { grid-template-columns: 1fr; gap: 10px; }
  .sp-name { font-size: 28px; }
  .landing-foot { padding: 12px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .landing *, .landing *::before { animation-delay: 0s !important; }
}
