:root {
  --paper: #fcfaf3;
  --paper-deep: #f4efe2;
  --paper-tint: #f8f3e8;
  --paper-warm: #f6eddb;
  --surface: #fffdf7;
  --ink: #1c1917;
  --ink-2: #4a453e;
  --ink-3: #6b645a;
  --ink-hover: #000;
  --rule: rgba(28, 25, 23, 0.22);
  --rule-strong: rgba(28, 25, 23, 0.38);
  --hairline: rgba(28, 25, 23, 0.14);
  --zhu: #8f2a19;
  --zhu-soft: #f2e0da;
  --stele: #1c1917;
  --on-stele: #f6f2e7;
  --green-deep: #3f5d4b;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Source Sans 3", "PingFang SC", "Heiti SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  --fs-display: clamp(28px, 4vw, 46px);
  --fs-h1: 40px;
  --fs-h2: 26px;
  --fs-h3: 18px;
  --fs-body: 16px;
  --fs-small: 13px;
  --fs-mono: 12px;
  --max: 1200px;
}

[data-theme="night"] {
  --paper: #1a1917;
  --paper-deep: #141312;
  --paper-tint: #211f1c;
  --paper-warm: #26231f;
  --surface: #24221f;
  --ink: #ece7db;
  --ink-2: #b9b2a5;
  --ink-3: #918a7d;
  --ink-hover: #fff;
  --rule: rgba(246, 242, 231, 0.24);
  --rule-strong: rgba(246, 242, 231, 0.4);
  --hairline: rgba(246, 242, 231, 0.14);
  --zhu: #d76a55;
  --zhu-soft: #3a241f;
  --stele: #11100f;
  --on-stele: #f6f2e7;
  --green-deep: #a8c7b6;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--zhu); }
h1, h2, h3, h4 { line-height: 1.3; letter-spacing: 0.01em; font-weight: 600; margin: 0; }
p { margin: 0 0 1.1em; }
code, .mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.rule { border-top: 1px solid var(--rule); }
.hair { border-top: 1px solid var(--hairline); }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-small); }
.mono { font-size: var(--fs-mono); letter-spacing: 0.02em; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 32px;
  height: 64px; display: flex; align-items: center; gap: 24px;
}
.brand { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: 0.06em; }
.brand .dot { color: var(--zhu); }
.nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.nav a { font-family: var(--sans); font-size: var(--fs-small); color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a[aria-current="page"], .nav a:hover { color: var(--ink); border-bottom-color: var(--zhu); }
.nav .count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.search-btn, .theme-btn {
  font-family: var(--sans); font-size: var(--fs-small); color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 0;
  height: 36px; padding: 0 12px; cursor: pointer;
}
.search-btn { min-width: 168px; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.search-btn .key { font-family: var(--mono); font-size: 11px; color: var(--ink-3); border: 1px solid var(--rule); padding: 0 5px; }
.theme-btn { width: 36px; padding: 0; }

/* hero */
.hero { padding: 96px 32px 72px; }
.eyebrow { font-family: var(--sans); font-size: var(--fs-small); letter-spacing: 0.14em; color: var(--ink-3); text-transform: uppercase; }
.hero h1 { font-size: var(--fs-display); font-weight: 400; max-width: 900px; margin: 18px 0 28px; }
.hero .lead { max-width: 720px; color: var(--ink-2); }
.src { font-family: var(--mono); font-size: var(--fs-mono); color: var(--zhu); }

/* stats */
.home-stats { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.home-stats .stat { padding: 22px 0; border-right: 1px solid var(--hairline); }
.home-stats .stat:last-child { border-right: 0; }
.home-stats b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 500; }
.home-stats span { font-family: var(--sans); font-size: 12px; color: var(--ink-3); }

/* sections */
.section { padding: 88px 32px; border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-head h2 { font-size: var(--fs-h2); font-weight: 400; }
.section-head .aside { font-family: var(--sans); font-size: var(--fs-small); color: var(--ink-3); }
.section-head .aside a { border-bottom: 1px solid var(--rule); }

/* discipline rows */
.disc-list { border-top: 1px solid var(--rule); }
.disc-row { display: grid; grid-template-columns: 44px 14px 1fr auto; gap: 14px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--hairline); }
.disc-row .num { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.swatch { width: 10px; height: 10px; display: inline-block; }
.disc-row .name { font-size: 22px; font-weight: 600; }
.disc-row .covers { display: block; font-family: var(--sans); font-size: 13px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.disc-row .n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.disc-row:hover .name { border-bottom: 1px solid var(--zhu); }

/* card grid */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 48px; }
.card-link { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.card-link .title { font-size: 17px; }
.card-link:hover .title { border-bottom: 1px solid var(--zhu); }
.card-link .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* stele */
.stele { background: var(--stele); color: var(--on-stele); padding: 64px 40px 56px; }
.stele-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 36px; }
.stele-head h2 { font-size: var(--fs-h2); font-weight: 400; }
.stele-head span { font-family: var(--sans); font-size: 12px; color: rgba(246, 242, 231, 0.6); }
.stele-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid rgba(246, 242, 231, 0.14); border-left: 1px solid rgba(246, 242, 231, 0.14); }
.stele-item { padding: 22px 18px; border-right: 1px solid rgba(246, 242, 231, 0.14); border-bottom: 1px solid rgba(246, 242, 231, 0.14); }
.stele-item .q { font-family: var(--mono); font-size: 11px; color: var(--zhu); }
.stele-item .t { display: block; font-size: 17px; margin-top: 10px; line-height: 1.55; }
.stele-item .n { display: block; font-family: var(--sans); font-size: 11px; color: rgba(246, 242, 231, 0.55); margin-top: 10px; }
.stele-item:hover .t { border-bottom: 1px solid var(--zhu); }

/* books */
.book-wall { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; }
.spines { display: flex; gap: 18px; align-items: flex-end; padding-top: 12px; }
.spine { width: 42px; height: 230px; display: flex; align-items: center; justify-content: center; color: #f6f2e7; font-family: var(--serif); font-size: 13px; writing-mode: vertical-rl; letter-spacing: 0.18em; }
.spine.s1 { background: #2f3e55; height: 214px; }
.spine.s2 { background: #5e2622; height: 246px; }
.book-list { border-top: 1px solid var(--rule); }
.book-row { display: flex; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.book-row .bt { font-size: 20px; }
.book-row .bs { font-family: var(--sans); font-size: 13px; color: var(--ink-3); }

/* footer */
.site-foot { padding: 48px 0 72px; border-top: 1px solid var(--rule); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; }
.foot-grid h3 { font-family: var(--sans); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 10px; font-weight: 500; }
.foot-grid p, .foot-grid li { font-size: 13px; color: var(--ink-2); }
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid li { margin-bottom: 4px; }
.foot-note { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--ink-3); }

/* page header */
.page-head { padding: 64px 0 36px; border-bottom: 1px solid var(--rule); }
.breadcrumb { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { border-bottom: 1px solid var(--hairline); }
.page-head h1 { font-size: var(--fs-h1); font-weight: 400; margin-bottom: 12px; }
.page-head .lead { max-width: 780px; color: var(--ink-2); }
.kicker { font-family: var(--sans); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; margin-bottom: 10px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 11px; color: var(--green-deep); border: 1px solid var(--green-deep); padding: 1px 6px; margin-left: 8px; vertical-align: middle; }
.badge.zhu { color: var(--zhu); border-color: var(--zhu); }
.badge.muted { color: var(--ink-3); border-color: var(--rule); }

/* prose */
.prose { max-width: 760px; }
.prose p { margin-bottom: 1.1em; }
.prose blockquote { margin: 0 0 1.4em; padding: 16px 20px; background: var(--paper-warm); border-left: 2px solid var(--zhu); font-size: 17px; line-height: 1.7; }
.prose blockquote .src { display: block; margin-top: 10px; }

/* card detail */
.card-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; padding: 48px 0 88px; }
.card-main > section { margin-bottom: 44px; }
.card-main h2 { font-size: var(--fs-h3); font-family: var(--sans); font-weight: 600; letter-spacing: 0.04em; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.def { font-size: 19px; line-height: 1.8; }
.boundary { color: var(--ink-2); }
.quote-list { display: grid; gap: 16px; }
.quote-item { background: var(--paper-warm); padding: 18px 20px; border-left: 2px solid var(--zhu); }
.quote-item .t { font-size: 17px; line-height: 1.7; }
.quote-item .src { margin-top: 10px; }
.source-list, .edge-list { list-style: none; padding: 0; margin: 0; }
.source-list li, .edge-list li { padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.edge-list .rel { display: inline-block; min-width: 56px; font-family: var(--sans); font-size: 11px; color: var(--zhu); }
.edge-list .note { display: block; color: var(--ink-3); font-size: 13px; margin-left: 56px; }
.side-box { border-top: 1px solid var(--rule); padding-top: 14px; margin-bottom: 32px; }
.side-box h3 { font-family: var(--sans); font-size: 12px; letter-spacing: 0.08em; color: var(--ink-3); margin-bottom: 8px; }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-box li { padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.phase-list { list-style: none; padding: 0; margin: 0; }
.phase-list li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline); align-items: start; }
.phase-list .pid { font-family: var(--sans); font-size: 13px; }
.phase-list .pnote { color: var(--ink-2); font-size: 14px; }
.phase-list .pver { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.phase-list .pver.on { color: var(--green-deep); }

/* index page */
.index-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; padding: 40px 0 88px; }
.rail { position: sticky; top: 88px; align-self: start; }
.rail h3 { font-family: var(--sans); font-size: 12px; letter-spacing: 0.08em; color: var(--ink-3); margin-bottom: 10px; }
.rail ul { list-style: none; padding: 0; margin: 0; }
.rail li { padding: 6px 0; font-family: var(--sans); font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 8px; }
.rail li.active { color: var(--ink); border-bottom-color: var(--zhu); }
.collapse-controls { display: flex; gap: 12px; margin-bottom: 18px; font-family: var(--sans); font-size: 12px; }
.collapse-controls button { background: transparent; border: 0; color: var(--ink-3); cursor: pointer; padding: 0; border-bottom: 1px solid var(--hairline); }
details.group { border-top: 1px solid var(--rule); }
details.group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 0; font-size: 20px; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .plus { font-family: var(--mono); color: var(--zhu); width: 16px; }
details.group[open] > summary .plus { content: "−"; }
details.group > summary .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.group-body { padding: 0 0 24px 28px; }
.fold-more { margin-top: 12px; }
.fold-more summary { cursor: pointer; font-family: var(--sans); font-size: 12px; color: var(--zhu); }

/* graph */
.graph-wrap { padding: 32px 0 64px; }
.graph-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.graph-title h1 { font-size: 32px; font-weight: 400; }
.graph-title .unit { font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
#g-svg { width: 100%; height: 640px; display: block; background: linear-gradient(180deg, var(--paper), var(--paper-deep)); border: 1px solid var(--rule); }
#g-svg .g-link { stroke: var(--ink-3); fill: none; stroke-width: 0.8; opacity: 0.5; }
#g-svg .g-link[data-rel="演生"] { stroke-dasharray: 4 4; }
#g-svg .g-link[data-rel="前提"] { stroke-dasharray: 1 4; }
#g-svg .g-link[data-rel="反例"] { stroke-dasharray: 6 3 1 3; }
#g-svg .g-link[data-rel="跨域"] { stroke-dasharray: 8 3; }
#g-svg .g-node circle { stroke: var(--paper); stroke-width: 2; }
#g-svg .g-node text { font-family: var(--sans); font-size: 9px; fill: var(--ink-2); pointer-events: none; }
#g-svg .g-node:hover text { fill: var(--ink); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* search */
.search-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(28,25,23,0.35); display: none; }
.search-overlay[data-open="true"] { display: block; }
.search-box { max-width: 720px; margin: 12vh auto 0; background: var(--paper); border: 1px solid var(--rule-strong); }
.search-box input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); font-family: var(--serif); font-size: 22px; padding: 18px 20px; outline: none; }
.search-results { max-height: 56vh; overflow: auto; }
.search-result { display: flex; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--hairline); }
.search-result .meta { font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
.search-empty { padding: 20px; color: var(--ink-3); font-family: var(--sans); font-size: 13px; }

/* tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.data-table th { font-family: var(--sans); font-size: 12px; color: var(--ink-3); font-weight: 500; }

/* toc */
details.chapter { border-top: 1px solid var(--rule); }
details.chapter > summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; padding: 14px 0; list-style: none; }
details.chapter > summary::-webkit-details-marker { display: none; }
details.chapter .chno { font-family: var(--mono); font-size: 12px; color: var(--ink-3); min-width: 120px; }
details.chapter .chname { font-size: 18px; }
details.chapter .chmeta { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.sec-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 92px; gap: 12px; padding: 7px 0 7px 24px; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.sec-row .pg { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.sec-row .ln { font-family: var(--mono); font-size: 11px; color: var(--ink-3); text-align: right; }

/* responsive */
@media (max-width: 900px) {
  .home-stats { grid-template-columns: repeat(3, 1fr); }
  .home-stats .stat:nth-child(3n) { border-right: 0; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .card-layout { grid-template-columns: 1fr; gap: 32px; }
  .index-layout { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail ul { display: flex; gap: 14px; overflow-x: auto; border-bottom: 1px solid var(--rule); }
  .rail li { border-bottom: 0; white-space: nowrap; }
  .book-wall { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .wrap, .topbar-inner { padding: 0 20px; }
  .nav { gap: 12px; }
  .nav .count { display: none; }
  .stele-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 64px 20px 48px; }
  .section { padding: 64px 20px; }
  .page-head { padding: 44px 0 28px; }
}
@media (max-width: 600px) {
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-stats .stat:nth-child(3n) { border-right: 1px solid var(--hairline); }
  .home-stats .stat:nth-child(2n) { border-right: 0; }
  .card-grid { grid-template-columns: 1fr; }
  .stele-grid { grid-template-columns: 1fr; }
  .stele { padding: 48px 20px 40px; }
  .foot-grid { grid-template-columns: 1fr; }
  .search-btn { min-width: 0; width: auto; padding: 0 10px; justify-content: center; }
  .search-btn .label { display: inline; }
  .search-btn .key { display: none; }
  .sec-row { grid-template-columns: 54px 1fr; }
  .sec-row .ln { display: none; }
}

@media (max-width: 600px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 20px; gap: 10px; }
  .brand { order: 1; font-size: 16px; letter-spacing: 0.03em; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; gap: 18px; padding: 6px 0 2px; border-top: 1px solid var(--hairline); }
  .nav a { white-space: nowrap; }
  .topbar .lang-switch { order: 2; }
  .search-btn { order: 2; margin-left: auto; }
  .theme-btn { order: 2; }
}

@media (max-width: 600px) {
  .phase-list li { grid-template-columns: 1fr auto; }
  .phase-list .pnote { grid-column: 1 / -1; }
}

/* focus + graph labels + rail */
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--zhu);
  outline-offset: 2px;
}
#g-svg .g-label { opacity: 0; transition: opacity 120ms ease-out; pointer-events: none; }
#g-svg .g-label--always { opacity: 0.9; }
#g-svg .g-node:hover .g-label { opacity: 1; }

/* reader */
.reader-note { margin-top: 18px; padding: 12px 16px; border-left: 2px solid var(--zhu); background: var(--paper-warm); font-size: 14px; color: var(--ink-2); }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; padding: 48px 0 88px; }
.reader-text { max-width: 760px; font-size: 17px; }
.reader-text p { margin-bottom: 1.2em; }
@media (max-width: 900px) { .reader-layout { grid-template-columns: 1fr; gap: 32px; } }
.search-scope { display: flex; border-bottom: 1px solid var(--rule); }
.search-scope button { flex: 1; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px; font-family: var(--sans); font-size: 12px; color: var(--ink-3); cursor: pointer; }
.search-scope button.on { color: var(--ink); border-bottom-color: var(--zhu); }
.search-result .snippet { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }

/* plates */
.plate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.plate { display: block; border: 1px solid var(--rule); background: var(--surface); padding: 8px; }
.plate img { width: 100%; height: 180px; object-fit: contain; background: var(--paper-deep); display: block; }
.plate-meta { display: block; font-family: var(--sans); font-size: 11px; color: var(--ink-3); margin-top: 8px; line-height: 1.4; }
.reader-plates { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--rule); }
.reader-plates h2 { font-size: var(--fs-h3); margin-bottom: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 82vh; background: #fff; }
.lightbox-caption { color: #f6f2e7; font-family: var(--sans); font-size: 12px; text-align: center; }
.lightbox-close { position: absolute; top: 16px; right: 20px; background: transparent; border: 1px solid rgba(246,242,231,0.5); color: #f6f2e7; font-size: 22px; width: 40px; height: 40px; cursor: pointer; }
@media (max-width: 900px) { .plate-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plate-grid { grid-template-columns: 1fr; } .plate img { height: 210px; } }


/* ---------- strategies-kb additions ---------- */
.skip { position: absolute; left: -9999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }
.hero, .section { max-width: var(--max); margin: 0 auto; }
.lead { color: var(--ink-2); max-width: 760px; }
.topbar-stat { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.entry-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border-top: 1px solid var(--rule); }
.entry-card { display: block; padding: 22px 20px 20px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--rule); min-height: 190px; }
.entry-card:last-child { border-right: 0; }
.entry-card:hover { background: var(--paper-tint); }
.entry-title { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.entry-desc { color: var(--ink-2); font-size: 14px; line-height: 1.7; min-height: 72px; }
.entry-links { display: flex; flex-direction: column; gap: 4px; font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
.entry-links a:hover { color: var(--zhu); }
.term-grid, .recipe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.term-row, .recipe-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.term-name, .recipe-name { font-family: var(--serif); font-size: 17px; flex: 1; min-width: 0; }
.term-aliases { color: var(--ink-3); font-size: 12px; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-meta { color: var(--ink-3); white-space: nowrap; }
.term-row:hover .term-name, .recipe-row:hover .recipe-name { text-decoration: underline; text-decoration-color: var(--zhu); text-underline-offset: 4px; }
.cat-square { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; }
.today-card { display: block; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 24px 0; }
.today-title { font-family: var(--serif); font-size: 24px; margin-bottom: 8px; }
.today-meta { color: var(--ink-3); margin-top: 10px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.method-grid h3 { font-size: var(--fs-h3); margin-bottom: 8px; }
.footer { border-top: 1px solid var(--rule); margin-top: 72px; padding: 40px 0 56px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-title { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 8px; }
.term-category-list { border-top: 1px solid var(--rule); }
.group { border-bottom: 1px solid var(--rule); }
.group-head { display: flex; align-items: center; gap: 10px; padding: 16px 0; cursor: pointer; list-style: none; }
.group-head::-webkit-details-marker { display: none; }
.group-title { font-family: var(--serif); font-size: 22px; }
.group-count { color: var(--ink-3); margin-left: auto; }
.group-body { padding: 0 0 20px 18px; }
.long-tail { margin-top: 32px; border-top: 1px solid var(--rule); }
.long-tail summary { padding: 14px 0; cursor: pointer; font-family: var(--sans); font-size: 13px; color: var(--zhu); }
.fold-more summary { margin-top: 10px; font-family: var(--sans); font-size: 12px; color: var(--zhu); cursor: pointer; }
.badge { display: inline-block; font-family: var(--sans); font-size: 11px; line-height: 1.4; padding: 2px 7px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.badge--inferred { color: var(--zhu); border-color: var(--zhu); }
.badge--rare { color: var(--ink-3); border-color: var(--hairline); }
.badge--favored { color: var(--green-deep); border-color: var(--green-deep); }
.badge--avoid { color: var(--zhu); border-color: var(--zhu); border-style: dashed; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.term-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; }
.term-main { min-width: 0; }
.term-side { position: sticky; top: 88px; align-self: start; }
.side-title { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; color: var(--ink-3); margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.def { font-size: 19px; line-height: 1.8; }
.boundary { color: var(--ink-2); }
.stat-inline { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 20px; }
.stat-inline span { padding: 14px 0; border-right: 1px solid var(--hairline); font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
.stat-inline span:last-child { border-right: 0; }
.stat-inline b { display: block; font-family: var(--mono); font-size: 20px; color: var(--ink); font-weight: 500; }
.role-bar-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 44px; align-items: center; gap: 10px; padding: 5px 0; }
.role-bar-label { font-family: var(--sans); font-size: 12px; color: var(--ink-2); }
.role-bar { display: block; height: 7px; background: var(--hairline); }
.role-bar-fill { display: block; height: 7px; background: var(--ink-2); }
.role-bar-fill--risk, .role-bar-fill--exit { background: var(--zhu); }
.role-bar-fill--filter { background: var(--green-deep); }
.role-bar-fill--context { background: var(--ink-3); }
.relation-cell { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
a.relation-cell-link { color: inherit; text-decoration: none; display: block; }
a.relation-cell-link:hover .relation-main { color: var(--zhu); }
.relation-label a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--hairline); }
.relation-label a:hover { color: var(--zhu); border-bottom-color: var(--zhu); }
.relation-main { color: var(--ink-2); }
.relation-sub { font-size: 12px; color: var(--ink-3); }
.relation-tag { font-family: var(--sans); font-size: 11px; color: var(--ink-3); border: 1px solid var(--hairline); padding: 1px 5px; white-space: nowrap; }
.relation-bars { margin: 0 0 8px; }
.relation-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.relation-row:last-child { border-bottom: 0; }
.relation-label { font-family: var(--sans); font-size: 12px; color: var(--ink-2); }
.relation-label--same { color: var(--ink-3); }
.relation-bar-cell { min-width: 0; }
.relation-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; text-align: right; }
.relation-foot { margin: 8px 0 24px; line-height: 1.7; }
.relation-note { display: flex; gap: 10px; align-items: baseline; border-left: 2px solid var(--zhu); padding: 8px 0 8px 12px; margin: 0 0 24px; font-size: 14px; color: var(--ink-2); }
.term-role-list { list-style: none; padding: 0; margin: 0 0 8px; }
.term-role-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.term-role-name { font-family: var(--sans); font-size: 13px; }
.term-role-counts { font-family: var(--mono); font-size: 11px; color: var(--ink-3); text-align: right; }
.regime-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.regime-cell { border: 1px solid var(--hairline); padding: 8px 6px; text-align: center; font-family: var(--sans); font-size: 11px; color: var(--ink-3); }
.regime-cell b { display: block; font-weight: 500; color: var(--ink-2); margin-bottom: 3px; }
.regime-cell--favored { border-bottom: 2px solid var(--green-deep); }
.regime-cell--avoid { border-bottom: 2px dashed var(--zhu); }
.quote-list { display: grid; gap: 12px; }
.quote-item { background: var(--paper-warm); padding: 16px 18px; border-left: 2px solid var(--zhu); }
.quote-item .t { font-size: 16px; line-height: 1.7; }
.quote-item .src { margin-top: 8px; color: var(--ink-3); }
.edge-list, .evidence-list, .similar-list { list-style: none; padding: 0; margin: 0; }
.edge-list li, .evidence-list li, .similar-list li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.edge-list .rel { font-family: var(--sans); font-size: 11px; color: var(--zhu); min-width: 40px; }
.edge-list .note { color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.role-label { font-family: var(--sans); font-size: 11px; color: var(--ink-3); border: 1px solid var(--hairline); padding: 1px 5px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); position: sticky; top: 64px; background: var(--paper); z-index: 20; }
.filter-bar input, .filter-bar select, .filter-bar button { font-family: var(--sans); font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 0; height: 36px; padding: 0 10px; }
.filter-bar input { flex: 1 1 220px; min-width: 160px; }
.filter-bar select { max-width: 180px; }
.filter-bar button { cursor: pointer; color: var(--ink-2); }
.filter-summary { padding: 10px 0; color: var(--ink-3); }
.strategy-results { border-top: 1px solid var(--hairline); }
.strategy-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 150px minmax(0, 1.2fr) 110px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.strategy-title { font-family: var(--serif); font-size: 16px; line-height: 1.45; }
.strategy-row:hover .strategy-title { text-decoration: underline; text-decoration-color: var(--zhu); text-underline-offset: 4px; }
.strategy-meta { font-family: var(--sans); font-size: 12px; color: var(--ink-3); }
.strategy-terms { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--hairline); padding: 1px 5px; font-family: var(--sans); font-size: 11px; color: var(--ink-2); }
.chip-role { font-family: var(--mono); font-size: 9px; color: var(--ink-3); }
.load-more { display: block; margin: 20px auto; background: transparent; border: 1px solid var(--rule); padding: 8px 18px; font-family: var(--sans); color: var(--ink-2); cursor: pointer; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 32px; }
.pipeline-col { padding: 14px 14px 18px 0; border-right: 1px solid var(--hairline); }
.pipeline-col:last-child { border-right: 0; }
.pipeline-head { font-family: var(--sans); font-size: 11px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; }
.pipeline-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.term-chip { display: inline-block; border: 1px solid var(--rule); padding: 3px 7px; font-family: var(--sans); font-size: 12px; color: var(--ink); }
.term-chip:hover { border-color: var(--zhu); }
.term-chip--context { color: var(--ink-3); border-color: var(--hairline); }
.context-block { padding: 18px 0; border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.context-block h3 { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; }
.context-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.unclassified { border: 1px dashed var(--rule); padding: 20px; color: var(--ink-2); margin-bottom: 28px; }
.strategy-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; }
.strategy-main { min-width: 0; }
.strategy-side { position: sticky; top: 88px; align-self: start; }
.strategy-section { margin-bottom: 26px; }
.strategy-section p { margin-bottom: .9em; }
.section-fold summary { font-family: var(--sans); font-size: 12px; color: var(--zhu); cursor: pointer; }
.code-block { border: 1px solid var(--rule); margin-top: 26px; background: var(--paper-deep); }
.code-block summary { padding: 10px 12px; cursor: pointer; font-family: var(--sans); font-size: 12px; color: var(--ink-2); }
.copy-btn { float: right; margin: 6px 10px; background: transparent; border: 1px solid var(--rule); font-family: var(--sans); font-size: 11px; color: var(--ink-2); padding: 3px 8px; cursor: pointer; }
.code-block pre { margin: 0; padding: 12px; overflow: auto; max-height: 480px; }
.code-block code { font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre; }
.warning { border-left: 2px solid var(--zhu); background: var(--paper-warm); padding: 10px 14px; margin: 0 0 24px; font-size: 14px; color: var(--ink-2); }
.similar-list .mono { margin-left: auto; color: var(--ink-3); }
@media (max-width: 900px) {
  .entry-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-card:nth-child(2n) { border-right: 0; }
  .term-grid, .recipe-grid { grid-template-columns: 1fr; }
  .term-layout, .strategy-layout { grid-template-columns: 1fr; gap: 32px; }
  .term-side, .strategy-side { position: static; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .pipeline-col:nth-child(3n) { border-right: 0; }
  .strategy-row { grid-template-columns: 1fr 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .entry-grid { grid-template-columns: 1fr; }
  .entry-card { border-right: 0; }
  .pipeline { grid-template-columns: 1fr; }
  .pipeline-col { border-right: 0; border-bottom: 1px solid var(--hairline); padding: 12px 0; }
  .strategy-row { grid-template-columns: 1fr; gap: 6px; }
  .regime-strip { grid-template-columns: repeat(4, 1fr); }
  .filter-bar { position: static; }
  .topbar-stat { display: none; }
  .relation-row { grid-template-columns: 1fr auto; grid-template-areas: "label meta" "bar bar"; row-gap: 4px; }
  .relation-label { grid-area: label; }
  .relation-meta { grid-area: meta; }
  .relation-bar-cell { grid-area: bar; }
}


/* ---------- graph ---------- */
.graph-wrap { max-width: var(--max); margin: 0 auto; padding: 48px 32px 88px; }
.graph-frame { border: 1px solid var(--rule); background: var(--paper); overflow: hidden; }
#g-svg { width: 100%; height: auto; display: block; }
.g-link { stroke: rgba(28,25,23,0.16); stroke-width: 1; }
.g-link--co { stroke: rgba(28,25,23,0.16); }
.g-link--依据 { stroke: #485977; stroke-width: 1.4; }
.g-link--演生 { stroke: #8a5f28; stroke-width: 1.4; stroke-dasharray: 6 3; }
.g-link--前提 { stroke: #5e6b3a; stroke-width: 1.4; stroke-dasharray: 2 3; }
.g-link--反例 { stroke: #a8321f; stroke-width: 1.4; stroke-dasharray: 8 3; }
.g-link--跨域 { stroke: #6d5f75; stroke-width: 1.4; stroke-dasharray: 2 4; }
.g-node circle { fill-opacity: 0.85; stroke: var(--paper); stroke-width: 1.5; }
.g-node:hover circle { fill-opacity: 1; stroke: var(--zhu); stroke-width: 2; }
.g-label { font-family: var(--sans); font-size: 10px; fill: var(--ink-2); display: none; pointer-events: none; }
.g-label--always { display: block; }
.graph-term-list { columns: 2; column-gap: 48px; }
.graph-term-list li { break-inside: avoid; }
@media (max-width: 600px) { .graph-term-list { columns: 1; } }


.section-head .aside { white-space: nowrap; flex: 0 0 auto; }


/* ---------- bilingual strategy view ---------- */
.topbar .lang-switch { display: inline-block; border: 1px solid var(--rule); margin: 0; padding: 4px 8px; font-family: var(--sans); font-size: 12px; color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.topbar .lang-switch:hover { color: var(--zhu); border-color: var(--zhu); }
.lang-switch button { background: transparent; border: 0; border-right: 1px solid var(--rule); font-family: var(--sans); font-size: 12px; color: var(--ink-3); padding: 6px 14px; cursor: pointer; }
.lang-switch button:last-child { border-right: 0; }
.lang-switch button.on { color: var(--ink); background: var(--paper-tint); }
.lang-badge-row { margin-bottom: 18px; }
.lang-columns[data-lang="zh"] .lang-col[data-lang="en"] { display: none; }
.lang-columns[data-lang="en"] .lang-col[data-lang="zh"] { display: none; }
.lang-columns[data-lang="both"] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.lang-col .strategy-section:first-child .side-title { margin-top: 0; }
.lang-col .side-title { margin-top: 24px; }
@media (max-width: 900px) { .lang-columns[data-lang="both"] { grid-template-columns: 1fr; gap: 0; } }


/* ---------- code notes ---------- */
.code-notes-sub { font-family: var(--sans); font-size: 12px; letter-spacing: .06em; color: var(--ink-3); margin: 20px 0 8px; }
.code-notes .def { font-size: 17px; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; line-height: 1.6; }
.comment-list .mono { color: var(--ink-3); flex: 0 0 34px; }


/* ---------- DESIGN.md alignment: clickable regions ---------- */
.topbar-stat, .footer-title { text-decoration: none; }
.topbar-stat:hover, .footer-title:hover { color: var(--zhu); }
.footer-grid a { color: inherit; text-decoration: none; }
.footer-grid a:hover { color: var(--zhu); }

.home-stats .stat { display: block; color: inherit; text-decoration: none; }
.home-stats .stat:hover b { color: var(--zhu); }

.entry-card { position: relative; }
.stretched-link { position: absolute; inset: 0; z-index: 0; }
.entry-title, .entry-links { position: relative; z-index: 2; }
.entry-desc { position: relative; z-index: 1; pointer-events: none; }

.disc-toc { border-top: 1px solid var(--rule); }
.disc-toc-row {
  display: grid;
  grid-template-columns: 56px 1fr 96px;
  align-items: baseline;
  gap: 24px;
  padding: 17px 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: inherit;
}
.disc-toc-row:hover .name {
  text-decoration: underline;
  text-decoration-color: var(--zhu);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.disc-toc-row:hover .no { color: var(--zhu); }
.disc-toc-row .no {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .06em;
}
.disc-toc-row .name {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .01em;
}
.disc-toc-row .swatch { width: 10px; height: 10px; flex: none; background: var(--c); }
.disc-toc-row .covers {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-small);
  color: var(--ink-3);
  margin-top: 2px;
  padding-left: 24px;
}
.disc-toc-row .n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}
.disc-toc-row .n em { font-family: var(--sans); font-style: normal; font-size: 11px; margin-left: 3px; }

.stele {
  margin-top: 88px;
  background: var(--stele);
  color: var(--on-stele);
  padding: 64px 0 56px;
}
[data-theme="night"] .stele { border-top: 1px solid #312c27; border-bottom: 1px solid #312c27; }
.stele-inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.stele .section-head h2 { color: var(--on-stele); font-weight: 400; }
.stele .section-head .aside { color: rgba(246, 242, 231, .55); }
.stele-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(246, 242, 231, .22);
}
.stele-item {
  display: block;
  color: var(--on-stele);
  padding: 28px 24px 28px 0;
  border-bottom: 1px solid rgba(246, 242, 231, .14);
  border-right: 1px solid rgba(246, 242, 231, .14);
  text-decoration: none;
}
.stele-item:nth-child(4n) { border-right: 0; }
.stele-item .no {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(246, 242, 231, .5);
  letter-spacing: .08em;
}
.stele-item .q {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--on-stele);
}
.stele-item:hover .q {
  text-decoration: underline;
  text-decoration-color: #c9502f;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.stele-item.hot .no { color: #e06a4d; }
.stele-item.hot .q::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #c9502f;
  margin-left: 10px;
  vertical-align: .28em;
}

.spine-wall {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: end;
}
.spines { display: flex; gap: 6px; align-items: flex-end; height: 232px; margin-top: 8px; }
.spine {
  width: 42px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 14px;
  color: #f4efe2;
  text-decoration: none;
}
.spine:hover { filter: brightness(1.08); }
.spine .st {
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.3;
}
.spine .sn {
  font-family: var(--mono);
  font-size: 9px;
  color: rgba(244, 239, 226, .6);
  letter-spacing: .06em;
}
.spine-list { border-top: 1px solid var(--rule); }
.spine-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: inherit;
}
.spine-row:hover { color: var(--zhu); }

.method-item { display: block; text-decoration: none; color: inherit; }
.method-item:hover h3 { text-decoration: underline; text-decoration-color: var(--zhu); text-underline-offset: 4px; }

a.badge { text-decoration: none; }
a.badge:hover { border-color: var(--zhu); color: var(--zhu); }
a.regime-cell { display: block; text-decoration: none; color: inherit; }
a.regime-cell:hover { border-color: var(--zhu); }

.term-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
@media (max-width: 900px) {
  .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stele-grid { grid-template-columns: repeat(2, 1fr); }
  .stele-item:nth-child(4n) { border-right: 1px solid rgba(246, 242, 231, .14); }
  .stele-item:nth-child(2n) { border-right: 0; }
  .spine-wall { grid-template-columns: 1fr; gap: 32px; }
  .spines { height: 180px; }
}
@media (max-width: 600px) {
  .term-grid { grid-template-columns: 1fr; }
  .stele { padding: 52px 0 44px; }
  .stele-inner { padding: 0 24px; }
  .stele-grid { grid-template-columns: 1fr; }
  .stele-item { border-right: 0 !important; padding-right: 0; }
  .disc-toc-row { grid-template-columns: 40px 1fr 72px; gap: 12px; }
  .disc-toc-row .name { font-size: 19px; }
}


/* resolve legacy component overrides */
.stele-grid { border-left: 0; }
.spine { writing-mode: horizontal-tb; }
.spine .sn { writing-mode: horizontal-tb; }


/* anchor offset for sticky top bar */
section[id], .stele[id], #combo-relations { scroll-margin-top: 80px; }
@media (max-width: 600px) { section[id], .stele[id], #combo-relations { scroll-margin-top: 124px; } }


@media (max-width: 600px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .section-head .aside { white-space: normal; }
}


/* ---------- index collapse / rail ---------- */
.rail a { display: flex; justify-content: space-between; gap: 10px; color: inherit; width: 100%; }
.rail li { align-items: baseline; }
.rail li.active a { color: var(--ink); border-bottom: 1px solid var(--zhu); }
.group-head::before { content: "+"; font-family: var(--mono); font-size: 14px; color: var(--ink-3); width: 14px; text-align: center; }
details.group[open] > .group-head::before { content: "−"; color: var(--zhu); }
.group-count { margin-left: auto; }
.group-body { overflow-x: auto; }
details.group[id] { scroll-margin-top: 88px; }
@media (max-width: 900px) {
  .index-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .rail { position: static; }
  .rail h3 { display: none; }
  .rail ul { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
  .rail li { border-bottom: 0; white-space: nowrap; }
}
@media (max-width: 600px) {
  details.group[id] { scroll-margin-top: 124px; }
  .group-body { padding-left: 8px; }
}


/* keep index pages within the viewport on mobile */
.index-layout > * { min-width: 0; }
.rail { min-width: 0; }
.group-body { min-width: 0; }
@media (max-width: 900px) {
  .rail { overflow-x: auto; }
  .rail ul { width: max-content; min-width: 100%; }
}
@media (max-width: 600px) {
  .term-row .term-aliases { display: none; }
}

/* 彭道富纸墨设计的共用变量。只用于两个独立知识库。 */
html[data-reading-typography] {
  --paper: #f6f2e7;
  --paper-warm: #fffdf8;
  --paper-tint: #fcfaf3;
  --paper-deep: #efe9db;
  --surface: #fcfaf3;
  --hairline: #d2c9b7;
  --line: #b8ae9a;
  --rule: #b8ae9a;
  --rule-strong: #8a7f6b;
  --ink: #1c1917;
  --ink-2: #4a453e;
  --ink-3: #746d61;
  --ink-hover: #33312b;
  --canvas-dot: #dcd6c8;
  --zhu: #8f2a19;
  --zhu-soft: #f2e7e2;
  --stele: #1c1917;
  --on-stele: #f6f2e7;
  --green: #3f5d4b;
  --green-deep: #354e3f;
  --green-soft: #e8efe9;
  --amber: #8a5f28;
  --amber-soft: #f4ead8;
  --red: #8f2a19;
  --red-deep: #76220f;
  --red-soft: #f2e7e2;
  --blue: #485977;
  --blue-soft: #e8eaf0;
  --park: #6f685c;
  --brand: #506373;
  --ink-on-dark: #cfcabd;
  --d-strategy: #3f5d4b;
  --d-value: #485977;
  --d-cycle: #8a5f28;
  --d-longtou: #a8321f;
  --d-tactics: #7a5c3e;
  --d-mind: #6d5f75;
  --d-risk: #3b3631;
  --d-theme: #5e6b3a;
  --d-outer: #6f685c;
  --ink-dim: var(--ink-2);
  --ink-muted: var(--park);
  --ink-ghost: var(--canvas-dot);
  --bg: var(--paper);
  --card: var(--surface);
  --accent: var(--zhu);
  --accent-soft: var(--zhu-soft);
  --font-serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;
  --font-sans:
    "Source Sans 3", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  --font-mono:
    "JetBrains Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo,
    Consolas, monospace;
  --serif: var(--font-serif);
  --sans: var(--font-sans);
  --mono: var(--font-mono);
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;
  --s9: 56px;
  --s10: 80px;
  --s11: 88px;
  --max: 1200px;
  --gutter: 32px;
  --fs-display: clamp(32px, 4vw, 46px);
  --fs-h1: 40px;
  --fs-h2: 26px;
  --fs-h3: 18px;
  --fs-body: 16px;
  --fs-small: 13px;
  --fs-mono: 12px;
  --fs-micro: 11px;
  --fw-display: 400;
  --fw-h1: 600;
  --fw-h2: 600;
  --fw-h3: 600;
  --fw-body: 400;
  --fw-medium: 500;
  --fw-mono: 500;
  color-scheme: light;
}
html[data-reading-typography][data-theme="night"] {
  --paper: #1a1917;
  --paper-warm: #211f1d;
  --paper-tint: #232120;
  --paper-deep: #232120;
  --surface: #211f1d;
  --hairline: #332f2b;
  --line: #4a453e;
  --rule: #4a453e;
  --rule-strong: #6b6355;
  --ink: #e8e2d5;
  --ink-2: #a9a294;
  --ink-3: #948c7e;
  --ink-hover: #f2ece0;
  --park: #948c7e;
  --canvas-dot: #3a352f;
  --zhu: #d65c45;
  --zhu-soft: #2e211e;
  --stele: #0f0e0d;
  --on-stele: #e8e2d5;
  --green-soft: #1f2a24;
  --amber-soft: #2a2419;
  --red-soft: #2e211e;
  --blue-soft: #1f232c;
  --card: #211f1d;
  color-scheme: dark;
}
@media (max-width: 860px) {
  html[data-reading-typography] {
    --gutter: 24px;
    --fs-display: 44px;
    --fs-h1: 34px;
  }
}
@media (max-width: 620px) {
  html[data-reading-typography] {
    --gutter: 18px;
    --fs-display: 38px;
    --fs-h1: 30px;
    --fs-h2: 21px;
  }
}
/* 两站共用的阅读角色。明暗主题独立配对，不改变纸面、字级或布局。 */
html[data-reading-typography] {
  --reading-section: #485977;
  --reading-emphasis: #8f2a19;
  --reading-boundary: #7a5c3e;
  --reading-status: #3f5d4b;
}
html[data-reading-typography][data-theme="night"] {
  --reading-section: #b7c7df;
  --reading-emphasis: #e69b89;
  --reading-boundary: #c5b49d;
  --reading-status: #a8c7b6;
}
html[data-reading-typography] main h2,
html[data-reading-typography] main h3,
html[data-reading-typography] .field-label,
html[data-reading-typography] .criteria-name {
  color: var(--reading-section);
  font-weight: 600;
}
html[data-reading-typography] .field-label {
  font-size: 12px;
}
html[data-reading-typography] [data-reading-field="definition"] {
  font-weight: 500;
}
html[data-reading-typography] [data-reading-field="boundary"],
html[data-reading-typography] [data-reading-field="failure"] {
  color: var(--reading-boundary);
}
html[data-reading-typography] strong[data-reading-emphasis] {
  color: var(--reading-emphasis);
  font-weight: 600;
}
/* 首页沿用原先划出的两处“第一性”，只改呈现，不改引文。 */
html[data-reading-typography] .hero-quote .nb {
  color: var(--reading-emphasis);
  font-weight: 600;
}
/* 概念入口使用第二层强调，覆盖静态目录、关联卡与动态搜索结果。 */
html[data-reading-typography] main a[href^="/html/"][href*="/cards/"] {
  color: var(--reading-section);
}
html[data-reading-typography]
  :is(
    .rec-card > strong,
    .idx-row > .t,
    .card-row-main > strong,
    .card-link > span:first-child,
    .disc-row .covers,
    .rel-group a[href*="/cards/"],
    .edge-list a[href*="/cards/"],
    a.evidence-card,
    a.chip[href*="/cards/"],
    .search-result strong,
    .g-tip__name,
    .mgs__name
  ) {
  color: var(--reading-section);
  font-weight: 600;
}
html[data-reading-typography] #g-svg .g-node text {
  fill: var(--reading-section);
}
html[data-reading-typography] .search-result mark {
  color: var(--reading-emphasis);
  background: transparent;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
html[data-reading-typography]
  main
  :is(
    .source-read-link,
    .source-read,
    .source-list a,
    .src a,
    .reader-back,
    .reader-nav a
  ),
html[data-reading-typography] .reading-library-about a {
  color: var(--reading-section);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
html[data-reading-typography]
  main
  :is(
    .source-read-link,
    .source-read,
    .source-list a,
    .src a,
    .reader-back,
    .reader-nav a
  ):hover,
html[data-reading-typography] .reading-library-about a:hover {
  color: var(--reading-emphasis);
}
html[data-reading-typography] :is(.badge-full, .pver.on) {
  color: var(--reading-status);
  border-color: var(--reading-status);
}
/* 量化策略知识库：在原有结构上应用 DESIGN.md 的纸墨规范。 */
html[data-strategies-design] {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html[data-strategies-design] body {
  font: 16px/1.75 var(--font-sans);
  overflow-x: clip;
}
html[data-strategies-design] :is(h1, h2, h3, h4) {
  font-family: var(--font-serif);
  overflow-wrap: anywhere;
}
html[data-strategies-design] .topbar-inner {
  height: auto;
  min-height: 72px;
  gap: 24px;
  padding: 0 var(--gutter);
}
html[data-strategies-design] .brand {
  order: 0;
  flex: none;
  font: 600 18px/1.3 var(--font-sans);
  letter-spacing: -0.02em;
}
html[data-strategies-design] .search-btn {
  order: 0;
  flex: 1;
  min-width: 44px;
  max-width: 560px;
  height: 44px;
  gap: 12px;
  padding: 0 16px;
  margin: 0;
  font: 13px/1.4 var(--font-sans);
  color: var(--ink-2);
}
html[data-strategies-design] .search-btn .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-strategies-design] .search-btn .key {
  flex: none;
  font-family: var(--font-mono);
}
html[data-strategies-design] .nav {
  order: 0;
  flex: none;
  min-width: 0;
  gap: 18px;
}
html[data-strategies-design] .lang-switch {
  order: 0;
  flex: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
html[data-strategies-design] #strategies-menu {
  display: none;
}
html[data-strategies-design] #theme-toggle {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  width: auto;
  min-height: 44px;
  padding: 9px 14px;
  font: 11px/1.5 var(--font-mono);
  background: var(--paper);
  color: var(--ink-2);
}
html[data-strategies-design]
  :is(.hero, .section, .wrap, .footer .wrap, .stele-inner) {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
html[data-strategies-design] .hero {
  padding-top: 96px;
  padding-bottom: 0;
}
html[data-strategies-design] .hero h1 {
  text-wrap: balance;
  font: 400 clamp(28px, 4vw, 46px)/1.52 var(--font-serif);
  max-width: 18em;
}
html[data-strategies-design] .hero .lead {
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font: 14px/1.9 var(--font-sans);
}
html[data-strategies-design] .home-stats {
  margin-top: 96px;
  padding: 28px 0;
}
html[data-strategies-design] .home-stats .stat {
  padding: 0 0 0 20px;
  border: 0;
  border-left: 1px solid var(--hairline);
}
html[data-strategies-design] .home-stats .stat:first-child {
  padding-left: 0;
  border-left: 0;
}
html[data-strategies-design] .stat b {
  font: 500 22px/1.1 var(--font-mono);
}
html[data-strategies-design] .stat span {
  display: block;
  margin-top: 8px;
}
html[data-strategies-design] .section {
  padding-top: 64px;
  padding-bottom: 24px;
  border-top: 0;
}
html[data-strategies-design] .section-head {
  margin-bottom: 32px;
  gap: 24px;
}
html[data-strategies-design] .section-head h1 {
  font-size: var(--fs-h1);
  font-weight: 400;
}
html[data-strategies-design] .side-title {
  color: var(--reading-section);
}
html[data-strategies-design]
  :is(
    .term-name,
    .recipe-name,
    .entry-title,
    .strategy-title,
    .search-result strong,
    .today-title,
    .term-chip,
    .pipeline-head
  ) {
  color: var(--reading-section);
}
html[data-strategies-design]
  :is(
    .entry-desc,
    .strategy-meta,
    .term-aliases,
    .term-meta,
    .note,
    .small,
    .muted
  ) {
  overflow-wrap: anywhere;
}
html[data-strategies-design] .boundary {
  color: var(--reading-boundary);
}
html[data-strategies-design] .badge--favored {
  color: var(--reading-status);
  border-color: var(--reading-status);
}
html[data-strategies-design] .badge--inferred {
  color: var(--reading-boundary);
  border-color: var(--reading-boundary);
}
html[data-strategies-design] .stele .section-head h2 {
  color: var(--on-stele);
}
html[data-strategies-design] .stele .section-head .aside {
  color: var(--ink-on-dark);
}
html[data-strategies-design] .strategy-section {
  max-width: 48em;
}
html[data-strategies-design] .strategy-section :is(p, li) {
  font: 16px/1.9 var(--font-sans);
}
html[data-strategies-design] .strategy-main,
.term-main,
.strategy-side,
.term-side,
.pipeline-col,
.entry-card {
  min-width: 0;
}
html[data-strategies-design] .strategy-layout,
.term-layout {
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 48px;
}
html[data-strategies-design] .code-block code {
  font-family: var(--font-mono);
  font-size: 12px;
}
html[data-strategies-design] .code-block {
  max-width: 100%;
}
html[data-strategies-design]
  :is(.copy-btn, .filter-reset, .load-more, .search-scope button) {
  min-height: 44px;
}
html[data-strategies-design] .search-box {
  width: min(680px, calc(100% - 36px));
  background: var(--surface);
  padding: 20px;
}
html[data-strategies-design] .search-box input {
  font: 26px/1.3 var(--font-sans);
}
html[data-strategies-design] .search-result {
  padding: 12px 0;
}
html[data-strategies-design] .search-result .snippet {
  font: 13px/1.75 var(--font-sans);
}
html[data-strategies-design] :is(input, select) {
  max-width: 100%;
  min-width: 0;
}
html[data-strategies-design] .strategy-side {
  overflow-wrap: anywhere;
}
html[data-strategies-design] .kb-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 16px;
}
html[data-strategies-design] .kb-table-scroll > .data-table {
  width: 100%;
}
html[data-strategies-design] .disc-toc-row .n {
  white-space: normal;
}
html[data-strategies-design] .disc-toc-row .n em {
  display: block;
  margin-left: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
html[data-strategies-design] #graph-svg {
  background: var(--paper);
}
html[data-strategies-design] .g-label {
  fill: var(--reading-section);
}
html[data-strategies-design] .publication-note {
  max-width: 1200px;
  padding: 24px var(--gutter) 0;
  margin: 32px auto 0;
  border-top: 1px solid var(--rule);
  font: 12px/1.8 var(--font-sans);
  color: var(--ink-3);
}
html[data-strategies-design] .publication-note a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
html[data-strategies-design]
  :is(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--zhu);
  outline-offset: 3px;
}
@media (max-width: 900px) {
  html[data-strategies-design] .home-stats {
    row-gap: 28px;
  }
  html[data-strategies-design] .topbar-inner {
    gap: 16px;
  }
  html[data-strategies-design] .search-btn {
    flex: none;
    width: 44px;
    padding: 0;
    min-width: 44px;
    justify-content: center;
    border: 0;
    background: transparent;
  }
  html[data-strategies-design] .search-btn :is(.label, .key) {
    display: none;
  }
  html[data-strategies-design] .strategy-layout,
  html[data-strategies-design] .term-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  html[data-strategies-design] .home-stats .stat:nth-child(4) {
    padding-left: 0;
    border-left: 0;
  }
}
@media (max-width: 640px) {
  html[data-strategies-design] .topbar-inner {
    min-height: 64px;
    flex-wrap: nowrap;
  }
  html[data-strategies-design] .brand {
    margin-right: auto;
    font-size: 16px;
    max-width: 55%;
  }
  html[data-strategies-design] .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    padding: 12px var(--gutter);
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    margin: 0;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
  }
  html[data-strategies-design] .nav[data-open="true"] {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  html[data-strategies-design] .nav a {
    min-height: 44px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 16px;
  }
  html[data-strategies-design] #strategies-menu {
    display: flex;
    flex: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
  }
  html[data-strategies-design] #strategies-menu span {
    width: 18px;
    height: 1.5px;
    background: var(--ink);
  }
  html[data-strategies-design] #theme-toggle {
    bottom: max(14px, env(safe-area-inset-bottom));
    right: 14px;
  }
}
@media (max-width: 600px) {
  html[data-strategies-design] .hero {
    padding-top: 72px;
  }
  html[data-strategies-design] .hero h1 {
    font-size: 26px;
    line-height: 1.62;
  }
  html[data-strategies-design] .section {
    padding-top: 48px;
  }
  html[data-strategies-design] .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }
  html[data-strategies-design] .section-head .aside {
    white-space: normal;
  }
  html[data-strategies-design] .home-stats .stat {
    padding-left: 20px;
    border-left: 1px solid var(--hairline);
  }
  html[data-strategies-design] .home-stats .stat:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }
  html[data-strategies-design] .entry-desc {
    min-height: 0;
  }
  html[data-strategies-design] .search-box input {
    font-size: 21px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-strategies-design] {
    scroll-behavior: auto;
  }
  html[data-strategies-design] *,
  html[data-strategies-design] *::before,
  html[data-strategies-design] *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
