/* Hello, AI · 站点样式 —— 一本书的排版，加一间实验室的克制 */
:root {
  --paper: #f4f1ea; --paper-2: #ebe6da; --paper-3: #e2dccd; --white: #fffdf9;
  --ink: #1c1b18; --ink-soft: #46433c; --muted: #7b766b; --muted-2: #a29d92;
  --line: #d8d2c3; --line-soft: #e6e1d4;
  --accent: #a8402a; --accent-ink: #8c3220; --accent-soft: rgba(168, 64, 42, .09);
  --lab: #1d6b6b; --lab-soft: rgba(29, 107, 107, .1);
  --p-map: #8a6d1f; --p-learn: #1d6b6b; --p-language: #a8402a; --p-world: #4a5a8f; --p-topics: #6b5b95;
  --font-display: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-ui: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --header-h: 58px; --measure: 42rem; --wide: 1180px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 24, .05), 0 2px 8px rgba(28, 27, 24, .04);
  --shadow-md: 0 6px 24px rgba(28, 27, 24, .08);
  --radius: 10px;
  --header-bg: rgba(244, 241, 234, .86);
  --code-bg: #1e1d1a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 15.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
body[data-page] { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1 0 auto; padding-top: var(--header-h); }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: rgba(168, 64, 42, .2); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }
.wrap { width: min(var(--wide), 100% - 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; }
.narrow { width: min(var(--measure), 100% - 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; }
.kicker { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.kicker.accent { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.eyebrow { font-size: 12.5px; color: var(--muted); }

/* ---------- header ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; height: var(--header-h); display: flex; align-items: center; gap: 16px; padding: 0 clamp(16px, 3vw, 32px); background: var(--header-bg); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border-bottom: 1px solid var(--line-soft); z-index: 40; }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.brand-mark { align-self: center; fill: var(--ink); }
.brand-mark rect:nth-child(2) { fill: var(--accent); }
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.brand-comma { color: var(--accent); }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.site-nav > a { padding: 7px 12px; border-radius: 999px; font-size: 14px; color: var(--ink-soft); transition: background .15s, color .15s; }
.site-nav > a:hover { background: var(--paper-2); color: var(--ink); }
.site-nav > a.active { color: var(--ink); font-weight: 600; position: relative; }
.site-nav > a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; background: var(--accent); border-radius: 2px; }
.site-nav > a.nav-pdf, .nav-pdf { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 13px; font-size: 13.5px; background: var(--accent); color: #fff; transition: filter .15s, transform .15s; }
.nav-pdf b { font-family: var(--font-mono); font-weight: 500; }
.site-nav > a.nav-pdf:hover { filter: brightness(1.1); transform: translateY(-1px); background: var(--accent); color: #fff; }
body.lab-shell .site-nav > a.nav-pdf { background: var(--accent); color: #fff; }
.nav-tutor { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; cursor: pointer; color: var(--ink); transition: border-color .15s, background .15s; }
.nav-tutor:hover, .nav-tutor[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.nav-toggle { display: none; margin-left: auto; width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.nav-toggle span { display: block; width: 20px; height: 1.5px; background: var(--ink); transition: transform .2s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
@media (max-width: 860px) {
  .brand-sub { display: none; }
  .nav-toggle { display: flex; }
  .site-nav { position: fixed; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1px solid var(--line); padding: 10px 14px 16px; gap: 4px; display: none; }
  .site-nav.open { display: flex; }
  .site-nav > a { padding: 10px 12px; font-size: 15px; }
  .site-nav > a.active::after { display: none; }
  .nav-tutor, .nav-pdf { margin: 8px 0 0; justify-content: center; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); margin-top: 80px; padding: 36px 0 44px; font-size: 13px; color: var(--muted); }
.footer-inner { width: min(var(--wide), 100% - 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 32px; }
.footer-brand { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.footer-col p { margin: 2px 0; }
.footer-fine { max-width: 60ch; color: var(--muted-2); font-size: 12px; margin-top: 8px !important; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-content: start; }
.footer-links a:hover { color: var(--accent); }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }

/* ---------- home: hero band ---------- */
.hero-band { position: relative; height: clamp(480px, 72vh, 760px); overflow: hidden; background: var(--paper-2); }
.hero-band-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 78%; display: block; animation: heroIn 1.4s ease-out both; }
@keyframes heroIn { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
.hero-band-veil { position: absolute; inset: 0; background: radial-gradient(ellipse 58% 70% at 16% 30%, rgba(244, 241, 234, .9) 0%, rgba(244, 241, 234, .7) 45%, rgba(244, 241, 234, 0) 100%); }
.hero-band-copy { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; padding-top: clamp(28px, 6vh, 64px); max-width: none; }
.hero-band-copy > * { max-width: 540px; }
.hero-band-copy h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 6.6vw, 84px); line-height: 1.04; letter-spacing: -.005em; margin: 14px 0 20px; animation: slideUp .8s cubic-bezier(.2,.7,.2,1) both; }
.hero-band-copy h1 .comma { color: var(--accent); }
.hero-band-copy h1 small { display: block; font-size: .4em; font-weight: 500; color: var(--ink-soft); letter-spacing: .06em; margin-top: 10px; }
.hero-band-copy .hero-lead { animation: slideUp .8s .1s cubic-bezier(.2,.7,.2,1) both; margin-bottom: 22px; }
.hero-band-copy .hero-cta { animation: slideUp .8s .2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .hero-band { height: auto; }
  .hero-band-img { position: relative; height: 46vw; min-height: 220px; object-position: 50% 50%; }
  .hero-band-veil { display: none; }
  .hero-band-copy { padding: 22px 0 8px; }
  .hero-band-copy > * { max-width: none; }
}
.hero-under { padding: 44px 0 10px; }
.hero-intro h2 { font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 30px); line-height: 1.3; margin: 8px 0 14px; }
.hero-intro p { font-family: var(--font-body); font-size: 16.5px; line-height: 1.85; color: var(--ink-soft); margin: 0 0 18px; max-width: 34em; }
.hero-intro .hero-meta { margin-top: 0; }

/* gallery */
.gallery-section { padding-bottom: 10px; }
.gallery { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding: 4px 0 18px; scrollbar-width: thin; }
.gallery-track { display: flex; gap: 14px; padding: 0 clamp(16px, calc(50vw - var(--wide) / 2), 200px); width: max-content; }
.gallery-card { flex: none; width: 280px; scroll-snap-align: start; background: var(--white); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.gallery-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.gallery-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.gallery-cap { padding: 12px 14px 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline; }
.gallery-cap .n { font-family: var(--font-mono); color: var(--pc); font-size: 13px; }
.gallery-cap .t { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.gallery-cap .s { grid-column: 2; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.gallery-card.done .n::after { content: " ✓"; }
@media (max-width: 700px) { .gallery-card { width: 230px; } }

/* ---------- home ---------- */
.hero { padding: clamp(40px, 8vh, 96px) 0 24px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: clamp(24px, 5vw, 72px); align-items: center; }
.hero h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 6.4vw, 78px); line-height: 1.08; letter-spacing: -.005em; margin: 14px 0 22px; }
.hero h1 .comma { color: var(--accent); }
.hero h1 small { display: block; font-size: .42em; font-weight: 500; color: var(--ink-soft); letter-spacing: .06em; margin-top: 10px; }
.hero-lead { font-family: var(--font-body); font-size: clamp(17px, 1.6vw, 19.5px); line-height: 1.8; color: var(--ink-soft); max-width: 34em; margin: 0 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-size: 14.5px; font-weight: 600; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--white); }
.btn.lab { background: var(--lab); border-color: var(--lab); color: #fff; }
.btn.lab:hover { background: #155656; }
.btn small { font-weight: 400; opacity: .7; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 26px; font-size: 13px; color: var(--muted); }
.hero-meta b { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.pdf-link { color: var(--accent); border-bottom: 1px dotted currentColor; }

/* next-char widget */
.ntk { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 16px; box-shadow: var(--shadow-sm); }
.ntk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ntk-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.ntk-title b { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--ink); }
.ntk-title .ntk-sub { flex-basis: 100%; font-size: 12px; color: var(--muted); padding-left: 16px; }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(168, 64, 42, .5); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(168, 64, 42, .45); } 100% { box-shadow: 0 0 0 9px rgba(168, 64, 42, 0); } }
.ntk-order { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--paper); }
.ntk-order button { border: 0; background: transparent; padding: 4px 11px; border-radius: 999px; font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.ntk-order button.active { background: var(--ink); color: var(--paper); }
.ntk-order button.loading { opacity: .5; }
.ntk-text mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 2px 0 var(--accent); }
.ntk-text { font-family: var(--font-body); font-size: 20px; line-height: 1.7; min-height: 4.6em; color: var(--ink); letter-spacing: .02em; word-break: break-all; }
.ntk-text .cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--accent); vertical-align: -.15em; margin-left: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ntk-cands { margin-top: 14px; display: grid; gap: 5px; }
.ntk-cand { display: grid; grid-template-columns: 1.8em 1fr 3.2em; align-items: center; gap: 10px; font-size: 13px; }
.ntk-cand .ntk-ch { font-family: var(--font-body); font-size: 16px; text-align: center; }
.ntk-cand .bar { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.ntk-cand .bar i { display: block; height: 100%; background: var(--line); border-radius: 4px; transition: width .35s cubic-bezier(.2,.7,.2,1), background .2s; }
.ntk-cand.pick .bar i { background: var(--accent); }
.ntk-cand .p { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); text-align: right; }
.ntk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.ntk-foot label { display: inline-flex; align-items: center; gap: 8px; }
.ntk-foot input[type=range] { width: 90px; accent-color: var(--accent); }
.ntk-foot button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; color: var(--ink-soft); }
.ntk-foot button:hover { border-color: var(--ink); }
.ntk-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; }
.ntk-note a { color: var(--accent); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.section { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); font-weight: 700; margin: 6px 0 0; line-height: 1.25; }
.section-head p { margin: 8px 0 0; color: var(--ink-soft); max-width: 60ch; font-size: 15px; }
.section-head .more { font-size: 14px; color: var(--accent); white-space: nowrap; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mode { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 20px; position: relative; transition: transform .15s, box-shadow .15s, border-color .15s; }
.mode:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.mode .kicker { margin-bottom: 8px; }
.mode h3 { font-family: var(--font-display); font-size: 21px; margin: 0 0 8px; font-weight: 700; }
.mode p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.mode .mode-time { margin-top: 16px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; }
.mode .mode-time b { color: var(--ink); font-weight: 500; }
.mode.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.mode.primary p, .mode.primary .mode-time { color: rgba(244, 241, 234, .75); }
.mode.primary .mode-time b { color: var(--paper); }
.mode.primary .kicker { color: rgba(244, 241, 234, .6); }
.mode.primary:hover { filter: brightness(1.12); }
@media (max-width: 860px) { .modes { grid-template-columns: 1fr; } }

/* 目录 */
.toc-parts { display: grid; gap: 34px; }
.toc-part { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.toc-part-head { position: sticky; top: calc(var(--header-h) + 16px); }
.toc-part-head .num { font-family: var(--font-display); font-size: 13px; color: var(--pc); letter-spacing: .2em; }
.toc-part-head h3 { font-family: var(--font-display); font-size: 30px; margin: 4px 0 6px; font-weight: 700; }
.toc-part-head .sub { color: var(--ink-soft); font-size: 14px; }
.toc-part-head .blurb { color: var(--muted); font-size: 13px; line-height: 1.65; margin-top: 10px; }
.toc-list { display: grid; gap: 8px; }
.toc-ch { display: grid; grid-template-columns: 52px 1fr auto; gap: 16px; align-items: start; background: var(--white); border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px 18px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.toc-ch:hover { border-color: var(--pc); transform: translateX(2px); box-shadow: var(--shadow-sm); }
.toc-ch .n { font-family: var(--font-mono); font-size: 22px; color: var(--pc); font-weight: 500; line-height: 1.1; }
.toc-ch .n small { display: block; font-size: 10px; letter-spacing: .12em; color: var(--muted-2); margin-top: 3px; }
.toc-ch h4 { font-family: var(--font-display); font-size: 18px; margin: 0 0 4px; font-weight: 700; line-height: 1.35; }
.toc-ch .sub { color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.toc-ch .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.toc-ch .meta .labs { color: var(--lab); }
.toc-ch .state { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; margin-top: 2px; }
.toc-ch.done .state { background: var(--pc); border-color: var(--pc); color: #fff; }
.toc-ch.done .state::after { content: "✓"; font-size: 12px; }
@media (max-width: 860px) { .toc-part { grid-template-columns: 1fr; } .toc-part-head { position: static; } .toc-ch { grid-template-columns: 40px 1fr auto; padding: 14px; } .toc-ch .n { font-size: 18px; } }

/* 专题卡 */
.topics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.topic-card { display: block; background: var(--white); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.topic-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.topic-cap { padding: 12px 14px 14px; }
.topic-cap h4 { font-family: var(--font-display); font-size: 16px; margin: 6px 0 4px; line-height: 1.35; }
.topic-cap p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.topic-card.done .kicker::after { content: " ✓"; color: var(--p-topics); }
@media (max-width: 1000px) { .topics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .topics-grid { grid-template-columns: 1fr; } }

/* 实验条 */
.labs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lab-tile { display: flex; flex-direction: column; gap: 6px; background: var(--white); border: 1px solid var(--line-soft); border-top: 3px solid var(--accent, var(--lab)); border-radius: 10px; padding: 14px 15px; transition: transform .15s, box-shadow .15s; min-height: 132px; }
.lab-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.lab-tile .num { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.lab-tile h4 { font-size: 15px; margin: 0; font-weight: 600; line-height: 1.4; }
.lab-tile p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; flex: 1; }
.lab-tile .t { font-family: var(--font-mono); font-size: 11px; color: var(--lab); }
@media (max-width: 1000px) { .labs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .labs-grid { grid-template-columns: 1fr; } }

.credits { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.credits h2 { font-family: var(--font-display); font-size: 26px; margin: 6px 0 12px; }
.credits p { color: var(--ink-soft); line-height: 1.8; font-size: 15px; margin: 0 0 12px; font-family: var(--font-body); }
.credits .kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14px; }
.credits .kv dt { color: var(--muted); }
.credits .kv dd { margin: 0; }
@media (max-width: 800px) { .credits { grid-template-columns: 1fr; } }

/* ---------- chapter ---------- */
.ch { display: grid; grid-template-columns: 232px minmax(0, 1fr) 232px; gap: 32px; width: min(1240px, 100% - 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; }
.ch-rail { position: sticky; top: calc(var(--header-h) + 22px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; font-size: 13px; padding-bottom: 20px; }
.ch-rail::-webkit-scrollbar { width: 0; }
.rail-part { color: var(--pc); font-family: var(--font-display); font-size: 12px; letter-spacing: .18em; margin-bottom: 6px; }
.rail-chs { display: grid; gap: 2px; margin-bottom: 20px; }
.rail-chs a { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 5px 6px; border-radius: 6px; color: var(--muted); line-height: 1.4; }
.rail-chs a:hover { background: var(--paper-2); color: var(--ink); }
.rail-chs a.cur { color: var(--ink); font-weight: 600; background: var(--white); }
.rail-chs a .n { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted-2); padding-top: 2px; }
.rail-chs a.done .n { color: var(--pc); }
.rail-toc { border-left: 1px solid var(--line); margin-left: 6px; }
.rail-toc a { display: block; padding: 4px 10px; color: var(--muted); line-height: 1.45; border-left: 2px solid transparent; margin-left: -1px; }
.rail-toc a:hover { color: var(--ink); }
.rail-toc a.active { color: var(--ink); border-left-color: var(--pc); font-weight: 600; }
.rail-toc a.t-deep { font-size: 12px; color: var(--muted-2); padding-left: 22px; position: relative; }
.rail-toc a.t-deep::before { content: "深"; position: absolute; left: 9px; top: 6px; font-size: 9px; color: var(--pc); border: 1px solid currentColor; border-radius: 3px; padding: 0 2px; line-height: 1.2; }
body.mode-core .rail-toc a.t-deep { display: none; }
.rail-title { font-size: 11px; letter-spacing: .12em; color: var(--muted-2); text-transform: uppercase; font-family: var(--font-mono); margin: 0 0 8px; }

.ch-side { position: sticky; top: calc(var(--header-h) + 22px); align-self: start; display: grid; gap: 14px; font-size: 13px; }
.side-card { background: var(--white); border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px 16px; }
.side-card h5 { margin: 0 0 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); font-weight: 500; }
.side-card .q { font-family: var(--font-body); font-size: 14.5px; line-height: 1.65; color: var(--ink); }
.side-labs a { display: block; padding: 8px 0; border-top: 1px solid var(--line-soft); color: var(--ink-soft); line-height: 1.45; }
.side-labs a:first-of-type { border-top: 0; padding-top: 0; }
.side-labs a:hover { color: var(--lab); }
.side-labs a .t { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--lab); }
.side-terms { display: flex; flex-wrap: wrap; gap: 5px; }
.side-terms a { border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; color: var(--ink-soft); }
.side-terms a:hover { border-color: var(--ink); color: var(--ink); }
.side-progress { display: flex; align-items: center; gap: 10px; }
.side-progress .bar { flex: 1; height: 5px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.side-progress .bar i { display: block; height: 100%; width: 0; background: var(--pc); transition: width .2s; }
.side-progress b { font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; color: var(--muted); width: 3ch; text-align: right; }

.ch-body { min-width: 0; }
.ch-head { margin: 22px 0 28px; }
.ch-head .part-line { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.ch-head .part-line .pn { color: var(--pc); font-family: var(--font-display); letter-spacing: .15em; }
.ch-head .part-line .n { font-family: var(--font-mono); }
.ch-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.2; margin: 12px 0 10px; letter-spacing: -.005em; }
.ch-head .sub { font-family: var(--font-body); font-size: clamp(16px, 1.6vw, 19px); color: var(--ink-soft); line-height: 1.65; margin: 0; }
.ch-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.ch-tools .time { font-family: var(--font-mono); font-size: 12px; }
.ch-tools .time b { color: var(--ink); font-weight: 500; }
.mode-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--white); margin-left: auto; }
.mode-switch button { border: 0; background: transparent; padding: 5px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.mode-switch button.active { background: var(--ink); color: var(--paper); }
.ch-tools .toc-btn { display: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: var(--white); cursor: pointer; font-size: 12.5px; }

.ch-hero { margin: 0 0 34px; max-width: var(--measure); }
.ch-hero img { width: 100%; max-height: 520px; object-fit: cover; display: block; border-radius: 12px; border: 1px solid var(--line-soft); }
.ch-hero figcaption { font-family: var(--font-ui); font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.prose { font-family: var(--font-body); font-size: 17.5px; line-height: 1.95; color: var(--ink); letter-spacing: .012em; max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.25em; }
.prose h2 { font-family: var(--font-display); font-weight: 700; font-size: 25px; line-height: 1.35; margin: 2.4em 0 .9em; letter-spacing: -.005em; scroll-margin-top: calc(var(--header-h) + 20px); position: relative; }
.prose h2::before { content: ""; display: block; width: 28px; height: 3px; background: var(--pc); margin-bottom: 14px; border-radius: 2px; }
.prose h3 { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin: 2em 0 .7em; line-height: 1.4; }
.prose h4 { font-family: var(--font-ui); font-weight: 600; font-size: 15.5px; margin: 1.6em 0 .6em; color: var(--ink-soft); }
.prose strong { font-weight: 700; color: var(--ink); }
.prose em { font-style: normal; background: linear-gradient(transparent 62%, rgba(168, 64, 42, .18) 62%); padding: 0 1px; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(168, 64, 42, .4); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1.25em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); font-family: var(--font-mono); font-size: .9em; }
.prose blockquote { margin: 1.5em 0; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--pc); color: var(--ink-soft); font-size: 16.5px; }
.prose blockquote p { margin-bottom: .6em; }
.prose blockquote cite { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 6px; font-family: var(--font-ui); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.5em auto; width: 40%; }
.prose code { font-family: var(--font-mono); font-size: .82em; background: var(--paper-2); padding: .12em .4em; border-radius: 4px; color: var(--ink); }
.prose pre { background: var(--code-bg); color: #ebe6da; padding: 16px 18px; border-radius: 10px; overflow: auto; font-size: 13px; line-height: 1.65; margin: 1.4em 0; font-family: var(--font-mono); }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-family: var(--font-ui); font-size: 14px; line-height: 1.55; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.prose th { font-weight: 600; color: var(--muted); font-size: 12.5px; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.prose tr:last-child td { border-bottom: 0; }
.prose img { display: block; margin: 1.5em auto; border-radius: 8px; }
.prose .fig { margin: 1.8em 0; }
.prose .fig pre { background: var(--white); color: var(--ink); border: 1px solid var(--line); font-size: 12.5px; text-align: left; }
.prose .fig figcaption { font-family: var(--font-ui); font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; line-height: 1.6; }
.prose .fig figcaption .fig-note { display: block; font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.prose .fig-svg svg { width: 100%; height: auto; display: block; font-family: var(--font-ui); }
.prose .fig-svg svg text { fill: var(--ink); }
.prose .fig-svg svg .muted { fill: var(--muted); }
.prose .fig-svg svg .mono { font-family: var(--font-mono); }
.prose .fig-svg svg .line { stroke: var(--line); }
.prose .fig-svg svg .ink { stroke: var(--ink); }
.prose .fig-svg svg .box { fill: var(--white); stroke: var(--line); }
.prose .fig-svg svg .box-soft { fill: var(--paper-2); stroke: none; }
.prose .fig-svg svg .accent { fill: var(--accent); }
.prose .fig-svg svg .accent-stroke { stroke: var(--accent); }
.prose .fig-svg svg .pc { fill: var(--pc); }
.prose .fig-svg svg .pc-stroke { stroke: var(--pc); }
.prose .fig-svg svg .pc-soft { fill: color-mix(in srgb, var(--pc) 14%, transparent); }
.prose .fig-svg svg .lab { fill: var(--lab); }
.prose .fig-svg svg .paper { fill: var(--paper); }
.prose .fig-img img { width: 100%; border-radius: 10px; border: 1px solid var(--line-soft); }
.prose .fig.wide { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); max-width: none; }
.prose .footnote { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line-soft); margin-top: 3em; padding-top: 1em; font-family: var(--font-ui); }
.prose .footnote hr { display: none; }
.prose sup { font-family: var(--font-ui); font-size: .7em; }
.prose .katex-display { margin: 1.2em 0; overflow-x: auto; overflow-y: hidden; }

/* callouts */
.callout { font-family: var(--font-ui); font-size: 14.5px; line-height: 1.75; border-radius: 10px; padding: 16px 18px; margin: 1.6em 0; background: var(--white); border: 1px solid var(--line-soft); }
.callout .callout-title { font-weight: 600; font-size: 13px; letter-spacing: .02em; margin-bottom: 6px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.callout .callout-body > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 .8em; }
.callout-note { background: var(--paper-2); border-color: transparent; }
.callout-aside { background: transparent; border: 0; border-left: 2px solid var(--line); border-radius: 0; padding: 2px 0 2px 16px; color: var(--ink-soft); font-size: 14px; }
.callout-warn { border-color: rgba(168, 64, 42, .3); background: rgba(168, 64, 42, .05); }
.callout-warn .callout-title { color: var(--accent-ink); }
.callout-snapshot { border: 1px dashed var(--line); background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(28, 27, 24, .018) 8px 9px), var(--white); }
.callout-snapshot .callout-title { color: var(--muted); font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.snap-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* deep */
.deep { margin: 1.8em 0; border: 1px solid var(--line); border-left: 3px solid var(--pc); border-radius: 10px; background: var(--white); overflow: hidden; }
.deep-toggle { width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 13px 16px 13px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; font-family: var(--font-ui); }
.deep-toggle:hover { background: var(--paper); }
.deep-kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--pc); border: 1px solid currentColor; border-radius: 4px; padding: 2px 6px; }
.deep-title { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--ink); line-height: 1.4; }
.deep-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.deep-chev { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; margin-right: 2px; }
.deep[open] .deep-chev, .deep-toggle[aria-expanded="true"] .deep-chev { transform: rotate(45deg); }
.deep-body { display: none; padding: 4px 22px 22px 18px; font-size: 16.5px; line-height: 1.9; }
.deep-body > :first-child { margin-top: 0; }
.deep-body h3 { font-size: 17px; margin-top: 1.6em; }
.deep-body h3:first-child { margin-top: .4em; }
.deep.open .deep-body { display: block; }
.deep.open .deep-chev { transform: rotate(45deg); }
.deep-body .deep { border-left-width: 2px; }
body.mode-full .deep:not(.closed) .deep-body { display: block; }
body.mode-full .deep:not(.closed) .deep-chev { transform: rotate(45deg); }

/* check */
.check { margin: 2.4em 0 1em; border-top: 2px solid var(--ink); padding-top: 14px; font-family: var(--font-ui); }
.check-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.check-kicker { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.check-hint { font-size: 12.5px; color: var(--muted); }
.check-list { padding-left: 1.4em; margin: 0; }
.check-item { margin: 10px 0; }
.check-q { font-size: 15.5px; line-height: 1.7; }
.check-q p { margin: 0; }
.check-a { margin-top: 6px; }
.check-a summary { cursor: pointer; font-size: 13px; color: var(--accent); list-style: none; display: inline-block; border-bottom: 1px dashed currentColor; }
.check-a summary::-webkit-details-marker { display: none; }
.check-a-body { margin-top: 8px; padding: 10px 14px; background: var(--white); border: 1px solid var(--line-soft); border-radius: 8px; font-size: 14.5px; line-height: 1.75; color: var(--ink-soft); }
.check-a-body p { margin: 0 0 .6em; }
.check-a-body > :last-child { margin-bottom: 0; }

/* lab card */
.labcard { margin: 1.8em 0; font-family: var(--font-ui); }
.labcard-link { display: grid; gap: 4px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--lab)); border-radius: 10px; padding: 16px 18px; transition: transform .15s, box-shadow .15s; }
.labcard-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.labcard-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--accent, var(--lab)); }
.labcard-title { font-weight: 700; font-size: 16.5px; color: var(--ink); }
.labcard-blurb { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }
.labcard-cta { font-size: 13px; color: var(--accent, var(--lab)); font-weight: 600; margin-top: 4px; }
.labcard-note { font-size: 13.5px; color: var(--muted); padding: 8px 4px 0; line-height: 1.6; }
.labcard-note p { margin: 0; }

