html.handbook408-root{min-width:0}
.handbook408-handbook{--hand-concept:#8fbdff;--hand-key:#ffb3b3;--hand-contrast:#f3bf79;--hand-example:#c5b1ff;--hand-memory:#83d6b0}
html[data-theme="light"] .handbook408-handbook{--hand-concept:#185ca8;--hand-key:#ac2537;--hand-contrast:#875000;--hand-example:#6846ad;--hand-memory:#196b4b}
.handbook408-handbook [hidden]{display:none!important}
.handbook408-handbook .formula-hero .subhero-card::after{content:"0 · 1";font-family:var(--font-cjk);bottom:-.18em;opacity:.7}
.handbook408-handbook .formula-hero .subhero-card h1{max-width:100%;text-wrap:balance}
.handbook408-handbook .formula-filter-grid>label,.handbook408-handbook .formula-filter-grid input,.handbook408-handbook .formula-filter-grid select{min-width:0}
.handbook408-handbook .formula-card-number{grid-column:1;grid-row:2}
.handbook408-handbook .formula-card-summary{grid-row:3}
.handbook408-card-parts{grid-column:1/-1;grid-row:4;color:var(--muted);font-size:.73rem;letter-spacing:.03em}
.handbook408-handbook .formula-card summary::after{grid-row:1/4}
.handbook408-handbook .formula-card-body{grid-template-columns:1fr;padding-top:1rem;gap:1rem}
.handbook408-handbook .formula-chapter-head{flex-wrap:wrap;align-items:start}
.handbook408-handbook .formula-chapter-head h2{font-size:1.2rem;margin:0;line-height:1.6;max-width:100%}
.handbook408-handbook .formula-chapter{margin-bottom:2rem;scroll-margin-top:100px}
.handbook408-handbook .formula-index{position:sticky;top:90px;max-height:calc(100dvh - 110px);overflow:auto;scrollbar-width:thin}
.handbook408-directory>summary{cursor:pointer;font-size:.9rem;font-weight:700;padding:.3rem}
.handbook408-handbook .formula-index nav{margin-top:.5rem}
.handbook408-handbook .formula-index a{align-items:start;line-height:1.55}
.handbook408-handbook .formula-index a[aria-current]{color:var(--text);background:var(--surface-soft)}
.handbook408-handbook .formula-index .index-subject{padding:.5rem .6rem .2rem;font-size:.82rem;line-height:1.6}
.handbook408-card[data-state="mastered"] .formula-card-number::after{content:" · 已掌握"}
.handbook408-card[data-state="review"] .formula-card-number::after{content:" · 待复习"}
.handbook408-handbook .formula-card summary:focus-visible{outline:2px solid var(--accent);outline-offset:-4px;border-radius:var(--radius-md)}
.handbook408-handbook .formula-actions .button:focus-visible,.handbook408-table-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.handbook408-handbook .formula-card,.handbook408-handbook .formula-filter-grid label{overflow-wrap:anywhere}
.handbook408-handbook .formula-actions a{text-decoration:none}
.handbook408-legend{display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin:.4rem 0 1.15rem;font-size:.8rem;line-height:1.6}
.handbook408-legend>span{display:inline-flex;gap:.4rem;align-items:center}
.handbook408-legend>span::before{content:"";display:inline-block;width:.45rem;height:.45rem;border-radius:50%;background:currentColor}
.legend-concept{color:var(--hand-concept)}.legend-key{color:var(--hand-key)}.legend-contrast{color:var(--hand-contrast)}.legend-example{color:var(--hand-example)}.legend-memory{color:var(--hand-memory)}
.handbook408-section{--kind-color:var(--accent-strong);min-width:0;padding:.85rem 1rem;border-left:3px solid var(--kind-color);border-radius:0 12px 12px 0;background:var(--surface-soft)}
.handbook408-section.kind-concept{--kind-color:var(--hand-concept)}
.handbook408-section.kind-key{--kind-color:var(--hand-key)}
.handbook408-section.kind-contrast{--kind-color:var(--hand-contrast)}
.handbook408-section.kind-example{--kind-color:var(--hand-example)}
.handbook408-section.kind-memory{--kind-color:var(--hand-memory)}
.handbook408-section h4{margin:0 0 .65rem;color:var(--kind-color);font-size:.9rem;line-height:1.6;font-weight:700}
.handbook408-section ul{padding-left:1.25rem;margin:0;color:var(--text);font-size:.95rem;line-height:1.95}
.handbook408-section li+li{margin-top:.55rem}
.handbook408-section strong{color:var(--kind-color);font-weight:750}
.handbook408-table-scroll{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;border:1px solid var(--line);border-radius:8px;scrollbar-width:thin}
.handbook408-section table{width:100%;border-collapse:collapse;font-size:.9rem;line-height:1.85;min-width:520px;background:var(--surface)}
.handbook408-section th,.handbook408-section td{padding:.7rem .8rem;border-bottom:1px solid var(--line);vertical-align:top;text-align:left;min-width:100px;white-space:normal}
.handbook408-section th{color:var(--kind-color);font-weight:700;background:var(--surface-soft)}
.handbook408-section tbody tr:last-child td{border-bottom:0}
.handbook408-section td:first-child{font-weight:650;color:var(--kind-color)}
@media(max-width:900px){.handbook408-handbook .formula-index{position:static;max-height:none}.handbook408-handbook .formula-index nav{max-height:45vh;overflow:auto}.handbook408-handbook .formula-card-list{grid-template-columns:1fr}}
@media(max-width:620px){.handbook408-handbook .formula-index nav{grid-template-columns:1fr}.handbook408-handbook .formula-stat-row{gap:.5rem}.handbook408-handbook .formula-stat-row span{font-size:.78rem}.handbook408-handbook .formula-card summary{padding:.85rem}.handbook408-handbook .formula-card-body{padding:1rem .75rem}.handbook408-section{padding:.8rem .7rem}.handbook408-section ul{font-size:.94rem;padding-left:1.1rem}.handbook408-handbook .formula-reference .section-head{flex-direction:column;align-items:flex-start;gap:.7rem}.handbook408-handbook .formula-reference .section-intro{margin:0;text-align:left}}
@media print{.handbook408-handbook{--hand-concept:#185ca8;--hand-key:#ac2537;--hand-contrast:#875000;--hand-example:#6846ad;--hand-memory:#196b4b}.handbook408-handbook .formula-controls,.handbook408-handbook .formula-index,.handbook408-handbook .formula-reference,.handbook408-handbook .page-tools,.handbook408-handbook .section-nav{display:none!important}.handbook408-handbook .formula-card:not([hidden]){break-inside:auto;box-shadow:none;backdrop-filter:none}.handbook408-handbook .formula-card-body{display:block!important}.handbook408-section{margin-top:.6rem;background:#fff;break-inside:avoid;border-right:1px solid #ddd;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.handbook408-section ul,.handbook408-section td{color:#111}.handbook408-handbook .formula-chapter-head{color:#111}.handbook408-handbook .formula-hero .subhero-card::after{display:none}.handbook408-handbook .formula-actions{display:none!important}.handbook408-section table{min-width:0;background:#fff}.handbook408-table-scroll{overflow:visible}.handbook408-section th{background:#fff}.handbook408-handbook .formula-card summary{break-after:avoid}.handbook408-card-parts{color:#333}}
html:lang(zh-CN) body.handbook408-handbook .formula-chapter-head h2{font-size:1.2rem;max-width:100%;line-height:1.6}
html:lang(zh-CN) body.handbook408-handbook .formula-controls-head h2{font-size:clamp(1.35rem,2vw,1.8rem);max-width:100%;line-height:1.4}
.handbook408-handbook .formula-reference .section-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:1rem}
.handbook408-section.kind-memory li{color:var(--hand-memory)}
html.handbook408-root{scroll-behavior:auto}

.handbook408-section p{margin:.4rem 0 .8rem;font-size:.95rem;line-height:1.95;color:var(--text)}
.handbook408-section p:last-child{margin-bottom:0}
.handbook408-section pre{white-space:pre;overflow:auto;max-width:100%;font:.88rem/1.7 Consolas,monospace;padding:1rem;border:1px solid var(--line);border-radius:8px;background:var(--surface-strong)}
.handbook408-formula{max-width:100%;overflow-x:auto;overflow-y:hidden;padding:.7rem .2rem;color:var(--kind-color)}
.handbook408-formula .katex{font-size:1.1em}
.handbook408-section .handbook408-formula-note{font-size:.86rem;color:var(--muted)}
.handbook408-handbook .formula-card-list{grid-template-columns:1fr}
.handbook408-section.kind-memory p{color:var(--hand-memory)}
@media print{.handbook408-section pre{white-space:pre-wrap;overflow-wrap:anywhere;overflow:visible}.handbook408-formula{overflow:visible}.handbook408-section{break-inside:auto}}

.handbook408-diagram{margin:.8rem 0}.handbook408-diagram-scroll{overflow-x:auto;max-width:100%;border:1px solid var(--line);border-radius:10px}.handbook408-diagram-scroll svg{display:block;width:100%;min-width:700px;height:auto;--diagram-bg:var(--surface-strong);--diagram-fill:var(--surface-soft);--diagram-line:var(--accent);--diagram-text:var(--text);--diagram-muted:var(--muted)}.handbook408-diagram figcaption{font-size:.85rem;padding-top:.5rem}@media print{.handbook408-diagram-scroll svg{min-width:0;--diagram-bg:#fff;--diagram-fill:#f4f4f4;--diagram-line:#444;--diagram-text:#111;--diagram-muted:#444}.handbook408-diagram-scroll{overflow:visible}}

/* Keep statistics and navigation as two distinct, wrapping rows. */
.handbook408-handbook .formula-hero .formula-stat-row{align-items:center;gap:.7rem;margin-bottom:0}
.handbook408-handbook .formula-hero .formula-stat-row>span{min-height:44px;align-items:center;white-space:nowrap;line-height:1.5}
.handbook408-handbook .formula-hero .formula-stat-row+.hero-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;margin-top:20px}
.handbook408-handbook .formula-hero .hero-actions>.button{margin:0;min-height:44px;line-height:1.5;white-space:normal;text-align:center}
@media(max-width:620px){.handbook408-handbook .formula-hero .formula-stat-row{gap:.6rem}.handbook408-handbook .formula-hero .formula-stat-row+.hero-actions{gap:.6rem;margin-top:18px}.handbook408-handbook .formula-hero .hero-actions>.button{max-width:100%}}
.study-sim{min-width:0}.study-sim .sim-title{font-weight:700}.sim-stage{overflow-x:auto;max-width:100%;border:1px solid var(--line);border-radius:12px;background:var(--surface-strong)}.sim-track{position:relative;min-width:660px;height:260px}.sim-node{position:absolute;width:150px;min-height:52px;box-sizing:border-box;padding:12px 7px;display:flex;align-items:center;justify-content:center;text-align:center;font-size:15px;line-height:1.5;border:2px solid var(--line-strong);border-radius:10px;background:var(--surface-strong);color:var(--text);transition:left .7s ease,top .7s ease,transform .4s ease,border-color .4s ease;z-index:1}.sim-active{border-color:var(--hand-example);transform:translateY(-5px);box-shadow:0 3px 12px var(--line)}.sim-pending{opacity:.4}.sim-edges{position:absolute;inset:0;width:660px;height:260px}.sim-edges path{stroke:var(--accent);stroke-width:3;fill:none}.study-sim .sim-heading{font-size:1rem;color:var(--hand-example);margin:.6rem 0}.study-sim .sim-explain{min-height:5.5em}.study-sim .sim-count{font-size:.82rem;color:var(--muted);margin-top:.8rem}.sim-buttons{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0}.sim-buttons .button{min-height:44px}.sim-buttons button:disabled{opacity:.4;cursor:default}.sim-transcript{margin-top:1rem}.sim-transcript summary{cursor:pointer;color:var(--hand-example)}.sim-transcript ol{padding-left:1.4rem;line-height:1.9}.sim-transcript li+li{margin-top:.6rem}@media(prefers-reduced-motion:reduce){.sim-node{transition:none}}@media print{.sim-interactive{display:none!important}.sim-transcript{display:block}.sim-transcript ol{display:block}}
.sim-cursor{position:absolute;top:145px;width:150px;text-align:center;color:var(--hand-example);font-size:15px;transition:left .65s ease}.sim-token{position:absolute;top:190px;width:110px;padding:8px;border-radius:999px;text-align:center;background:var(--hand-memory);color:var(--surface-strong);font-size:15px;transition:left .8s ease,opacity .4s ease}.sim-tcp .sim-track{height:340px}.sim-bar{position:absolute;left:5%;height:32px;overflow:hidden;white-space:nowrap;font-size:14px;line-height:32px;text-align:center;color:var(--text);transition:width .75s ease;box-sizing:border-box}.sim-flight{top:200px;background:var(--surface-soft);border:2px solid var(--hand-contrast)}.sim-credit{top:250px;background:var(--surface-soft);border:2px solid var(--hand-memory)}@media(prefers-reduced-motion:reduce){.sim-cursor,.sim-token,.sim-bar{transition:none}}
/* Use one coordinate system for moving nodes and SVG connectors. */
.sim-track{width:660px;margin-inline:auto}
.study-sim .sim-transcript>summary{display:list-item}
.study-sim .sim-transcript>summary::after{display:none}
.sim-node[hidden],.sim-cursor[hidden]{display:none!important}.sim-edges text{fill:var(--text);font:16px SimSun,serif}.kmp-row{position:absolute;left:35px;display:flex;transition:transform .8s ease}.kmp-main{top:50px}.kmp-pattern{top:150px}.kmp-label{position:absolute;left:35px;font-size:16px;color:var(--muted)}.kmp-label-main{top:12px}.kmp-label-pattern{top:112px}.kmp-cell{display:flex;width:48px;height:46px;box-sizing:border-box;align-items:center;justify-content:center;border:1px solid var(--line-strong);background:var(--surface-strong);font:24px 'Times New Roman',serif;color:var(--text);transition:background .3s,border-color .3s}.kmp-matched{background:var(--surface-soft);border-color:var(--hand-memory)}.kmp-current{border:3px solid var(--hand-example);color:var(--hand-example)}.fragment-packet{position:absolute;left:35px;top:20px;width:590px;padding:15px;box-sizing:border-box;text-align:center;border:2px solid var(--accent);border-radius:10px;background:var(--surface-soft);font-size:17px;transition:opacity .6s}.fragment-piece{position:absolute;left:0;top:0;width:190px;min-height:100px;padding:12px;box-sizing:border-box;display:grid;gap:8px;text-align:center;border:2px solid var(--accent);border-top:12px solid var(--hand-concept);border-radius:10px;background:var(--surface-strong);font-size:15px;transition:transform .8s,opacity .6s}.fragment-active{border-color:var(--hand-example)}@media(prefers-reduced-motion:reduce){.kmp-row,.kmp-cell,.fragment-piece,.fragment-packet{transition:none}}
.visual-caption{position:absolute;left:20px;right:20px;bottom:3px;line-height:25px;text-align:center;color:var(--text);font-size:16px}.visual-label{position:absolute;top:18px;left:20px;right:20px;text-align:center;font-size:16px;color:var(--muted)}.ring-slot{position:absolute;width:64px;height:64px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:2px solid var(--line-strong);background:var(--surface-strong);color:var(--text);font-size:16px;transition:background .5s,border-color .5s}.ring-filled{border-color:var(--hand-memory);background:var(--surface-soft)}.ring-pointer{position:absolute;width:98px;line-height:22px;text-align:center;font:15px 'Times New Roman',serif;color:var(--hand-example)}.ring-center{left:285px;right:auto;top:105px;bottom:auto;width:115px;font-size:14px}.lru-tile{position:absolute;left:0;top:0;width:140px;height:78px;display:flex;align-items:center;justify-content:center;border:2px solid var(--hand-memory);border-radius:12px;background:var(--surface-strong);color:var(--text);font-size:22px;transition:transform .8s,opacity .6s,border-color .4s}.bfs-node{position:absolute;width:60px;height:50px;border:2px solid var(--line-strong);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:20px;background:var(--surface-strong);color:var(--text);transition:background .5s,border-color .5s}.bfs-visited{border-color:var(--hand-memory);background:var(--surface-soft)}.visual-current{border-color:var(--hand-example);box-shadow:0 0 0 3px var(--line-strong)}.gbn-end{position:absolute;top:20px;padding:12px;border:2px solid var(--accent);border-radius:10px;font-size:16px;box-sizing:border-box;width:180px;color:var(--text);background:var(--surface-strong)}.gbn-sender{left:25px}.gbn-receiver{left:455px}.gbn-packet{position:absolute;top:105px;width:200px;padding:12px;box-sizing:border-box;text-align:center;border:2px solid var(--hand-memory);border-radius:8px;font-size:16px;transition:left .9s,border-color .5s;color:var(--text);background:var(--surface-soft)}.gbn-lost{border-color:var(--hand-key);border-style:dashed}.gbn-ack{position:absolute;top:180px;left:140px;right:40px;text-align:center;font-size:18px;color:var(--hand-concept)}@media(prefers-reduced-motion:reduce){.ring-slot,.lru-tile,.bfs-node,.gbn-packet{transition:none}}
/* Exact SVG scenes keep controls readable and confine scrolling to each picture. */
.board-stage{max-width:100%;overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:var(--surface-strong);overscroll-behavior-x:contain;scrollbar-width:thin}
.board-svg{display:block;width:100%;min-width:680px;height:auto;color:var(--text)}
.board-node{transition:transform .7s ease,opacity .35s ease}.board-node rect{fill:var(--surface-soft);stroke:var(--hand-concept);stroke-width:2;transition:stroke .35s,fill .35s}.board-node.active rect{stroke:var(--hand-example);stroke-width:4}.board-node.done rect{stroke:var(--hand-memory);stroke-width:3}.board-node text{fill:var(--text);font-family:SimSun,'Times New Roman',serif}.board-edge{stroke:var(--hand-concept);stroke-width:2;fill:none;transition:opacity .35s}.board-edge-label{fill:var(--text);font:18px SimSun,serif;paint-order:stroke;stroke:var(--surface-strong);stroke-width:8px;stroke-linejoin:round;transition:opacity .35s}
.board-note{padding:.7rem .9rem;border-radius:8px;background:var(--surface-soft);color:var(--text);line-height:1.8;font-size:.87rem}.board-settings{display:flex;flex-wrap:wrap;gap:1rem;align-items:center}.board-settings label{display:flex;gap:.6rem;align-items:center;font-size:.85rem;color:var(--text)}.board-settings input{min-width:120px;max-width:100%;accent-color:var(--hand-example)}.board-settings select{font:inherit;border:1px solid var(--line-strong);border-radius:7px;padding:.4rem;color:var(--text);background:var(--surface-strong);min-height:40px}.board-stage:focus-visible{outline:2px solid var(--hand-example);outline-offset:3px}
.visual-filter-row{display:flex;flex-wrap:wrap;gap:10px;margin:.9rem 0}.visual-filter-row .button{min-height:44px}.visual-filter-row [aria-pressed=true]{border-color:var(--hand-example);color:var(--hand-example);background:var(--surface-soft)}.visual-badges{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.5rem}.visual-badges span{font-size:.75rem;line-height:1.6;color:var(--hand-example);border:1px solid var(--line);padding:.15rem .5rem;border-radius:6px}
@media(prefers-reduced-motion:reduce){.board-node,.board-node rect,.board-edge,.board-edge-label{transition:none}}
@media print{.board-stage{display:none}.visual-filter-row{display:none!important}}

.board-wire{fill:none;stroke:var(--hand-concept);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;transition:opacity .35s}@media(prefers-reduced-motion:reduce){.board-wire{transition:none}}

.board-node.rb-red rect{stroke:var(--hand-key)}.board-node.rb-red text{fill:var(--hand-key)}.board-node.rb-black rect{stroke:var(--text);stroke-width:3}
