/* ==========================================================================
   ROBOT AGENTS — retro 80s / synthwave theme, modern layout
   ========================================================================== */

/* Two themes:
   - default ("paper"): light pages, while code / simulators / diagrams / tabs
     stay dark "screens" with the synthwave neon (the --scr-* tokens).
   - [data-theme="dark"] ("graphite"): neutral dark pages and screens, softer neon.
   The toggle lives in the top bar (site.js). */
:root {
  /* page */
  --bg: #f4efe6;
  --bg-2: #ede6d8;
  --surface: #fffaf1;
  --surface-2: #f2eadb;
  --line: #d9cdb7;
  --line-soft: #e6dccb;
  --text: #221e2c;
  --muted: #575166;
  --dim: #857d91;
  --pink: #d1245c;
  --cyan: #0b8a9b;
  --yellow: #a8790a;
  --purple: #7446c9;
  --green: #1d9460;
  --orange: #c9601d;
  --gold: #a86f00;
  --gold-2: #c2410c;
  --gold-hi: #c98a00;
  --inline-code: #9a3412;
  --topbar-bg: rgba(244, 239, 230, .88);
  --scanlines: 0;

  /* dark "screens" inside the page */
  --scr-base: #0d0826;
  --scr-bg: #0b0620;
  --scr-bg-2: #120a2e;
  --scr-surface: #170e3a;
  --scr-surface-2: #1f1450;
  --scr-line: #2e2270;
  --scr-line-soft: #231a58;
  --scr-text: #ece8ff;
  --scr-muted: #a39cd6;
  --scr-dim: #6f68a3;
  --scr-code: #d9d3ff;
  --scr-pink: #ff2a6d;
  --scr-cyan: #05d9e8;
  --scr-yellow: #f9c80e;
  --scr-purple: #b967ff;
  --scr-green: #3dfc9b;
  --scr-orange: #ff8a3d;

  /* message-type colours (used everywhere, keep consistent) */
  --msg-system: var(--purple);
  --msg-human: var(--cyan);
  --msg-ai: var(--pink);
  --msg-tool: var(--yellow);
  --msg-retrieval: var(--green);

  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 280px;
  --content-w: 860px;
  --glow-pink: 0 0 12px rgba(255, 42, 109, .55), 0 0 32px rgba(255, 42, 109, .25);
  --glow-cyan: 0 0 12px rgba(5, 217, 232, .5), 0 0 32px rgba(5, 217, 232, .2);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --bg-2: #15181e;
  --surface: #1a1e25;
  --surface-2: #20252e;
  --line: #2b313c;
  --line-soft: #222731;
  --text: #e6e4df;
  --muted: #a3a9b4;
  --dim: #6b7280;
  --pink: #ff5c8a;
  --cyan: #38c6d6;
  --yellow: #eec05a;
  --purple: #a58cff;
  --green: #56d49a;
  --orange: #f59a5b;
  --gold: #ffcf40;
  --gold-2: #ff9f1c;
  --gold-hi: #fff1b8;
  --inline-code: #eec05a;
  --topbar-bg: rgba(17, 19, 24, .85);
  --scanlines: .4;

  --scr-base: #0e1014;
  --scr-bg: #111318;
  --scr-bg-2: #15181e;
  --scr-surface: #1a1e25;
  --scr-surface-2: #20252e;
  --scr-line: #2b313c;
  --scr-line-soft: #222731;
  --scr-text: #e6e4df;
  --scr-muted: #a3a9b4;
  --scr-dim: #6b7280;
  --scr-code: #d6d8dd;
  --scr-pink: #ff5c8a;
  --scr-cyan: #38c6d6;
  --scr-yellow: #eec05a;
  --scr-purple: #a58cff;
  --scr-green: #56d49a;
  --scr-orange: #f59a5b;
}

/* Everything inside a "screen" uses the screen palette. --msg-* must be
   redeclared here: a var() inside a custom property resolves where it's declared. */
.code, .sim, .diagram, .widget, .tabs, .hero {
  --bg: var(--scr-bg);
  --bg-2: var(--scr-bg-2);
  --surface: var(--scr-surface);
  --surface-2: var(--scr-surface-2);
  --line: var(--scr-line);
  --line-soft: var(--scr-line-soft);
  --text: var(--scr-text);
  --muted: var(--scr-muted);
  --dim: var(--scr-dim);
  --pink: var(--scr-pink);
  --cyan: var(--scr-cyan);
  --yellow: var(--scr-yellow);
  --purple: var(--scr-purple);
  --green: var(--scr-green);
  --orange: var(--scr-orange);
  --inline-code: var(--scr-yellow);
  --msg-system: var(--scr-purple);
  --msg-human: var(--scr-cyan);
  --msg-ai: var(--scr-pink);
  --msg-tool: var(--scr-yellow);
  --msg-retrieval: var(--scr-green);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* subtle CRT scanlines over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
  opacity: var(--scanlines);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--pink); color: #fff; }
img, svg { max-width: 100%; }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2.2em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; color: var(--cyan); }
p { margin: 0 0 1.1em; }
code { font-family: var(--font-mono); font-size: .9em; }
:not(pre) > code {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: .1em .4em; border-radius: 5px; color: var(--inline-code);
}

