/* ==========================================================================
   Agentic AI: design tokens + components
   Light theme · 4 role hues + neutrals · Inter (text) + JetBrains Mono (code)
   ========================================================================== */

:root {
  /* Neutrals */
  --ink: #1f2937;
  --ink-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #cfd4dc;
  --page: #ffffff;
  --soft: #f8f9fb;
  --sunk: #f2f4f7;

  /* Role hues: the only colours on the site. Same meaning everywhere. */
  --model: #3776ab;  --model-ink: #24557f;  --model-tint: #eef4fa;  --model-line: #b9cfe5;  /* LLM / reasoning + UI accent */
  --data: #e0a800;   --data-ink: #855d00;   --data-tint: #fff8dc;   --data-line: #f0d27a;   /* state, messages, documents, memory */
  --tool: #2f9466;   --tool-ink: #1e6b48;   --tool-tint: #ecf7f1;   --tool-line: #a8d8bf;   /* tools, actions, external world */
  --out: #d14d63;    --out-ink: #a3283c;    --out-tint: #fdf0f2;    --out-line: #f1b9c2;    /* outputs, attention, errors */

  --py-yellow: #ffd43b;   /* highlighted code line marker */
  --hl: #fff7d1;          /* highlighted code line background */

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 6px 18px rgba(16, 24, 40, .08);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: 220ms;
  --topbar-h: 60px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 24px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--model-ink); text-decoration: underline; text-decoration-color: var(--model-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--model); outline-offset: 2px; border-radius: 6px; }
code { font-family: var(--font-mono); font-variant-ligatures: none; font-size: .86em; padding: .1em .36em; border-radius: 5px; background: var(--sunk); border: 1px solid var(--line); color: var(--ink); }
strong, b { font-weight: 650; }
mark { background: var(--hl); padding: 0 .15em; border-radius: 3px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--fill { fill: currentColor; stroke: none; }

.label { font: 600 11px/1.2 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Style-board banner ---------- */
.board-note { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 7px 16px; font-size: 13px; color: var(--data-ink); background: var(--data-tint); border-bottom: 1px solid var(--data-line); }
.board-note .icon { width: 16px; height: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 32px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.topnav { display: flex; gap: 24px; font-size: 14.5px; }
.topnav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.topnav a:hover, .topnav a[aria-current] { color: var(--model-ink); }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  width: 280px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); }
kbd { font: 500 11px/1.4 var(--font-mono); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: #fff; color: var(--muted); }

/* ---------- Page shell ---------- */
.shell { display: grid; grid-template-columns: 288px minmax(0, 1fr) 232px; max-width: 1480px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 24px 14px 48px 18px; border-right: 1px solid var(--line); background: var(--soft);
}
.content { min-width: 0; padding: 44px 56px 120px; }
.toc { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 44px 22px; }
@media (max-width: 1240px) { .shell { grid-template-columns: 272px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .topnav { display: none; }
  .content { padding: 28px 18px 80px; }
  .search { width: auto; flex: 1; }
}

/* ---------- Sidebar ---------- */
.side-title { margin: 2px 10px 14px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.mod { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--r-md); color: var(--ink-2); text-decoration: none; }
.mod:hover { background: #fff; }
.mod .icon { margin-top: 3px; color: var(--faint); }
.mod-name { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.mod-meta { display: block; margin-top: 3px; font: 600 10.5px/1 var(--font-sans); letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.mod.is-open { background: #fff; border-color: var(--line); box-shadow: var(--shadow-1); }
.mod.is-open::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--model); }
.mod.is-open .mod-name, .mod.is-open .icon { color: var(--model-ink); }
.side-lessons { list-style: none; margin: 6px 0 12px 23px; padding: 0 0 0 12px; border-left: 1px solid var(--line); }
.side-lessons a { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 14px; line-height: 1.4; color: var(--ink-2); text-decoration: none; }
.side-lessons a:hover { background: #fff; }
.side-lessons a[aria-current="page"] { background: var(--model-tint); color: var(--model-ink); font-weight: 600; }

.num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); background: #fff;
  font: 600 10.5px/1 var(--font-mono); color: var(--muted);
}
.num.is-done { border-color: var(--tool-line); background: var(--tool-tint); color: var(--tool-ink); }
[aria-current="page"] .num, .num.is-current { border-color: var(--model); background: var(--model); color: #fff; }

/* ---------- Table of contents ---------- */
.toc .label { display: block; margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; margin-left: -1px; padding: 5px 0 5px 14px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--model-ink); border-left-color: var(--model); font-weight: 600; }

/* ---------- Lesson typography ---------- */
.prose { max-width: 70ch; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--model-ink); }
.crumbs .icon { width: 14px; height: 14px; color: var(--faint); }
h1 { margin: 0 0 12px; font-size: 40px; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; }
.lede { max-width: 62ch; margin: 0 0 20px; font-size: 18px; line-height: 1.6; color: var(--muted); }
h2 { margin: 64px 0 12px; font-size: 26px; line-height: 1.25; letter-spacing: -.015em; font-weight: 700; }
h3 { margin: 32px 0 8px; font-size: 19px; line-height: 1.35; font-weight: 650; }
p { margin: 0 0 16px; }
.section-divider { margin: 88px 0 0; padding-top: 28px; border-top: 1px dashed var(--line-strong); }
.section-divider h2 { margin-top: 6px; }
.section-divider p { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink-2); }
.chip .icon { width: 14px; height: 14px; color: var(--muted); }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

.tldr { padding: 18px 22px 16px; }
.tldr ul { margin: 8px 0 0; padding: 0; list-style: none; }
.tldr li { position: relative; margin: 8px 0; padding-left: 22px; }
.tldr li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--model); transform: rotate(45deg); }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 12px; margin: 16px 0; padding: 14px 16px; border: 1px solid; border-radius: 12px; font-size: 15px; line-height: 1.6; }
.callout .icon { margin-top: 3px; }
.callout p { margin: 0; }
.callout .title { display: block; margin-bottom: 2px; font-weight: 650; }
.callout--note { background: var(--model-tint); border-color: var(--model-line); }
.callout--note .icon, .callout--note .title { color: var(--model-ink); }
.callout--key { background: var(--data-tint); border-color: var(--data-line); }
.callout--key .icon, .callout--key .title { color: var(--data-ink); }
.callout--tip { background: var(--tool-tint); border-color: var(--tool-line); }
.callout--tip .icon, .callout--tip .title { color: var(--tool-ink); }
.callout--warn { background: var(--out-tint); border-color: var(--out-line); }
.callout--warn .icon, .callout--warn .title { color: var(--out-ink); }

