/* =====================================================================
   升学数据研究 · High-Density Empirical Data Stylesheet
   ===================================================================== */
:root {
  --paper: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #141413;
  --ink-2: #353532;
  --muted: #6b6a65;
  --line: #d8d5cc;
  --line-2: #e8e5dc;
  --hs: #0f6b58;
  --hs-2: #1f8a73;
  --hs-soft: #e6f2ee;
  --col: #283891;
  --col-2: #4355b8;
  --col-soft: #eaecf8;
  --cn: #9e2a2b;
  --cn-2: #b83a3b;
  --cn-soft: #f9ecec;
  --truth: #c84b15;
  --truth-soft: #fbece5;
  --pri: #78358a;
  --pri-soft: #f4ebf7;
  --accent: var(--ink);
  --accent-2: #4a4a46;
  --accent-soft: #eae8e1;
  --r: 5px;
  --serif: "Newsreader", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1340px;
}
body.hs  { --accent: var(--hs);  --accent-2: var(--hs-2);  --accent-soft: var(--hs-soft); }
body.col { --accent: var(--col); --accent-2: var(--col-2); --accent-soft: var(--col-soft); }
body.cn  { --accent: var(--cn);  --accent-2: var(--cn-2);  --accent-soft: var(--cn-soft); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 38%, transparent);
}
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0; font-weight: 650; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 2.4vw, 2rem); letter-spacing: -.015em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.15rem, 1.7vw, 1.35rem); letter-spacing: -.01em; }
h3 { font-size: .92rem; font-weight: 650; margin: 0 0 .35rem; }
p { margin: .35rem 0; }
b, strong { font-weight: 650; color: var(--ink); }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .86em; }
.num, .tnum { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }

/* ---------- top bar ---------- */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 60; background: var(--accent); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 245, 240, .95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 46px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: .98rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent);
  display: inline-block;
}
body.home .brand::before { background: linear-gradient(135deg, var(--hs) 33%, var(--col) 33%, var(--col) 66%, var(--cn) 66%); }
.topnav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.topnav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
}
.topnav a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
body.home .topnav a.active { background: var(--ink); color: #fff; }

.subnav-wrap { border-top: 1px solid var(--line-2); background: rgba(250, 249, 245, .92); }
.subnav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 32px;
  align-items: center;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: .78rem;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- layout & masthead ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.masthead { padding: 22px 0 18px; border-bottom: 1px solid var(--line); }
.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}
.masthead .lead {
  font-size: .88rem;
  color: var(--ink-2);
  max-width: 980px;
  margin: 6px 0 0;
  line-height: 1.55;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  gap: 14px;
}
.kpi { padding-left: 12px; border-left: 2px solid var(--line); }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi .n {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi .n span { font-size: .76rem; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .l { font-size: .75rem; color: var(--muted); margin-top: 2px; }

.sec { padding: 24px 0; border-bottom: 1px solid var(--line); }
.sec:last-of-type { border-bottom: 0; }
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sec-head .sub { font-size: .8rem; color: var(--muted); margin: 0; font-family: var(--mono); }
.sec-label {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--accent);
  font-weight: 600;
  margin-right: 7px;
}

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-12 { grid-template-columns: 1.15fr 1fr; }
.g-32 { grid-template-columns: 1fr 1.35fr; align-items: start; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
}
.panel.flush { padding: 0; overflow: hidden; }

/* ---------- controls & toolbars ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.seg {
  display: inline-flex;
  background: #eae7df;
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 3px;
  font: inherit;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-2);
}
.seg button:hover { color: var(--ink); }
.seg button.on {
  background: var(--surface);
  color: var(--accent);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.search { position: relative; flex: 0 1 210px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: .8rem;
  padding: 5px 9px 5px 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  outline: none;
}
.search input:focus, select.sel:focus { border-color: var(--accent); }
.search::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6d68' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
select.sel {
  font: inherit;
  font-size: .84rem;
  font-weight: 500;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6d68' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center/13px;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  outline: none;
  cursor: pointer;
}
.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--muted);
  align-items: center;
  margin-left: auto;
}
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.legend i.bar { width: 13px; height: 5px; border-radius: 2px; opacity: .32; }
.legend i.tk { width: 2.5px; height: 10px; border-radius: 1px; vertical-align: -1px; }
.count { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.tabnote {
  font-size: .76rem;
  font-family: var(--mono);
  color: var(--muted);
  padding: 6px 14px;
  background: #f4f2ec;
  border-bottom: 1px solid var(--line-2);
}

/* ---------- tables ---------- */
.tablewrap { overflow: auto; max-height: 620px; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
table.data th, table.data td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
table.data.dense th, table.data.dense td { padding: 4px 5px; font-size: .75rem; }
table.data.dense td.num { font-size: .74rem; }
table.data thead th {
  position: sticky;
  top: 0;
  background: #f4f2ec;
  z-index: 2;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  font-size: .72rem;
  border-bottom: 1px solid var(--line);
}
table.data thead th:hover { color: var(--ink); }
table.data thead th.sorted { color: var(--accent); }
table.data thead th.sorted::after { content: " ↓"; }
table.data thead th.sorted.asc::after { content: " ↑"; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: .78rem; }
table.data th.num { font-family: var(--sans); font-size: .72rem; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data.clickable tbody tr { cursor: pointer; }
table.data tbody tr.active-row { background: var(--accent-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.name { white-space: nowrap; font-family: var(--sans); }
table.data td.name b { font-weight: 600; display: inline; }
table.data td.name small { display: inline; margin-left: 6px; font-size: .72rem; color: var(--muted); }
table.data td small { font-size: .7rem; color: var(--muted); font-family: var(--mono); }

.rk {
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rk.t1, .rk.t2, .rk.t3 { color: var(--ink); font-weight: 700; }

.tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: .68rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: #eeece5;
  color: var(--ink-2);
  font-weight: 500;
}
.tag.pri { background: var(--pri-soft); color: var(--pri); }
.tag.pub { background: var(--hs-soft); color: var(--hs); }
.tag.lac { background: #faefe0; color: #8c510a; }
.tag.uni { background: var(--col-soft); color: var(--col); }
.tag.tier1 { background: #fee2e2; color: #991b1b; font-weight: 600; }
.tag.tier2 { background: #ffedd5; color: #9a3412; font-weight: 600; }
.tag.tier3 { background: #fef9c3; color: #854d0e; font-weight: 600; }
.tag.tier4 { background: #dcfce7; color: #166534; font-weight: 600; }
.tag.tier5 { background: #d1fae5; color: #065f46; font-weight: 600; }
.tag.tier6 { background: #e0f2fe; color: #075985; font-weight: 600; }
.up { color: #117a43; font-size: .78em; }
.down { color: #b83227; font-size: .78em; }
.truth { color: var(--truth); font-weight: 650; }

.rbar { position: relative; height: 12px; width: 72px; }
.rbar::before { content: ""; position: absolute; left: 0; right: 0; top: 5.5px; height: 1.5px; background: var(--line); }
.rbar .seg2 { position: absolute; top: 3px; height: 6px; background: var(--accent); opacity: .24; border-radius: 2px; }
.rbar .dot { position: absolute; top: 2.5px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.2px #fff; }
.rbar .tru { position: absolute; top: 1px; width: 2px; height: 10px; margin-left: -1px; background: var(--truth); }
.rcell { display: flex; align-items: center; gap: 5px; }
.rcell small { min-width: 52px; }

/* ---------- inspector strip (9-campus & destinations) ---------- */
.inspector {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
}
.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.inspector-head h4 { font-size: .88rem; font-weight: 650; }
.inspector-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }
table.camp { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .74rem; background: var(--surface); border: 1px solid var(--line-2); }
table.camp th, table.camp td { padding: 4px 6px; border: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; }
table.camp th:first-child, table.camp td:first-child { text-align: left; font-family: var(--sans); font-weight: 600; color: var(--ink-2); background: #f7f6f1; }
table.camp thead th { background: #f4f2ec; color: var(--muted); font-weight: 600; }
.dest-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.dest-pill {
  font-family: var(--mono);
  font-size: .74rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
}
.dest-pill.el { border-color: var(--hs); background: var(--hs-soft); color: var(--hs); font-weight: 600; }

/* ---------- 2D cross-admit matrix ---------- */
.matrix-wrap { overflow: auto; max-height: 640px; }
table.matrix { border-collapse: separate; border-spacing: 0; font-family: var(--mono); font-size: .72rem; width: 100%; }
table.matrix th, table.matrix td {
  padding: 4px 4px;
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  text-align: center;
  min-width: 36px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.matrix thead th {
  position: sticky;
  top: 0;
  background: #f4f2ec;
  z-index: 3;
  font-weight: 600;
  color: var(--ink-2);
  font-size: .7rem;
}
table.matrix tbody th {
  position: sticky;
  left: 0;
  background: #f4f2ec;
  z-index: 2;
  text-align: left;
  padding: 4px 8px;
  font-weight: 600;
  color: var(--ink);
  border-right: 1px solid var(--line);
}
table.matrix thead th:first-child { left: 0; z-index: 4; text-align: left; padding-left: 8px; border-right: 1px solid var(--line); }
table.matrix td.diag { background: #eae7df; color: var(--muted); }
table.matrix td.cell { cursor: pointer; }
table.matrix td.cell:hover { outline: 1.5px solid var(--ink); z-index: 1; position: relative; }
table.matrix td.mod { color: var(--muted); font-style: italic; }

/* ---------- spec & parameter tables ---------- */
table.spec { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.spec th, table.spec td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
table.spec th { color: var(--muted); font-weight: 600; font-size: .74rem; background: #f7f6f1; }
table.spec td.num, table.spec th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.spec tr:last-child td { border-bottom: 0; }

/* ---------- charts & tooltips ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 11px; fill: var(--muted); }
.chart .lbl { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.chart .axt { font-weight: 600; fill: var(--ink-2); font-size: 11px; }
.chart .gl { stroke: var(--line-2); }
.chart circle.pt { transition: r .12s, fill-opacity .12s; cursor: pointer; }
.chart circle.pt:hover { fill-opacity: 1; }
.tip {
  position: fixed;
  pointer-events: none;
  background: rgba(20, 20, 19, .95);
  color: #fff;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: .76rem;
  line-height: 1.5;
  max-width: 300px;
  z-index: 80;
  opacity: 0;
  transition: opacity .08s;
}
.tip.on { opacity: 1; }
.tip b { color: #fff; }

/* ---------- calculator workbench ---------- */
.calc-box { display: flex; flex-direction: column; gap: 12px; }
.eq-bar {
  font-family: var(--mono);
  font-size: .78rem;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--ink-2);
  overflow-x: auto;
}
.slider { margin-bottom: 2px; }
.slider .lab { display: flex; justify-content: space-between; align-items: baseline; font-size: .8rem; color: var(--ink-2); margin-bottom: 3px; }
.slider .lab b { font-family: var(--mono); font-size: .95rem; color: var(--accent); font-weight: 700; }
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line) var(--p, 50%));
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  cursor: pointer;
}
.presets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.presets .pl { font-size: .74rem; color: var(--muted); margin-right: 2px; }
.pchip {
  font: inherit;
  font-size: .74rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 2px 7px;
  cursor: pointer;
  color: var(--ink-2);
}
.pchip:hover { border-color: var(--accent); color: var(--accent); }
.pchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.calc-out {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 12px 14px;
}
.calc-out-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.calc-out .v { font-family: var(--mono); font-size: 1.85rem; font-weight: 700; color: var(--accent); line-height: 1; }
.calc-out .ci { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); }
.strip { margin-top: 8px; }
.strip .cap { font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 2px; }
.calc-detail { font-family: var(--mono); font-size: .74rem; color: var(--muted); line-height: 1.5; }

/* ---------- head to head ---------- */
.h2h-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.vs { font-family: var(--mono); font-weight: 700; color: var(--muted); font-size: .76rem; padding: 0 4px; }
.suggest { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.suggest span { font-size: .74rem; color: var(--muted); margin-right: 2px; }
.duel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.duel-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.duel-team { padding: 8px 12px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: baseline; }
.duel-team.b { flex-direction: row-reverse; text-align: right; }
.duel-team .nm { font-weight: 650; font-size: .9rem; }
.duel-team .sub { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.duel-team .p { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; line-height: 1; }
.duel-team.a .p { color: var(--col); }
.duel-team.b .p { color: var(--truth); }
.duel .row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; margin: 6px 0; font-size: .78rem; }
.duel .row .lab { color: var(--muted); font-weight: 500; }
.duel .bar { display: flex; height: 22px; border-radius: 3px; overflow: hidden; font-family: var(--mono); font-weight: 600; color: #fff; font-size: .74rem; background: #eee; }
.duel .bar div { display: flex; align-items: center; padding: 0 7px; white-space: nowrap; }
.duel .bar .a { background: var(--col); }
.duel .bar .b { background: var(--truth); justify-content: flex-end; }
.duel .bar.model { height: 16px; font-size: .7rem; opacity: .78; }
.duel .empty { color: var(--muted); font-size: .76rem; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 3px; padding: 3px 9px; }
.duel .expl { font-size: .76rem; color: var(--ink-2); margin-top: 8px; }

/* ---------- home study columns ---------- */
.home-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.home-card-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-2);
  border-top: 3px solid var(--c, var(--ink));
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.home-card-head h2 { font-size: 1.15rem; margin: 0; }
.home-card-foot {
  padding: 9px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--line-2);
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  font-weight: 600;
}
.home-card-foot a { text-decoration: none; }
.home-card-foot a:hover { text-decoration: underline; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 24px;
  font-size: .76rem;
  color: var(--muted);
  background: #f0eee8;
}
footer .f-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
footer .f-links { display: flex; gap: 14px; flex-wrap: wrap; }
footer a { color: var(--ink-2); }

.totop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 30;
  font-size: .85rem;
}
.totop.on { opacity: 1; pointer-events: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .g2, .g3, .g-12, .g-32, .inspector-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { padding-left: 0; border-left: 0; }
  .legend { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  .wrap, .topbar .inner, .subnav { padding-left: 12px; padding-right: 12px; }
  .search { flex: 1 1 100%; }
  .h2h-pick { grid-template-columns: 1fr; }
  .vs { text-align: center; }
  .duel .row { grid-template-columns: 1fr; gap: 3px; }
  .rcell small { display: none; }
  .hide-sm { display: none; }
}

/* ---------- skip link & page status ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 80;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: .82rem;
}
.skip-link:focus { left: 12px; }

.page-status {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: .82rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.page-status.loading { color: var(--muted); }
.page-status.error { border-color: #e8b4b4; background: #fdf5f5; color: #7f1d1d; }

.btn-copy {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 4px;
  padding: 4px 10px;
  font: inherit;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- mobile nav ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  padding: 5px 10px;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle-bars {
  width: 14px;
  height: 10px;
  background: linear-gradient(var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 6px, transparent 6px 8px, var(--ink) 8px 10px);
  display: inline-block;
}

@media (max-width: 960px) {
  .topbar .inner { flex-wrap: wrap; height: auto; min-height: 46px; padding-top: 6px; padding-bottom: 6px; position: relative; }
  .nav-toggle { display: inline-flex; }
  .topnav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;
    margin: 6px 0 0;
    padding: 6px 0 4px;
    border-top: 1px solid var(--line-2);
    gap: 2px;
  }
  .topnav.open { display: flex; }
  .topnav a { white-space: normal; padding: 8px 10px; }
}

/* ---------- subnav split ---------- */
.subnav { justify-content: space-between; gap: 10px; min-height: 32px; height: auto; padding-top: 4px; padding-bottom: 4px; }
.subnav-anchors { display: flex; gap: 18px; align-items: center; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.subnav-anchors::-webkit-scrollbar { display: none; }
.subnav-jump {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--accent) !important;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 4px;
  padding: 2px 8px !important;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)) !important;
  background: var(--surface);
  font-size: .74rem !important;
}
.subnav-jump:hover { background: var(--accent-soft); }

/* ---------- home CTA ---------- */
.home-cta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 18px;
}
.home-cta-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 12px 14px;
  border-top: 3px solid var(--c, var(--ink));
}
.home-cta-card h3 { font-family: var(--serif); font-size: 1rem; margin: 0 0 4px; }
.home-cta-card p { font-size: .78rem; color: var(--muted); margin: 0 0 10px; min-height: 2.6em; }
.home-cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.home-cta-actions a {
  text-decoration: none;
  font-size: .76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.home-cta-actions a.primary { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }
@media (max-width: 900px) { .home-cta { grid-template-columns: 1fr; } }

/* ---------- table UX extras ---------- */
.th-gloss { font-size: .62rem; opacity: .55; margin-left: 2px; vertical-align: super; }
.col-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-2);
  background: #faf8f2;
  font-size: .72rem;
}
.col-picker-label { color: var(--muted); font-weight: 600; }
.col-picker label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; white-space: nowrap; }
.row-expand td { background: #f7f6f1 !important; padding: 6px 10px !important; border-bottom: 1px solid var(--line) !important; }
.row-expand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; }
.row-expand-item { font-size: .72rem; }
.row-expand-item .k { display: block; color: var(--muted); }
.row-expand-item .v { font-family: var(--mono); }

table.matrix .matrix-xhl { outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 12%, #fff) !important; }

footer .f-meta { display: flex; flex-direction: column; gap: 4px; max-width: 720px; }
footer .f-disclaimer { color: var(--muted); line-height: 1.45; }

.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }

@media print {
  .topbar, .subnav-wrap, .progress, .totop, .nav-toggle, .col-picker, .toolbar .seg, .search, .btn-copy { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .tablewrap, .matrix-wrap { max-height: none !important; overflow: visible !important; }
  .hide-sm { display: table-cell !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9px; color: #666; }
  a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }
}