.pixel { font-family: var(--font-pixel); letter-spacing: .04em; }
.eyebrow {
  font-family: var(--font-pixel); font-size: .62rem; letter-spacing: .12em;
  color: var(--pink); text-transform: uppercase;
}
.grad-text {
  background: linear-gradient(90deg, var(--pink), var(--purple) 50%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.topbar .brand .logo { width: 30px; height: 30px; image-rendering: pixelated; }
.topbar .brand span { font-family: var(--font-pixel); font-size: .7rem; line-height: 1.4; }
.topbar .spacer { flex: 1; }
.topbar .top-link { color: var(--muted); font-size: .9rem; }
.topbar .top-link:hover { color: var(--text); }
.menu-btn {
  display: none; background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit;
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar {
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
  padding: 24px 16px 40px; border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
}
.sidebar .side-title { font-family: var(--font-pixel); font-size: .58rem; color: var(--dim); margin: 0 10px 14px; letter-spacing: .1em; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: start;
  padding: 9px 10px; border-radius: 10px; color: var(--muted); text-decoration: none;
  font-size: .92rem; line-height: 1.35; transition: background .2s, color .2s;
}
.sidebar li a:hover { background: var(--surface); color: var(--text); }
.sidebar li a .num { font-family: var(--font-pixel); font-size: .6rem; color: var(--dim); padding-top: 4px; }
.sidebar li a small { display: block; color: var(--dim); font-size: .76rem; margin-top: 2px; }
.sidebar li a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--pink); }
.sidebar li a.active .num { color: var(--pink); }
.sidebar .toc { margin: 4px 0 8px 52px; padding: 0; border-left: 1px solid var(--line); }
.sidebar .toc a { display: block; padding: 3px 12px; font-size: .8rem; color: var(--dim); grid-template-columns: none; }
.sidebar .toc a:hover { color: var(--cyan); background: none; }

main.content { padding: 48px clamp(20px, 5vw, 64px) 80px; min-width: 0; }
.content-inner { max-width: var(--content-w); margin: 0 auto; }

/* ---------- chapter header ---------- */
.chapter-head { position: relative; padding: 8px 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line-soft); }
.chapter-head .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: .78rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip.pink { color: var(--pink); border-color: rgba(255,42,109,.4); }
.chip.cyan { color: var(--cyan); border-color: rgba(5,217,232,.4); }
.chip.yellow { color: var(--yellow); border-color: rgba(249,200,14,.4); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

/* ---------- callouts ---------- */
.callout {
  position: relative; margin: 1.6em 0; padding: 16px 18px 16px 52px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.callout::before {
  position: absolute; left: 16px; top: 14px; font-family: var(--font-pixel); font-size: .8rem;
}
.callout.tip { border-color: rgba(5,217,232,.35); }
.callout.tip::before { content: "i"; color: var(--cyan); }
.callout.warn { border-color: rgba(249,200,14,.4); }
.callout.warn::before { content: "!"; color: var(--yellow); }
.callout.robot { border-color: rgba(255,42,109,.35); }
.callout.robot::before { content: ">"; color: var(--pink); }
.callout p:last-child { margin: 0; }
.callout strong { color: var(--text); }

.takeaways {
  margin: 2.4em 0; padding: 22px 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,42,109,.1), rgba(5,217,232,.08));
  border: 1px solid var(--line);
}
.takeaways h4 { font-family: var(--font-pixel); font-size: .7rem; color: var(--yellow); margin-bottom: 14px; }
.takeaways ul { margin: 0; padding-left: 1.1em; }
.takeaways li { margin: .35em 0; }

.todo {
  margin: 1.2em 0; padding: 12px 16px; border: 1px dashed var(--dim); border-radius: var(--radius-sm);
  color: var(--dim); font-size: .9rem;
}
.todo::before { content: "TODO · "; font-family: var(--font-pixel); font-size: .6rem; color: var(--orange); }

