:root { color-scheme: light; --ink:#232b30; --muted:#56616b; --paper:#faf9f6; --line:#d7dfdf; --teal:#087477; --teal-soft:#eaf5f3; --gold:#976216; --gold-soft:#fff2d7; --purple:#5b3c8c; }
* { box-sizing:border-box; }
html { scroll-behavior:smooth; scroll-padding-top:20px; }
body { margin:0; background:var(--paper); color:var(--ink); font:16px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
a { color:var(--teal); text-underline-offset:4px; }
button,input,select { font:inherit; min-height:44px; }
button { border:1px solid #bac9c8; background:white; border-radius:7px; padding:7px 14px; color:var(--ink); cursor:pointer; font-weight:600; }
button:hover:not(:disabled) { background:var(--teal-soft); border-color:var(--teal); }
button:disabled { color:#6d7979; background:#f1f3f2; cursor:default; }
button.primary { color:white; background:var(--teal); border-color:var(--teal); }
button.primary:hover:not(:disabled) { background:#075e61; }
button.primary:disabled { background:#dfeae8; color:#64716f; border-color:#dfeae8; }
input,select { border:1px solid #aebdbc; border-radius:6px; background:white; color:var(--ink); padding:6px 9px; max-width:100%; }
input { width:100px; }
:focus-visible { outline:3px solid var(--purple); outline-offset:4px; }
code { font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace; overflow-wrap:anywhere; }
p code { background:#edf0f0; padding:2px 4px; border-radius:3px; font-size:.92em; }
h1,h2,h3,p { margin-top:0; }
h1,h2,h3 { line-height:1.2; }
h1 { font-size:clamp(2.3rem,5vw,3.8rem); letter-spacing:-.045em; font-weight:650; margin-bottom:20px; }
h2 { font-size:clamp(1.5rem,3vw,1.9rem); letter-spacing:-.025em; font-weight:650; margin-bottom:12px; }
h3 { font-size:1.07rem; }
.site-header { max-width:1160px; margin:auto; display:flex; justify-content:space-between; align-items:center; padding:24px 32px; gap:20px; border-bottom:1px solid var(--line); }
.site-header a { font-size:.9rem; text-decoration:none; }
.site-header .wordmark { font-size:1rem; font-weight:750; color:var(--ink); }
.wordmark span { margin-left:13px; padding-left:14px; border-left:1px solid #acb6b6; font-weight:400; color:var(--muted); }
main { max-width:1160px; margin:auto; padding:0 32px; }
.introduction { padding:52px 0 30px; }
.eyebrow { color:var(--teal); text-transform:uppercase; letter-spacing:.12em; font-size:.78rem; font-weight:700; margin-bottom:12px; }
.lead { max-width:680px; color:#47545d; font-size:1.13rem; margin-bottom:16px; }
.scope,.hint,.source-note { color:var(--muted); font-size:.86rem; }
.section-nav { display:flex; flex-wrap:wrap; gap:12px 25px; border-block:1px solid var(--line); padding:18px 0; margin-top:28px; font-size:.94rem; }
.lesson { padding-top:28px; margin-bottom:46px; }
.section-heading > p:last-child { color:var(--muted); max-width:750px; margin-bottom:23px; }
.lab-shell { background:white; border:1px solid var(--line); border-radius:12px; overflow:hidden; box-shadow:0 12px 34px #142d2910; }
.toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:12px 18px; padding:20px 22px; }
.toolbar label,.answer-row label { display:inline-flex; align-items:center; gap:9px; font-size:.9rem; font-weight:600; }
.toolbar .hint { margin-left:auto; }
.toolbar.secondary { border-bottom:1px solid var(--line); padding-top:0; }
.toolbar button { font-size:.9rem; }
.control-help { padding:0 22px; color:var(--muted); font-size:.86rem; margin-bottom:17px; }
.two-columns { display:grid; grid-template-columns:1fr 1fr; }
.collection-panel { min-width:0; padding:24px; border-top:1px solid var(--line); }
.collection-panel + .collection-panel { border-left:1px solid var(--line); }
.collection-panel h3 { margin-bottom:6px; }
.collection-panel > p { margin-bottom:12px; }
.direction { color:var(--muted); font-size:.8rem; }
.tokens { display:flex; flex-wrap:wrap; gap:8px; list-style:none; padding:0; margin:15px 0 22px; min-height:56px; align-items:start; }
.token { min-width:47px; max-width:100%; min-height:45px; display:flex; align-items:center; justify-content:center; padding:8px; background:var(--teal-soft); border:1px solid #9cbdb9; border-radius:6px; font:600 .95rem/1.4 "SFMono-Regular",Consolas,monospace; overflow-wrap:anywhere; }
.token.next { border:2px solid var(--teal); background:#d8ede8; }
.empty { color:var(--muted); padding:9px; font-size:.9rem; border:1px dashed #bccac8; border-radius:5px; }
.operation-output { padding-top:14px; color:var(--muted); font-size:.88rem; min-height:44px; }
.status { margin:0; background:#f2f8f7; padding:18px 24px; border-top:1px solid var(--line); font-size:.94rem; overflow-wrap:anywhere; }
.status p { margin:0 0 5px; }
.status p:last-child { margin-bottom:0; }
.status code { background:white; padding:1px 5px; }
.procedure { padding:16px 24px; border-top:1px solid var(--line); color:#46545c; font-size:.9rem; }
.procedure summary { cursor:pointer; color:var(--teal); font-weight:600; min-height:30px; }
.procedure[open] summary { margin-bottom:15px; }
.procedure .two-columns { gap:30px; }
.procedure ol { padding-left:22px; }
.procedure li { margin-bottom:8px; }
.procedure p:last-child { margin-bottom:0; }
.prediction { margin-top:25px; padding:23px 0; border-bottom:1px solid var(--line); }
.prediction h3 { margin-bottom:9px; }
.prediction > p { max-width:790px; font-size:.95rem; }
.answer-row { display:flex; flex-wrap:wrap; gap:12px 18px; align-items:center; }
.answer-row button { font-size:.9rem; }
.feedback { margin:12px 0 0; }
.feedback:empty { margin:0; }
.feedback:not(:empty) { padding:12px 15px; background:var(--gold-soft); border-left:3px solid var(--gold); font-size:.92rem; }
.feedback.correct { background:var(--teal-soft); border-left-color:var(--teal); color:#155250; }
.source-note { margin-top:13px; font-size:.78rem; }
.list-stage { padding:23px 24px; }
.head-pointer { font-family:"SFMono-Regular",Consolas,monospace; color:var(--teal); font-size:.95rem; margin-bottom:17px; }
.linked-nodes { padding:0; margin:0; list-style:none; display:flex; flex-wrap:wrap; gap:15px 23px; min-height:122px; }
.linked-node { display:flex; align-items:center; gap:12px; }
.node-box { min-width:112px; max-width:155px; border:1px solid #9dbfba; background:var(--teal-soft); border-radius:8px; overflow:hidden; }
.node-id { display:block; padding:4px 10px; font-size:.75rem; color:#3c6664; border-bottom:1px solid #bad4cf; }
.node-value { display:block; padding:9px 10px; font-family:"SFMono-Regular",Consolas,monospace; font-weight:650; overflow-wrap:anywhere; }
.node-next { display:block; background:#f6faf8; border-top:1px solid #bad4cf; padding:4px 10px; font:.76rem/1.5 "SFMono-Regular",Consolas,monospace; }
.node-position { font-size:.72rem; color:var(--muted); text-align:center; margin-top:5px; }
.node-arrow { color:var(--teal); font-size:1.25rem; }
.null-node { align-self:center; font: .9rem "SFMono-Regular",Consolas,monospace; color:var(--muted); }
.tree-layout { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(230px,1fr); border-top:1px solid var(--line); }
.tree-stage { min-width:0; padding:25px 16px 15px; }
.tree-svg { display:block; width:100%; height:auto; }
.tree-edges { fill:none; stroke:#a8b9b6; stroke-width:2; }
.tree-node circle { fill:white; stroke:#8ca7a2; stroke-width:2; }
.tree-node > text { text-anchor:middle; dominant-baseline:central; fill:var(--ink); font-size:20px; font-weight:600; }
.tree-node.visited circle { fill:var(--teal-soft); stroke:var(--teal); }
.tree-node.current circle { fill:#d7eee8; stroke:var(--teal); stroke-width:4; }
.tree-node .visit-index { fill:var(--teal); font-size:13px; font-weight:500; }
.edge-labels text { fill:#5b6d69; font-size:13px; }
.diagram-caption { font-size:.76rem; color:var(--muted); padding:15px 8px 0; margin:0; }
.tree-info { border-left:1px solid var(--line); padding:25px 22px; background:#f9fbfa; min-width:0; }
.rule { color:var(--teal); font-size:.97rem; padding-bottom:18px; border-bottom:1px solid var(--line); }
.tree-info h3 { margin-bottom:8px; font-size:.88rem; }
.sequence { font:600 1.06rem/1.8 "SFMono-Regular",Consolas,monospace; min-height:36px; overflow-wrap:anywhere; word-spacing:4px; }
.tree-status { color:var(--muted); font-size:.86rem; margin-bottom:0; }
.tree-info .hint { font-size:.77rem; margin-bottom:7px; }
.transport { display:flex; flex-wrap:wrap; gap:8px; }
footer { border-top:1px solid var(--line); padding:25px 0 35px; display:flex; justify-content:space-between; gap:16px; color:var(--muted); font-size:.78rem; }
footer p { margin:0; }
.skip-link { position:absolute; top:-100px; left:12px; background:white; padding:12px; z-index:10; }
.skip-link:focus { top:10px; }
.notice { background:var(--gold-soft); padding:15px; }
[hidden] { display:none !important; }
@media(max-width:740px) {
  main { padding:0 18px; }
  .site-header { padding:18px; gap:15px; }
  .site-header a { font-size:.76rem; }
  .site-header .wordmark { font-size:.88rem; }
  .wordmark span { margin-left:7px; padding-left:8px; }
  .introduction { padding-top:33px; }
  .two-columns,.tree-layout { grid-template-columns:1fr; }
  .collection-panel + .collection-panel { border-left:0; }
  .tree-info { border-left:0; border-top:1px solid var(--line); }
  .toolbar { padding:18px; gap:12px; }
  .toolbar .hint { margin-left:0; width:100%; }
  .control-help { padding-inline:18px; }
  .collection-panel,.status,.list-stage,.procedure { padding-inline:18px; }
  .procedure .two-columns { gap:10px; }
  .linked-nodes { gap:14px; }
  .node-box { min-width:103px; max-width:136px; }
  .linked-node { gap:8px; }
  .lesson { margin-bottom:26px; }
  footer { flex-direction:column; gap:6px; }
}
@media(max-width:360px) {
  main { padding-inline:14px; }
  .site-header { padding-inline:14px; flex-wrap:wrap; gap:8px; }
  .toolbar label { flex-wrap:wrap; }
  .toolbar button { padding-inline:10px; }
  .node-box { min-width:92px; max-width:102px; }
  .tree-node > text { font-size:28px; }
  .tree-node .visit-index { font-size:21px; }
  .edge-labels text { font-size:20px; }
}
@media(prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } *,*::before,*::after { animation:none !important; transition:none !important; } }
