/* 颜色都走变量，深色模式只换变量。数据色只用在图形标记上，文字一律用文字色。 */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --zone-very_low: #2a78d6;
  --zone-low: #6da7ec;
  --zone-mid: #d5d4cc;
  --zone-high: #ee8a89;
  --zone-very_high: #e34948;
  --banner-bg: #fdf3d9;
  --banner-ink: #4d3a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.07);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --zone-very_low: #3987e5;
    --zone-low: #184f95;
    --zone-mid: #45453f;
    --zone-high: #8a3535;
    --zone-very_high: #e66767;
    --banner-bg: #33290c;
    --banner-ink: #f3dfa0;
  }
}

* { 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, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}
a { color: inherit; text-underline-offset: 3px; }
h1, h2, p, ul { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.3; font-weight: 650; }
h2 { font-size: 1.15rem; line-height: 1.4; font-weight: 650; }

.site-header, main, .site-footer { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { font-weight: 650; text-decoration: none; }
.site-header nav { display: flex; gap: 18px; font-size: 0.92rem; color: var(--ink-2); }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
main { display: grid; gap: 16px; }
.site-footer { padding-top: 28px; padding-bottom: 40px; color: var(--muted); font-size: 0.85rem; display: grid; gap: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: grid; gap: 14px; min-width: 0; }
/* 卡片里的内容不能把卡片撑宽：宽表格在自己的容器里横向滚动 */
.card > * { min-width: 0; }
.intro { display: grid; gap: 10px; padding: 14px 6px 6px; }
.intro p { color: var(--ink-2); max-width: 40em; }
.eyebrow { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.02em; }
.asof { color: var(--ink-2); font-size: 0.9rem; }
.note, .caption { color: var(--ink-2); font-size: 0.88rem; }
.caption { color: var(--muted); }
/* 图的读法：比图例说明更显眼，比正文弱 */
.howto { border-left: 2px solid var(--axis); padding-left: 12px; display: grid; gap: 6px; color: var(--ink-2); font-size: 0.9rem; }
.howto b { color: var(--ink); margin-right: 8px; }
.banner { background: var(--banner-bg); color: var(--banner-ink); border-radius: 8px; padding: 9px 12px; font-size: 0.9rem; }

/* 档位：一个色点加文字，颜色不单独承担含义 */
.chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.zone-very_low { background: var(--zone-very_low); }
.zone-low { background: var(--zone-low); }
.zone-mid { background: var(--zone-mid); }
.zone-high { background: var(--zone-high); }
.zone-very_high { background: var(--zone-very_high); }

/* 主读数 */
.hero-reading { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 4px; }
.hero-figure { display: flex; align-items: baseline; gap: 8px; }
.hero-num { font-size: 4.4rem; line-height: 1; font-weight: 650; letter-spacing: -0.02em; }
.hero-num.small { font-size: 2.4rem; }
.hero-unit { color: var(--muted); font-size: 1.05rem; }
.hero-text { display: grid; gap: 4px; flex: 1 1 260px; }
.hero-zone { font-size: 1.15rem; }
.hero-text p:last-child { color: var(--ink-2); }

/* 水位条：五段加一个指针 */
.meter { position: relative; padding-top: 30px; margin: 0 4px; }
.meter-track { display: flex; gap: 2px; height: 8px; }
.seg { display: block; height: 100%; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.meter-labels { display: flex; gap: 2px; margin-top: 6px; color: var(--ink-2); font-size: 0.82rem; }
.meter-labels span { text-align: center; min-width: 0; }
.meter-marker { position: absolute; top: 0; height: 30px; width: 0; }
.meter-marker span { position: absolute; left: 0; top: 0; transform: translateX(-50%); font-size: 0.85rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.meter-marker::after { content: ""; position: absolute; left: -5px; top: 18px; border: 5px solid transparent; border-top: 7px solid var(--ink); border-bottom: 0; }
.meter.compact { padding-top: 14px; }
.meter.compact .meter-marker span { display: none; }
.meter.compact .meter-marker::after { top: 2px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 2px; align-content: start; }
.tile-label { color: var(--ink-2); font-size: 0.88rem; }
.tile-value { font-size: 1.9rem; line-height: 1.2; font-weight: 650; }
.tile-note { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

/* 控件与图例 */
.controls { display: flex; flex-wrap: wrap; gap: 6px; }
.controls button, .legend button {
  font: inherit; font-size: 0.88rem; color: var(--ink-2); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 13px; cursor: pointer;
}
.controls button:hover, .legend button:hover { background: var(--wash); }
.controls button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; padding: 3px 10px; color: var(--ink); }
.legend button[aria-pressed="false"] { color: var(--muted); }
.legend button[aria-pressed="false"] .key { opacity: 0.3; }
.legend b { font-weight: 650; font-variant-numeric: tabular-nums; }
.key { width: 16px; height: 0; border-top: 2px solid var(--muted); border-radius: 1px; flex: none; }
.key.s1 { border-color: var(--series-1); }
.key.s2 { border-color: var(--series-2); }
.key.s3 { border-color: var(--series-3); }
.key.price { border-color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* 图表 */
.chart { position: relative; min-width: 0; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.panel-title { fill: var(--ink-2); font-size: 12px; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line.s1, .dot.s1 { stroke: var(--series-1); }
.line.s2, .dot.s2 { stroke: var(--series-2); }
.line.s3, .dot.s3 { stroke: var(--series-3); }
.line.price { stroke: var(--ink-2); }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot.s1 { fill: var(--series-1); stroke: var(--surface); }
.dot.s2 { fill: var(--series-2); stroke: var(--surface); }
.dot.s3 { fill: var(--series-3); stroke: var(--surface); }
.dot.price { fill: var(--ink-2); }
.crosshair { stroke: var(--axis); stroke-width: 1; }
.range { fill: var(--axis); }
.range.current { fill: var(--series-1); }
.median { fill: var(--ink-2); stroke: var(--surface); stroke-width: 2; }
.median.current { fill: var(--series-1); }
.row-label { fill: var(--ink-2); font-size: 13px; }
.row-label.current { fill: var(--ink); font-weight: 650; }
.value-label { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.row-hit { fill: transparent; }
.row-hit:hover { fill: var(--wash); }

.tooltip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); padding: 8px 10px; font-size: 0.82rem; line-height: 1.5;
}
.tooltip .tt-title { color: var(--ink-2); margin-bottom: 2px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tooltip .tt-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tooltip .tt-row span:last-child { color: var(--ink-2); }

/* 表格 */
details summary { cursor: pointer; color: var(--ink-2); font-size: 0.9rem; }
details[open] summary { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
table.narrow { width: auto; min-width: min(100%, 380px); }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; vertical-align: top; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink-2); font-weight: 500; font-size: 0.85rem; }
tbody th { font-weight: 500; }
td small { display: block; color: var(--muted); font-size: 0.8rem; }
tr.current { background: var(--wash); }
.table-title { font-weight: 600; font-size: 0.9rem; margin-top: 6px; }

.facts { list-style: none; padding: 0; display: grid; gap: 8px; color: var(--ink-2); font-size: 0.93rem; }
.facts b { color: var(--ink); margin-right: 8px; }

.index-card { text-decoration: none; }
.index-card:hover { border-color: var(--axis); }
.index-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.index-card-reading { display: flex; align-items: center; gap: 12px; }

.prose { gap: 12px; }
.prose h2 { margin-top: 12px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; }
.prose b { color: var(--ink); }

@media (max-width: 520px) {
  .card { padding: 16px; border-radius: 12px; }
  .hero-num { font-size: 3.6rem; }
  h1 { font-size: 1.35rem; }
}
