:root {
  color-scheme: light;
  --paper: #f6f4eb;
  --surface: #fffdf6;
  --ink: #213a32;
  --muted: #55675e;
  --line: #d5dcd0;
  --moss: #527763;
  --wash: #e9efe3;
  --accent: #a83f29;
  --warm: #f7e6d9;
  --serif: 'Iowan Old Style', 'Songti SC', 'Noto Serif CJK SC', 'STSong', serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SFMono-Regular', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.85 var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip { position: fixed; left: 12px; top: -80px; padding: 8px 16px; background: var(--surface); z-index: 20; }
.skip:focus { top: 12px; }
.page-width { width: min(100% - 96px, 1216px); margin-inline: auto; }
.masthead { min-height: 72px; padding: 10px max(28px, calc((100vw - 1280px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: flex; gap: 11px; align-items: center; line-height: 1.3; }
.mark { display: grid; place-items: center; width: 39px; height: 39px; color: #fffdf6; background: var(--accent); font: 29px/1 var(--serif); }
.brand strong { font: 600 14px/1.1 var(--mono); letter-spacing: .1em; }
.brand small { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); }
.masthead nav { display: flex; gap: 28px; font-size: 13px; }
.masthead nav a:hover, .lab-link:hover { color: var(--accent); }
.lab-link { display: inline-flex; align-items: center; gap: 13px; padding: 7px 12px; border: 1px solid var(--line); font-size: 12px; }
.progress { position: absolute; height: 2px; inset: auto 0 -1px; transform-origin: left; transform: scaleX(0); background: var(--accent); }
.hero { padding-block: 68px 65px; display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; gap: clamp(30px, 7vw, 100px); }
.eyebrow { margin: 0 0 14px; color: var(--muted); font: 11px/1.55 var(--mono); letter-spacing: .1em; }
.edition-dot { display: inline-block; height: 7px; width: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.issue { margin-left: 13px; color: var(--accent); white-space: nowrap; }
h1, h2 { font-family: var(--serif); line-height: 1.15; }
.hero h1 { margin: 19px 0 23px; font-weight: 700; font-size: clamp(43px, 5.2vw, 75px); letter-spacing: -.045em; }
.hero h1 span { font-size: .84em; letter-spacing: -.05em; }
.intro { max-width: 35em; margin: 0 0 26px; color: var(--muted); font-size: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; }
.button { display: inline-flex; gap: 18px; align-items: center; padding: 9px 15px; border: 1px solid var(--line); font-size: 13px; }
.button:hover { border-color: var(--accent); }
.primary { color: #fffdf6; border-color: var(--accent); background: var(--accent); }
.primary:hover { background: #923823; }
.edition-meta { display: flex; gap: 24px; flex-wrap: wrap; margin: 31px 0 0; padding-top: 17px; border-top: 1px solid var(--line); }
.edition-meta div { display: grid; gap: 3px; }
.edition-meta dt { font-size: 11px; color: var(--muted); }
.edition-meta dd { margin: 0; font: 12px/1.6 var(--mono); }
.edition-meta a { text-decoration: underline; text-underline-offset: 3px; }
.hero-figure { margin: 0; background: #203b32; color: #f5f5e9; border: 1px solid #315244; box-shadow: 10px 12px 0 #dce3d6; }
.hero-figure figcaption, .figure-footer { display: flex; justify-content: space-between; gap: 10px; padding: 13px 17px; font-size: 11px; }
.hero-figure figcaption { color: #dce9dc; border-bottom: 1px solid #466154; }
.hero-figure figcaption span:first-child, .hero-loop-note { font-family: var(--mono); letter-spacing: .1em; }
.hero-svg { display: block; width: 100%; }
.hero-node rect { fill: #2e4a3d; stroke: #6d9280; }
.hero-node text { fill: #c1d6c5; font: 10px var(--mono); }
.hero-node .cn { fill: #f5f5e9; font: 17px var(--sans); }
.hero-loop { fill: #f0cebb; font: 26px var(--mono); }
.hero-loop-note { fill: #bed0c1; font-size: 9px; }
.orbit { stroke-dasharray: 10 868; animation: circuit 4s linear 3; opacity: .8; }
@keyframes circuit { to { stroke-dashoffset: -878; } }
.figure-footer { border-top: 1px solid #466154; color: #ccddcd; }
.figure-footer a { color: #ffd3b8; }
.map-section { border-block: 1px solid var(--line); padding: 39px 0 43px; background: var(--wash); }
.map-section h2, .reference-section h2 { margin: 0; font-size: clamp(31px, 3.4vw, 44px); letter-spacing: -.025em; }
.section-copy { max-width: 64em; margin: 10px 0 23px; color: var(--muted); }
.mind-map { display: grid; grid-template-columns: minmax(145px, 1fr) clamp(46px, 7vw, 112px) minmax(175px, 1fr) minmax(245px, 1.65fr); align-items: center; border: 1px solid #c7d5c6; background: var(--surface); padding: 22px 27px; }
.map-root { text-align: center; border: 1px solid var(--moss); padding: 13px 9px; background: var(--ink); color: var(--surface); }
.map-root span { display: block; color: #ecd0bc; font: 35px/1.15 var(--serif); }
.map-root strong { display: block; margin-top: 5px; font: 14px/1.4 var(--mono); }
.map-root small { color: #d5e1d7; font-size: 11px; }
.map-links { height: 180px; width: 100%; }
.map-links path { fill: none; stroke: #9bb6a4; stroke-width: 1.4px; vector-effect: non-scaling-stroke; }
.map-links path.active { stroke: var(--accent); stroke-width: 2px; stroke-dasharray: 5 4; animation: edge 1.2s linear 2; }
.map-branches { display: grid; grid-template-rows: repeat(3, 1fr); min-height: 180px; align-items: center; gap: 0; }
.map-branches button { display: grid; grid-template-columns: 46px 1fr 18px; text-align: left; gap: 5px; align-items: center; border: 1px solid var(--line); background: var(--paper); padding: 8px 9px; min-height: 43px; }
.map-branches button span:first-child { color: var(--muted); font: 10px var(--mono); }
.map-branches button[aria-pressed=true] { border-color: var(--accent); color: var(--accent); background: var(--warm); }
.map-branches strong { font-size: 13px; }
.map-leaves { align-self: stretch; min-width: 0; padding: 0 0 0 23px; margin-left: 23px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.map-leaves p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 5px; font-size: 12px; color: var(--muted); }
.map-leaves a { display: grid; grid-template-columns: 24px 1fr 20px; align-items: center; padding: 6px 0; gap: 6px; border-bottom: 1px solid var(--line); font-size: 13px; }
.map-leaves a span:first-child { color: var(--accent); font: 11px var(--mono); }
.map-leaves a:hover { color: var(--accent); }
.reading { padding-block: 48px 64px; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: clamp(28px, 5.2vw, 75px); align-items: start; }
.contents { position: sticky; top: 99px; }
summary { cursor: pointer; }
.contents summary { padding-block: 0 10px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.contents summary span, .source-details summary span { margin-left: 7px; color: var(--accent); font: 11px var(--mono); }
.nav-group p { font-size: 11px; color: var(--muted); margin: 14px 0 4px; }
.nav-group a { display: flex; gap: 10px; align-items: baseline; padding: 5px 7px; font-size: 13px; }
.nav-group a span { font: 10px var(--mono); color: var(--muted); }
.nav-group a:hover, .nav-group a[aria-current] { color: var(--accent); background: var(--warm); }
.contents-foot { display: grid; gap: 4px; padding-top: 13px; margin-top: 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.contents-foot a { text-decoration: underline; text-underline-offset: 3px; }
.chapter { padding: 42px 0 43px; border-bottom: 1px solid var(--line); }
.chapter:first-child { padding-top: 0; }
.chapter:last-child { border-bottom: 0; padding-bottom: 0; }
.chapter-kicker span { color: var(--accent); margin-right: 11px; }
.chapter h2 { margin: 0; font-size: clamp(31px, 3.9vw, 50px); letter-spacing: -.03em; }
.chapter-intro { margin: 14px 0 22px; color: var(--muted); font-size: 16px; max-width: 54em; }
.chapter-figure { margin: 0 0 27px; border: 1px solid #ccd7ca; background: var(--surface); }
.chapter-figure figcaption { display: flex; gap: 13px; align-items: baseline; padding: 11px 15px; background: var(--wash); border-bottom: 1px solid var(--line); }
.figure-number { color: var(--moss); font: 10px var(--mono); white-space: nowrap; }
.chapter-figure figcaption strong { font-size: 13px; }
.route-tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 13px 15px 0; }
.route-tabs button, .figure-controls button { border: 1px solid var(--line); background: var(--surface); padding: 4px 10px; font-size: 12px; min-height: 35px; }
.route-tabs button[aria-pressed=true] { background: var(--wash); color: var(--ink); border-color: #789783; }
.flow-grid, .session-tree { position: relative; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(76px, auto)); gap: 24px; padding: 18px 24px; }
.steps button { position: relative; border: 1px solid #c8d7cb; background: #f7f9f2; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 10px; text-align: left; min-width: 0; }
.steps button:nth-child(4) { grid-row: 2; grid-column: 3; }
.steps button:nth-child(5) { grid-row: 2; grid-column: 2; }
.steps button:nth-child(6) { grid-row: 2; grid-column: 1; }
.steps button span, .tree-node code { font: 10px/1.3 var(--mono); color: var(--muted); }
.steps button strong, .tree-node strong { font-size: 13px; line-height: 1.35; }
.steps button code { font: 10px/1.35 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.steps button.passed { background: var(--wash); }
.steps button[aria-pressed=true], .tree-node[aria-pressed=true] { border-color: var(--accent); background: var(--warm); color: var(--accent); }
.steps button:hover, .tree-leaf:hover { border-color: var(--accent); }
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.flow-lines g path { fill: none; stroke: #87a693; stroke-width: 1.5; }
.flow-lines marker path { fill: #87a693; }
.flow-lines g path.trace-path { stroke: var(--accent); stroke-width: 2; }
.is-playing .flow-lines g path.trace-path, .session-tree .trace-path { stroke-dasharray: 4 3; animation: edge 1s linear 2; }
@keyframes edge { to { stroke-dashoffset: -21; } }
.step-detail, .tree-output { display: flex; align-items: baseline; gap: 12px; padding: 10px 15px 12px; border-top: 1px solid var(--line); min-height: 78px; }
.step-count { flex-shrink: 0; color: var(--accent); font: 11px var(--mono); }
.step-detail strong, .tree-output strong { font-size: 13px; }
.step-detail p, .tree-output p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.figure-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 15px; border-top: 1px solid var(--line); }
.figure-controls button:hover:not(:disabled) { border-color: var(--accent); }
.figure-controls .play-button { color: var(--surface); border-color: var(--ink); background: var(--ink); min-width: 75px; }
.loop-hint { margin-left: auto; color: var(--muted); font-size: 11px; }
.session-tree { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; gap: 18px 10px; padding: 17px 22px; }
.tree-node { display: grid; align-content: center; justify-items: center; gap: 3px; padding: 6px; min-height: 48px; position: relative; width: min(100%, 225px); border: 1px solid var(--line); background: var(--wash); }
.tree-node[data-entry=u1], .tree-node[data-entry=r1] { grid-column: 2 / 4; }
.tree-node[data-entry=a1] { grid-column: 1 / 3; }
.tree-node[data-entry=b1] { grid-column: 3 / 5; }
.tree-output { display: grid; grid-template-columns: auto 1fr; gap: 2px 11px; align-items: baseline; }
.tree-output span { color: var(--muted); font-size: 11px; }
.tree-output strong { font-family: var(--mono); color: var(--accent); }
.tree-output p { grid-column: 1 / -1; }
.chapter-prose { max-width: 68ch; }
.chapter-prose h3 { margin: 18px 0 3px; font-size: 17px; }
.chapter-prose p { margin: 0 0 12px; }
.decision { padding: 11px 15px; border-left: 3px solid var(--accent); background: var(--warm); margin: 22px 0 13px; }
.decision span { color: var(--accent); font-size: 12px; font-weight: 600; }
.decision p { margin: 3px 0 0; font-size: 14px; }
.inline-lab { display: inline-block; color: var(--accent); border-bottom: 1px solid var(--accent); font-size: 13px; margin: 4px 0 12px; }
.source-details { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.source-details summary { font-size: 13px; color: var(--muted); }
.citation { margin-top: 8px; border: 1px solid var(--line); padding: 7px 9px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; background: var(--surface); }
.citation div { flex: 1 1 155px; }
.citation strong { font-size: 12px; display: block; }
.citation code { font: 10px/1.4 var(--mono); overflow-wrap: anywhere; color: var(--muted); }
.citation a, .excerpt-trigger { font-size: 11px; color: var(--accent); }
.excerpt-trigger { background: transparent; border: 1px solid var(--line); padding: 3px 7px; }
.excerpt { flex-basis: 100%; width: 100%; margin: 2px 0 0; padding: 10px 12px; background: var(--ink); color: #e5eee1; font: 11px/1.7 var(--mono); overflow-x: auto; }
.reference-section { padding: 40px 0; background: var(--wash); border-block: 1px solid var(--line); }
.references { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.references article { border-top: 1px solid #9bb6a4; padding-top: 12px; min-width: 0; }
.references article span { font: 10px var(--mono); color: var(--muted); }
.references h3 { margin: 3px 0; font: 700 20px/1.4 var(--serif); }
.references p { color: var(--muted); font-size: 13px; margin: 4px 0; }
.references a, .scope a { color: var(--accent); font-size: 12px; overflow-wrap: anywhere; }
.scope { border-top: 1px solid var(--line); margin: 23px 0 0; padding-top: 12px; color: var(--muted); font-size: 12px; }
.scope a { margin-left: 8px; }
.site-footer { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; padding-block: 20px; color: var(--muted); font-size: 12px; }
.site-footer span { font-family: var(--mono); }
.no-script { margin-inline: auto; width: min(100% - 30px, 800px); }
@media (max-width: 1050px) {
  .page-width { width: calc(100% - 64px); }
  .hero { gap: 33px; }
  .reading { gap: 25px; grid-template-columns: 155px minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .page-width { width: calc(100% - 36px); }
  .masthead { min-height: 62px; padding-inline: 18px; }
  .masthead nav { display: none; }
  .hero { padding-block: 38px; grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .hero h1 { margin: 13px 0 15px; font-size: clamp(41px, 9.3vw, 67px); }
  .intro { font-size: 15px; margin-bottom: 18px; }
  .edition-meta { margin-top: 19px; padding-top: 10px; }
  .hero-figure { width: min(100%, 500px); box-shadow: 5px 6px 0 #dce3d6; }
  .reading { display: block; padding-block: 25px 42px; }
  .contents { position: static; margin-bottom: 23px; }
  .contents-foot { display: none; }
  .map-section { padding: 26px 0; }
  .mind-map { grid-template-columns: minmax(110px, 1fr) 35px minmax(140px, 1.3fr); padding: 12px 13px; }
  .map-leaves { grid-column: 1 / -1; padding: 8px 0 0; margin: 8px 0 0; border: 0; border-top: 1px solid var(--line); }
  .map-branches button { grid-template-columns: 36px 1fr 14px; }
  .references { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 470px) {
  .brand strong { font-size: 12px; }
  .masthead { gap: 9px; }
  .lab-link { gap: 5px; padding: 6px 8px; font-size: 11px; }
  .steps { gap: 17px 11px; padding: 13px 15px; grid-template-rows: repeat(2, minmax(72px, auto)); }
  .steps button { padding: 5px; }
  .steps button strong { font-size: 11px; }
  .steps button code { font-size: 8px; }
  .steps button span { font-size: 9px; }
  .route-tabs, .figure-controls { padding-inline: 10px; }
  .route-tabs button { padding-inline: 7px; }
  .chapter-intro { font-size: 15px; }
  .chapter { padding-block: 32px; }
  .loop-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.trace-panel { margin: 0 15px 13px; padding: 7px 9px; background: #eef3e9; border: 1px solid var(--line); }
.trace-lane { display: grid; grid-template-columns: minmax(48px, .8fr) repeat(3, minmax(0, 1fr)); gap: 5px; align-items: center; font-size: 11px; padding: 3px 0; }
.trace-lane span { text-align: center; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.trace-lane span.past { background: #dce9dc; color: var(--ink); }
.trace-lane span.now { background: var(--warm); border-color: var(--accent); color: var(--accent); }
.trace-lane code { font: 10px var(--mono); }
.projection { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; }
.projection code { padding: 0 6px; background: var(--surface); border: 1px solid var(--line); font: 11px/1.8 var(--mono); }
.projection code.summary-entry { background: var(--warm); color: var(--accent); border-color: #d1a28e; }
.projection > span { color: var(--muted); margin-left: auto; }
@media (max-width: 380px) {
  .mind-map { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1.3fr); padding-inline: 9px; }
  .map-branches button { grid-template-columns: 29px minmax(0, 1fr) 10px; padding-inline: 5px; }
  .map-branches strong { font-size: 11px; }
  .map-root strong { font-size: 12px; }
}
.supplement-links { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 13px; font-size: 12px; }
.supplement-links span { color: var(--muted); }
.supplement-links a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.ecosystem-section { border-top: 1px solid var(--line); margin-top: 27px; padding-top: 19px; min-width: 0; }
.ecosystem-section > .eyebrow { margin-bottom: 5px; }
.ecosystem-section > h3 { margin: 0 0 7px; font: 700 24px/1.35 var(--serif); }
.ecosystem-note { color: var(--muted); font-size: 14px; margin: 0 0 13px; max-width: 62em; }
.package-filters { padding: 0; }
.package-count { min-height: 1.55em; color: var(--muted); font: 11px/1.6 var(--mono); margin: 7px 0; }
.ecosystem-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ecosystem-card { display: flex; flex-direction: column; min-width: 0; padding: 13px; border: 1px solid var(--line); background: var(--surface); }
.ecosystem-card .case-tag { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--moss); font: 11px/1.4 var(--mono); margin: 0; }
.case-tag span { white-space: nowrap; }
.ecosystem-card h4 { margin: 5px 0 2px; font-size: 16px; overflow-wrap: anywhere; }
.ecosystem-card > p { margin: 4px 0; font-size: 13px; }
.ecosystem-card dl { margin: 6px 0 10px; color: var(--muted); font-size: 12px; }
.ecosystem-card dt { font-weight: 600; color: var(--ink); margin-top: 5px; }
.ecosystem-card dd { margin: 0; }
.package-command { margin-top: auto; border: 1px solid var(--line); background: var(--wash); display: flex; gap: 7px; align-items: center; min-width: 0; padding: 5px 7px; }
.package-command code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 10px/1.5 var(--mono); }
.package-command button { flex: none; padding: 2px 5px; border: 1px solid var(--line); background: var(--surface); font-size: 11px; min-height: 29px; }
.package-command button:hover { border-color: var(--accent); }
.ecosystem-sources { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 7px; font-size: 11px; }
.ecosystem-sources a, .integration-list a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.integration-list { border-block: 1px solid var(--line); }
.integration-list article { display: grid; grid-template-columns: 145px 1fr 1fr; gap: 10px; padding: 9px 0; align-items: baseline; }
.integration-list article + article { border-top: 1px solid var(--line); }
.integration-list h4, .integration-list p { margin: 0; font-size: 13px; }
.integration-list p { color: var(--muted); }
.integration-list a { font-size: 11px; white-space: nowrap; }
.contract-details { padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); }
.contract-details summary { font-size: 13px; }
.contract-details pre { margin: 8px 0 0; padding: 9px; background: var(--ink); color: var(--surface); font: 11px/1.7 var(--mono); overflow: auto; }
.rollout-list { margin: 0; padding: 0; list-style: none; }
.rollout-list li { display: grid; grid-template-columns: 33px 1fr; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rollout-list li > span { color: var(--accent); font: 11px var(--mono); }
.rollout-list h4, .rollout-list p { margin: 0; font-size: 13px; }
.rollout-list .rollout-gate { color: var(--muted); }
.rollout-gate strong { color: var(--moss); margin-right: 6px; }
@media (max-width: 650px) {
  .ecosystem-grid { grid-template-columns: 1fr; }
  .integration-list article { grid-template-columns: 1fr; gap: 4px; }
  .contract-details pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}
