/* 颜色取自 dataviz 参考调色板；强度用单一蓝色序列（浅/深色模式分别校验过）。 */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #256abf;
  --pip: #256abf;
  --s1: #86b6ef; --s1-ink: #0b0b0b;
  --s2: #5598e7; --s2-ink: #0b0b0b;
  --s3: #256abf; --s3-ink: #ffffff;
  --s4: #104281; --s4-ink: #ffffff;
  --warn: #fab219;
  --good: #0ca30c;
  --critical: #d03b3b;
  --chip: #f0efec;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #86b6ef;
    --pip: #3987e5;
    --s1: #184f95; --s1-ink: #ffffff;
    --s2: #256abf; --s2-ink: #ffffff;
    --s3: #3987e5; --s3-ink: #0b0b0b;
    --s4: #86b6ef; --s4-ink: #0b0b0b;
    --chip: #262624;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; line-height: 1.3; margin: 1.2rem 0 .4rem; }
h1 small { font-size: 1rem; color: var(--muted); font-weight: 400; }
h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; padding-top: .4rem; border-top: 1px solid var(--grid); }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
p { margin: .5rem 0; }
code { font-size: .92em; background: var(--chip); padding: 0 .3em; border-radius: 4px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.lead { color: var(--ink-2); font-size: 1.05rem; }
.note { color: var(--ink-2); font-size: .95rem; }
.todo { color: var(--muted); font-size: .9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.code { display: inline-block; min-width: 1.5em; margin-right: .25em; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* 页眉 */
.site-header { background: var(--surface); border-bottom: 1px solid var(--grid); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); white-space: nowrap; }
.nav { display: flex; gap: 14px; flex-wrap: wrap; }
.nav a { color: var(--ink-2); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.search { position: relative; margin-left: auto; }
.search input { width: 220px; padding: 6px 10px; border: 1px solid var(--axis); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; font-size: .95rem; }
.search-results { position: absolute; right: 0; top: calc(100% + 4px); width: 340px; max-height: 60vh; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--grid); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.search-results a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink); }
.search-results a:hover, .search-results a:focus, .search-results a.active { background: var(--chip); text-decoration: none; }
.search-results .kind { display: inline-block; min-width: 3.2em; font-size: .8rem; color: var(--muted); }
.search-results small { color: var(--muted); }
.search-results .none { padding: 6px 8px; color: var(--muted); }
.toggle { font-size: .9rem; color: var(--ink-2); white-space: nowrap; cursor: pointer; }

/* 首页 */
.stats { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 0; list-style: none; color: var(--ink-2); }
.stats b { color: var(--ink); font-size: 1.1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; color: var(--ink); }
.card:hover { border-color: var(--axis); text-decoration: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.card .muted { font-size: .9rem; }
.card-title { font-weight: 600; }
.card-title small { color: var(--muted); font-weight: 400; }
.card-meta { font-size: .85rem; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: .82rem; }
a.tag:hover { text-decoration: none; color: var(--ink); }
.tag-muted { color: var(--muted); }
.ifm { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.ifm dt { font-weight: 600; }
.ifm dd { margin: 0; }

/* 记号 */
.meter { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.meter i { width: 9px; height: 14px; border-radius: 3px; border: 1px solid var(--axis); }
.meter i.on { background: var(--pip); border-color: var(--pip); }
.meter b { margin-left: 4px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.chip { display: inline-block; padding: 0 7px; border-radius: 6px; background: var(--chip); color: var(--ink-2); font-size: .85rem; white-space: nowrap; }
.chip.ev { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-2); white-space: nowrap; }
.status i { font-style: normal; display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; font-size: .78rem; }
.st-draft i { background: var(--warn); color: #0b0b0b; }
.st-sourced i { background: var(--chip); color: var(--ink); border: 1px solid var(--axis); }
.st-reviewed i { background: var(--good); color: #ffffff; }
.flag { display: inline-block; padding: 0 6px; margin-left: 4px; border: 1px solid var(--axis); border-radius: 6px; font-size: .78rem; color: var(--ink-2); }
.flag-warn { border-color: var(--critical); }
.refstate { font-size: .8rem; color: var(--muted); }
.rs-ok::before { content: "✓ "; color: var(--good); }
.rs-mismatch::before, .rs-not_found::before { content: "✗ "; color: var(--critical); }
.rs-unverified::before, .rs-stale::before { content: "○ "; }

/* 页面结构 */
.crumbs { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.callout { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; }
.forms dt { font-weight: 600; margin-top: .4rem; }
.forms dd { margin: 0 0 .3rem 0; color: var(--ink-2); }
.group { margin-bottom: 1rem; }
.group h3 a { color: var(--ink); }
.link-card { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 12px 16px; margin: 8px 0; }
.link-card header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: center; }
.link-mech { font-weight: 600; color: var(--ink); }
.scores { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .9rem; }
.cite { font-size: .8rem; margin-left: 2px; vertical-align: super; }
.cautions li { margin: .3rem 0; }
.refs { padding-left: 1.6rem; }
.refs li { margin: .6rem 0; }
.refs li > * { margin-right: 6px; }
.ref-title { display: block; color: var(--ink); }
.ref-note { font-size: .9rem; color: var(--ink-2); margin-top: 2px; }
.ref-mini { padding-left: 1.2rem; font-size: .9rem; }
.mech-list { display: grid; gap: 10px; margin-top: 1rem; }
.mech-row { background: var(--surface); border: 1px solid var(--grid); border-radius: 12px; padding: 12px 16px; }
.mech-row h2 { border: 0; margin: 0 0 .2rem; padding: 0; font-size: 1.08rem; }
.mini-links { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
.plain th, .plain td, .links-table th, .links-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.plain th[scope="row"] { white-space: nowrap; font-weight: 600; }
.links-table thead th { font-size: .85rem; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--axis); }
.links-table tbody tr:first-child th, .links-table tbody tr:first-child td { border-bottom: 0; }
.links-table th[scope="row"] { font-weight: 600; }
.links-table .cond { font-size: .88rem; color: var(--ink-2); }
.links-table .detail td { padding-top: 0; }
.links-table details summary { cursor: pointer; color: var(--accent); font-size: .9rem; }

/* 矩阵 */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: .6rem 0; font-size: .9rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cell-swatch { display: inline-grid; place-items: center; width: 26px; height: 22px; border-radius: 4px; font-size: .8rem; font-weight: 600; }
.matrix { width: auto; border-collapse: separate; border-spacing: 2px; background: transparent; }
.matrix th { font-weight: 500; font-size: .85rem; color: var(--ink-2); padding: 4px 6px; text-align: center; }
.matrix th[scope="row"] { text-align: left; white-space: nowrap; padding-right: 12px; }
.matrix th[scope="row"] a { color: var(--ink); }
.matrix .corner { text-align: left; }
.cell { width: 34px; height: 30px; text-align: center; font-size: .85rem; font-weight: 600; border-radius: 4px; font-variant-numeric: tabular-nums; }
.cell[data-tip] { cursor: default; }
.cell[data-tip]:hover, .cell[data-tip]:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--grid); }
.s0 { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--axis); }
.s1 { background: var(--s1); color: var(--s1-ink); }
.s2 { background: var(--s2); color: var(--s2-ink); }
.s3 { background: var(--s3); color: var(--s3-ink); }
.s4 { background: var(--s4); color: var(--s4-ink); }
.code-key { columns: 3 220px; padding-left: 0; list-style: none; }
.tip { position: fixed; z-index: 50; max-width: 380px; padding: 8px 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--axis); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); font-size: .85rem; line-height: 1.5; white-space: pre-line; pointer-events: none; }

/* 打分规则页 */
.prose table { margin: .6rem 0; }
.prose th, .prose td { border-bottom: 1px solid var(--grid); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose h1 { display: none; }

/* 只看已核 */
.hide-draft .is-draft { display: none; }

.site-footer { margin-top: 3rem; padding: 1.2rem 0 2rem; border-top: 1px solid var(--grid); font-size: .88rem; color: var(--ink-2); }

@media (max-width: 720px) {
  .site-header { position: static; }
  .header-inner { gap: 6px 14px; padding-top: 8px; padding-bottom: 8px; }
  .search { margin-left: 0; flex: 1 1 60%; }
  .search input { width: 100%; }
  .search-results { width: 100%; }
  h1 { font-size: 1.45rem; }
}
@media (forced-colors: active) {
  .meter i.on { background: CanvasText; }
  .cell { border: 1px solid CanvasText; }
}
