/* "Behind the Save" visual system: blueprint paper, navy ink, one colour per person.
   Loaded after styles.css; overrides its tokens and components. */
:root {
  --paper: #eef2f6;
  --sheet: #f6f8fb;
  --card: #ffffff;
  --line: #d6dee8;
  --line-soft: #e5ebf2;
  --edge: #1d2b3a;
  --ink: #111c28;
  --ink-2: #2a3a4c;
  --muted: #5d6c7d;
  --grid: #d9e3ee;
  --drop: rgba(17, 28, 40, .10);

  --accent: #1667c2;
  --accent-soft: #dbe8f7;
  --good: #1d8a5f;
  --good-soft: #d5efe3;
  --warn: #b0730f;
  --warn-soft: #f7e6c2;
  --bad: #c23d33;
  --bad-soft: #f8dcd8;
  --req: #e07a2e;
  --res: #1d8a5f;

  --c-lena: #1667c2;
  --c-user: #13897b;
  --c-admin: #c27a12;
  --c-dev: #6a4bd6;
  --c-sam: #c2563b;

  --n-blue-t: #dfeafb;  --n-blue-l: #bcd3f3;  --n-blue-r: #9dbde9;
  --n-gold-t: #fbeccc;  --n-gold-l: #f2d595;  --n-gold-r: #e6c070;
  --n-violet-t: #e9e3fb; --n-violet-l: #cfc3f4; --n-violet-r: #b7a6ea;
  --n-green-t: #d8f1e6; --n-green-l: #b2e0cb; --n-green-r: #8fceb2;
  --n-rose-t: #fbe1dc;  --n-rose-l: #f2bdb3;  --n-rose-r: #e69c8f;
  --n-slate-t: #e6ebf1; --n-slate-l: #c9d2dd; --n-slate-r: #afbbca;
  --n-paper-t: #f9fbfd; --n-paper-l: #e3e9f0; --n-paper-r: #cfd8e3;
  --screen: #cfe2f7;
  --zone: #e4ebf3;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --pop: 0 1px 2px rgba(17, 28, 40, .08), 0 6px 16px -10px rgba(17, 28, 40, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1720; --sheet: #141e29; --card: #18232f; --line: #283646; --line-soft: #1f2b38;
    --edge: #c9d6e4; --ink: #e8eef5; --ink-2: #cbd6e2; --muted: #8c9cad; --grid: #1c2733; --drop: rgba(0,0,0,.4);
    --accent: #6aa8ef; --accent-soft: #1b3150; --good: #5cc79a; --good-soft: #173a2c; --warn: #e2ab4f; --warn-soft: #3d2f15;
    --bad: #f0857a; --bad-soft: #43201d; --req: #f09a55; --res: #5cc79a;
    --c-lena: #6aa8ef; --c-user: #45c2b1; --c-admin: #e8a73f; --c-dev: #a28cf2; --c-sam: #ec8b6f;
    --n-blue-t: #284465; --n-blue-l: #203853; --n-blue-r: #192c42;
    --n-gold-t: #5a4622; --n-gold-l: #4a3a1c; --n-gold-r: #3b2e16;
    --n-violet-t: #3e3466; --n-violet-l: #332a55; --n-violet-r: #282145;
    --n-green-t: #1f4a3b; --n-green-l: #1a3d31; --n-green-r: #143127;
    --n-rose-t: #5a2e27; --n-rose-l: #4a2620; --n-rose-r: #3a1e19;
    --n-slate-t: #2d3946; --n-slate-l: #25303b; --n-slate-r: #1e2731;
    --n-paper-t: #22303e; --n-paper-l: #1c2834; --n-paper-r: #16202a;
    --screen: #22405f; --zone: #17212c;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1720; --sheet: #141e29; --card: #18232f; --line: #283646; --line-soft: #1f2b38;
  --edge: #c9d6e4; --ink: #e8eef5; --ink-2: #cbd6e2; --muted: #8c9cad; --grid: #1c2733; --drop: rgba(0,0,0,.4);
  --accent: #6aa8ef; --accent-soft: #1b3150; --good: #5cc79a; --good-soft: #173a2c; --warn: #e2ab4f; --warn-soft: #3d2f15;
  --bad: #f0857a; --bad-soft: #43201d; --req: #f09a55; --res: #5cc79a;
  --c-lena: #6aa8ef; --c-user: #45c2b1; --c-admin: #e8a73f; --c-dev: #a28cf2; --c-sam: #ec8b6f;
  --n-blue-t: #284465; --n-blue-l: #203853; --n-blue-r: #192c42;
  --n-gold-t: #5a4622; --n-gold-l: #4a3a1c; --n-gold-r: #3b2e16;
  --n-violet-t: #3e3466; --n-violet-l: #332a55; --n-violet-r: #282145;
  --n-green-t: #1f4a3b; --n-green-l: #1a3d31; --n-green-r: #143127;
  --n-rose-t: #5a2e27; --n-rose-l: #4a2620; --n-rose-r: #3a1e19;
  --n-slate-t: #2d3946; --n-slate-l: #25303b; --n-slate-r: #1e2731;
  --n-paper-t: #22303e; --n-paper-l: #1c2834; --n-paper-r: #16202a;
  --screen: #22405f; --zone: #17212c;
}

