:root {
  color-scheme: light;
  --ink: #17223b;
  --muted: #5f6b82;
  --paper: #f7f4ec;
  --surface: #fffdf8;
  --blue: #174ea6;
  --blue-dark: #103b7e;
  --cyan: #dcebf7;
  --line: #d8deea;
  --good: #207567;
  --preview: #3c6fb6;
  --check: #aa6b16;
  --missing: #a84444;
  --shadow: 0 18px 45px rgba(23, 34, 59, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.65;
}

a { color: var(--blue); text-underline-offset: 0.2em; }
a:hover { color: var(--blue-dark); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 1rem;
  background: #fff;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.page-header {
  position: relative;
  overflow: hidden;
  color: white;
  background: #113b79;
}

.page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background-image:
    linear-gradient(115deg, transparent 34%, rgba(255,255,255,.15) 34.2%, transparent 34.5%),
    repeating-linear-gradient(90deg, transparent 0 86px, rgba(255,255,255,.07) 87px 88px),
    repeating-linear-gradient(0deg, transparent 0 86px, rgba(255,255,255,.05) 87px 88px);
}

.page-header::after {
  content: "∠  π  x²";
  position: absolute;
  right: max(2rem, calc((100vw - 1180px) / 2));
  bottom: -1.8rem;
  color: rgba(255,255,255,.08);
  font: 700 clamp(5rem, 12vw, 10rem)/1 Georgia, serif;
  letter-spacing: .08em;
}

.header-inner,
main,
footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.header-inner {
  position: relative;
  z-index: 1;
  padding: 4.6rem 0 3.5rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 .85rem;
  color: #8dd5e9;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .15em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin-bottom: 1.2rem;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  line-height: 1.06;
  letter-spacing: -.045em;
}