/* ---------- code blocks ---------- */
.code {
  margin: 1.4em 0; border-radius: var(--radius); overflow: hidden;
  background: var(--scr-base); border: 1px solid var(--line);
  box-shadow: 0 20px 50px -30px rgba(185,103,255,.5);
}
.code-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
}
.code-head .dots { display: flex; gap: 6px; }
.code-head .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.code-head .dots i:nth-child(1) { background: var(--pink); }
.code-head .dots i:nth-child(2) { background: var(--yellow); }
.code-head .dots i:nth-child(3) { background: var(--cyan); }
.code-head .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.65 var(--font-mono); color: var(--scr-code); tab-size: 4; }
.code pre .hl-line { background: rgba(255,42,109,.12); display: inline-block; width: 100%; box-shadow: inset 2px 0 0 var(--pink); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font: 600 .78rem var(--font-body); letter-spacing: .02em;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
  text-decoration: none !important;
}
.btn:hover { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.primary:hover { box-shadow: var(--glow-pink); border-color: #ff6f9a; }
.btn.run { color: var(--green); border-color: rgba(61,252,155,.4); }
.btn.run:hover { box-shadow: 0 0 14px rgba(61,252,155,.45); border-color: var(--green); }
.btn.big { padding: 12px 22px; font-size: .95rem; border-radius: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* syntax colours */
.tk-kw { color: var(--pink); }
.tk-str { color: var(--green); }
.tk-com { color: var(--dim); font-style: italic; }
.tk-num { color: var(--orange); }
.tk-dec { color: var(--yellow); }
.tk-fn { color: var(--cyan); }
.tk-cls { color: var(--purple); }
.tk-self { color: var(--orange); font-style: italic; }

/* ---------- robot simulator ---------- */
.sim {
  margin: 1.8em 0; border-radius: 18px; overflow: hidden;
  background: var(--scr-base); border: 1px solid var(--line);
  box-shadow: 0 30px 80px -40px rgba(255,42,109,.45), 0 0 0 1px rgba(185,103,255,.08) inset;
}
.sim-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.sim-bar .title { font-family: var(--font-pixel); font-size: .6rem; color: var(--muted); letter-spacing: .08em; }
.sim-bar .spacer { flex: 1; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); display: inline-block; }
.led.on { background: var(--green); box-shadow: 0 0 10px var(--green); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.brain-badge { font-family: var(--font-mono); font-size: .74rem; color: var(--purple); border: 1px solid rgba(185,103,255,.4); padding: 3px 9px; border-radius: 999px; }

.sim-prompts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); background: var(--bg-2); }
.sim-prompts .label { width: 100%; font-size: .72rem; color: var(--dim); font-family: var(--font-pixel); letter-spacing: .08em; }
.prompt-chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font: .82rem var(--font-body);
  background: transparent; color: var(--cyan); border: 1px solid rgba(5,217,232,.35); transition: all .2s;
}
.prompt-chip:hover { background: rgba(5,217,232,.1); }
.prompt-chip.active { background: var(--cyan); color: var(--bg); font-weight: 600; }

.sim-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 380px; }
.sim-world { position: relative; padding: 14px; border-right: 1px solid var(--line-soft);
  background: radial-gradient(ellipse at 50% 120%, rgba(255,42,109,.18), transparent 60%); }
.sim-world svg { width: 100%; height: auto; display: block; }
.sim-hud { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.hud-card { flex: 1; min-width: 120px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: .74rem; color: var(--muted); }
.hud-card.active { border-color: var(--pink); box-shadow: var(--glow-pink); }
.hud-card b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.hud-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.hud-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width .6s; }
.hud-bar.tokens i { background: linear-gradient(90deg, var(--yellow), var(--pink)); }

.sim-console { display: flex; flex-direction: column; max-height: 520px; min-height: 380px; }
.console-head { padding: 8px 14px; font-family: var(--font-pixel); font-size: .55rem; color: var(--dim); border-bottom: 1px solid var(--line-soft); letter-spacing: .08em; display: flex; justify-content: space-between; gap: 12px; }
.console-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.console-empty { margin: auto; text-align: center; color: var(--dim); font-size: .85rem; }
.console-empty .pixel { display: block; font-size: .6rem; margin-bottom: 8px; color: var(--pink); }