/* end-of-chapter */
.ch-end { margin-top: 48px; font-family: var(--font-ui); }
.ch-terms { margin: 26px 0; }
.ch-terms h4 { font-family: var(--font-display); font-size: 17px; margin: 0 0 10px; }
.term-list { display: grid; gap: 8px; }
.term-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; font-size: 14px; line-height: 1.6; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.term-row b { font-weight: 600; }
.term-row b small { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.term-row p { margin: 0; color: var(--ink-soft); }
@media (max-width: 560px) { .term-row { grid-template-columns: 1fr; gap: 4px; } }
.ch-done { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 20px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; margin: 26px 0; }
.ch-done .txt { flex: 1; font-size: 14px; color: var(--ink-soft); }
.ch-done .txt b { color: var(--ink); }
.ch-done button { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 16px; font-size: 13.5px; cursor: pointer; }
.ch-done.is-done button { background: transparent; color: var(--ink); }
.ch-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.ch-nav a { display: block; padding: 16px 18px; background: var(--white); border: 1px solid var(--line-soft); border-radius: 12px; transition: border-color .15s; }
.ch-nav a:hover { border-color: var(--pc); }
.ch-nav a.next { text-align: right; }
.ch-nav .lbl { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); letter-spacing: .1em; }
.ch-nav .ttl { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 4px; line-height: 1.4; }
.ch-nav .ttl small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); font-family: var(--font-ui); }
@media (max-width: 1140px) { .ch { grid-template-columns: 210px minmax(0, 1fr); } .ch-side { display: none; } }
@media (max-width: 880px) {
  .ch { grid-template-columns: 1fr; gap: 0; }
  .ch-rail { display: none; position: fixed; inset: var(--header-h) 0 0 0; background: var(--paper); z-index: 30; padding: 20px clamp(16px, 4vw, 40px); max-height: none; }
  .ch-rail.open { display: block; }
  .ch-tools .toc-btn { display: inline-block; }
  .prose { font-size: 16.5px; }
  .ch-nav { grid-template-columns: 1fr; }
}
.reading-bar { position: fixed; left: 0; top: 0; height: 2px; background: var(--pc, var(--accent)); width: 0; z-index: 41; transition: width .1s linear; }

