/* Layout idea: a drafting-table workspace — the diagram is the page, the step card is the margin note. */
:root {
  --paper: #f2ece2;
  --sheet: #f7f2e9;
  --card: #f9f5ee;
  --line: #ddd4c6;
  --line-soft: #e7e0d4;
  --edge: #3d3a35;
  --ink: #1b1c1f;
  --ink-2: #33343a;
  --muted: #6d6a64;
  --grid: #e3dbcd;
  --drop: #1b1c1f;

  --accent: #1f6fc4;          /* cloud blue */
  --accent-soft: #d6e6f6;
  --good: #3f8f4e;
  --good-soft: #d7e9c6;
  --warn: #b7791f;
  --warn-soft: #f6e3b8;
  --bad: #b5452f;
  --bad-soft: #f5d4cb;
  --req: #d8743f;
  --res: #4f9a58;

  /* isometric node faces: top / left / right */
  --n-blue-t: #d9e7f7;  --n-blue-l: #b9d0ec;  --n-blue-r: #9dbbe0;
  --n-gold-t: #f8e3ad;  --n-gold-l: #efcd7f;  --n-gold-r: #e2b860;
  --n-violet-t: #e5ddf4; --n-violet-l: #cdbfe9; --n-violet-r: #b6a5dc;
  --n-green-t: #dcebc9; --n-green-l: #bfd9a1; --n-green-r: #a4c784;
  --n-rose-t: #f5d9d2;  --n-rose-l: #eab9ad;  --n-rose-r: #dc9e8f;
  --n-slate-t: #e2e5ea; --n-slate-l: #c7ccd4; --n-slate-r: #aeb5bf;
  --n-paper-t: #f6f0e6; --n-paper-l: #e4dccf; --n-paper-r: #d3c9b9;
  --screen: #cfe0f4;
  --zone: #ebe4d8;

  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  --pop: 1.5px 2.5px 0 var(--drop);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1d1c1a; --sheet: #232220; --card: #262522; --line: #3a3833; --line-soft: #2e2c29;
    --edge: #cfc8bd; --ink: #efe8dc; --ink-2: #ddd5c8; --muted: #a39b8f; --grid: #2b2926; --drop: #050505;
    --accent: #6fb0f2; --accent-soft: #23364b; --good: #84c98d; --good-soft: #2d4128; --warn: #e6b45a; --warn-soft: #4a3b1f;
    --bad: #ec8c76; --bad-soft: #4d2a23; --req: #ec9a66; --res: #84c98d;
    --n-blue-t: #34506f; --n-blue-l: #2a4160; --n-blue-r: #213450;
    --n-gold-t: #6a5527; --n-gold-l: #57451e; --n-gold-r: #463717;
    --n-violet-t: #4e3f6a; --n-violet-l: #40335a; --n-violet-r: #33284a;
    --n-green-t: #3f5530; --n-green-l: #334628; --n-green-r: #283820;
    --n-rose-t: #63392f; --n-rose-l: #522f27; --n-rose-r: #42251f;
    --n-slate-t: #41464e; --n-slate-l: #353a41; --n-slate-r: #2b2f35;
    --n-paper-t: #3a3732; --n-paper-l: #302d29; --n-paper-r: #272522;
    --screen: #2c4561; --zone: #262420;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1d1c1a; --sheet: #232220; --card: #262522; --line: #3a3833; --line-soft: #2e2c29;
  --edge: #cfc8bd; --ink: #efe8dc; --ink-2: #ddd5c8; --muted: #a39b8f; --grid: #2b2926; --drop: #050505;
  --accent: #6fb0f2; --accent-soft: #23364b; --good: #84c98d; --good-soft: #2d4128; --warn: #e6b45a; --warn-soft: #4a3b1f;
  --bad: #ec8c76; --bad-soft: #4d2a23; --req: #ec9a66; --res: #84c98d;
  --n-blue-t: #34506f; --n-blue-l: #2a4160; --n-blue-r: #213450;
  --n-gold-t: #6a5527; --n-gold-l: #57451e; --n-gold-r: #463717;
  --n-violet-t: #4e3f6a; --n-violet-l: #40335a; --n-violet-r: #33284a;
  --n-green-t: #3f5530; --n-green-l: #334628; --n-green-r: #283820;
  --n-rose-t: #63392f; --n-rose-l: #522f27; --n-rose-r: #42251f;
  --n-slate-t: #41464e; --n-slate-l: #353a41; --n-slate-r: #2b2f35;
  --n-paper-t: #3a3732; --n-paper-l: #302d29; --n-paper-r: #272522;
  --screen: #2c4561; --zone: #262420;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
code { font: inherit; background: var(--sheet); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; font-size: .92em; }
b { font-weight: 700; }
.hl { background: linear-gradient(transparent 55%, var(--good-soft) 55%); font-weight: 700; }

/* ---------- top bar ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.iconbtn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--edge); border-radius: 10px; box-shadow: var(--pop);
}
.iconbtn:hover { transform: translate(-1px, -1px); box-shadow: 2.5px 3.5px 0 var(--drop); }
.iconbtn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--drop); }
.iconbtn svg { width: 18px; height: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; text-decoration: none; color: var(--ink); cursor: pointer; background: none; border: 0; padding: 0; }
.brand .mark { width: 30px; height: 30px; }
.brand em { font-style: normal; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab {
  border: 1.5px solid transparent; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.tab[aria-current="page"] { border-color: var(--edge); background: var(--accent-soft); color: var(--ink); box-shadow: var(--pop); }
.tab:hover { color: var(--ink); }
.spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; width: 260px; height: 36px; padding: 0 10px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; color: var(--muted);
}
.search kbd, .kbd { font: 10px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--sheet); color: var(--muted); }
.search span { flex: 1; text-align: left; }

/* ---------- views ---------- */
.view { height: calc(100% - 56px); overflow: auto; }
.lesson-grid {
  height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; padding: 14px;
}
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 10px 22px -18px rgba(60,40,20,.35);
}
.main-card { flex: 1; display: flex; flex-direction: column; padding: 16px 18px 14px; min-height: 0; }
.crumbs { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 2px; }
.title-row h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--edge);
  background: var(--sheet); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.chip.gold { background: var(--warn-soft); } .chip.green { background: var(--good-soft); } .chip.blue { background: var(--accent-soft); } .chip.rose { background: var(--bad-soft); }