.msg { border-radius: 10px; padding: 8px 11px; background: var(--surface); border-left: 3px solid var(--c, var(--line)); font-size: .86rem; line-height: 1.5; animation: msgIn .35s ease-out both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg .kind { font-family: var(--font-mono); font-size: .7rem; color: var(--c); display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.msg.by-agent { background: linear-gradient(90deg, color-mix(in srgb, var(--agent) 16%, var(--surface)), var(--surface) 75%); }
.agent-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 3px; border-radius: 999px; border: 1px solid var(--a); color: var(--a); font: 600 .66rem var(--font-mono); letter-spacing: .02em; white-space: nowrap; line-height: 1.5; }
.agent-chip svg { width: 14px; height: 14px; }
.agent-legend { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); }
.msg .kind .who { color: var(--dim); }
.msg pre { margin: 4px 0 0; white-space: pre-wrap; font: .78rem/1.5 var(--font-mono); color: var(--muted); }
.msg.system { --c: var(--msg-system); }
.msg.human { --c: var(--msg-human); }
.msg.ai { --c: var(--msg-ai); }
.msg.tool { --c: var(--msg-tool); }
.msg.retrieval { --c: var(--msg-retrieval); }
.msg.note { --c: var(--dim); background: transparent; border: 1px dashed var(--line); font-style: italic; color: var(--muted); }
.msg.summary { --c: var(--orange); background: rgba(255,138,61,.08); }
.msg.route { --c: var(--purple); background: rgba(185,103,255,.08); }
.msg.collapsed { opacity: .28; filter: grayscale(1); transition: opacity .6s, filter .6s; }
.msg .call { font-family: var(--font-mono); font-size: .8rem; color: var(--yellow); }
.hit { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: rgba(61,252,155,.06); border: 1px solid rgba(61,252,155,.2); font-size: .78rem; color: var(--muted); }
.hit b { color: var(--green); font-family: var(--font-mono); font-weight: 500; }
.thinking { display: inline-flex; gap: 4px; padding: 6px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); animation: think 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* svg world */
.w-cell { fill: none; stroke: rgba(46,34,112,.7); stroke-width: 1; }
.w-station { fill: rgba(23,14,58,.9); stroke-width: 1.5; }
.w-label { font: 8px var(--font-pixel); fill: var(--muted); text-anchor: middle; }
.w-item { transition: transform .8s cubic-bezier(.5,0,.3,1); }
.w-robot { transition: transform var(--dur, .9s) cubic-bezier(.45,0,.25,1); }
.w-robot .bob { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.w-robot.active .halo { opacity: 1; }
.w-robot .halo { opacity: 0; transition: opacity .3s; }
.w-bubble { transition: opacity .25s; }
.w-bubble text { font: 9px var(--font-mono); fill: var(--bg); }
.w-scan { animation: scan 1s ease-out forwards; }
@keyframes scan { from { r: 4; opacity: .9; } to { r: 60; opacity: 0; } }

/* ---------- fullscreen (simulators + diagrams) ---------- */
.sim-bar .stepcount { font: .72rem var(--font-mono); color: var(--muted); }
.sim-bar .stepcount:empty { display: none; }
.is-fs { position: fixed !important; inset: 0; z-index: 900; margin: 0 !important; border-radius: 0 !important; overflow: auto; transform: none !important; width: auto !important; left: 0 !important; }
.diagram:fullscreen, .diagram.is-fs { background: var(--scr-base); padding: 3vh 4vw; display: flex; flex-direction: column; overflow: auto; }
.diagram:fullscreen svg, .diagram.is-fs svg { height: 70vh; width: 100%; flex: none; }
.diagram:fullscreen:has(.d-state) svg, .diagram.is-fs:has(.d-state) svg { height: 52vh; }
.diagram:fullscreen .diagram-controls .caption, .diagram.is-fs .diagram-controls .caption { font-size: 1.2rem; color: var(--text); }
.sim:fullscreen, .sim.is-fs { background: var(--scr-base); display: flex; flex-direction: column; overflow: auto; }
.sim:fullscreen .sim-body, .sim.is-fs .sim-body { flex: 1; min-height: 0; }
.sim:fullscreen .sim-console, .sim.is-fs .sim-console { max-height: none; }
.sim:fullscreen .sim-world svg, .sim.is-fs .sim-world svg { max-height: 72vh; }
.sim:fullscreen .msg, .sim.is-fs .msg { font-size: .98rem; }

/* ---------- concept diagram ---------- */
.diagram { margin: 1.8em 0; padding: 18px; border-radius: 18px; background: var(--scr-base); border: 1px solid var(--line); }
.diagram-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.diagram-controls .caption { flex: 1; min-width: 200px; color: var(--muted); font-size: .9rem; }
.diagram-controls .step { font-family: var(--font-pixel); font-size: .6rem; color: var(--pink); }
.diagram svg { width: 100%; height: auto; display: block; }
.d-node > rect { fill: var(--surface); stroke-width: 1.5; }
.d-node text { font: 600 13px var(--font-display); fill: var(--text); text-anchor: middle; }
.d-node .sub { font: 10px var(--font-mono); fill: var(--muted); }
.d-node, .d-edge { transition: opacity .6s, transform .6s; }
.d-world { transition: transform 1s cubic-bezier(.6, 0, .2, 1); }
.d-state { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.d-state-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); font: .74rem var(--font-mono); color: var(--orange); }
.d-state-by { color: var(--muted); }
.d-state-by b { color: var(--text); }
.d-row { display: grid; grid-template-columns: 90px 110px minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: .84rem; transition: background .4s; }
.d-row:last-child { border-bottom: 0; }
.d-row.changed { background: rgba(249, 200, 14, .12); box-shadow: inset 3px 0 0 var(--yellow); }
.d-key { font: 600 .82rem var(--font-mono); color: var(--text); }
.d-type, .d-merge { font: .74rem var(--font-mono); color: var(--dim); }
.d-val code { color: var(--yellow); background: none; border: 0; padding: 0; }
.d-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font: .74rem var(--font-mono); color: var(--muted); }
.d-empty { font: .8rem var(--font-mono); color: var(--dim); }
@media (max-width: 700px) { .d-row { grid-template-columns: 80px minmax(0, 1fr); } .d-type, .d-merge { display: none; } }
.d-zone { transition: opacity .6s; }
.d-zone rect { fill: none; stroke-width: 1.2; stroke-dasharray: 6 5; opacity: .7; }
.d-node.small text { font-size: 11px; }
.d-edge.thin path { stroke-width: 1.1; opacity: .75; }
.d-hidden { opacity: 0; pointer-events: none; }
.d-edge path { fill: none; stroke-width: 1.6; }
.d-edge.dashed path { stroke-dasharray: 5 5; animation: dash 1.2s linear infinite; }
.d-edge text { font: 10px var(--font-mono); fill: var(--muted); }
@keyframes dash { to { stroke-dashoffset: -20; } }
.d-node.pulse > rect { animation: nodePulse .9s ease-in-out 2; }
@keyframes nodePulse { 50% { filter: drop-shadow(0 0 10px currentColor); } }