/* ---------- toc page / lectures / glossary / now / about ---------- */
.page-head { padding: 44px 0 26px; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(32px, 4.5vw, 48px); font-weight: 700; margin: 10px 0 12px; line-height: 1.15; }
.page-head .lead { font-family: var(--font-body); font-size: 17px; color: var(--ink-soft); line-height: 1.8; max-width: 44em; margin: 0; }
.page-head .lead + .lead { margin-top: .6em; }
.mode-explain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0 40px; }
.mode-explain div { background: var(--white); border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px 18px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.mode-explain b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; }
.mode-explain .t { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
@media (max-width: 800px) { .mode-explain { grid-template-columns: 1fr; } }

.lec-list { display: grid; gap: 12px; }
.lec { display: grid; grid-template-columns: 180px 1fr; gap: 20px; background: var(--white); border: 1px solid var(--line-soft); border-radius: 14px; padding: 18px 20px; align-items: start; }
.lec-cover { aspect-ratio: 16 / 9; background: var(--paper-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line-soft); display: grid; place-items: center; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.lec-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lec h3 { font-family: var(--font-display); font-size: 21px; margin: 0 0 4px; font-weight: 700; }
.lec .sub { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 10px; }
.lec .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.lec .acts a { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px; color: var(--ink-soft); background: var(--white); }
.lec .acts a:hover { border-color: var(--ink); color: var(--ink); }
.lec .acts a.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lec .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 10px; }
@media (max-width: 700px) { .lec { grid-template-columns: 1fr; } }

.lecture-page { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; width: min(1100px, 100% - 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; }
.lecture-page .ch-rail { font-size: 12.5px; }
.lecture-page .rail-toc a { padding: 3px 10px; }
.lec-sec { margin: 0 0 40px; }
.lec-sec h2.sec-title { font-family: var(--font-display); font-size: 24px; margin: 0 0 16px; padding-top: 12px; scroll-margin-top: calc(var(--header-h) + 16px); }
.lec-sec h2.sec-title::before { content: none; }
.lec-sec h2.sec-title small { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-weight: 400; margin-bottom: 6px; letter-spacing: .1em; }
.takeaways { background: var(--paper-2); border-radius: 10px; padding: 14px 18px; font-family: var(--font-ui); font-size: 14.5px; margin: 1.5em 0 0; }
.takeaways::before { content: "本节要点"; display: block; font-size: 11.5px; letter-spacing: .12em; color: var(--muted); font-family: var(--font-mono); margin-bottom: 6px; }
.takeaways > :last-child { margin-bottom: 0; }
.lecture-prose { font-size: 16.5px; }
.lecture-prose h2 { font-size: 21px; }
.lecture-prose h2::before { content: none; }
.lecture-prose h3 { font-size: 18px; }
.lecture-prose h4 { font-size: 15px; }
@media (max-width: 880px) { .lecture-page { grid-template-columns: 1fr; } }

.gl-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 30px; }
.gl-nav a { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink-soft); background: var(--white); }
.gl-nav a:hover { border-color: var(--ink); color: var(--ink); }
.gl-group { margin-bottom: 40px; scroll-margin-top: calc(var(--header-h) + 16px); }
.gl-group h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 4px; }
.gl-group h2 a { color: var(--ink); }
.gl-group h2 a:hover { color: var(--accent); }
.gl-group .gsub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.gl-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.gl-item { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: calc(var(--header-h) + 16px); }
.gl-item:target { background: var(--accent-soft); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.gl-item .term { font-weight: 700; font-size: 16px; font-family: var(--font-display); }
.gl-item .term small { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.gl-item .def { font-size: 14.5px; line-height: 1.75; color: var(--ink-soft); }
.gl-item .def p { margin: 0 0 .5em; }
.gl-item .def > :last-child { margin-bottom: 0; }
.gl-item .rel { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.gl-item .rel a { color: var(--accent); }
@media (max-width: 640px) { .gl-item { grid-template-columns: 1fr; gap: 6px; } }

.now-head { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; }
.now-date { text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--muted); line-height: 1.7; }
.now-date b { display: block; font-size: 30px; color: var(--ink); font-weight: 500; }
.now-warn { margin-top: 26px; }
@media (max-width: 700px) { .now-head { grid-template-columns: 1fr; } .now-date { text-align: left; } }

/* ---------- tutor ---------- */
.tutor { position: fixed; right: 18px; bottom: 18px; width: min(420px, calc(100vw - 36px)); height: min(620px, calc(100vh - var(--header-h) - 36px)); background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 60px rgba(28, 27, 24, .18); z-index: 50; display: flex; flex-direction: column; overflow: hidden; font-family: var(--font-ui); }
.tutor[hidden] { display: none; }
.tutor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line-soft); background: var(--paper); }
.tutor-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.tutor-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tutor-actions { display: flex; gap: 4px; }
.tutor-icon { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.tutor-icon:hover { background: var(--paper-2); color: var(--ink); }
.tutor-msgs { flex: 1; overflow: auto; padding: 14px 16px; display: grid; gap: 12px; align-content: start; font-size: 14px; line-height: 1.7; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 12px; }
.msg.user { justify-self: end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.ai { justify-self: start; background: var(--paper); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; color: var(--ink); }
.msg.ai p { margin: 0 0 .6em; }
.msg.ai p:last-child { margin-bottom: 0; }
.msg.ai ul, .msg.ai ol { margin: .3em 0 .6em; padding-left: 1.3em; }
.msg.ai code { font-family: var(--font-mono); font-size: .85em; background: var(--paper-2); padding: .1em .35em; border-radius: 4px; }
.msg.ai pre { background: var(--code-bg); color: #ebe6da; padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12.5px; }
.msg.ai pre code { background: none; color: inherit; padding: 0; }
.msg.ai.err { color: var(--accent-ink); border-color: rgba(168, 64, 42, .3); }
.msg .dots i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: blink 1s infinite; }
.msg .dots i:nth-child(2) { animation-delay: .2s; } .msg .dots i:nth-child(3) { animation-delay: .4s; }
.tutor-sugg { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 8px; }
.tutor-sugg button { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--ink-soft); }
.tutor-sugg button:hover { border-color: var(--accent); color: var(--accent-ink); }
.tutor-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); align-items: flex-end; }
.tutor-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 14px; line-height: 1.5; background: var(--white); max-height: 120px; }
.tutor-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.tutor-form button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--ink); color: var(--paper); cursor: pointer; display: grid; place-items: center; }
.tutor-form button:disabled { opacity: .5; cursor: default; }
@media (max-width: 560px) { .tutor { right: 0; bottom: 0; width: 100vw; height: calc(100vh - var(--header-h)); border-radius: 16px 16px 0 0; } }
body.no-fab .nav-tutor { display: none; }

