: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: "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: "PingFang SC", "Source Sans 3", "Heiti SC", sans-serif;
  --mono: "SF Mono", "JetBrains 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; }
  .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; } }

.publication-note{max-width:1200px;margin:28px auto 0;padding:0 32px;font-family:var(--sans);font-size:12px;line-height:1.8;color:var(--ink-3)}.publication-note a{text-decoration:underline}
