/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  color-scheme: light;
  --page: #f7f4ee;
  --paper: #f7f4ee;
  --paper-raised: #f9f7f2;
  --paper-sunk: #e9e3da;
  --paper-sunk-strong: #e1dbd2;
  --line: #dfdbd2;
  --line-strong: #cfc9bf;
  --ink: #2a2b2f;
  --ink-2: #434247;
  --ink-3: #77746f;
  --ink-4: #a5a19a;
  --coral: #e2705a;
  --coral-deep: #d6624b;
  --coral-300: #f3bcae;
  --coral-200: #f7cec0;
  --coral-100: #fae0d6;
  --coral-50: #fcece5;
  --coral-ink: #7c2717;
  --code-bg: #2d2e32;
  --code-fg: #e9e6e0;
  --code-gutter: #7c7e87;
  --code-kw: #f08a6d;
  --code-type: #93cfc6;
  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-card: 14px;
  --r-ctl: 8px;
  --r-chip: 7px;
  --shadow-card: 0 1px 0 #ffffffbf inset, 0 1px 2px #4a3a280a, 0 6px 14px -8px #4a3a281f;
  --shadow-ctl: 0 1px 0 #fffc inset, 0 1px 2px #4a3a280d;
  --shadow-coral: 0 1px 0 #ffffff38 inset, 0 1px 2px #a03c2847, 0 4px 10px -4px #d45f4873;
  --hover: #2b2c300d;
  --stage: var(--paper-raised);
  --grid-line: #d2cabd;
  --mark: var(--coral-200);
  --brand-tile: var(--ink);
  --brand-line: var(--paper);
  --grain: .55;
  --grain-blend: multiply;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0c0e;
  --paper: #141518;
  --paper-raised: #1a1b1f;
  --paper-sunk: #24262b;
  --paper-sunk-strong: #2e3036;
  --line: #26282d;
  --line-strong: #383b42;
  --ink: #f2f0eb;
  --ink-2: #c8c5bf;
  --ink-3: #908d87;
  --ink-4: #66645f;
  --coral: #e8694e;
  --coral-deep: #f07a5f;
  --coral-300: #94402e;
  --coral-200: #6e2f21;
  --coral-100: #4c2219;
  --coral-50: #271612;
  --coral-ink: #f6ab98;
  --code-bg: #101114;
  --code-gutter: #6c6e77;
  --shadow-card: 0 1px 0 #ffffff09 inset, 0 10px 24px -14px #000000b3;
  --shadow-ctl: 0 1px 0 #ffffff0d inset, 0 1px 2px #0006;
  --hover: #ffffff0a;
  --grid-line: #26282d;
  --mark: var(--coral);
  --brand-tile: #202226;
  --brand-line: #f2f0eb;
  --grain: .22;
  --grain-blend: soft-light;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, ::before, ::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.4 var(--font-sans);
  font-feature-settings: "cv11", "ss03", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Paper grain over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  mix-blend-mode: var(--grain-blend);
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3, p, ul, ol, pre, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
mark { background: var(--mark); color: inherit; border-radius: 5px; padding: 0 .22em; }
[hidden] { display: none !important; }
.icon {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
kbd {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink-2);
  font: 560 11px var(--font-sans);
  letter-spacing: .01em;
  padding: 3px 7px;
  white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 1260px;
  height: 100vh;
  min-height: 860px;
}

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand__mark { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 2px 5px -2px rgba(43, 44, 48, .45); }
.brand__tile { fill: var(--brand-tile); }
.brand__top { fill: var(--coral); }
.brand__line { fill: none; stroke: var(--brand-line); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand__name { font-size: 19px; font-weight: 780; letter-spacing: -.035em; white-space: nowrap; }
.brand__name mark { margin-left: -.1em; }

.nav {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: clamp(2px, .5vw, 12px);
  margin-inline-start: clamp(28px, -225px + 22vw, 200px);
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 39px;
  padding: 0 clamp(11px, .95vw, 18px);
  border-radius: var(--r-ctl);
  font-size: 14.8px;
  font-weight: 650;
  letter-spacing: -.012em;
  transition: background-color .15s;
}
.nav__item .icon { font-size: 19px; }
.nav__item:hover { background: var(--hover); }
.nav__item.is-active {
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-coral);
  margin-inline-end: 4px;
  padding: 0 19px 0 18px;
}