body { font: 14px/1.6 var(--font); background: var(--paper); }
code, kbd, pre, .kbd, .search kbd { font-family: var(--mono); }
code { background: var(--sheet); border-color: var(--line); }
.dpanel pre.code, .step-body pre.code { font-family: var(--mono); }
.pill text, .zone-label, svg text { font-family: var(--font); }

/* ---------- chrome ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.mark .mk-body { fill: var(--n-blue-t); stroke: var(--edge); stroke-width: 1.3; stroke-linejoin: round; }
.mark .mk-line { fill: none; stroke: var(--edge); stroke-width: 1.3; stroke-linejoin: round; }
.mark .mk-lid { fill: var(--c-admin); stroke: var(--edge); stroke-width: 1.3; stroke-linejoin: round; transform: translate(-2px, -3px); }
.mark .mk-dot { fill: var(--c-user); }
.iconbtn { border: 1px solid var(--line); border-radius: 8px; box-shadow: none; background: var(--card); }
.iconbtn:hover { transform: none; box-shadow: none; border-color: var(--edge); }
.iconbtn:active { transform: none; box-shadow: none; }
.tab { border: 0; border-radius: 0; padding: 16px 12px 14px; border-bottom: 2px solid transparent; font-weight: 600; }
.tab[aria-current="page"] { border: 0; border-bottom: 2px solid var(--accent); background: none; box-shadow: none; color: var(--ink); }
.search { border-radius: 8px; border: 1px solid var(--line); }
.btn { border: 1px solid var(--line); border-radius: 8px; box-shadow: none; font-weight: 600; background: var(--card); }
.btn:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--edge); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: var(--edge); color: var(--card); border-color: var(--edge); }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn.accent { background: var(--accent-soft); }
.card { border-radius: var(--radius); box-shadow: var(--pop); border-color: var(--line); }
.chip { border: 1px solid var(--line); background: var(--sheet); font-weight: 500; }
.chip.role-user { border-color: var(--c-user); color: var(--c-user); background: transparent; }
.chip.role-admin { border-color: var(--c-admin); color: var(--c-admin); background: transparent; }
.chip.role-dev { border-color: var(--c-dev); color: var(--c-dev); background: transparent; }
.crumbs { font-size: 12px; letter-spacing: .02em; }
.crumbs b { color: var(--accent); }

/* ---------- episode layout: story rail + stage ---------- */
.ep { height: 100%; display: grid; grid-template-columns: 430px minmax(0, 1fr); }
.rail { min-height: 0; overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.ep-head h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; margin: 4px 0 8px; }
.brief { display: flex; gap: 12px; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; }
.brief p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; font-style: italic; }
.brief .who { font-size: 12px; color: var(--muted); }
.brief .who b { color: var(--ink); font-style: normal; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--av); color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.mini-av { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--av); color: #fff; font-size: 9px; font-weight: 700; vertical-align: -4px; }