/* ---------- Figures (static diagrams) ---------- */
.figure { margin: 28px 0; padding: 18px; }
.fig-panel { padding: 16px 20px 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--soft); }
.fig-panel + .fig-panel { margin-top: 14px; }
.fig-panel.is-emph { background: #fff; border-color: var(--tool-line); box-shadow: 0 0 0 4px var(--tool-tint); }
.fig-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.fig-title { display: block; font-weight: 700; font-size: 16px; line-height: 1.3; }
.fig-sub { display: block; font-size: 14px; color: var(--muted); }
.status { font-size: 13px; font-weight: 600; white-space: nowrap; }
.status--muted { color: var(--muted); }
.status--tool { color: var(--tool-ink); }

.flow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.flow-grid { display: grid; grid-template-columns: auto 30px auto 30px auto; justify-content: center; align-items: center; row-gap: 6px; }
.flow-grid .below { grid-column: 3; justify-self: center; }
.flow-arrow { width: 18px; height: 18px; justify-self: center; color: var(--faint); }
.flow-arrow.is-tool { color: var(--tool); }
.loop-arrows { display: flex; gap: 10px; color: var(--tool); }
.loop-arrows .icon { width: 16px; height: 16px; }

.node-card {
  width: 118px; min-height: 98px; padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center;
}
.node-card .icon { width: 22px; height: 22px; margin-bottom: 3px; color: var(--ink-2); }
.node-card b { font-size: 13.5px; line-height: 1.2; }
.node-card small { font-size: 11.5px; line-height: 1.3; color: var(--muted); }
.node-card.role-model { background: var(--model-tint); border-color: var(--model-line); }
.node-card.role-model .icon, .node-card.role-model b { color: var(--model-ink); }
.node-card.role-tool { background: var(--tool-tint); border-color: var(--tool-line); }
.node-card.role-tool .icon, .node-card.role-tool b { color: var(--tool-ink); }
.node-card.role-data { background: var(--data-tint); border-color: var(--data-line); }
.node-card.role-data .icon, .node-card.role-data b { color: var(--data-ink); }
.node-card.role-out { background: var(--out-tint); border-color: var(--out-line); }
.node-card.role-out .icon, .node-card.role-out b { color: var(--out-ink); }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ---------- Interactive demo (run player) ---------- */
.demo { margin: 28px 0; padding: 22px 22px 20px; }
.demo-head h3 { margin: 0 0 4px; font-size: 18px; }
.demo-head p { margin: 0; font-size: 14.5px; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 14px; }
.ctrl-group { display: flex; flex-direction: column; gap: 6px; }

.seg { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.seg button { padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; font: 500 13.5px var(--font-sans); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--model-ink); font-weight: 600; box-shadow: var(--shadow-1); }

.btns { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  font: 500 13.5px var(--font-sans); color: var(--ink); cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur);
}
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .45; cursor: default; }
.btn .icon { width: 15px; height: 15px; }
.btn--primary { min-width: 92px; justify-content: center; background: var(--model); border-color: var(--model); color: #fff; }
.btn--primary:hover { background: var(--model-ink); }
.btn--ghost { border-color: transparent; color: var(--muted); }

.readouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; transition: background var(--dur), border-color var(--dur); }
.stat .label { display: block; margin-bottom: 5px; font-size: 10.5px; }
.stat output { display: block; font: 600 20px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.stat small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.stat--data output { color: var(--data-ink); }
.stat--tool output { color: var(--tool-ink); }
.stat[data-role="model"] { background: var(--model-tint); border-color: var(--model-line); }
.stat[data-role="model"] output { color: var(--model-ink); }
.stat[data-role="tool"] { background: var(--tool-tint); border-color: var(--tool-line); }
.stat[data-role="tool"] output { color: var(--tool-ink); }
.stat[data-role="out"] { background: var(--out-tint); border-color: var(--out-line); }
.stat[data-role="out"] output { color: var(--out-ink); }

.stage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
.graph-box {
  border: 1px solid var(--line); border-radius: 12px;
  background-color: var(--soft);
  background-image: radial-gradient(#dfe3e8 1px, transparent 1px);
  background-size: 16px 16px;
}
.graph-box svg { display: block; width: 100%; height: auto; }

.state-box { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.state-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); font: 500 12.5px var(--font-mono); color: var(--ink-2); }
.tag { padding: 1px 8px; border: 1px solid var(--data-line); border-radius: 999px; background: var(--data-tint); font: 600 10.5px/1.6 var(--font-sans); color: var(--data-ink); }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px; list-style: none; overflow: auto; max-height: 300px; }
.msgs-empty { margin: auto; padding: 16px; text-align: center; font-size: 13px; color: var(--faint); }
.msg { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; line-height: 1.45; transition: background 600ms var(--ease), border-color 600ms var(--ease); }
.msg.is-new { background: var(--data-tint); border-color: var(--data-line); }
.msg.is-entering { animation: msg-in 420ms var(--ease) both; }
.msg-role { display: inline-block; margin-bottom: 3px; padding: 0 6px; border-radius: 5px; font: 600 10.5px/1.7 var(--font-mono); letter-spacing: .02em; }
.msg-role.human { background: var(--sunk); color: var(--ink-2); }
.msg-role.ai { background: var(--model-tint); color: var(--model-ink); }
.msg-role.tool { background: var(--tool-tint); color: var(--tool-ink); }
.msg-call { display: block; margin-top: 2px; padding: 0; border: 0; background: none; font-size: 11.5px; color: var(--tool-ink); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.caption { display: flex; align-items: flex-start; gap: 10px; min-height: 50px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 14.5px; line-height: 1.55; }
.step-badge { flex: none; margin-top: 1px; padding: 3px 7px; border: 1px solid var(--model-line); border-radius: 6px; background: var(--model-tint); font: 600 11.5px/1.3 var(--font-mono); color: var(--model-ink); white-space: nowrap; }
.observe { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.observe b { color: var(--ink); }

/* SVG graph */
.g-group { fill: none; stroke: var(--line-strong); stroke-dasharray: 4 4; }
.g-group-label, .g-label, .g-note { font-family: var(--font-mono); }
.g-group-label { font-size: 11px; fill: var(--muted); }
.g-label { font-size: 10.5px; fill: var(--muted); }
.g-note { font-size: 10.5px; fill: var(--faint); }
.g-edge { fill: none; stroke: #b6bcc6; stroke-width: 1.5; marker-end: url(#arrow); transition: stroke var(--dur) var(--ease); }
.g-edge.is-cond { stroke-dasharray: 5 4; }
.g-edge.is-active { stroke: var(--ink-2); stroke-width: 2; marker-end: url(#arrow-on); }
.g-node .box { stroke-width: 1.25; transition: stroke var(--dur) var(--ease), stroke-width var(--dur) var(--ease), fill var(--dur) var(--ease); }
.g-node .t-main { font: 650 14px var(--font-sans); }
.g-node .t-sub { font: 500 10.5px var(--font-mono); }
.g-node .ring { fill: none; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.role-model .box { fill: var(--model-tint); stroke: var(--model-line); }
.role-model .t-main { fill: var(--model-ink); }
.role-model .t-sub { fill: var(--model); }
.role-model .ring { stroke: var(--model); }
.role-tool .box { fill: var(--tool-tint); stroke: var(--tool-line); }
.role-tool .t-main { fill: var(--tool-ink); }
.role-tool .t-sub { fill: var(--tool); }
.role-tool .ring { stroke: var(--tool); }
.role-ctrl .box, .role-end .box { fill: #fff; stroke: var(--line-strong); }
.role-ctrl .t-main, .role-end .t-main { font: 600 11px var(--font-mono); letter-spacing: .06em; fill: var(--ink-2); }
.g-node.is-active .box { stroke-width: 2.25; }
.role-model.is-active .box { stroke: var(--model); filter: drop-shadow(0 0 8px rgba(55, 118, 171, .35)); }
.role-tool.is-active .box { stroke: var(--tool); filter: drop-shadow(0 0 8px rgba(47, 148, 102, .35)); }
.role-ctrl.is-active .box { stroke: var(--ink-2); }
.role-end.is-active .box { fill: var(--out-tint); stroke: var(--out); filter: drop-shadow(0 0 8px rgba(209, 77, 99, .3)); }
.role-end.is-active .t-main { fill: var(--out-ink); }
.g-node.is-running .ring { animation: ring 900ms var(--ease) infinite; }
@keyframes ring { from { opacity: .55; transform: scale(1); } to { opacity: 0; transform: scale(1.08); } }
.packet { fill: var(--data); stroke: #fff; stroke-width: 2; opacity: 0; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }

/* ---------- Code cells ---------- */
.code-cell { margin: 24px 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-1); }
.demo .code-cell { margin: 12px 0 0; box-shadow: none; border-radius: 12px; }
.code-head { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 10px; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--line); background: var(--soft); font: 500 12.5px var(--font-mono); color: var(--ink-2); }
.code-head .sync { font: 500 12px var(--font-sans); color: var(--muted); }
.code-head .lang { margin-left: auto; padding: 1px 8px; border: 1px solid var(--model-line); border-radius: 999px; background: var(--model-tint); font: 600 10.5px/1.6 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--model-ink); }
.copy { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; font: 500 12px var(--font-sans); color: var(--muted); cursor: pointer; }
.copy:hover { border-color: var(--line); background: #fff; color: var(--ink); }
.copy .icon { width: 14px; height: 14px; }
.code-cell pre { position: relative; margin: 0; padding: 12px 0; overflow: auto; counter-reset: ln; font: 13.5px/1.7 var(--font-mono); font-variant-ligatures: none; color: var(--ink); tab-size: 4; }
.code-cell pre.is-compact { max-height: 262px; }
.code-cell pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.line { display: inline-block; min-width: 100%; padding-right: 18px; transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.line::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.4em; margin-right: 1.3em; text-align: right; color: #b3b9c3; user-select: none; }
.line.is-hl { background: var(--hl); box-shadow: inset 3px 0 0 var(--py-yellow); }

/* Python syntax: Python blue + Python yellow (darkened) + gray */
.k { color: var(--model-ink); font-weight: 600; }  /* keywords */
.f { color: var(--model); }                          /* function names */
.b { color: var(--model); }                          /* builtins, types */
.s { color: var(--data-ink); }                       /* strings */
.n { color: var(--data-ink); }                       /* numbers */
.c { color: #8b95a1; font-style: italic; }           /* comments */

.annot-ref { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 10px; border-radius: 50%; background: var(--model); color: #fff; font: 600 10.5px/1 var(--font-sans); vertical-align: 1px; user-select: none; }
.annots { display: grid; gap: 8px; margin: 0; padding: 12px 16px 14px; border-top: 1px solid var(--line); list-style: none; counter-reset: an; font-size: 14px; line-height: 1.55; }
.annots li { display: flex; gap: 10px; }
.annots li::before { counter-increment: an; content: counter(an); flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--model); color: #fff; font: 600 10.5px/1 var(--font-sans); }

.out { border-top: 1px solid var(--line); }
.out summary { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--soft); list-style: none; cursor: pointer; }
.out summary::-webkit-details-marker { display: none; }
.out summary::before { content: ""; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform var(--dur) var(--ease); }
.out[open] summary::before { transform: rotate(90deg); }
.out pre { margin: 0; padding: 12px 16px; overflow: auto; border-top: 1px dashed var(--line); background: var(--soft); font: 12.5px/1.6 var(--font-mono); color: var(--ink-2); }
.badge { padding: 1px 8px; border: 1px solid; border-radius: 999px; font: 600 10.5px/1.6 var(--font-sans); }
.badge--illus { color: var(--data-ink); background: var(--data-tint); border-color: var(--data-line); }
.badge--real { color: var(--tool-ink); background: var(--tool-tint); border-color: var(--tool-line); }

/* ---------- Check yourself ---------- */
.check { margin: 20px 0; }
.check summary { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; list-style: none; cursor: pointer; }
.check summary::-webkit-details-marker { display: none; }
.check .q { font-weight: 600; }
.check .reveal { font-size: 13px; font-weight: 600; color: var(--model-ink); }
.check[open] .reveal { display: none; }
.check-answer { margin: 0 18px; padding: 12px 0 16px; border-top: 1px dashed var(--line); color: var(--ink-2); }

/* ---------- Module overview: lesson list ---------- */
.lesson-list { display: grid; gap: 10px; margin: 18px 0; padding: 0; list-style: none; }
.lesson-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; }
.lesson-row .num { width: 30px; height: 30px; font-size: 12px; }
.lesson-card { display: flex; align-items: center; gap: 14px; padding: 13px 14px 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.lesson-card:hover { border-color: var(--model-line); box-shadow: var(--shadow-2); }
.lesson-card.is-current { border-color: var(--model); box-shadow: 0 0 0 3px var(--model-tint); }
.lesson-card .txt { flex: 1; min-width: 0; }
.lesson-card b { display: block; font-weight: 600; line-height: 1.35; }
.lesson-card small { display: block; font-size: 13.5px; color: var(--muted); }
.type { padding: 1px 8px; border: 1px solid; border-radius: 999px; font: 600 10.5px/1.6 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.type--concept { color: var(--data-ink); background: var(--data-tint); border-color: var(--data-line); }
.type--build { color: var(--model-ink); background: var(--model-tint); border-color: var(--model-line); }
.type--project { color: var(--tool-ink); background: var(--tool-tint); border-color: var(--tool-line); }
.go { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.go .icon { width: 16px; height: 16px; }

/* ---------- Pager ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.pager a:hover { border-color: var(--model-line); box-shadow: var(--shadow-2); }
.pager small { font-size: 12.5px; color: var(--muted); }
.pager b { font-weight: 600; }
.pager .next { text-align: right; }

@media (max-width: 760px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