.topbar__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 0%;
  min-width: 0;
  margin-inline-start: 24px;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 330px;
  min-width: 150px;
  height: 40px;
  padding: 0 9px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: var(--paper-raised);
  box-shadow: var(--shadow-ctl);
  transition: border-color .15s;
  cursor: text;
}
.search:hover, .search:focus-within { border-color: var(--ink-4); }
.search .icon { font-size: 17.5px; stroke-width: 2.1px; }
.search__hint {
  flex: 1 1 0%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 14.5px;
  color: var(--ink);
}
.search__hint::placeholder { color: var(--ink-2); opacity: 1; }
.search__hint::-webkit-search-cancel-button { display: none; }
.tool-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: var(--paper);
  box-shadow: var(--shadow-ctl);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .01em;
  transition: background-color .15s;
}
.tool-btn:hover { background: var(--paper-raised); }
.tool-btn .icon { font-size: 14.5px; stroke-width: 2px; }
.tool-btn .tool-btn__caret { font-size: 11.5px; stroke-width: 2.4px; color: var(--ink-2); }
.tool-btn--icon { justify-content: center; width: 40px; padding: 0; }
.tool-btn--icon .icon { font-size: 16px; }

/* ==========================================================================
   Workspace
   ========================================================================== */
.workspace {
  display: grid;
  grid-template-columns: clamp(262px, 14.2vw, 276px) minmax(0, 1fr) clamp(400px, 23.5vw, 440px);
  gap: 14px;
  min-height: 0;
  padding: 12px 12px 10px 10px;
}

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; min-height: 0; }
.sidebar__head { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 11px; }
.sidebar__head h2 { flex: 1 1 0%; font-size: 16px; font-weight: 750; letter-spacing: -.028em; }
.sidebar__head span { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.sidebar__icon { font-size: 16.5px; fill: var(--ink); stroke: var(--ink); }

.tree {
  flex: 1 1 0%;
  min-height: 0;
  margin-top: 6px;
  padding-bottom: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.tree__row {
  display: flex;
  align-items: center;
  width: 100%;
  height: 35px;
  padding: 0 6px 0 8px;
  border-radius: var(--r-ctl);
  text-align: start;
  transition: background-color .15s;
}
.tree__row:hover { background: var(--hover); }
.tree__caret { font-size: 11.5px; stroke-width: 2.4px; margin-inline-end: 7px; transition: transform .15s; }
.tree__chapter.is-open .tree__caret { transform: rotate(90deg); }
.tree__folder { font-size: 15.5px; stroke-width: 1.7px; fill: var(--paper-sunk); margin-inline-end: 9px; }
.tree__chapter.is-current .tree__folder { fill: var(--coral); stroke: var(--coral-deep); }
.tree__title {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.8px;
  font-weight: 560;
  letter-spacing: -.016em;
}
.tree__count { flex: 0 0 auto; margin-inline-start: 6px; color: var(--ink-3); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tree__fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .36s cubic-bezier(.3, .7, .2, 1); }
.tree__chapter.is-open .tree__fold { grid-template-rows: 1fr; }
.tree__lessons {
  position: relative;
  display: grid;
  gap: 1px;
  min-height: 0;
  margin: 0 0 0 15px;
  padding: 0 0 0 11px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, margin .36s, padding .36s, visibility .36s;
}
.tree__chapter.is-open .tree__lessons {
  opacity: 1;
  visibility: visible;
  margin: 1px 0 7px 15px;
  padding: 1px 0 1px 11px;
  transition: opacity .3s 60ms, margin .36s, padding .36s;
}
.tree__lessons::before { content: ""; position: absolute; top: 0; bottom: 17px; left: 0; width: 1px; background: var(--line-strong); }
.tree__lessons li { position: relative; }
.tree__lessons li::before { content: ""; position: absolute; top: 16px; left: -11px; width: 8px; height: 1px; background: var(--line-strong); }
.tree__lesson {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 33px;
  padding: 5px 8px 5px 9px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-size: 13.8px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.012em;
  transition: background-color .15s;
}
.tree__lesson:hover { background: var(--hover); }
.tree__lesson .icon { font-size: 12.5px; stroke-width: 1.8px; color: var(--ink-4); }
.tree__lesson.is-soon { color: var(--ink-4); }
.tree__lesson.is-soon .icon { color: var(--line-strong); }
.tree__lesson.is-done .icon { color: var(--coral); }
.tree__lesson.is-active { background: var(--coral-100); color: var(--ink); font-weight: 620; }
.tree__lesson.is-active .icon { color: var(--coral); }

.progress-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-card);
  font-size: 13px;
}
.progress-pill strong { font-weight: 700; letter-spacing: -.014em; }
.progress-pill .meter { flex: 1 1 0%; }
.progress-pill__count { font-weight: 560; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--paper-sunk-strong); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--coral); transition: width .5s; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-ctl);
}
.eyebrow { font-size: 11.5px; font-weight: 680; line-height: 1.3; letter-spacing: .075em; text-transform: uppercase; }
.card__title { font-size: 17.5px; font-weight: 750; line-height: 1.2; letter-spacing: -.032em; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-chip);
  background: var(--coral-200);
  color: var(--coral-ink);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.chip--tag { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- Lesson column ---------- */
.lesson { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; padding: 0 14px 14px; }
.lesson__head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 24px; padding: 13px 6px 0 8px; }
.lesson__head h1 { min-width: 0; font-size: 38px; font-weight: 800; line-height: 1.12; letter-spacing: -.03em; }
.trail { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; }
.trail__text { display: grid; justify-items: end; gap: 4px; }
.trail__chapter { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 650; line-height: 1.2; letter-spacing: -.016em; white-space: nowrap; }
.trail__num { padding: 2px 5px 2px 6px; border-radius: 5px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 650; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.trail__lesson { color: var(--ink-2); font-size: 10.8px; white-space: nowrap; }

.is-fresh { animation: fresh-in .5s cubic-bezier(.2, .7, .2, 1) both; }
.rail > .is-fresh:nth-child(1) { animation-delay: 80ms; }
.rail > .is-fresh:nth-child(2) { animation-delay: .18s; }
.rail > .is-fresh:nth-child(3) { animation-delay: .28s; }
.steps.is-fresh { animation-delay: .14s; }
@keyframes fresh-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Stage ---------- */
.system-view { display: flex; flex: 1 1 0%; min-width: 0; min-height: 0; overflow: hidden; isolation: isolate; background: var(--stage); }
.system-view::after { /* fade the floor grid out towards the edges */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(ellipse 55% 60% at 50% 50%, transparent 30%,
    color-mix(in srgb, var(--stage) 45%, transparent) 58%,
    color-mix(in srgb, var(--stage) 86%, transparent) 82%, var(--stage) 100%);
}
.system-view__stage { position: relative; flex: 1 1 0%; min-height: 380px; margin: 10px 8px; }
.system-view__stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.stage-grid { z-index: 0; }
.stage-grid path { fill: none; stroke: var(--grid-line); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.system-view__stage .scene { z-index: 2; }
.soon { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; color: var(--ink-3); font-weight: 600; }

/* ---------- Steps ---------- */
.steps { flex: 0 0 auto; padding: 12px 16px 13px; }
.steps__head { display: flex; align-items: baseline; justify-content: space-between; }
.steps__head > span { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.steps__head .steps__keys { display: flex; align-items: center; gap: 4px; margin: 0 12px 0 auto; color: var(--ink-3); font-size: 11.5px; }
.steps__keys kbd { padding: 0 5px; font-size: 10.5px; line-height: 16px; }
.steps__track { display: flex; align-items: flex-start; gap: 8px; margin-top: 5px; }
.steps__rail {
  position: relative;
  display: grid;
  flex: 1 1 0%;
  grid-auto-flow: column;
  grid-auto-columns: minmax(max-content, 1fr);
  min-width: 0;
  padding: 4px 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.steps__item { position: relative; min-width: 104px; }
.steps__item::before { content: ""; position: absolute; top: 14.5px; left: 0; right: 0; height: 1.5px; background: var(--line-strong); }
.steps__item:first-child::before { left: 50%; }
.steps__item:last-child::before { right: 50%; }
.steps__item.is-done::before, .steps__item.is-active:last-child::before { background: var(--coral); }
.steps__item.is-active:not(:first-child, :last-child)::before { background: linear-gradient(to right, var(--coral) 50%, var(--line-strong) 0); }
.steps__item.is-active:first-child::before { background: var(--line-strong); }
.steps__item button { position: relative; display: grid; justify-items: center; gap: 6px; width: 100%; padding: 0 11px; }
.steps__num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-raised);
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  transition: border-color .25s, background-color .25s, color .25s, box-shadow .25s;
}
.steps__label { color: var(--ink-3); font-size: 12.8px; font-weight: 500; line-height: 1.25; letter-spacing: -.01em; text-align: center; white-space: nowrap; }
.steps__label::after { /* reserve the bold width so labels don't shift */
  content: attr(data-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 680;
}
.steps__item button:hover .steps__num { border-color: var(--ink-3); }
.steps__item.is-done .steps__num { border-color: var(--coral); background: var(--coral-100); color: var(--coral-ink); }
.steps__item.is-active .steps__num { border-color: var(--coral-deep); background: var(--coral); color: #fff; box-shadow: 0 0 0 3px var(--coral-100), var(--shadow-coral); }
.steps__item.is-active .steps__label { color: var(--ink); font-weight: 680; }
.is-ticked { display: inline-block; animation: tick-up .3s cubic-bezier(.2, .7, .2, 1); }
@keyframes tick-up { from { opacity: 0; transform: translateY(5px); } }

/* ---------- Right rail ---------- */
.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  margin: 0 -8px -10px;
  padding: 0 8px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.step-card { flex: 0 0 auto; padding: 15px 18px 16px 19px; }
.step-card__pages { display: grid; margin: 0 -18px 0 -19px; padding: 0 18px 0 19px; overflow-x: clip; }
.step-card__page { grid-area: 1 / 1; min-width: 0; visibility: hidden; }
.step-card__page.is-current, .step-card__page.is-leaving { visibility: visible; }
.step-card__page.to-left { animation: page-to-left .15s ease-in both; }
.step-card__page.to-right { animation: page-to-right .15s ease-in both; }
.step-card__page.from-right { animation: page-from-right .32s cubic-bezier(.2, .7, .2, 1) .11s both; }
.step-card__page.from-left { animation: page-from-left .32s cubic-bezier(.2, .7, .2, 1) .11s both; }
@keyframes page-to-left { to { opacity: 0; transform: translateX(-30px); } }
@keyframes page-to-right { to { opacity: 0; transform: translateX(30px); } }
@keyframes page-from-right { from { opacity: 0; transform: translateX(30px); } }
@keyframes page-from-left { from { opacity: 0; transform: translateX(-30px); } }
.step-card__head { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.step-card__head .eyebrow { color: var(--ink-2); }
.step-card__title { margin-top: 7px; font-size: 21px; font-weight: 780; line-height: 1.2; letter-spacing: -.032em; }
.step-card__body { display: grid; gap: 9px; margin-top: 7px; font-size: 14.2px; font-weight: 440; line-height: 21px; letter-spacing: -.006em; color: var(--ink-2); }
.step-card__body strong { font-weight: 700; color: var(--ink); }
.step-card__body code, .note code { font-family: var(--font-mono); font-size: .92em; }
.note {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding: 11px 13px 12px 12px;
  border: 1px solid var(--coral-200);
  border-radius: 10px;
  background: var(--coral-50);
}
.note__icon { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px; background: var(--coral-200); color: var(--coral-ink); font-size: 13.5px; }
.note .eyebrow { color: var(--coral-ink); font-size: 10.5px; }
.note p { margin-top: 2px; font-size: 13.3px; line-height: 19px; letter-spacing: -.004em; }
.step-card__nav { display: flex; gap: 9px; margin-top: 14px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: var(--paper);
  box-shadow: var(--shadow-ctl);
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -.012em;
  white-space: nowrap;
  transition: background-color .15s;
}
.btn:hover { background: var(--paper-raised); }
.btn .icon { font-size: 13.5px; stroke-width: 2.2px; }
.btn:disabled { color: var(--ink-4); box-shadow: none; cursor: default; }
.btn:disabled:hover { background: var(--paper); }
.btn--primary { border-color: var(--coral); background: var(--coral); color: #fff; box-shadow: var(--shadow-coral); }
.btn--primary:hover { background: var(--coral-deep); }
.step-card__nav .btn--primary { flex: 1 1 0%; justify-content: space-between; min-width: 0; padding: 0 14px 0 16px; }
.step-card__nav .btn--primary span { overflow: hidden; text-overflow: ellipsis; }
.btn--primary:disabled { border-color: var(--line-strong); background: var(--paper-sunk); color: var(--ink-3); }
.btn--primary:disabled:hover { background: var(--paper-sunk); }

/* ---------- Pseudocode ---------- */
.code-panel { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 140px; overflow: hidden; }
.code-panel__head { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; height: 51px; padding: 5px 12px 0 20px; }
.code-panel__head .card__title { flex: 1 1 0%; }
.code-panel__icon { color: var(--coral); font-size: 19px; stroke-width: 2px; }
.code {
  position: relative;
  flex: 0 1 auto;
  margin: 0 -1px -1px;
  padding: 10px 0 12px;
  border-radius: 0 0 var(--r-card) var(--r-card);
  background: var(--code-bg);
  color: var(--code-fg);
  font: 470 12.3px/19.8px var(--font-mono);
  font-variant-ligatures: none;
  overflow: auto;
}
.code__line { display: flex; border-left: 2px solid transparent; transition: opacity .3s, background-color .3s, border-color .3s; }
.code.has-focus .code__line { opacity: .42; }
.code.has-focus .code__line.is-focus { opacity: 1; border-left-color: var(--coral); background: rgba(226, 112, 90, .11); }
.code__line > span { flex: 1 1 0%; min-width: 0; padding: 0 14px 0 calc((var(--indent, 0) + 2) * 1ch); text-indent: -2ch; white-space: pre-wrap; }
.code__line i { flex: 0 0 auto; width: 31px; margin-right: 23px; color: var(--code-gutter); font-size: 11.5px; font-style: normal; text-align: right; user-select: none; }
.code__line.is-head { color: #fff; font-weight: 650; }
.tok-kw { color: var(--code-kw); }
.tok-op { color: var(--code-type); }

/* ---------- Facts / cost card ---------- */
.facts-card, .cost-card { flex: 0 0 auto; padding: 15px 14px 15px 19px; }
.facts-card dl, .cost-card dl { display: grid; gap: 2px; margin: 10px 0 0 -8px; }
.facts-card dl > div, .cost-card dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 3px 5px 3px 8px;
  border-radius: var(--r-ctl);
  font-size: 14px;
  letter-spacing: -.01em;
  transition: background-color .3s;
}
.facts-card dt small, .cost-card dt small { margin-inline-start: 7px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.facts-card .chip, .cost-card .chip {
  height: 24px;
  padding: 0 8px;
  background: var(--paper-sunk);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: background-color .3s, color .3s;
}
.facts-card dl > div.is-active, .cost-card dl > div.is-active { background: var(--coral-100); font-weight: 620; }
.facts-card dl > div.is-active .chip, .cost-card dl > div.is-active .chip { background: var(--coral); color: #fff; }
.facts-card dl > div.is-changed .chip { animation: fact-in .45s cubic-bezier(.2, .7, .2, 1) .3s both; }
@keyframes fact-in { from { opacity: 0; transform: translateY(5px) scale(.9); } }
#side-note { margin-top: 9px; color: var(--ink-2); font-size: 13px; }

/* ==========================================================================
   Isometric scene
   ========================================================================== */
.scene, .stairs {
  --iso-top: #faf8f3;
  --iso-left: #f2eee7;
  --iso-blush: #fbe2d8;
  --iso-blush-soft: #fcebe3;
  --iso-blush-deep: #f8d2c5;
  --obj-ink: var(--ink);
  --obj-paper: var(--paper);
  --floor-ink: var(--ink);
  --case: transparent;
  --tag-fill: var(--ink);
  --tag-line: transparent;
  --tag-text: var(--paper);
  --tag-quiet-fill: var(--paper-sunk-strong);
  --tag-quiet-line: transparent;
  --tag-quiet-text: var(--ink-2);
  --panel-fill: var(--paper);
  --panel-line: var(--ink);
  --panel-head: var(--ink);
  --panel-head-text: var(--paper);
  --panel-row: var(--paper-sunk);
  --panel-text: var(--ink);
  --out-top: #f3f0ea;
  --out-side: #ebe6de;
  --out-dark: #c9c3ba;
  --out-line: #bcb6ad;
  --out-text: #b7b1a8;
  --cast: #4f3d2a;
  --cast-strength: .24;
}
:root[data-theme="dark"] :is(.scene, .stairs) {
  --iso-top: #e6e3dc;
  --iso-left: #d6d2ca;
  --iso-blush: #eac8bb;
  --iso-blush-soft: #eed6cc;
  --iso-blush-deep: #dfb3a3;
  --obj-ink: #282a2f;
  --obj-paper: #f2f0eb;
  --coral: #dd684f;
  --coral-deep: #cd583f;
  --coral-300: #eeb1a0;
  --coral-200: #f2c6b9;
  --coral-ink: #6f2314;
  --floor-ink: #dcd9d2;
  --case: #0f1012;
  --tag-fill: #1c1d21;
  --tag-line: #868990;
  --tag-text: #f2f0eb;
  --tag-quiet-fill: #25272c;
  --tag-quiet-line: #4a4d54;
  --tag-quiet-text: #c8c5bf;
  --panel-fill: #17181c;
  --panel-line: #7c7f86;
  --panel-head: #17181c;
  --panel-head-text: #f2f0eb;
  --panel-row: #272a2f;
  --panel-text: #f2f0eb;
  --out-top: #cdcac3;
  --out-side: #c1bdb6;
  --out-dark: #8f8d88;
  --out-line: #9d9a94;
  --out-text: #8b8882;
  --cast: #000;
  --cast-strength: .45;
}
.scene text { font-family: var(--font-sans); user-select: none; }
.f-top { fill: var(--iso-top); }
.f-ink { fill: var(--obj-ink); }
.f-blush { fill: var(--iso-blush); }
.f-blush-soft { fill: var(--iso-blush-soft); }
.p-coral { fill: var(--coral); }
.s-ink, .s-dash path, .s-dash, .s-lead, .s-arrow { fill: none; stroke: var(--obj-ink); stroke-width: 1.6px; stroke-linecap: round; stroke-linejoin: round; }
.s-dash path, .s-dash, .s-lead, .s-arrow { stroke: var(--floor-ink); }
.f-ink.s-ink { fill: var(--obj-ink); }
.feed .f-ink.s-ink { fill: var(--floor-ink); stroke: var(--floor-ink); }
.s-dash path, path.s-dash { stroke-width: 1.7px; stroke-dasharray: 6.5 4.8; stroke-linecap: butt; }
.s-stitch { stroke-dasharray: 4.5 3; stroke-linecap: butt; }
.s-arrow { stroke-width: 4.4px; stroke-linecap: butt; }
.s-lead { stroke-width: 1.5px; }
.s-lead--dash { stroke-dasharray: 10 5; stroke-linecap: butt; }
.s-hair { stroke-width: 1.1px; }
.t-face { text-anchor: middle; dominant-baseline: central; }
.t-value { fill: var(--obj-ink); font-size: 27px; font-weight: 750; letter-spacing: -.02em; }
.t-value--m { font-size: 22px; }
.t-word { fill: var(--obj-ink); font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.t-index { fill: var(--obj-paper); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; transition: fill .5s; }
.t-index.is-read { fill: var(--coral-300); }
.t-plate { fill: var(--obj-paper); font-size: 14.5px; font-weight: 600; letter-spacing: .13em; }
.t-tray { fill: var(--obj-paper); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; }
.t-tag { fill: var(--tag-text); font-size: 12.5px; font-weight: 500; text-anchor: middle; dominant-baseline: central; }
.shadow { fill: var(--cast); fill-opacity: var(--cast-strength); pointer-events: none; }
.cell { fill: var(--iso-blush-soft); stroke: var(--coral); stroke-width: 1.1px; stroke-linejoin: round; }

.block__top { fill: var(--iso-top); transition: fill .4s; }
.block__face { fill: var(--iso-left); transition: fill .4s; }
.block__side { fill: var(--iso-blush); transition: fill .4s; }
.block__hatch { transition: opacity .4s; }
.block .s-ink, .block text { transition: stroke .4s, fill .4s; }
.block__rim { fill: none; stroke: var(--obj-ink); stroke-width: 1.6px; stroke-linejoin: round; transition: stroke .4s, stroke-width .4s; }
.block__shadow { fill: none; stroke: var(--obj-ink); stroke-width: 4.6px; stroke-linejoin: round; opacity: 0; transform: translateY(1.8px); transition: opacity .35s; }
.is-lifted .block__shadow { opacity: 1; }
.is-covered .block__top { fill: var(--iso-blush); }
.is-covered .block__rim { stroke: var(--coral); stroke-width: 1.1px; }
.is-active .block__top { fill: var(--coral-300); }

.is-out .block__hatch { opacity: 0; }
.is-out .block__side { fill: var(--out-side); }
.is-out .block__face, .is-out .block__top { fill: var(--out-top); }
.is-out .s-ink, .is-out .block__rim { stroke: var(--out-line); }
.is-out text { fill: var(--out-text); }
.plat.is-out .f-ink { fill: var(--out-dark); }
.plat.is-out .f-blush { fill: var(--out-side); }
.plat.is-out [fill^="url"] { opacity: 0; }
.plat.is-out .s-ink { stroke: var(--out-line); }
.plat .f-ink, .plat .f-blush, .plat .f-top, .plat .s-ink, .plat text { transition: fill .4s, stroke .4s; }
.plat [fill^="url"] { transition: opacity .4s; }
.runner circle { fill: var(--coral); stroke: var(--obj-ink); stroke-width: 1.8px; }

.tag__box { fill: var(--tag-fill); stroke: var(--tag-line); stroke-width: 1.2px; }
.tag__dot { fill: var(--floor-ink); stroke: var(--case); stroke-width: 1.5px; paint-order: stroke; }
.tag--coral .tag__box, .tag--coral .tag__dot { fill: var(--coral-deep); stroke: none; }
.tag--coral .s-lead { stroke: var(--coral-deep); }
.tag--coral .t-tag { fill: #f7f4ee; }
.tag--quiet .tag__box { fill: var(--tag-quiet-fill); stroke: var(--tag-quiet-line); }
.tag--quiet .tag__dot { fill: var(--out-line); }
.tag--quiet .s-lead { stroke: var(--out-line); }
.tag--quiet .t-tag { fill: var(--tag-quiet-text); font-weight: 600; }

.ops__head { fill: var(--panel-head); }
.ops__frame { fill: var(--panel-fill); }
.ops__outline { fill: none; stroke: var(--panel-line); stroke-width: 1.6px; }
.ops__title { fill: var(--panel-head-text); font-size: 12.5px; font-weight: 600; letter-spacing: .06em; dominant-baseline: central; }
.ops__row rect { fill: var(--panel-row); transition: fill .3s; }
.ops__row text { fill: var(--panel-text); font-size: 15px; font-weight: 570; letter-spacing: -.01em; dominant-baseline: central; transition: fill .3s; }
.ops__icon { fill: none; stroke: var(--panel-text); stroke-width: 2.3px; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ops__row.is-active rect { fill: var(--coral-300); transform-box: fill-box; transform-origin: 50% 50%; animation: row-press .34s ease-out; }
.ops__row.is-active text { fill: var(--coral-ink); }
.ops__row.is-active .ops__icon { stroke: var(--coral-ink); }
@keyframes row-press { from { transform: scale(.94); } }

/* Chapter staircase next to the lesson title */
.stairs { flex: 0 0 auto; overflow: visible; }
.stairs .s-ink { stroke-width: 1.15px; }
.stairs__riser { fill: var(--iso-left); }
.stairs__tread { fill: var(--iso-top); }
.is-done .stairs__tread { fill: var(--iso-blush-deep); }
.is-current .stairs__tread { fill: var(--coral); }
.is-current .stairs__riser { fill: var(--coral-200); }
.stairs__marker { fill: var(--obj-ink); stroke: var(--obj-paper); stroke-width: 1.1px; }

/* ==========================================================================
   Motion and small screens
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .is-fresh, .is-ticked, .step-card__page, .facts-card dl > div.is-changed .chip, .ops__row.is-active rect { animation: none !important; }
  .tree__fold, .tree__lessons { transition: none; }
}
@media (max-width: 1480px) { .search kbd { display: none; } }
