:root {
  color-scheme: light;
  --ink: #12274e;
  --dark: #11254b;
  --dark-raised: #1b3666;
  --white: #fff;
  --paper: #f2f6fd;
  --paper-deep: #e7effc;
  --sky: #d9e9ff;
  --sky-deep: #c4dcff;
  --blue: #194cb8;
  --blue-hover: #123c98;
  --muted: #456084;
  --light-muted: #c6d7f1;
  --gutter: clamp(20px, 5vw, 76px);
  --nav-height: 72px;
  --display: clamp(3rem, 5.55vw, 6.15rem);
  --headline: clamp(2.4rem, 4.55vw, 4.65rem);
  --subhead: clamp(1.27rem, 1.65vw, 1.65rem);
  --body: clamp(1rem, .96rem + .17vw, 1.125rem);
  --small: .875rem;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--nav-height) + 14px); }
body { margin: 0; color: var(--ink); background: var(--dark); font-size: var(--body); line-height: 1.65; }
h1, h2, h3, h4, h5, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h1, h2 { font-weight: 800; letter-spacing: -.052em; }
h2 { font-size: var(--headline); }
h3 { font-size: var(--subhead); letter-spacing: -.025em; }
h4 { font-size: var(--body); }
a { color: inherit; text-underline-offset: .22em; }
button, input { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
code { font-size: .93em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3778dd; outline-offset: 5px; }
::selection { color: var(--dark); background: var(--sky-deep); }

.shell { width: min(100%, 1560px); padding-inline: var(--gutter); margin-inline: auto; }
.skip { position: fixed; inset: 12px auto auto 12px; z-index: 5; padding: .6rem 1rem; color: var(--white); background: var(--blue); transform: translateY(-150%); }
.skip:focus { transform: none; }
.top { position: sticky; top: 0; z-index: 4; background: var(--white); color: var(--ink); transition: background-color .25s; }
.top[data-chapter="roadmap"], .top[data-chapter="glossary"] { background: var(--paper); color: var(--ink); }
.top[data-chapter="lab"] { background: var(--sky); }
.nav, .foot-layout { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.nav { min-height: var(--nav-height); }
.brand, .nav nav { display: flex; align-items: center; gap: 12px; }
.brand { text-decoration: none; white-space: nowrap; font-weight: 750; }
.brand-en, figcaption { font-size: var(--small); font-weight: 500; }
.brand-en { margin-left: 3px; opacity: .76; }
.nav nav { gap: clamp(16px, 2.8vw, 44px); }
.nav nav a, .bottom a { font-weight: 650; font-size: var(--small); white-space: nowrap; text-decoration: none; }
.nav nav a:hover, .bottom a:hover { text-decoration: underline; }

.hero { color: var(--ink); background: var(--white); padding-block: clamp(30px, 5vw, 84px) clamp(44px, 6vw, 96px); }
.hero-layout { display: grid; grid-template-columns: minmax(0, .97fr) minmax(0, 1.15fr); align-items: center; gap: clamp(22px, 4.5vw, 76px); }
.hero-copy h1 { font-size: var(--display); line-height: 1.03; }
.hero-copy h1 span { display: block; }
.hero-intro { margin-block: clamp(20px, 3vw, 40px) 30px; max-width: 28em; color: var(--muted); font-size: var(--subhead); line-height: 1.55; }
.button { display: inline-flex; justify-content: space-between; align-items: center; gap: 30px; min-height: 52px; padding: 12px 18px; color: var(--white); background: var(--blue); text-decoration: none; font-weight: 750; }
.button span { display: inline-block; transition: transform .25s ease; }
.button:hover { background: var(--blue-hover); }
.button:hover span { transform: translate(3px, 2px); }
.button:active { transform: translateY(1px); }
.hero-art { min-width: 0; }
.hero-frame { position: relative; overflow: hidden; }
.hero-image { width: 100%; height: auto; aspect-ratio: 1.24; object-fit: cover; }
.hero-image, .resource-media img { filter: grayscale(1) sepia(.62) saturate(2.4) hue-rotate(177deg); }
.hero-signal { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.signal-track path { fill: none; stroke: #81e6ff; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.signal-dot { fill: #f0fdff; }
.signal-core { fill: none; stroke: #def9ff; stroke-width: 3.2; }
.hero-frame[data-lit] .hero-signal, .hero-frame[data-lit] .signal-core { opacity: 1 !important; }
.hero-frame[data-lit] .signal-track path { stroke-dasharray: none !important; }
.hero-frame[data-lit] .signal-dot { opacity: 0 !important; }
.signal-button { position: absolute; left: 12px; bottom: 12px; border: 0; padding: 7px 13px; min-height: 42px; color: var(--white); background: var(--blue); font-size: var(--small); font-weight: 750; }
.signal-button:hover { background: var(--blue-hover); }
.signal-button:focus-visible { outline-color: var(--white); }
.hero-art figcaption { display: flex; justify-content: space-between; gap: 12px; padding-top: 11px; color: var(--muted); }

.chapter { padding-block: clamp(62px, 9vw, 134px); }
.roadmap { background: var(--paper); }
.route-layout { display: grid; grid-template-columns: minmax(245px, .64fr) minmax(0, 1.36fr); gap: clamp(28px, 6vw, 100px); }
.route-sticky { position: sticky; top: calc(var(--nav-height) + 32px); }
.route-sticky > p, .section-intro p, .resource-layout > div > p { max-width: 34em; margin-top: 17px; }
.route-sticky > p { max-width: 21em; }
.progress { margin-top: 24px; max-width: 240px; }
.progress > div { display: flex; align-items: baseline; gap: 10px; }
.progress strong { font-size: var(--subhead); font-variant-numeric: tabular-nums; }
.progress small, .progress > div span { color: var(--muted); font-size: var(--small); }
progress { display: block; width: 100%; height: 7px; margin: 8px 0 4px; border: 0; appearance: none; background: var(--paper-deep); }
progress::-webkit-progress-bar { background: var(--paper-deep); }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }
.route-nav { margin-top: 24px; }
.route-nav ol { margin: 0; padding: 0; list-style: none; }
.route-nav a { display: inline-flex; align-items: center; gap: .6em; min-height: 33px; color: var(--muted); font-size: var(--small); text-decoration: none; }
.route-nav a::before { content: ""; display: block; width: 6px; height: 6px; background: #718bb5; border-radius: 50%; }
.route-nav a:hover, .route-nav a[aria-current] { color: var(--ink); text-decoration: underline; }
.route-nav a[aria-current]::before { background: var(--blue); transform: scale(1.4); }
.stage-list { position: relative; display: grid; gap: 8px; padding-left: 16px; }
.trace { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; overflow: hidden; background: var(--paper-deep); }
.trace span { display: block; height: 100%; background: var(--blue); transform: scaleY(0); transform-origin: top; }
.stage { background: var(--paper-deep); }
.stage:has(details[open]) { background: var(--sky); }
.stage summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 21px clamp(14px, 3vw, 34px); cursor: pointer; list-style: none; }
.stage summary::-webkit-details-marker { display: none; }
.stage summary:hover { background: var(--sky-deep); }
.stage-name { flex: 1; min-width: 0; }
.stage-flow { display: block; margin-bottom: 5px; color: var(--blue-hover); font-size: var(--small); font-weight: 650; }
.stage-name p { margin-top: 6px; color: var(--muted); font-size: var(--small); }
.expander { position: relative; width: 26px; height: 26px; flex: 0 0 26px; }
.expander::before, .expander::after { content: ""; position: absolute; inset: 12px 4px; background: currentColor; transition: transform .25s; }
.expander::after { transform: rotate(90deg); }
[open] .expander::after { transform: rotate(0); }
.stage-tick { color: var(--blue-hover); font-size: var(--small); font-weight: 750; white-space: nowrap; }
.stage-body { padding: 2px clamp(14px, 3vw, 34px) 25px; }
.stage details:not([open]) > .stage-body { display: none; }
.plan-fields { display: grid; gap: 18px; }
.plan-fields p { margin-top: 4px; }
.takeaway { margin-top: 22px; padding: 16px 18px; background: var(--white); }
.takeaway a { display: inline-block; margin-top: 8px; font-weight: 650; }
.done { display: flex; align-items: center; gap: 9px; margin-top: 16px; min-height: 44px; width: fit-content; cursor: pointer; font-weight: 650; }
.done input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.workshop { margin-top: 17px; background: var(--paper); }
.stage .workshop > summary { justify-content: flex-start; gap: .65em; padding: 11px 15px; min-height: 44px; font-weight: 750; color: var(--blue-hover); }
.workshop > summary::before { content: "＋"; }
.workshop[open] > summary::before { content: "−"; }
.workshop-body { padding: 4px 16px 18px; }
.workshop:not([open]) > .workshop-body { display: none; }
.workshop-body h4 { margin: 15px 0 5px; }
.workshop-body ol { padding-left: 1.4em; margin: 5px 0 0; }
.workshop-body li + li { margin-top: 7px; }
.lesson-diagrams { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-top: 9px; color: var(--blue-hover); font-weight: 700; }
.deep-dive { display: grid; gap: 9px; }
.deep-dive > div { padding: 10px 13px; background: var(--white); }
.deep-dive h5 { font-size: var(--body); }
.example { margin-top: 14px; color: var(--white); background: var(--dark); }
.example-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 12px; min-height: 42px; background: var(--dark-raised); font-size: var(--small); overflow-wrap: anywhere; }
.example button { border: 0; padding: 5px 9px; min-height: 32px; color: var(--dark); background: var(--sky-deep); flex: 0 0 auto; }
.example button:hover { background: var(--white); }
.example pre { margin: 0; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--small); line-height: 1.55; }

.lab { background: var(--sky); }
.section-intro { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, .8fr); align-items: end; gap: 16px 32px; margin-bottom: clamp(26px, 4vw, 54px); }
.section-intro p { margin-top: 0; }
.lab-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 5px; }
.flow-panel, .memory-panel { padding: clamp(20px, 3vw, 40px); }
.flow-panel { color: var(--paper); background: var(--dark); }
.memory-panel { background: var(--white); }
.lab-layout h3 + p { margin-block: 9px 20px; }
.flow-panel h3 + p, .token-row > span { color: var(--light-muted); }
.flow-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.flow-buttons button { min-height: 44px; min-width: 0; padding: 5px; border: 0; color: var(--paper); background: var(--dark-raised); font-size: var(--small); font-weight: 650; }
.flow-buttons button:hover { background: #294b83; }
.flow-buttons button:active { transform: translateY(1px); }
.flow-buttons button[aria-pressed="true"] { color: var(--ink); background: var(--sky-deep); }
.play-button { min-height: 42px; margin-top: 10px; padding: 5px 12px; border: 0; font-size: var(--small); font-weight: 750; }
.flow-play { color: var(--dark); background: var(--sky-deep); }
.flow-play:hover { background: var(--white); }
.batch-play { color: var(--white); background: var(--blue); }
.batch-play:hover { background: var(--blue-hover); }
.play-button:active, .signal-button:active { transform: translateY(1px); }
.token-board { margin-top: 16px; padding: 15px; background: var(--dark-raised); }
.token-row { display: grid; grid-template-columns: 105px 1fr; align-items: center; gap: 7px; min-height: 42px; }
.token-row > span, .tokens { font-size: var(--small); }
.tokens { display: flex; align-items: center; gap: 4px; min-height: 31px; }
.tokens b { display: inline-grid; min-width: 28px; min-height: 28px; place-items: center; background: #31558e; }
#tokens-out b { color: var(--dark); background: var(--sky-deep); }
#flow-note { margin-top: 12px; min-height: 4.8em; }
.slider-label, .range-ends { display: flex; justify-content: space-between; gap: 10px; }
.slider-label { font-weight: 700; }
input[type="range"] { width: 100%; margin: 10px 0 1px; accent-color: var(--blue); min-height: 32px; cursor: pointer; }
.range-ends, .model-note { color: var(--muted); font-size: var(--small); }
.memory-meter { height: 9px; background: var(--sky-deep); margin-block: 20px 15px; overflow: hidden; }
.memory-meter span { display: block; width: 100%; height: 100%; background: var(--blue); transform: scaleX(.125); transform-origin: left; }
.memory-result { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.memory-result output { font-size: var(--headline); font-weight: 800; letter-spacing: -.065em; line-height: 1; font-variant-numeric: tabular-nums; }
.memory-result > span { font-size: var(--small); }
.formula { margin-top: 14px; font-weight: 650; }
.model-note { margin-top: 6px; }
.diagram-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 5px; margin-top: 5px; }
.diagram { padding: clamp(17px, 3vw, 40px); background: var(--white); }
.diagram h3 + p { margin-block: 9px 16px; }
.diagram table { width: 100%; border-collapse: separate; border-spacing: 3px; text-align: center; font-size: var(--small); table-layout: fixed; }
.diagram td, .diagram th { height: 40px; }
.attention .allowed { background: var(--sky); color: var(--blue-hover); }
.attention .masked { background: var(--paper); color: var(--muted); }
.attention .selected-row .allowed { color: var(--white); background: var(--blue); }
.attention .selected-row .masked { color: var(--ink); background: #dce4f2; }
.attention button, .batch-modes button { border: 0; min-height: 40px; color: var(--blue-hover); background: var(--paper-deep); font-weight: 750; }
.attention button { width: 100%; }
.attention button:hover, .batch-modes button:hover { background: var(--sky-deep); }
.attention button[aria-pressed="true"], .batch-modes button[aria-pressed="true"] { color: var(--white); background: var(--blue); }
.diagram-note { margin-top: 12px; min-height: 3.25em; }
.batch-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.batch-modes button { padding: 6px 4px; }
.batch-table { margin-block: 9px 12px; }
.batch-table th:first-child { width: 64px; }
.batch-table td, .batch-table th:not(:first-child) { background: var(--paper); }
.batch-table .current-tick { color: var(--white); background: var(--blue) !important; }
.batch-diagram input[type="range"] { margin-block: 3px 0; }
.batch-diagram .diagram-note { margin-top: 4px; }

.glossary { background: var(--paper); }
.term-search { display: grid; grid-template-columns: minmax(0, 460px); gap: 7px; margin-bottom: 16px; }
.term-search label { font-weight: 750; }
.term-search input { width: 100%; min-height: 49px; padding: 8px 13px; border: 2px solid #a0b8df; background: var(--white); color: var(--ink); }
.term-search input::placeholder { color: var(--muted); opacity: 1; }
#term-status { color: var(--muted); min-height: 1.5em; font-size: var(--small); }
.glossary-groups { display: grid; gap: 6px; }
.glossary-group { background: var(--white); }
.glossary-group summary { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 52px; font-weight: 750; cursor: pointer; background: var(--paper-deep); list-style: none; }
.glossary-group summary::-webkit-details-marker { display: none; }
.glossary-group summary:hover { background: var(--sky); }
.glossary-group summary::after { content: "＋"; font-size: var(--subhead); line-height: 1; }
.glossary-group[open] summary::after { content: "−"; }
.term-count { margin-left: auto; color: var(--muted); font-size: var(--small); font-weight: 550; }
.term-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 28px; margin: 0; padding: 12px 17px; }
.glossary-group:not([open]) .term-list { display: none; }
.term { padding: 8px; overflow-wrap: anywhere; }
.term:target { background: var(--sky); }
.term dt { color: var(--blue-hover); font-weight: 750; }
.term dd { margin: 3px 0 0; }

.resources { color: var(--ink); background: var(--white); }
.resource-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 32px clamp(28px, 5vw, 75px); }
.resource-layout > div > p { color: var(--muted); }
.resource-layout .button { margin-top: 24px; }
.run-guide { display: grid; gap: 6px; margin-top: 20px; max-width: 34em; }
.resource-media img { width: 100%; height: auto; aspect-ratio: 1.85; object-fit: cover; }
.resource-media figcaption { margin-block: 7px 17px; color: var(--muted); }
.resource-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.resource-list a { display: block; background: var(--paper); padding: 14px 18px; font-weight: 650; text-decoration: none; }
.resource-list a:hover { background: var(--sky); }
.resource-list a > span { float: right; transition: transform .2s; }
.resource-list a:hover > span { transform: translate(3px, -3px); }
.resource-list small { display: block; color: var(--muted); font-size: var(--small); font-weight: 400; }
.bottom { padding-block: 22px; color: var(--light-muted); background: var(--dark); font-size: var(--small); }
.foot-layout > span:first-child { color: var(--paper); font-weight: 750; }

@media (max-width: 890px) {
  .brand-en { display: none; }
  .route-layout { grid-template-columns: minmax(190px, .6fr) minmax(0, 1.4fr); }
  .token-row { grid-template-columns: 86px 1fr; }
}
@media (max-width: 700px) {
  :root { --nav-height: 61px; --display: clamp(2.5rem, 11vw, 4.8rem); }
  .hero { padding-top: 27px; }
  .hero-layout, .route-layout, .section-intro, .lab-layout, .diagram-layout, .resource-layout, .term-list { grid-template-columns: minmax(0, 1fr); }
  .hero-layout { gap: 31px; }
  .hero-intro { margin-bottom: 19px; }
  .hero-image { aspect-ratio: 1.55; }
  .route-sticky { position: static; }
  .route-nav ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-nav a { min-height: 40px; }
  .route-nav { margin-top: 12px; }
  .stage-list { padding-left: 8px; }
  .trace { width: 3px; }
  .foot-layout { flex-wrap: wrap; gap: 4px 18px; }
  .foot-layout > span:nth-child(2) { order: 3; flex-basis: 100%; }
}
@media (max-width: 420px) {
  .nav nav { gap: 10px; }
}
@media (max-width: 370px) {
  .nav nav { gap: 10px; }
  .brand { gap: 6px; }
  .brand img { width: 24px; height: 24px; }
  .nav { gap: 8px; }
}
@media (max-width: 355px) {
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .trace span { transform: scaleY(1); }
}