.footer-ver { color: var(--ink-soft); border-bottom: 1px dotted var(--line); }
.footer-ver:hover { color: var(--accent); }
.cl-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.cl-entry { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.cl-meta b { display: block; font-family: var(--font-mono); font-size: 18px; font-weight: 500; }
.cl-meta span { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cl-body h2 { font-family: var(--font-display); font-size: 19px; margin: 0 0 8px; }
.cl-body ul { margin: 0; padding-left: 1.2em; font-size: 14.5px; line-height: 1.75; color: var(--ink-soft); }
.cl-body li { margin: 4px 0; }
.cl-body li p { margin: 0; }
@media (max-width: 600px) { .cl-entry { grid-template-columns: 1fr; gap: 8px; } }

/* 404 */
.nf { padding: 100px 0; text-align: center; }
.nf h1 { font-family: var(--font-display); font-size: 60px; margin: 0 0 8px; }
.nf p { color: var(--muted); }

@media print { .site-header, .site-footer, .ch-rail, .ch-side, .tutor, .ch-tools, .ch-done { display: none !important; } .site-main { padding-top: 0; } .deep .deep-body { display: block !important; } }

/* ---------- concept map ---------- */
.kg-wrap { padding-top: 32px; }
.kg-head { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 16px; }
.kg-head h1 { font-family: var(--font-display); font-size: clamp(26px, 3.5vw, 36px); margin: 8px 0 8px; }
.kg-head .lead { margin: 0; color: var(--ink-soft); font-size: 14.5px; max-width: 60ch; line-height: 1.7; }
.kg-tools { display: grid; gap: 8px; justify-items: end; }
.kg-tools input { width: 220px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 13.5px; background: var(--white); }
.kg-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.kg-filters button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.kg-filters button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink)); }
.kg-filters button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.kg-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.kg-stage { background: var(--white); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; min-height: 520px; }
.kg-stage svg { width: 100%; height: 100%; display: block; touch-action: none; }
.kg-link { stroke: var(--line); stroke-width: 1; }
.kg-link.hi { stroke: var(--ink); stroke-width: 1.5; }
.kg-link.hidden, .kg-node.hidden { display: none; }
.kg-node { cursor: pointer; transition: opacity .15s; }
.kg-node circle { fill: var(--c); stroke: var(--white); stroke-width: 2; }
.kg-node text { font-family: var(--font-ui); font-size: 12px; fill: var(--ink); paint-order: stroke; stroke: var(--white); stroke-width: 3px; stroke-linejoin: round; }
.kg-node.dim { opacity: .18; }
.kg-node.active circle { stroke: var(--ink); stroke-width: 2.5; }
.kg-panel { background: var(--white); border: 1px solid var(--line-soft); border-radius: 14px; padding: 18px 20px; font-size: 14px; line-height: 1.7; align-self: start; position: sticky; top: calc(var(--header-h) + 16px); }
.kg-panel h2 { font-family: var(--font-display); font-size: 22px; margin: 4px 0 10px; }
.kg-panel h2 small { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.kg-panel .kg-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.kg-panel .kg-def { color: var(--ink-soft); }
.kg-panel .kg-def p { margin: 0 0 .6em; }
.kg-panel .kg-rel { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0; }
.kg-panel .kg-rel button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.kg-panel .kg-rel button:hover { border-color: var(--ink); }
.kg-panel .kg-acts { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.kg-panel .kg-acts a { color: var(--accent); }
@media (max-width: 900px) { .kg-head { grid-template-columns: 1fr; } .kg-tools { justify-items: start; } .kg-body { grid-template-columns: 1fr; } .kg-stage { min-height: 460px; } .kg-panel { position: static; } }

/* ---------- 深色模式：跟随系统，实验页（Tailwind 排版）不参与 ---------- */
@media (prefers-color-scheme: dark) {
  body:not(.lab-shell) {
    --paper: #17171a; --paper-2: #212125; --paper-3: #2a2a2f; --white: #1e1e22;
    --ink: #ebe7de; --ink-soft: #c3beb2; --muted: #8f8a7f; --muted-2: #6c6860;
    --line: #3a3a40; --line-soft: #2b2b30;
    --accent: #d9785e; --accent-ink: #e89a83; --accent-soft: rgba(217, 120, 94, .16);
    --lab: #5fb0b0; --lab-soft: rgba(95, 176, 176, .14);
    --p-map: #cfae54; --p-learn: #5fb0b0; --p-language: #d9785e; --p-world: #93a3dc; --p-topics: #a996d8;
    --header-bg: rgba(23, 23, 26, .86); --code-bg: #0f0f12;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .5);
  }
  body:not(.lab-shell) { background: var(--paper); color: var(--ink); }
  body:not(.lab-shell) ::selection { background: rgba(217, 120, 94, .35); }
  body:not(.lab-shell) .prose em { background: linear-gradient(transparent 62%, rgba(217, 120, 94, .35) 62%); }
  body:not(.lab-shell) .callout-warn { background: rgba(217, 120, 94, .08); border-color: rgba(217, 120, 94, .35); }
  body:not(.lab-shell) .callout-snapshot { background: var(--white); }
  body:not(.lab-shell) .tutor { box-shadow: 0 18px 60px rgba(0, 0, 0, .6); }
  body:not(.lab-shell) .live-dot { box-shadow: 0 0 0 0 rgba(217, 120, 94, .5); }
  body:not(.lab-shell) .lec-cover img { opacity: .9; }
  body:not(.lab-shell) .hero-band-img { opacity: .82; }
  body:not(.lab-shell) .hero-band-veil { background: radial-gradient(ellipse 62% 78% at 18% 28%, rgba(23, 23, 26, .94) 0%, rgba(23, 23, 26, .8) 45%, rgba(23, 23, 26, 0) 100%); }
}
