/* 百年课标 —— 与辞渊（sy）、风雅千载（cp）同系的宣纸朱砂主题。
   两套色系：纸色（默认随系统）与墨色；文字对比度均 ≥ 4.5:1。 */
:root,
:root[data-theme="light"] {
  --paper: #f6f1e6;
  --paper-2: #fbf8f0;
  --card: #fffdf8;
  --ink: #2c2620;
  --ink-soft: #5c5347;
  --ink-faint: #6b6253;
  --line: #e3d9c6;
  --line-2: #d8ccb4;
  --seal: #9e2b25;
  --seal-soft: #b8413a;
  --seal-ink: #ffffff;
  --seal-tint: rgba(158, 43, 37, 0.08);
  --jade: #2c7873;
  --jade-bg: #edf3ef;
  --gold: #7f5d1d;
  --heat-1: #dcaaa0;
  --heat-2: #c0574a;
  --heat-3: #9e2b25;
  --dot-off: #d8ccb4;
  --focus: #1f5f8b;
  --shadow: 0 2px 14px rgba(60, 46, 26, 0.08);
  --shadow-lg: 0 8px 32px rgba(60, 46, 26, 0.14);
  --topbar: rgba(246, 241, 230, 0.92);
  --glow: rgba(158, 43, 37, 0.05);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --radius: 12px;
}

:root[data-theme="dark"] {
  --paper: #161513;
  --paper-2: #1b1a17;
  --card: #1f1d1a;
  --ink: #ebe5d8;
  --ink-soft: #cfc7b8;
  --ink-faint: #a8a091;
  --line: #3a362f;
  --line-2: #4a453c;
  --seal: #e0694f;
  --seal-soft: #ea8570;
  --seal-ink: #1a1410;
  --seal-tint: rgba(224, 105, 79, 0.14);
  --jade: #7fc2b8;
  --jade-bg: #1c2a27;
  --gold: #d6b04f;
  --heat-1: #6b3a30;
  --heat-2: #b4523f;
  --heat-3: #f08a6f;
  --dot-off: #4a453c;
  --focus: #8ab4ff;
  --shadow: none;
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
  --topbar: rgba(22, 21, 19, 0.92);
  --glow: rgba(224, 105, 79, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, var(--glow), transparent 60%), var(--paper);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; margin: 0 0 .5em; font-weight: 700; }
p { margin: 0 0 .8em; }
small { font-size: .82rem; }
code { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--seal); color: var(--seal-ink); padding: 8px 14px; z-index: 80; border-radius: 8px; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.kicker { color: var(--ink-faint); font-size: .85rem; letter-spacing: .08em; margin-bottom: .3em; }
.lede { color: var(--ink-soft); max-width: 48em; }
.panel-note { color: var(--ink-faint); font-size: .86rem; }
.loading { text-align: center; padding: 48px 0; color: var(--ink-faint); }
.error { color: var(--seal); }
.serif { font-family: var(--serif); }
/* 长串无空格文本在窄屏断行，避免横向溢出（不在 html/body 上加 overflow-x:hidden，以免破坏 sticky 顶栏） */
.row-title, .para p, .hits p, .tw-points, .aim-card blockquote, .facts dd { overflow-wrap: anywhere; }

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--topbar); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: var(--seal); color: var(--seal-ink); font-family: var(--serif); font-weight: 700; font-size: 22px; display: grid; place-items: center; box-shadow: var(--shadow); }
.brand b { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.2; letter-spacing: 1px; }
.brand small { display: block; font-size: 12px; color: var(--ink-faint); letter-spacing: 1px; line-height: 1.4; }
.mainnav { margin-left: auto; }
.mainnav > ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; align-items: center; }
.mainnav a, .mainnav summary { display: block; color: var(--ink-soft); padding: 6px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.mainnav a:hover, .mainnav summary:hover { background: var(--seal-tint); color: var(--seal); text-decoration: none; }
.mainnav a[aria-current="page"], .mainnav summary.is-current { background: var(--seal); color: var(--seal-ink); }
.mainnav summary { list-style: none; }
.mainnav summary::-webkit-details-marker { display: none; }
.mainnav summary::after { content: " ▾"; font-size: .8em; }
.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px 16px; display: grid; grid-template-columns: repeat(5, minmax(108px, auto)); gap: 4px 18px; }
.menu-group p { margin: 0 0 4px; color: var(--ink-faint); font-size: 12px; letter-spacing: 1px; }
.menu-group ul { list-style: none; margin: 0; padding: 0; }
.menu-group a { padding: 4px 8px; font-size: 14px; }
.theme-toggle { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-soft); font-size: 16px; cursor: pointer; }
.theme-toggle:hover { color: var(--seal); border-color: var(--seal); }

