/* Shared by the homepage and Chapter 4/5 code explorers. */
:root{--paper:#f7f4ee;--surface:#fffdfa;--bg:#f7f4ee;--ink:#1e2c3d;--muted:#586578;--navy:#183448;--accent:#b94c1d;--accent-pale:#f9e9dc;--blue:#b94c1d;--orange:#b94c1d;--line:#d9d7d0;--soft:#f1ece3;--code:#172b34;--codeink:#dfeae9}
body{background:var(--paper);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"Noto Sans KR","Malgun Gothic",sans-serif;font-size:18px;line-height:1.75;word-break:keep-all;overflow-wrap:anywhere}
.site-header{background:var(--paper)}
a{text-underline-offset:4px}button,select,input{font:inherit}button,select{border-color:var(--line);border-radius:7px;background:var(--surface);color:var(--ink);min-height:44px}button:hover{border-color:var(--accent);background:var(--accent-pale)}button.active,button[aria-pressed=true]:not(.row):not(.line){background:var(--accent);color:#fff;border-color:var(--accent)}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:4px}
header:not(.site-header){background:var(--paper);color:var(--ink);border-bottom:1px solid var(--line);padding:28px max(24px,calc((100vw - 1280px)/2)) 32px}header:not(.site-header)>div{max-width:1280px;margin:auto}header:not(.site-header) a{color:var(--accent)}header:not(.site-header) p{color:var(--muted)}header h1{font-size:clamp(30px,4vw,44px);line-height:1.35;letter-spacing:-.045em}header .eyebrow,header .label{color:var(--accent);font-size:12px;font-weight:800;letter-spacing:.12em}.toplinks,.site-toplinks{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;font-size:14px;margin-bottom:24px}.site-toplinks a{font-weight:750;text-decoration:none}.site-toplinks span{font-size:12px;font-weight:700;color:var(--muted);letter-spacing:.08em}.label{color:var(--accent)}
.card,.sidebar,.explain,.routebox,.guide>div,.bottom details{background:var(--surface);border-color:var(--line);border-radius:8px;box-shadow:none}.card{padding:26px;margin-bottom:26px}.card h2,.section-heading h2{letter-spacing:-.035em}.card h2{font-size:25px}.note{background:var(--accent-pale);border-left-color:var(--accent);border-radius:5px}.explain{background:var(--surface)}.guide>div{border-left-color:var(--accent)}.pill,.pill.prepare{background:var(--accent-pale);color:var(--accent)}
main:not(.shell):not(#workspace){max-width:1328px}.intro,.controls,.route,.layout{max-width:1328px}.layout{gap:20px}.sidebar{background:var(--surface)}.module{background:var(--surface)}.module.active{background:var(--accent)}nav button{background:var(--surface)}nav small,.muted{color:var(--muted)}nav button.active small{color:white}
.flow button{background:#f1ece3;border-radius:7px}.flow button.active{background:var(--accent)}.flow button:hover:not(.active){background:var(--accent-pale)}#stage,#toyText{background:#f3eee5;border-left-color:var(--accent);min-height:140px}.metric{background:#f1ece3;border-radius:6px}.metric strong{color:var(--navy)}.bar{background:#e8e1d5}.bar span{background:var(--accent)}.slider{accent-color:var(--accent)}.token,.matrix span{background:#efe6d9;color:var(--navy);border-radius:5px}.annotation{background:var(--surface);border-radius:8px}.shape,.selectedcode{background:#f1ece3;border-left-color:var(--accent)}.visual{background:#f5f0e7;border-color:var(--line)}.cell{background:#e9e0d1;color:var(--navy)}.cell.hot{background:var(--accent);color:#fff}.cell.gold{background:#f0d5a0}.stagebar span{background:#eee7db}.stagebar span.on{background:var(--accent)}.fill{background:#d28b68}.track{background:#e8e1d5}.reading-note{border-radius:6px}
.codebox,.sourcebox{background:var(--code);border-color:#27424d;border-radius:8px}.sourcehead,.codecontrols{background:#203742}.sourcehead h2{color:#fff}.code-layout{grid-template-columns:minmax(0,1.2fr) minmax(260px,.8fr)}.codebox{min-width:0}.row{display:grid;grid-template-columns:36px minmax(0,1fr);gap:10px;white-space:normal;border-left:3px solid transparent;min-height:34px;background:transparent;color:var(--codeink);font:13px/1.85 Consolas,"Courier New",monospace;padding:4px 12px 4px 4px}.row .src{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}.row .num,.line .no{color:#94acb2;text-align:right;min-width:0}.row:hover,.line:hover{background:#233e48}.row.selected,.line.selected{background:#294450;border-left-color:#f3c56a;box-shadow:none}.row.comment,.line.comment{color:#a6b6ad}.row.changed .num{color:#f3c56a}.annotation pre{background:var(--code);color:var(--codeink);border-radius:6px;padding:14px}.selectedcode{background:var(--code);color:var(--codeink)}
/* Token colours have the same meaning in both chapters. */
.kw,.syn-kw{color:#9ccbf0}.str,.syn-str{color:#e9c592}.src .num,.syn-num{color:#b8dbad}.syn-fn{color:#c9b5ef}.syn-op{color:#e1e8ec}.syn-comment{color:#a6b6ad}.syn-name{color:#dfeae9}
.code-legend{display:flex;gap:14px;flex-wrap:wrap;align-items:center;font-size:12px;background:var(--code);color:var(--codeink);padding:11px 14px;border-radius:6px;margin:12px 0}.code-legend span{white-space:nowrap}.code-legend b{font-family:Consolas,monospace;font-weight:400}.bottom,.site-footer{color:var(--ink)}
@media(max-width:1000px){.code-layout{grid-template-columns:1fr}}@media(max-width:600px){body{font-size:16px}.card{padding:18px}.row{font-size:12px;grid-template-columns:30px minmax(0,1fr);gap:8px}header:not(.site-header){padding:22px 20px 26px}.site-toplinks{margin-bottom:20px}.card h2{font-size:22px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important}}
@media print{body,header:not(.site-header){background:white;color:black}.site-toplinks{display:none}.codebox,.annotation pre,.sourcebox,.selectedcode{background:white;color:black}.kw,.str,.syn-kw,.syn-str,.syn-num,.syn-fn,.syn-op,.syn-comment,.syn-name{color:black}}