/* ---------- comparison / cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin: 1.4em 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 1.4em 0; }
.card { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: transform .25s, border-color .25s; }
.card:hover { transform: translateY(-3px); border-color: var(--purple); }
.card h4 { margin-bottom: 6px; font-size: 1rem; }
.card p { color: var(--muted); font-size: .9rem; margin: 0; }
.card.highlight { border-color: var(--pink); box-shadow: var(--glow-pink); }

.download-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 1em 0; }

/* ---------- prev / next ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pager a { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: border-color .2s, box-shadow .2s; }
.pager a:hover { border-color: var(--pink); box-shadow: var(--glow-pink); }
.pager small { display: block; font-family: var(--font-pixel); font-size: .55rem; color: var(--dim); margin-bottom: 6px; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- footer / authors ---------- */
.site-footer { border-top: 1px solid var(--line-soft); padding: 48px 24px; background: var(--bg-2); }
.site-footer .inner { max-width: 1100px; margin: 0 auto; }
.site-footer h3 { color: var(--text); margin-top: 0; }
.authors { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 20px 0 28px; }
.author { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 20px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; transition: transform .25s, border-color .25s, box-shadow .25s; }
.author:hover { transform: translateY(-4px); border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.author svg { width: 56px; height: 56px; image-rendering: pixelated; }
.author b { font-family: var(--font-display); }
.author small { color: var(--muted); font-size: .78rem; }
.author .go { font-size: .72rem; color: var(--cyan); font-family: var(--font-mono); }
.footer-note { color: var(--dim); font-size: .82rem; }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- landing ---------- */
.hero { position: relative; overflow: hidden; min-height: calc(100vh - 64px); display: grid; place-items: center; text-align: center; padding: 48px 20px calc(30vh + 48px);
  background: linear-gradient(180deg, #0b0620 0%, #150a36 45%, #2b0b4d 70%, #3d0c52 100%); }
.hero .stars { position: absolute; inset: 0 0 30% 0; background-image: radial-gradient(1px 1px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 20%, #fff6, transparent), radial-gradient(1.5px 1.5px at 40% 60%, #fff5, transparent), radial-gradient(1px 1px at 85% 45%, #fff7, transparent), radial-gradient(1px 1px at 10% 70%, #fff5, transparent), radial-gradient(1px 1px at 55% 10%, #fff8, transparent), radial-gradient(1px 1px at 92% 12%, #fff6, transparent), radial-gradient(1.5px 1.5px at 30% 8%, #fff5, transparent); }
.hero .floor { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; width: 100%; display: block; background: linear-gradient(180deg, #1a0733, var(--bg)); border-top: 2px solid var(--pink); box-shadow: 0 -6px 40px rgba(255,42,109,.6); }
.emblem { position: relative; width: 210px; height: 190px; margin: 0 auto; }
.emblem .sun { position: absolute; left: 50%; top: 0; width: 190px; height: 190px; margin-left: -95px; border-radius: 50%;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--orange) 40%, var(--pink) 75%, var(--purple) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0 50%, transparent 50% 54%, #000 54% 63%, transparent 63% 68%, #000 68% 75%, transparent 75% 81%, #000 81% 86%, transparent 86% 93%, #000 93%);
  mask-image: linear-gradient(180deg, #000 0 50%, transparent 50% 54%, #000 54% 63%, transparent 63% 68%, #000 68% 75%, transparent 75% 81%, #000 81% 86%, transparent 86% 93%, #000 93%);
  filter: drop-shadow(0 0 40px rgba(255,42,109,.55)); }
.hero .inner { position: relative; z-index: 2; max-width: 820px; }
.hero h1 { font-size: clamp(2.2rem, 6.4vw, 4.4rem); line-height: 1.04; margin: 14px 0 18px; text-shadow: 0 0 40px rgba(255,42,109,.35); }
.hero .lead { margin: 0 auto 28px; font-size: clamp(1rem, 2vw, 1.2rem); }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-robot { position: absolute; left: 50%; bottom: -8px; width: 116px; height: 116px; margin-left: -58px; image-rendering: pixelated; filter: drop-shadow(0 0 20px rgba(5,217,232,.5)); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.typing::after { content: "█"; margin-left: 2px; color: var(--pink); animation: blink .9s steps(1) infinite; }

.section { padding: 90px 20px; }
.section .inner { max-width: 1100px; margin: 0 auto; }
.section-title { text-align: center; margin-bottom: 44px; }
.section-title h2 { margin-top: 10px; }
.section-title p { color: var(--muted); max-width: 60ch; margin: 0 auto; }

.roadmap { position: relative; display: grid; gap: 16px; }
.roadmap::before { content: ""; position: absolute; left: 27px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--pink), var(--purple), var(--cyan)); opacity: .6; }
.stage { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 18px; align-items: center; padding: 18px 20px 18px 0; text-decoration: none !important; color: var(--text); }
.stage .dot { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); font-family: var(--font-pixel); font-size: .7rem; color: var(--pink); z-index: 1; transition: all .25s; }
.stage .body { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: all .25s; }
.stage .body h4 { margin: 0 0 4px; font-size: 1.1rem; }
.stage .body p { margin: 0; color: var(--muted); font-size: .92rem; }
.stage .body .builds { margin-top: 8px; font-family: var(--font-mono); font-size: .75rem; color: var(--cyan); }
.stage:hover .dot { border-color: var(--pink); box-shadow: var(--glow-pink); }
.stage:hover .body { border-color: var(--pink); transform: translateX(4px); }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature .ico { font-family: var(--font-pixel); font-size: 1rem; color: var(--yellow); margin-bottom: 12px; }
.feature h4 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .sim-body { grid-template-columns: 1fr; }
  .sim-world { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .sim-console { min-height: 280px; max-height: 420px; }
  .authors { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .feature-grid, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 64px; left: 0; width: min(var(--sidebar-w), 85vw); z-index: 40; transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
  .topbar .top-link { display: none; }
  main.content { padding: 32px 16px 64px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 44px 1fr; gap: 12px; }
  .stage .dot { width: 44px; height: 44px; }
  .roadmap::before { left: 21px; }
}
@media (max-width: 520px) {
  .authors { grid-template-columns: 1fr 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- tables, step lists, misc ---------- */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-family: var(--font-pixel); font-size: .56rem; letter-spacing: .08em; color: var(--muted); background: var(--surface); }
tr:last-child td { border-bottom: 0; }
.tag { font-family: var(--font-mono); font-size: .78rem; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; white-space: nowrap; }
.tag.system { color: var(--msg-system); } .tag.human { color: var(--msg-human); }
.tag.ai { color: var(--msg-ai); } .tag.tool { color: var(--msg-tool); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.4em 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 52px; }
.steps > li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-pixel); font-size: .6rem; color: var(--pink); background: var(--surface); border: 1px solid var(--line); }
.steps > li::after { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps > li > strong:first-child { display: block; padding-top: 6px; }

.msg-cards .card { border-top: 3px solid var(--c); }
.msg-cards .card h4 { color: var(--c); font-family: var(--font-mono); font-size: .95rem; }

.hero-robot svg { width: 100%; height: 100%; }
.hero .badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- tabs ---------- */
.tabs { margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--scr-base); overflow: hidden; }
.tab-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tab-list button { padding: 7px 13px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font: 600 .82rem var(--font-body); cursor: pointer; transition: all .2s; }
.tab-list button:hover { color: var(--text); background: var(--surface-2); }
.tab-list button.active { color: var(--bg); background: var(--cyan); box-shadow: var(--glow-cyan); }
.tab-panel { padding: 18px 20px; animation: msgIn .3s ease-out; }
.tab-panel > .code { margin: 1em 0 0; }
.tab-panel > p:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; margin: 0 0 .6em; }
.kv dt { color: var(--dim); font-family: var(--font-mono); font-size: .78rem; padding-top: 2px; }
.kv dd { margin: 0; }

/* ---------- concept briefing ---------- */
.briefing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0 0 2em; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--line); }
.briefing > div { padding: 16px 18px; background: var(--surface); }
.briefing h4 { font-family: var(--font-pixel); font-size: .56rem; letter-spacing: .1em; margin-bottom: 10px; }
.briefing > div:nth-child(1) h4 { color: var(--pink); }
.briefing > div:nth-child(2) h4 { color: var(--yellow); }
.briefing > div:nth-child(3) h4 { color: var(--cyan); }
.briefing p, .briefing ul { margin: 0; font-size: .9rem; color: var(--muted); }
.briefing ul { padding-left: 1.1em; }
.briefing strong { color: var(--text); }
@media (max-width: 860px) { .briefing { grid-template-columns: 1fr; } }

/* ---------- copilot prompt boxes ---------- */
.prompt-box { margin: 1.6em 0; border-radius: var(--radius); border: 1px solid rgba(185,103,255,.45); background: linear-gradient(135deg, rgba(185,103,255,.12), rgba(5,217,232,.06)); overflow: hidden; }
.prompt-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid rgba(185,103,255,.25); }
.prompt-head .pixel { font-size: .56rem; color: var(--purple); flex: 1; letter-spacing: .08em; }
.prompt-text { padding: 14px 16px; font: .86rem/1.6 var(--font-mono); color: var(--text); white-space: pre-wrap; }
.prompt-text a { color: var(--cyan); }
.credit { font-size: .8rem; color: var(--dim); padding: 0 16px 12px; }
.prompt-steps { margin: 0; padding: 0 16px 10px 36px; font-size: .86rem; color: var(--muted); }
.prompt-steps li { margin: .3em 0; }
.prompt-steps strong { color: var(--text); }
.prompt-steps .code { margin: .5em 0 .7em; }

/* ---------- wide blocks (break out of the text column) ---------- */
.wide { position: relative; left: 50%; width: min(1180px, calc(100vw - var(--sidebar-w) - 80px)); transform: translateX(-50%); margin: 1.8em 0; }
.wide.reveal { transform: translate(-50%, 18px); }
.wide.reveal.in { transform: translateX(-50%); }
.side-by-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.side-by-side > .code { margin: 0; }
@media (max-width: 860px) {
  .wide { width: calc(100vw - 32px); }
  .side-by-side { grid-template-columns: 1fr; }
}

/* ---------- widgets (widgets.js) ---------- */
.widget { border-radius: 18px; background: var(--scr-base); border: 1px solid var(--line); overflow: hidden; }
.widget-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.widget-bar .title { font-family: var(--font-pixel); font-size: .58rem; color: var(--muted); letter-spacing: .08em; flex: 1; }
.widget svg { display: block; width: 100%; height: auto; }
.widget .caption { padding: 10px 14px; font-size: .86rem; color: var(--muted); border-top: 1px solid var(--line-soft); min-height: 44px; }
.widget .caption b { color: var(--text); }

.tw-card rect.box { fill: var(--surface); stroke: var(--line); stroke-width: 1.4; transition: stroke .3s, fill .3s; }
.tw-card.on rect.box { stroke: var(--yellow); fill: #221545; }
.tw-card.off rect.box { stroke-dasharray: 4 4; opacity: .6; }
.tw-card text { font: 12px var(--font-mono); fill: var(--text); }
.tw-card text.doc { font-size: 9.5px; fill: var(--dim); }
.tw-badge { font: 10px var(--font-mono); fill: var(--yellow); opacity: 0; transition: opacity .3s; }
.tw-card.on .tw-badge { opacity: 1; }
.tw-wire { fill: none; stroke: var(--yellow); stroke-width: 2; filter: drop-shadow(0 0 4px rgba(249,200,14,.7)); }
.tw-wire.fire { stroke: var(--pink); filter: drop-shadow(0 0 6px rgba(255,42,109,.9)); }
.tw-agent > rect { fill: var(--surface-2); stroke: var(--pink); stroke-width: 2; }
.tw-agent text { font: 600 13px var(--font-display); fill: var(--text); text-anchor: middle; }
.tw-agent text.small { font: 10px var(--font-mono); fill: var(--muted); }
.tw-schema { padding: 10px 14px 14px; border-top: 1px solid var(--line-soft); font: .76rem/1.6 var(--font-mono); color: var(--muted); min-height: 60px; }
.tw-schema .head { font-family: var(--font-pixel); font-size: .52rem; color: var(--dim); margin-bottom: 6px; letter-spacing: .08em; }
.tw-schema div.row { animation: msgIn .35s ease-out both; }
.tw-schema b { color: var(--yellow); font-weight: 500; }

.rag-stages { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.rag-stages .phase { font-family: var(--font-pixel); font-size: .5rem; color: var(--dim); margin-right: 4px; letter-spacing: .08em; }
.rag-stage { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: .76rem; color: var(--muted); background: var(--surface); transition: all .3s; }
.rag-stage.on { color: var(--bg); background: var(--green); border-color: var(--green); box-shadow: 0 0 12px rgba(61,252,155,.5); }
.rag-stage.done { color: var(--green); border-color: rgba(61,252,155,.4); }
.rag-arrow { color: var(--dim); font-size: .8rem; }
.rag-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.rag-body > div { padding: 12px 14px; }
.rag-body > div + div { border-left: 1px solid var(--line-soft); }
.rag-space text { font: 9px var(--font-mono); fill: var(--dim); }
.rag-dot { transition: r .3s, opacity .4s; }
.rag-link { stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 4 3; }
.rag-panel h5 { font-family: var(--font-pixel); font-size: .52rem; color: var(--dim); margin: 4px 0 10px; letter-spacing: .08em; }
.rag-prompt { font: .76rem/1.55 var(--font-mono); color: var(--muted); }
.rag-prompt .seg { display: block; padding: 6px 8px; border-radius: 6px; margin-bottom: 6px; border-left: 3px solid var(--c); background: rgba(255,255,255,.02); animation: msgIn .35s ease-out both; }
.rag-prompt .seg small { display: block; color: var(--c); font-size: .66rem; margin-bottom: 2px; }
@media (max-width: 860px) { .rag-body { grid-template-columns: 1fr; } .rag-body > div + div { border-left: 0; border-top: 1px solid var(--line-soft); } }

/* standalone message lists (chapter 3 perspectives) */
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-list .msg { animation-duration: .4s; }
.cast { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 1.4em 0; }
.cast .card { text-align: center; }
.cast .card svg { width: 64px; height: 64px; margin: 0 auto 8px; display: block; }
@media (max-width: 860px) { .cast { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- research group ---------- */
.group-card { display: flex; align-items: center; gap: 16px; margin: 20px 0 0; padding: 16px 20px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(61,252,155,.1), rgba(5,217,232,.08)); border: 1px solid rgba(61,252,155,.35); color: var(--text); text-decoration: none !important; transition: border-color .25s, box-shadow .25s, transform .25s; }
.group-card:hover { border-color: var(--green); box-shadow: 0 0 18px rgba(61,252,155,.35); transform: translateY(-2px); }
.group-card .group-ico { font-size: 1.8rem; }
.group-card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.group-card b { font-family: var(--font-display); font-size: 1.1rem; }
.group-card small { color: var(--muted); font-size: .8rem; }
.group-card .go { font-family: var(--font-mono); font-size: .78rem; color: var(--green); white-space: nowrap; }
@media (max-width: 520px) { .group-card { flex-wrap: wrap; } }

/* ---------- safety gate widget ---------- */
.sg-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sg-col { padding: 12px 14px; min-height: 230px; }
.sg-col + .sg-col { border-left: 1px solid var(--line-soft); }
.sg-col h5 { font-family: var(--font-pixel); font-size: .52rem; color: var(--dim); margin: 4px 0 12px; letter-spacing: .08em; }
.sg-dim { color: var(--dim); font-size: .85rem; }
.sg-status { display: inline-block; font: .74rem var(--font-mono); padding: 3px 9px; border-radius: 6px; border: 1px solid currentColor; margin-bottom: 8px; }
.sg-status.execute { color: var(--green); } .sg-status.refuse { color: var(--pink); } .sg-status.need_more_info { color: var(--yellow); }
.sg-say { font-size: .84rem; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.sg-step { padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; animation: msgIn .3s ease-out both; }
.sg-step code { color: var(--yellow); font-size: .82rem; }
.sg-step small { display: block; color: var(--dim); font-size: .74rem; margin-top: 2px; }
.sg-step.accepted { border-color: rgba(61,252,155,.5); }
.sg-step.rejected { border-color: rgba(255,42,109,.6); opacity: .75; text-decoration: line-through; text-decoration-color: var(--pink); }
.sg-check { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: .84rem; color: var(--muted); transition: all .25s; }
.sg-check i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; transition: all .25s; }
.sg-check.ok { color: var(--text); border-color: rgba(61,252,155,.45); } .sg-check.ok i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.sg-check.fail { color: var(--text); border-color: rgba(255,42,109,.6); } .sg-check.fail i { background: var(--pink); box-shadow: 0 0 10px var(--pink); }
.sg-check.skip { opacity: .4; }
.sg-verdict { font-size: .82rem; color: var(--muted); margin-top: 6px; min-height: 40px; }
.sg-ok { color: var(--green); font-family: var(--font-mono); font-weight: 600; } .sg-bad { color: var(--pink); font-family: var(--font-mono); font-weight: 600; }
.sg-gauge { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.sg-gauge b { float: right; color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.sg-log { font: .74rem/1.7 var(--font-mono); color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 8px; max-height: 110px; overflow: hidden; }
.sg-log b { color: var(--cyan); font-weight: 500; }
.sg-log div { animation: msgIn .3s ease-out both; }
@media (max-width: 860px) { .sg-body { grid-template-columns: 1fr; } .sg-col + .sg-col { border-left: 0; border-top: 1px solid var(--line-soft); } .sg-col { min-height: 0; } }

/* ---------- GOLD: our field chapter ---------- */
:root { --glow-gold: 0 0 14px rgba(255,207,64,.55), 0 0 40px rgba(255,159,28,.25); }
.gold-text { background: linear-gradient(90deg, var(--gold-hi), var(--gold) 40%, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gold-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-family: var(--font-pixel); font-size: .55rem; letter-spacing: .1em; color: #1a1030; background: linear-gradient(90deg, #fff1b8, #ffcf40, #ff9f1c); box-shadow: var(--glow-gold); }
.gold-frame { position: relative; padding: 26px 24px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,207,64,.12), rgba(255,159,28,.05) 60%, transparent); border: 1px solid rgba(255,207,64,.5); box-shadow: var(--glow-gold); overflow: hidden; }
.gold-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,241,184,.18) 50%, transparent 70%); transform: translateX(-100%); animation: shine 4.5s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }
body[data-chapter="07-ros2-field"] .chapter-head .eyebrow { color: var(--gold); }
body[data-chapter="07-ros2-field"] h3 { color: var(--gold); }
.card.gold { border-color: rgba(255,207,64,.45); }
.card.gold:hover { border-color: var(--gold); box-shadow: var(--glow-gold); }
.card.gold h4 { color: var(--gold); }
.sidebar li a.gold-link { color: var(--gold); }
.sidebar li a.gold-link .num { color: var(--gold); }
.sidebar li a.gold-link.active { box-shadow: inset 3px 0 0 var(--gold); }
.stage.gold .dot { border-color: var(--gold); color: var(--gold); box-shadow: var(--glow-gold); }
.stage.gold .body { border-color: rgba(255,207,64,.55); background: linear-gradient(135deg, rgba(255,207,64,.12), var(--surface)); }
.stage.gold .body h4 { color: var(--gold); }
.stage.gold:hover .body { border-color: var(--gold); }
.lesson-list { counter-reset: lesson; list-style: none; padding: 0; margin: 1.4em 0; display: grid; gap: 10px; }
.lesson-list li { counter-increment: lesson; position: relative; padding: 14px 16px 14px 58px; border-radius: 12px; background: var(--surface); border: 1px solid rgba(255,207,64,.25); }
.lesson-list li::before { content: counter(lesson, decimal-leading-zero); position: absolute; left: 16px; top: 14px; font-family: var(--font-pixel); font-size: .7rem; color: var(--gold); }
.lesson-list li strong { color: var(--text); display: block; }
.lesson-list li span { color: var(--muted); font-size: .9rem; }
.map-table td:first-child { color: var(--cyan); font-family: var(--font-mono); font-size: .84rem; white-space: nowrap; }
.map-table td:nth-child(2) { color: var(--gold); font-family: var(--font-mono); font-size: .84rem; white-space: nowrap; }

/* ---------- theme transition canvas ---------- */
.theme-wipe { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1000; pointer-events: none; image-rendering: pixelated; }