/* ---------- 版式 ---------- */
main { display: block; }
.block { padding: 8px 0 18px; }
.section-title { font-family: var(--serif); font-size: 19px; margin: 26px 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 700; }
.section-title::before { content: ""; width: 4px; height: 18px; background: var(--seal); border-radius: 2px; flex: none; }
.section-title small { font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--ink-faint); }
.section-lede { color: var(--ink-soft); font-size: .92rem; margin: -4px 0 14px; max-width: 56em; }
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel { margin-bottom: 14px; }
.panel h2 { font-size: 17px; color: var(--seal); margin-bottom: 10px; }
.panel h2 small { font-family: var(--sans); color: var(--ink-faint); font-weight: 400; font-size: 13px; }
.sub { font-family: var(--serif); font-size: 15px; color: var(--ink); margin: 14px 0 8px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin-bottom: 6px; }
.source-note { margin: 16px 0; padding: 12px 18px; border-left: 3px solid var(--jade); background: var(--jade-bg); color: var(--ink); border-radius: 0 8px 8px 0; font-size: .92rem; line-height: 1.8; }
.source-note b { color: var(--ink); }
.crumbs { font-size: 13px; color: var(--ink-faint); margin: 18px 0 10px; }
.crumbs a { color: var(--ink-soft); }

/* ---------- 首页 hero ---------- */
.hero { text-align: center; padding: 34px 0 10px; }
.hero h1 { font-size: 34px; letter-spacing: 8px; margin: 0 0 6px; }
.hero .lede { margin: 0 auto 20px; font-size: 1rem; }
.searchbar { display: flex; gap: 0; max-width: 680px; margin: 0 auto; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 30px; box-shadow: var(--shadow); overflow: hidden; }
.searchbar:focus-within { border-color: var(--seal); }
.searchbar input, .searchbar select { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 13px 20px; }
.searchbar input:focus, .searchbar select:focus { outline: none; }
.searchbar select { flex: 0 0 auto; max-width: 9.5em; border-left: 1px solid var(--line); padding: 0 12px; font-size: 14px; color: var(--ink-soft); }
.searchbar button { flex: none; border: 0; background: var(--seal); color: var(--seal-ink); font: inherit; font-weight: 600; padding: 0 26px; cursor: pointer; }
.searchbar button:hover { background: var(--seal-soft); }
.searchbar.left { margin: 0; }
.stats { list-style: none; margin: 18px 0 0; padding: 0; display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; }
.stats li { text-align: center; }
.stats b { font-family: var(--serif); font-size: 26px; color: var(--seal); display: block; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--ink-faint); }