.chip.role-user { background: var(--n-green-t); } .chip.role-admin { background: var(--n-gold-t); } .chip.role-dev { background: var(--n-violet-t); }
.sub { color: var(--muted); margin: 2px 0 10px; }

.stage {
  position: relative; flex: 1; min-height: 340px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--sheet);
}
.metrics { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 2; pointer-events: none; }
.metric {
  min-width: 92px; padding: 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .3s, background .3s;
}
.metric .k { font-size: 9.5px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; display: flex; gap: 5px; align-items: center; }
.metric .v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 22px; }
.metric.total { border-left: 3px solid var(--good); }
.metric.total .v { color: var(--ink); }
.metric.bump { border-color: var(--edge); background: var(--good-soft); }
.metric.bad .v { color: var(--bad); }
svg.diagram { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: auto; height: 100%; transition: right .35s ease; }
svg.diagram { width: 100%; }
.legend { position: absolute; left: 12px; bottom: 10px; display: flex; gap: 14px; font-size: 10.5px; color: var(--muted); z-index: 2; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; border: 1.5px solid var(--edge); }
.controls { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; z-index: 2; }
.controls .iconbtn { width: 32px; height: 32px; }
.dpanel {
  position: absolute; right: 12px; bottom: 52px; width: 290px; z-index: 2; padding: 10px 12px;
  background: var(--card); border: 1.5px solid var(--edge); border-radius: 10px; box-shadow: var(--pop); font-size: 11px;
  max-height: calc(100% - 120px); overflow: auto; animation: rise .35s ease both;
}
.dpanel.wide { width: 410px; }
.dpanel pre.code, .step-body pre.code {
  margin: 0; padding: 8px 10px; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px;
  font: 10.5px/1.55 var(--font); white-space: pre; overflow-x: auto; color: var(--ink);
}
.dpanel table + pre.code { margin-top: 8px; }
pre.code .kw { color: var(--accent); font-weight: 700; }
pre.code .str { color: var(--good); }
pre.code .cm { color: var(--muted); font-style: italic; }
pre.code .ann { color: var(--warn); font-weight: 700; }
.dpanel h4 { margin: 0 0 6px; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dpanel table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dpanel td { padding: 2px 4px; vertical-align: top; overflow-wrap: break-word; }
.dpanel.left-cols td:first-child { width: 44%; }
.dpanel td:last-child { text-align: right; white-space: nowrap; }
.dpanel tr.em td { background: var(--good-soft); font-weight: 700; }
.dpanel tr.bad td { background: var(--bad-soft); font-weight: 700; }
.dpanel tr.warn td { background: var(--warn-soft); font-weight: 700; }
.dpanel tr.head td { color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.dpanel .foot { color: var(--muted); margin-top: 6px; font-size: 10.5px; }
.dpanel.left-cols td:last-child { text-align: left; white-space: normal; }
.illus { position: absolute; right: 12px; top: 64px; font-size: 10px; color: var(--muted); z-index: 1; }

.timeline-card { padding: 12px 18px 10px; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); }
.tl-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.tl-head span:last-child { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.timeline { position: relative; display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 22px; overflow-x: auto; }
.timeline::before { content: ""; position: absolute; left: 14px; right: 14px; top: 13px; height: 2px; background: var(--line); }
.tl-fill { position: absolute; left: 14px; top: 13px; height: 2px; background: var(--edge); transition: width .35s; }
.tl-dot {
  position: relative; z-index: 1; width: 28px; height: 28px; flex: none; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--edge); background: var(--card); font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.tl-dot.done { background: var(--good-soft); }
.tl-dot.cur { width: 32px; height: 32px; margin-top: -2px; background: var(--good-soft); box-shadow: var(--pop); border-width: 2px; }
.tl-dot .lbl { position: absolute; top: 36px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10.5px; font-weight: 700; }

/* step card */
.step-card { flex: 1; display: flex; flex-direction: column; padding: 16px; min-height: 0; }
.step-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.tag { font-size: 10px; letter-spacing: .08em; font-weight: 800; padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--edge); text-transform: uppercase; }
.tag.PROBLEM { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.tag.CONCEPT { background: var(--accent-soft); }
.tag.TECHNIQUE { background: var(--n-violet-t); }
.tag.CASE { background: var(--warn-soft); }
.tag.GOTCHA { background: var(--bad-soft); }
.tag.TRY { background: var(--good-soft); }
.tag.RECAP { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.step-card h2 { font-size: 16px; font-weight: 800; margin: 10px 0 6px; line-height: 1.35; }
.step-body { flex: 1; overflow: auto; min-height: 0; padding-right: 4px; }
.step-body p { margin: 0 0 10px; }
.step-body ul.checks { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.step-body ul.checks li { position: relative; padding-left: 24px; }
.step-body ul.checks li::before { content: "✓"; position: absolute; left: 0; top: 2px; display: grid; place-items: center; width: 15px; height: 15px; font-size: 10px; border: 1.5px solid var(--edge); border-radius: 4px; background: var(--good-soft); }
.step-body ul.plain { margin: 0 0 10px; padding-left: 18px; }
.keyidea {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px; margin: 4px 0 6px;
  background: var(--n-violet-t); border: 1px solid var(--line); border-radius: 10px;
}
.keyidea .ico { width: 30px; height: 30px; border: 1.5px solid var(--edge); border-radius: 8px; display: grid; place-items: center; background: var(--card); }
.keyidea .k { font-size: 9.5px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.nav { display: flex; gap: 8px; margin-top: 10px; }
.btn {
  padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--card); cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; box-shadow: var(--pop);
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 2.5px 3.5px 0 var(--drop); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.primary { background: var(--good-soft); flex: 1; }
.btn.accent { background: var(--accent-soft); }
.hints { margin-top: 8px; font-size: 10.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.learn-card { padding: 14px 16px; }
.learn-card h3 { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.learn-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.learn-card li { position: relative; padding-left: 24px; color: var(--muted); font-size: 12px; }
.learn-card li::before { content: ""; position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border: 1.5px solid var(--line); border-radius: 4px; background: var(--card); font-size: 10px; display: grid; place-items: center; }
.learn-card li.on { color: var(--ink); }
.learn-card li.on::before { content: "✓"; border-color: var(--edge); background: var(--good-soft); }

/* ---------- SVG ---------- */
.node { transition: opacity .4s ease, transform .4s ease; }
.node.off { opacity: 0; transform: translateY(10px); pointer-events: none; }
.node.dim { opacity: .28; }
.face { stroke: var(--edge); stroke-width: 1.4; stroke-linejoin: round; }
.shadow { fill: var(--drop); }
.ntext { font: 700 10.5px var(--font); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.nsub { font: 500 9px var(--font); fill: var(--muted); text-anchor: middle; dominant-baseline: central; }
.plate { fill: var(--card); stroke: var(--edge); stroke-width: 1; opacity: .94; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.zone-poly { fill: var(--zone); stroke: var(--edge); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .9; }
.zone-label { font: 700 10px var(--font); fill: var(--muted); letter-spacing: .04em; }
.hl-poly { fill: var(--good-soft); stroke: var(--good); stroke-width: 2; animation: pulse 1.8s ease-in-out infinite; }
.edge { stroke: var(--edge); stroke-width: 1.4; fill: none; }
.edge.dash { stroke-dasharray: 5 4; }
.edge.bad { stroke: var(--bad); }
.pill rect { fill: var(--card); stroke: var(--edge); stroke-width: 1.2; }
.pill text { font: 600 9.5px var(--font); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.pill.good rect { fill: var(--good-soft); } .pill.bad rect { fill: var(--bad-soft); stroke: var(--bad); } .pill.warn rect { fill: var(--warn-soft); } .pill.info rect { fill: var(--accent-soft); }
.pill.name rect { fill: var(--card); stroke-width: 1.5; }
.pill.name text { font-weight: 700; font-size: 10.5px; }
.fadein { animation: fade .45s ease both; }
.dot { stroke: var(--edge); stroke-width: 1.2; }
.dot.req { fill: var(--req); } .dot.res { fill: var(--res); } .dot.hs { fill: var(--card); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: .95; } 50% { opacity: .55; } }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20,18,15,.25); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: 340px; max-width: 92vw; z-index: 21; background: var(--sheet);
  border-right: 1.5px solid var(--edge); transform: translateX(-102%); transition: transform .28s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: 14px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.roles { display: flex; gap: 6px; flex-wrap: wrap; }
.rolebtn { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; }
.rolebtn[aria-pressed="true"] { border-color: var(--edge); background: var(--accent-soft); box-shadow: var(--pop); }
.drawer-body { flex: 1; overflow: auto; padding: 8px 10px 16px; }
.track-h { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 14px 6px 4px; display: flex; align-items: center; gap: 8px; }
.track-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mod-btn { width: 100%; display: grid; grid-template-columns: 12px 16px 1fr auto; align-items: center; gap: 8px; padding: 6px; border: 0; background: none; cursor: pointer; border-radius: 8px; text-align: left; font-weight: 700; }
.mod-btn:hover { background: var(--card); }
.mod-btn .car { transition: transform .2s; font-size: 10px; color: var(--muted); }
.mod-btn[aria-expanded="true"] .car { transform: rotate(90deg); }
.mod-btn .sw { width: 14px; height: 11px; border: 1.3px solid var(--edge); border-radius: 2px 4px 3px 3px; }
.mod-btn .cnt { color: var(--muted); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
.lessons { list-style: none; margin: 0 0 4px 22px; padding: 0 0 0 10px; border-left: 1px solid var(--line); display: none; }
.lessons.open { display: block; }
.lesson-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1.5px solid transparent; background: none; cursor: pointer; border-radius: 8px; text-align: left; font-size: 12px; }
.lesson-btn:hover { background: var(--card); }
.lesson-btn.cur { border-color: var(--edge); background: var(--good-soft); font-weight: 700; box-shadow: var(--pop); }
.lesson-btn .st { width: 14px; height: 14px; flex: none; border: 1.3px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font-size: 9px; }
.lesson-btn .st.done { background: var(--good); border-color: var(--good); color: var(--card); }
.lesson-btn.planned { color: var(--muted); }
.lesson-btn .soon { margin-left: auto; font-size: 9.5px; border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; color: var(--muted); }
.drawer-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 12px; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; width: 120px; }
.bar i { display: block; height: 100%; background: var(--good); }

/* ---------- map (home) ---------- */
.map { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; display: grid; gap: 26px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
.hero p { color: var(--ink-2); max-width: 62ch; margin: 12px 0 16px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { height: 250px; position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); overflow: hidden; }
.hero-art svg { width: 100%; height: 100%; }
.section-h { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.path { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 5px solid var(--c); }
.path .row { margin-top: auto; }
.path h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.path p { margin: 0; color: var(--ink-2); font-size: 12.5px; }
.path ul { margin: 0; padding-left: 20px; font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.path .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mod { padding: 14px; display: grid; gap: 8px; align-content: start; }
.mod h4 { margin: 0; font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.mod h4 span { color: var(--muted); font-weight: 600; font-size: 11px; }
.mod ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mod li button { width: 100%; text-align: left; background: none; border: 0; padding: 3px 6px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.mod li button:hover { background: var(--sheet); }
.mod li button.planned { color: var(--muted); }
.mod .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.roadmap { width: 100%; border-collapse: collapse; font-size: 12px; }
.roadmap th, .roadmap td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.roadmap th { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.roadmap .state { font-weight: 800; font-size: 10.5px; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--edge); white-space: nowrap; }
.roadmap .live { background: var(--good-soft); } .roadmap .next { background: var(--warn-soft); } .roadmap .later { background: var(--card); border-color: var(--line); color: var(--muted); }

/* planned lesson */
.planned-wrap { display: grid; place-items: center; height: 100%; padding: 20px; }
.planned-card { max-width: 560px; padding: 22px; display: grid; gap: 12px; }
.planned-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* search modal */
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: start center; padding-top: 12vh; background: rgba(20,18,15,.3); }
.modal.open { display: grid; }
.palette { width: min(560px, 92vw); background: var(--sheet); border: 1.5px solid var(--edge); border-radius: 14px; box-shadow: 3px 5px 0 var(--drop); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 14px 16px; font: 14px var(--font); color: var(--ink); outline: none; }
.results { max-height: 50vh; overflow: auto; padding: 6px; }
.result { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1.5px solid transparent; }
.result.sel { border-color: var(--edge); background: var(--good-soft); }
.result small { color: var(--muted); }
.palette .foot { display: flex; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translate(-50%, -10px); z-index: 40; opacity: 0; pointer-events: none;
  background: var(--card); border: 1.5px solid var(--edge); border-radius: 10px; box-shadow: var(--pop); padding: 10px 16px; font-weight: 700; transition: all .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---------- practice ---------- */
.qcard { padding: 16px; display: flex; flex-direction: column; gap: 8px; border-top: 5px solid var(--c); }
.qcard h3 { font-size: 14px; display: flex; gap: 8px; align-items: center; }
.qcard p { margin: 0; color: var(--ink-2); font-size: 12.5px; }
.qcard .row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.best { font-size: 11px; color: var(--muted); }
.quiz-wrap { display: grid; place-items: start center; padding: 28px 16px 60px; }
.quiz { width: min(720px, 100%); padding: 22px; display: grid; gap: 14px; }
.quiz h2 { font-size: 18px; line-height: 1.4; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.qbar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.opts { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; font-size: 13px; }
.opt:hover:not(:disabled) { border-color: var(--edge); box-shadow: var(--pop); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--good); background: var(--good-soft); font-weight: 700; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.keyidea.miss { background: var(--bad-soft); }
.miss-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 12.5px; }

/* ---------- cheatsheets ---------- */
.cheat-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.cheat-tools input { flex: 1; min-width: 200px; max-width: 360px; height: 34px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: 12.5px var(--font); }
.cheat-tools input:focus { border-color: var(--edge); outline: none; }
.cheat-mod { display: grid; gap: 12px; scroll-margin-top: 12px; }
.cheat-mod .section-h .chip { cursor: pointer; letter-spacing: 0; text-transform: none; font-weight: 600; }
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.cheat { padding: 12px 14px; display: grid; gap: 8px; }
.cheat-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cheat h3 { font-size: 13px; }
.cheat table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cheat td { padding: 4px 6px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.cheat td:first-child { font-weight: 700; width: 42%; }
.cheat tr:first-child td { border-top: 0; }
.cheat-note { margin: 0; font-size: 11px; color: var(--muted); }
.iconbtn.sm { width: 28px; height: 28px; box-shadow: none; }
@media print {
  .topbar, .cheat-tools, .iconbtn.sm, .scrim, .drawer { display: none !important; }
  .view { height: auto; overflow: visible; }
  .cheat { break-inside: avoid; box-shadow: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .lesson-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .view { height: auto; overflow: visible; }
  .stage { min-height: 380px; }
  .step-card { min-height: 360px; }
  .tabs, .search span, .search kbd { display: none; }
  .search { width: 36px; padding: 0; justify-content: center; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .paths { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 560px) {
  .brand span.long { display: none; }
  .metric { min-width: 72px; padding: 4px 7px; }
  .metric .v { font-size: 12px; }
  .stage { display: flex; flex-direction: column; min-height: 0; }
  .metrics { position: static; padding: 8px 8px 0; }
  svg.diagram { position: relative; height: 300px; width: 100%; flex: none; }
  .dpanel { position: static; margin: 0 8px 8px; width: auto; max-height: none; animation: none; }
  .illus, .legend { display: none; }
  .controls { position: static; justify-content: flex-end; padding: 0 8px 8px; }
  .tl-dot .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
#cheatBody { display: grid; gap: 30px; }

/* ---------- sources, about, footer ---------- */
.lesson-grid > .col:last-child { overflow-y: auto; }
.lesson-grid > .col:last-child .step-card { min-height: 340px; }
.src-card { padding: 0; flex: none; }
.src-card summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.src-card summary::-webkit-details-marker { display: none; }
.src-card summary::before { content: "▶"; font-size: 8px; margin-right: 2px; transition: transform .15s; }
.src-card[open] summary::before { transform: rotate(90deg); }
.src-card summary > span:first-child { flex: 1; }
.src-card .chk { font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.src-card ul { list-style: none; margin: 0; padding: 0 16px; display: grid; gap: 6px; }
.src-card a { color: var(--ink); font-size: 12px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; display: inline-flex; gap: 6px; align-items: baseline; }
.src-card a:hover { text-decoration-color: var(--edge); }
.src-card a svg { flex: none; position: relative; top: 2px; }
.src-card .checked { margin: 10px 16px 14px; font-size: 11px; color: var(--muted); }
.site-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; font-size: 11.5px; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.drawer-links { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.drawer-links button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font: inherit; font-size: 11.5px; font-weight: 600; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; }
.drawer-links button:hover { border-color: var(--edge); }
.about { max-width: 820px; }
.about-card { padding: 28px 32px; display: grid; gap: 10px; }
.about-card h1 { font-size: 30px; line-height: 1.15; }
.about-card h2 { font-size: 15px; margin-top: 12px; }
.about-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }
.about-card p b { color: var(--ink); }
.about-card .lead { font-size: 15.5px; color: var(--ink); }
.about-card a { color: var(--ink); text-underline-offset: 3px; }
.about-card .cta { margin-top: 12px; }
@media (max-width: 1000px) {
  .lesson-grid > .col:last-child { overflow: visible; }
  .about-card { padding: 20px; }
}