.scene { display: flex; flex-direction: column; gap: 10px; }
.scene .step-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.scene h2 { font-size: 19px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
.scene .step-body { font-size: 14px; color: var(--ink-2); overflow: visible; }
.scene .step-body p { margin: 0 0 10px; }
.tag { border: 0; border-radius: 4px; padding: 3px 8px; font-size: 10.5px; letter-spacing: .07em; font-weight: 700; text-transform: uppercase; background: var(--sheet); color: var(--ink-2); }
.tag.PROBLEM { background: var(--bad-soft); color: var(--bad); }
.tag.CONCEPT { background: var(--accent-soft); color: var(--accent); }
.tag.TECHNIQUE { background: var(--n-violet-t); color: var(--c-dev); }
.tag.CASE { background: var(--warn-soft); color: var(--warn); }
.tag.GOTCHA { background: var(--bad-soft); color: var(--bad); }
.tag.TRY { background: var(--good-soft); color: var(--good); }
.tag.RECAP { background: var(--edge); color: var(--card); }
.keyidea { display: block; border: 0; border-left: 3px solid var(--accent); border-radius: 0; background: var(--accent-soft); padding: 10px 12px; margin-top: 4px; font-weight: 600; color: var(--ink); }
.keyidea .k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.step-body ul.checks li::before { border: 1px solid var(--good); background: var(--good-soft); color: var(--good); border-radius: 50%; }
.scene .nav { display: flex; gap: 8px; margin-top: 4px; }
.scene .hints { font-size: 11px; color: var(--muted); }

.scenes { border-top: 1px solid var(--line); padding-top: 12px; }
.scenes-h { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.scenes ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: none; }
.scenes .tl-dot { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.scenes .tl-dot:hover { background: var(--sheet); }
.scenes .tl-dot:focus-visible { outline: 2px solid var(--accent); }
.scenes .tl-dot .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); }
.scenes .tl-dot .k { font-size: 10.5px; color: var(--muted); }
.scenes .tl-dot.done .n { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.scenes .tl-dot.cur { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.scenes .tl-dot.cur .n { background: var(--accent); border-color: var(--accent); color: #fff; }

.notes { border-top: 1px solid var(--line); padding-top: 10px; }
.notes summary { cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.notes h3 { font-size: 12px; margin: 10px 0 6px; }
.notes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.notes li { position: relative; padding-left: 22px; font-size: 13px; color: var(--muted); }
.notes li::before { content: ""; position: absolute; left: 0; top: 3px; width: 13px; height: 13px; border: 1px solid var(--line); border-radius: 50%; }
.notes li.on { color: var(--ink); }
.notes li.on::before { content: "✓"; font-size: 9px; display: grid; place-items: center; background: var(--good-soft); border-color: var(--good); color: var(--good); }
.rail .src-card { box-shadow: none; }

.stagewrap { min-width: 0; min-height: 0; padding: 0; display: flex; }
.stagewrap .stage { flex: 1; border: 0; border-radius: 0; background:
  radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 0) 0 0 / 22px 22px, var(--paper); }
.gridline { stroke: var(--grid); stroke-width: .8; opacity: .8; }
.face { stroke-width: 1; }
.edge { stroke-width: 1.3; }
.plate { stroke-width: .8; rx: 4px; }
.pill rect { stroke-width: .9; }
.metric { border-radius: 8px; box-shadow: var(--pop); border-color: var(--line); }
.metric .k { font-size: 10px; }
.metric .v { font-size: 15px; font-weight: 700; }
.metric.total { border-left: 3px solid var(--accent); }
.metric.bump { border-color: var(--accent); background: var(--accent-soft); }
.dpanel { border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--pop); font-size: 12px; }
.dpanel h4 { color: var(--accent); }
.legend i { border: 1px solid var(--edge); }
.legend i.cfg { background: var(--card); }
.controls .iconbtn { background: var(--card); }
g.dim { opacity: .8; }
.hero-art { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop); }
.hero-art { height: 340px; }
.hero-art svg { width: 100%; height: 100%; }

/* ---------- course map ---------- */
.hero h1 { font-size: 44px; line-height: 1.05; letter-spacing: -.03em; font-weight: 700; }
.hero .hero-lead { font-size: 19px; line-height: 1.4; color: var(--ink); margin: 10px 0 6px; font-weight: 500; }
.hero p { font-size: 15px; color: var(--ink-2); }
.section-h { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.arc { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.arc-step { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--pop); position: relative; }
.arc-step.done { border-color: var(--good); }
.arc-step.part { border-color: var(--accent); }
.arc-when { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.arc-step h3 { font-size: 15px; }
.arc-step p { margin: 0; font-size: 12.5px; color: var(--muted); }
.arc-step ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; flex: 1; align-content: start; }
.arc-step li button { all: unset; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.arc-step li button:hover { color: var(--accent); text-decoration: underline; }
.arc-bar { height: 4px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.arc-bar i { display: block; height: 100%; background: var(--good); }
.path, .qcard, .mod { box-shadow: var(--pop); }

@media (max-width: 1000px) {
  .ep { grid-template-columns: minmax(0, 1fr); height: auto; }
  .rail { order: 2; overflow: visible; border-right: 0; }
  .stagewrap { order: 1; height: auto; }
  .stagewrap .stage { min-height: 420px; }
  .arc { grid-template-columns: repeat(7, minmax(220px, 1fr)); }
  .hero h1 { font-size: 34px; }
}
.site-foot > span:first-child { max-width: 680px; line-height: 1.5; }