/* ---------- 全人培养要求矩阵 ---------- */
.toggle-row { display: inline-flex; border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; background: var(--card); margin-bottom: 12px; }
.toggle-row button { border: 0; background: transparent; padding: 5px 18px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink-soft); }
.toggle-row button[aria-selected="true"] { background: var(--seal); color: var(--seal-ink); }
html:not([data-js]) [data-js-only] { display: none; }
html[data-js] [data-region-hidden] { display: none; }
.region-title { font-size: 16px; margin: 4px 0 10px; }
.region-title small { display: block; font-family: var(--sans); color: var(--ink-faint); font-weight: 400; font-size: 13px; }
.matrix-scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); width: fit-content; max-width: 100%; box-shadow: var(--shadow); }
.aims-matrix { --dim: 132px; --cell: 56px; --total: 64px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; width: calc(var(--dim) + var(--n) * var(--cell) + var(--total)); }
.aims-matrix .col-dim { width: var(--dim); }
.aims-matrix .col-aim { width: var(--cell); }
.aims-matrix .col-count { width: var(--total); }
.aims-matrix th, .aims-matrix td { border-bottom: 1px solid var(--line); text-align: center; padding: 0; }
.aims-matrix .era-row th { padding: 8px 6px 5px; font-size: 12px; font-weight: 600; color: var(--ink-soft); text-align: left; border-bottom: 2px solid var(--line-2); background: var(--paper-2); }
.aims-matrix .era-row th + th { border-left: 1px solid var(--line); }
.aims-matrix thead tr:last-child th { vertical-align: top; padding: 10px 2px 8px; background: var(--card); }
.aims-matrix thead a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink); text-decoration: none; padding: 2px 4px; border-radius: 6px; }
.aims-matrix thead a:hover { background: var(--seal-tint); color: var(--seal); }
.aim-year { font-family: var(--serif); font-weight: 700; font-variant-numeric: tabular-nums; }
.aim-short { font-size: 12px; color: var(--ink-faint); writing-mode: vertical-rl; letter-spacing: .08em; height: 6.6em; overflow: hidden; line-height: 1.25; }
.aims-matrix tbody th, .aims-matrix .corner { position: sticky; left: 0; z-index: 2; background: var(--card); text-align: left; padding: 6px 12px; border-right: 1px solid var(--line); }
.aims-matrix .corner { color: var(--ink-faint); font-weight: 400; font-size: 12px; }
.aims-matrix tbody th b { font-family: var(--serif); font-size: 18px; display: inline-block; width: 1.5em; color: var(--seal); }
.aims-matrix tbody th small { color: var(--ink-faint); font-size: 12px; font-weight: 400; white-space: nowrap; }
.aims-matrix td { position: relative; height: 44px; }
.aims-matrix td.count { color: var(--ink-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.aims-matrix .dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--seal); box-shadow: 0 0 0 3px var(--seal-tint); }
.aims-matrix td.off::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--dot-off); }
.aims-matrix td.on { cursor: help; }
.aims-matrix .tip { display: none; position: absolute; z-index: 5; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 220px; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 12px; line-height: 1.5; text-align: left; pointer-events: none; }
.aims-matrix td.on:hover .tip { display: block; }
.aims-matrix tbody tr:hover th, .aims-matrix tbody tr:hover td { background: var(--paper-2); }
.aim-cards { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px 14px; align-items: start; }
.aim-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.aim-card summary { cursor: pointer; padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; font-family: var(--serif); }
.aim-card summary::marker { color: var(--ink-faint); }
.aim-card[open] { border-color: var(--line-2); box-shadow: var(--shadow); }
.aim-card-year { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--seal); flex: none; }
.aim-card-body { padding: 0 14px 14px; }
.aim-issuer { color: var(--ink-faint); font-size: 13px; }
.aim-card blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--seal); background: var(--paper-2); font-family: var(--serif); border-radius: 0 8px 8px 0; }
.aim-note { font-size: 13px; color: var(--ink-soft); }
.aim-mapped { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.aim-mapped li { background: var(--paper-2); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 1px 8px; }
.aim-mapped b { color: var(--seal); margin-right: 4px; font-family: var(--serif); }
.aim-source { font-size: 13px; color: var(--ink-faint); margin: 0; }

/* ---------- 学科入口 ---------- */
.subject-group { margin-bottom: 18px; }
.subject-group h3 { font-family: var(--sans); color: var(--ink-faint); font-size: 13px; font-weight: 500; letter-spacing: 2px; margin: 0 0 8px; }
.subject-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.subject-card { display: grid; gap: 2px; height: 100%; padding: 14px 16px 12px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--seal)); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.subject-head { display: flex; align-items: baseline; gap: 8px; }
.subject-name { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.subject-count { margin-left: auto; font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
.subject-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.subject-meta { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 28px; margin-top: 4px; }
.spark rect { fill: var(--c, var(--seal)); opacity: .85; }
.spark line { stroke: var(--line-2); stroke-width: 1; }
.feature-card { display: grid; gap: 6px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 5px solid var(--seal); background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.feature-title { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--seal); }
.feature-facts { color: var(--ink-soft); font-size: 14px; }
.feature-card .kicker { color: var(--jade); font-weight: 600; letter-spacing: 2px; }

/* ---------- 学科页 ---------- */
.page-head { border-bottom: 2px solid var(--line-2); padding-bottom: 14px; margin-bottom: 16px; }
.page-head h1 { font-size: 30px; margin: 4px 0 6px; letter-spacing: 1px; }
.page-head .lede { margin-bottom: 12px; }
.cov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 12px 0 14px; max-width: 640px; }
.cov-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; text-align: center; }
.cov-card b { font-family: var(--serif); font-size: 22px; color: var(--seal); display: block; line-height: 1.3; font-variant-numeric: tabular-nums; }
.cov-card span { font-size: 12px; color: var(--ink-faint); }
.subject-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.subject-side { position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow-y: auto; padding-bottom: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: flex-start; margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.filter-row { display: grid; gap: 6px; }
.filter-row > span, .filter-row > label { font-size: 12px; color: var(--ink-faint); letter-spacing: 1px; }
.filter-row .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-search { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; }
.filter-search input { flex: 1; min-width: 0; height: 36px; padding: 0 14px; font: inherit; font-size: 14px; color: var(--ink); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 18px; }
.filter-search input:focus { outline: none; border-color: var(--seal); }
.filter-search output { color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip, .pill { font: inherit; font-size: 13px; padding: 4px 14px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-soft); cursor: pointer; }
.chip:hover, .pill:hover { border-color: var(--seal); color: var(--seal); }
.chip[aria-pressed="true"], .pill[aria-pressed="true"] { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.list-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 18px 14px; margin-bottom: 14px; }
.era { margin-top: 10px; }
.era h3 { font-size: 16px; color: var(--ink); margin: 12px 0 2px; padding: 6px 0; border-bottom: 2px solid var(--line-2); display: flex; align-items: baseline; gap: 8px; }
.era h3 small { font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--ink-faint); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); align-items: start; border-radius: 6px; }
.row:hover { background: var(--paper-2); }
.row-year { font-family: var(--serif); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--seal); }
.row-title { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--ink); text-decoration: none; }
.row-title:hover { color: var(--seal); }
.row-historical .row-title { font-weight: 600; }
.row-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.row-links { font-size: 13px; white-space: nowrap; }
.badge, .tag { display: inline-block; font-size: 12px; line-height: 1.55; padding: 0 8px; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
.badge-accent { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.badge-note { border-style: dashed; border-color: var(--line-2); }
.badge-quiet { background: transparent; color: var(--ink-faint); }
.badge-jade { background: var(--jade-bg); border-color: transparent; color: var(--jade); }
.empty { color: var(--ink-faint); padding: 12px 0; }
.forms { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 8px; }
.forms li { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 0 8px; align-items: center; }
.form-name { font-family: var(--serif); font-weight: 700; font-size: 15px; }
.form-track { position: relative; height: 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; }
.form-bar { position: absolute; top: -1px; height: 8px; border-radius: 4px; background: var(--seal); }
.form-years { grid-column: 2; color: var(--ink-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.axis { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.forms-axis { margin-left: calc(5em + 8px); }
.events, .insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.events li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 8px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.events li:last-child { border-bottom: 0; }
.ev-year { font-family: var(--serif); font-weight: 700; color: var(--seal); font-variant-numeric: tabular-nums; }
.events b, .insights b { font-family: var(--serif); }
.events p, .insights p { margin: 2px 0; color: var(--ink-soft); font-size: 13px; }
.events small, .insights small { color: var(--ink-faint); font-size: 12px; }
.insights li { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.insights li:last-child { border-bottom: 0; }
.insight-era { display: block; color: var(--jade); font-weight: 600; font-size: 12px; }
.concepts summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.concepts summary h2 { margin: 0; display: inline; }
.concepts summary span { color: var(--ink-faint); font-size: 13px; }
.concepts[open] summary { margin-bottom: 10px; }
.concept-matrix { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.concept-matrix th, .concept-matrix td { border-bottom: 1px solid var(--line); padding: 4px; text-align: center; }
.concept-matrix thead th { font-weight: 400; color: var(--ink-faint); font-size: 12px; vertical-align: bottom; }
.concept-matrix thead th span { display: block; color: var(--ink-soft); writing-mode: vertical-rl; margin: 0 auto 4px; max-height: 6em; line-height: 1.2; }
.concept-matrix tbody th { text-align: left; font-family: var(--serif); font-weight: 700; white-space: nowrap; position: sticky; left: 0; background: var(--card); padding-right: 10px; }
.concept-matrix td { width: 34px; height: 28px; }
.concept-matrix td.hit::before { content: ""; display: block; width: 20px; height: 16px; margin: 0 auto; border-radius: 4px; }
.concept-matrix td.l1::before { background: var(--heat-1); }
.concept-matrix td.l2::before { background: var(--heat-2); }
.concept-matrix td.l3::before { background: var(--heat-3); }
.concept-matrix td.count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
details > summary h2 { display: inline; }

/* ---------- 台湾页 ---------- */
.chart { margin: 0 0 14px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chart svg { width: 100%; height: auto; display: block; font-size: 13px; }
.chart .tick line { stroke: var(--line-2); stroke-dasharray: 2 4; }
.chart .tick text, .chart .lane text { fill: var(--ink-faint); font-size: 12px; }
.chart .lane line { stroke: var(--line-2); stroke-width: 2; }
.chart .lane .lane-label { fill: var(--ink); font-size: 15px; font-weight: 700; font-family: var(--serif); }
.chart .mark-standard circle { fill: var(--seal); stroke: var(--card); stroke-width: 2; }
.chart .mark-guideline circle { fill: var(--card); stroke: var(--seal); stroke-width: 3; }
.chart figcaption { color: var(--ink-faint); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin-top: 6px; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.lg-standard { background: var(--seal); }
.lg-guideline { border: 3px solid var(--seal); }
.naming { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.naming > li { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 8px; align-items: start; }
.naming > li > b { font-family: var(--serif); }
.naming-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.naming-steps li { display: inline-flex; gap: 6px; padding: 1px 10px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: var(--serif); }
.naming-steps li span:first-child { color: var(--seal); font-weight: 700; font-variant-numeric: tabular-nums; }
.naming-steps li + li::before { content: "→"; color: var(--ink-faint); margin-right: 2px; }
.tw-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.tw-columns .panel { margin-bottom: 0; }
.tw-versions { list-style: none; margin: 0; padding: 0; }
.tw-versions > li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.tw-versions > li:last-child { border-bottom: 0; }
.tw-versions h3 { font-size: 15px; margin: 0 0 4px; }
.tw-points { margin: 6px 0; padding-left: 1.1em; color: var(--ink-soft); font-size: 13px; }
.tw-source, .tw-link { font-size: 12px; color: var(--ink-faint); margin: 4px 0 0; }
.tw-columns + .panel { margin-top: 14px; }
.fn { font-variant-numeric: tabular-nums; margin-right: 2px; }
.quote { color: var(--ink); font-family: var(--serif); }
.sources { margin: 0; padding-left: 1.6em; font-size: 13px; color: var(--ink-soft); }
.sources li { margin-bottom: 6px; scroll-margin-top: 90px; }
.sources li:target { background: var(--seal-tint); border-radius: 6px; }

/* official library */
.lib-group + .lib-group { margin-top: 18px; }
.lib-group h3 small { font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--ink-faint); }
.lib-item { grid-template-columns: 52px minmax(0, 1fr); scroll-margin-top: 90px; }
.lib-item:target, .lib-compact:target { background: var(--seal-tint); }
.lib-meta { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.lib-quote { margin: 6px 0 0; font-family: var(--serif); color: var(--ink); }
.lib-note { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.lib-files { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.lib-files small, .lib-compact small { color: var(--ink-faint); font-size: 12px; }
.digest { font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; }
.lib-compact-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 6px 18px; }
.lib-compact { padding: 4px 6px; border-radius: 6px; scroll-margin-top: 90px; overflow-wrap: anywhere; }
.ratios { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
.ratios li { display: grid; grid-template-columns: 6em minmax(0, 1fr) 7.5em; gap: 10px; align-items: center; }
.ratio-label { font-family: var(--serif); font-weight: 700; font-size: 15px; }
.ratio-track { position: relative; height: 16px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; background-image: linear-gradient(to right, transparent calc(25% - 1px), var(--line) calc(25% - 1px), var(--line) 25%, transparent 25%, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) 50%, transparent 50%, transparent calc(75% - 1px), var(--line) calc(75% - 1px), var(--line) 75%, transparent 75%); }
.ratio-bar { position: absolute; top: -1px; height: 16px; background: var(--seal); border-radius: 4px; }
.ratio-val { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 14px; }
.ratio-axis { margin-left: calc(6em + 10px); margin-right: calc(7.5em + 10px); }
.readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.reading-list { list-style: none; margin: 0; padding: 0; }
.reading-list li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; gap: 0 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.reading-list li > span:nth-child(2) { font-family: var(--serif); font-weight: 600; }
.reading-list small { grid-column: 2; color: var(--ink-faint); }
.rd-n { color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.rd-state { grid-column: 3; grid-row: 1 / span 2; font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 6px; border: 1.5px solid currentColor; white-space: nowrap; align-self: center; }
.reading-list .kept .rd-state { color: var(--jade); }
.reading-list .specified .rd-state { color: var(--gold); }
.reading-list .dropped .rd-state { color: var(--ink-faint); border-style: dashed; }
.reading-list .new .rd-state { color: var(--seal); }
.goal-list { margin: 0; padding-left: 1.4em; color: var(--ink-soft); font-size: 14px; font-family: var(--serif); }
.goal-list li { margin-bottom: 4px; }

/* ---------- 阅读与应用页 ---------- */
html[data-route="app"] #main { display: none; }
html[data-route="app"] #app-view { display: block !important; }
.app-view { min-height: 60vh; }
.app-shell { padding-top: 4px; padding-bottom: 30px; }
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; margin-top: 10px; }
.reader-side { position: sticky; top: 76px; }
.reader-main > h1 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
.para { padding: 10px 2px; border-bottom: 1px dashed var(--line); }
.para p { margin: 0; white-space: pre-wrap; }
.para-loc { display: block; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.para:target { background: var(--seal-tint); border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.note { color: var(--gold); }
.facts { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 4px 10px; margin: 0 0 12px; font-size: 14px; }
.facts dt { color: var(--ink-faint); }
.facts dd { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pdf { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
.ocr-page { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.ocr-page pre { white-space: pre-wrap; font: inherit; font-size: 14px; color: var(--ink-soft); }
.hits { list-style: none; margin: 0; padding: 0; }
.hits li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.hits li > a { font-family: var(--serif); font-weight: 700; }
.hits small { display: block; color: var(--ink-faint); }
.hits p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.form { display: grid; gap: 8px; align-content: start; }
.form label { font-weight: 600; font-size: 14px; }
.form textarea, .form select, .form input { width: 100%; font: inherit; color: var(--ink); background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; }
.form textarea:focus, .form select:focus, .form input:focus { outline: none; border-color: var(--seal); }
.form-status { color: var(--ink-soft); font-size: 14px; margin: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--seal); color: var(--seal-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.button:hover { background: var(--seal-soft); text-decoration: none; }
.button.secondary { background: var(--card); color: var(--seal); border: 1px solid var(--seal); }
.button[disabled] { opacity: .7; cursor: progress; }
.answer { white-space: pre-wrap; margin-bottom: 12px; padding: 10px 14px; border-left: 3px solid var(--seal); background: var(--paper-2); border-radius: 0 8px 8px 0; }
.comments { list-style: none; margin: 0; padding: 0; }
.comment { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.comment small { color: var(--ink-faint); margin-left: 8px; }

/* ---------- 页脚与移动底栏 ---------- */
.sitefoot { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; padding: 24px 0 36px; margin-top: 36px; }
.sitefoot p { max-width: 72em; }
.sitefoot b { font-family: var(--serif); }
.mobnav { display: none; }

@media (max-width: 1080px) {
  .tw-columns { grid-template-columns: 1fr; }
  .menu-panel { grid-template-columns: repeat(3, minmax(108px, auto)); }
}
@media (max-width: 900px) {
  .subject-layout, .reader { grid-template-columns: minmax(0, 1fr); }
  .subject-side, .reader-side { position: static; max-height: none; overflow: visible; }
  .readings { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .mainnav { display: none; }
  .topbar-inner { justify-content: space-between; }
  .brand b { font-size: 18px; }
  .hero h1 { font-size: 28px; letter-spacing: 6px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .mobnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--topbar); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .mobnav a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 12px; color: var(--ink-soft); text-decoration: none; }
  .mobnav a[aria-current="page"] { color: var(--seal); font-weight: 600; }
  .mobnav .ic { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.2; }
  html { scroll-padding-top: 70px; }
}
@media (max-width: 720px) {
  .aim-cards { grid-template-columns: 1fr; }
  .aims-matrix { --dim: 52px; --cell: 46px; --total: 54px; }
  .aims-matrix tbody th { padding: 6px 8px; }
  .aims-matrix tbody th small { display: none; }
  .aims-matrix .corner-label { display: none; }
  .row { grid-template-columns: 44px minmax(0, 1fr); }
  .row-links { grid-column: 2; }
  .ratios li { grid-template-columns: 4.6em minmax(0, 1fr); }
  .ratio-val { grid-column: 2; font-size: 13px; }
  .ratio-axis { margin-left: calc(4.6em + 10px); margin-right: 0; }
  .stats { gap: 10px 20px; }
  .stats b { font-size: 22px; }
  .searchbar select { max-width: 7em; }
  .list-card { padding: 4px 12px 12px; }
  .page-head h1 { font-size: 26px; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 12px; }
  .subject-grid { grid-template-columns: 1fr; }
  .searchbar button { padding: 0 18px; }
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
  .stats span { display: block; line-height: 1.4; }
  .section-title small { flex-basis: 100%; padding-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
@media print {
  .topbar, .sitefoot, .filters, .searchbar, .theme-toggle, .mobnav { display: none; }
  body { background: #fff; color: #000; padding-bottom: 0; }
}