h1 span { color: #cce8f2; }

.lede {
  max-width: 680px;
  margin-bottom: 2rem;
  color: #dce8f8;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 150px));
  gap: 1px;
  width: fit-content;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: .5rem;
  background: rgba(255,255,255,.2);
}

.summary div {
  display: grid;
  padding: .8rem 1rem;
  background: rgba(10, 40, 90, .5);
}

.summary strong { font-size: 1.35rem; }
.summary span { color: #bdd0ec; font-size: .74rem; }

main { padding: 3rem 0 2rem; }

.scope-note,
.evidence-section {
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(0, 1.55fr);
  gap: 3rem;
  padding: 0 0 2.8rem;
}

.scope-note h2,
.table-heading h2,
.evidence-section h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -.03em;
}

.scope-note .section-kicker,
.table-heading .section-kicker,
.evidence-section .section-kicker { color: var(--blue); }
.scope-copy { color: var(--muted); }
.scope-copy p:last-child { margin-bottom: 0; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(160px, .75fr) minmax(160px, .75fr) auto;
  gap: .8rem;
  align-items: end;
  margin-bottom: 1.15rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: rgba(255,255,255,.66);
}

.toolbar label { display: grid; gap: .35rem; }
.toolbar label > span { color: var(--muted); font-size: .74rem; font-weight: 700; }

input, select, button {
  min-height: 44px;
  border: 1px solid #bfc8d8;
  border-radius: .35rem;
  background: white;
  color: var(--ink);
  font: inherit;
}

input, select { width: 100%; padding: .62rem .72rem; }
button { padding: .58rem .95rem; cursor: pointer; }
button:hover { border-color: var(--blue); color: var(--blue); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid #f2b94b;
  outline-offset: 2px;
}

.result-count {
  grid-column: 1 / -1;
  margin: -.15rem 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.table-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  padding: 1.35rem 1.45rem;
  border-bottom: 1px solid var(--line);
}

.legend { display: flex; flex-wrap: wrap; gap: .85rem; color: var(--muted); font-size: .76rem; }
.dot { display: inline-block; width: .55rem; height: .55rem; margin-right: .25rem; border-radius: 50%; }
.dot-good { background: var(--good); }
.dot-preview { background: var(--preview); }
.dot-check { background: var(--check); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
thead { background: #edf2f8; }
th { color: #44516a; font-size: .72rem; letter-spacing: .04em; text-align: left; }
th, td { padding: 1rem .72rem; border-bottom: 1px solid #e5e9f0; vertical-align: top; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
thead th:first-child, tbody th[scope="row"] { width: 56px; text-align: center; }
th:nth-child(2) { min-width: 200px; }
th:nth-child(3) { min-width: 150px; }
th:nth-child(4), th:nth-child(5), th:nth-child(6) { min-width: 220px; }
th:nth-child(7) { min-width: 240px; }

.index-number {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid #bfd0e4;
  border-radius: 50%;
  color: var(--blue);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.book-path { display: block; color: var(--muted); font-size: .72rem; }
.topic-name { display: block; margin: .15rem 0 .35rem; font-size: 1rem; line-height: 1.35; }
.legacy-label { display: inline-block; padding: .12rem .36rem; border-radius: .25rem; background: #eaf0f8; color: #51617a; font-size: .68rem; }

.resource-link {
  display: inline-block;
  font-weight: 700;
  line-height: 1.38;
  text-decoration-thickness: 1px;
}
.resource-kind {
  display: block;
  width: fit-content;
  margin-bottom: .28rem;
  padding: .06rem .32rem;
  border: 1px solid #c8d4e4;
  border-radius: .2rem;
  color: #5a6880;
  background: #f2f6fb;
  font-size: .62rem;
  font-weight: 800;
}
.kind-verified { color: #155c51; border-color: #9acbc0; background: #e5f5f0; }
.resource-meta { display: block; margin-top: .25rem; color: var(--muted); font-size: .69rem; line-height: 1.35; }
.missing-link { color: var(--missing); font-size: .78rem; }
.problem-text, .chain-evidence { margin: .35rem 0; color: #334057; line-height: 1.55; }
.chain-evidence { font-size: .78rem; }

details { max-width: 280px; }
summary { color: var(--blue); font-weight: 700; cursor: pointer; }
details p { margin: .55rem 0 0; color: #3e4b62; }
.answer { color: var(--good); font-size: .78rem; }
.original-note { display: block; margin-top: .35rem; color: var(--muted); font-size: .66rem; }

.status-stack { display: grid; gap: .35rem; }
.badge { display: inline-flex; width: fit-content; align-items: center; gap: .3rem; padding: .16rem .42rem; border-radius: .25rem; font-size: .67rem; font-weight: 800; }
.badge-readable { color: #155c51; background: #dff2ed; }
.badge-preview { color: #27588f; background: #e2edf9; }
.badge-check { color: #7d4c0f; background: #faecd6; }
.badge-missing { color: #8b3333; background: #f8e1e1; }
.badge-verified { color: #155c51; background: #dff2ed; }

.empty-state { padding: 4rem 1rem; text-align: center; }
.empty-state p { color: var(--muted); }

.evidence-section { margin-top: 4rem; padding-bottom: 3rem; }
.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.evidence-grid article { padding: 1.35rem; background: var(--surface); }
.evidence-grid article > span { color: var(--blue); font: 700 .78rem/1 Georgia, serif; }
.evidence-grid h3 { margin: .55rem 0 .35rem; }
.evidence-grid p { color: var(--muted); font-size: .85rem; }
.evidence-grid a { font-size: .78rem; font-weight: 700; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0 2.5rem;
  border-top: 1px solid #ccd3df;
  color: var(--muted);
  font-size: .76rem;
}
footer p { margin-bottom: 0; }

@media (max-width: 850px) {
  .scope-note, .evidence-section { grid-template-columns: 1fr; gap: 1.25rem; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .summary { grid-template-columns: repeat(2, minmax(110px, 1fr)); width: min(100%, 420px); }
  .table-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 680px) {
  .header-inner { padding: 3.2rem 0 2.7rem; }
  .toolbar { grid-template-columns: 1fr; }
  .search-field, .result-count { grid-column: auto; }
  .evidence-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }

  table, thead, tbody, th, td, tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody { padding: .35rem .8rem; }
  tbody tr { padding: .85rem 0; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td, tbody th[scope="row"] { display: grid; grid-template-columns: 90px 1fr; width: auto; padding: .4rem .3rem; border: 0; text-align: left; }
  td::before, tbody th[scope="row"]::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; }
  .index-number { width: auto; height: auto; place-items: start; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .page-header { background: white; color: black; }
  .page-header::before, .page-header::after, .toolbar, .skip-link { display: none; }
  .eyebrow, h1 span, .lede { color: black; }
  .summary { border-color: #999; }
  .summary div { background: white; color: black; }
  .table-section { box-shadow: none; }
  a { color: black; }
}
