.viz-root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface-1: #fcfcfb;
  --border: #e4e3de;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --grid: #ecebe7;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #1a7f37;
  --warn-bg: #fff4e0;
  --warn-ink: #7a4b00;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --bg: #111110;
    --surface-1: #1a1a19;
    --border: #2e2e2c;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --grid: #2a2a28;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #4ac26b;
    --warn-bg: #3a2a0c;
    --warn-ink: #f5c86b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.viz-root { background: var(--bg); color: var(--text-primary); min-height: 100vh; }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.top { border-bottom: 1px solid var(--border); background: var(--surface-1); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
nav a { margin-left: 18px; color: var(--text-secondary); text-decoration: none; font-size: 15px; }
nav a:hover { color: var(--text-primary); }
.hero { padding: 40px 0 16px; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.lede { color: var(--text-secondary); font-size: 18px; max-width: 720px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 18px 0 10px; }
.sec { font-size: 26px; margin: 40px 0 16px; }
.tag { font-size: 13px; background: var(--accent); color: #fff; padding: 3px 9px; border-radius: 99px; vertical-align: middle; font-weight: 600; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; margin-top: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 820px) { .grid, .grid3 { grid-template-columns: 1fr; } nav a { margin-left: 12px; } }
@media (max-width: 520px) { nav a:not(:nth-child(2)) { display: none; } .card { padding: 18px; } }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
label output { float: right; font-weight: 700; color: var(--accent); }
input[type=number], select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-primary); font: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.hint { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }
.seg { border: 0; padding: 0; margin: 14px 0 0; display: flex; gap: 8px; }
.seg legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.seg input { position: absolute; opacity: 0; }
.seg label { margin: 0; flex: 1; text-align: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; }
.seg input:checked + label { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.more { margin-top: 14px; font-size: 14px; }
.more summary { cursor: pointer; color: var(--text-secondary); }
.more select { margin-top: 8px; }
button { margin-top: 20px; width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-family: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }
button:hover { filter: brightness(1.08); }
.result .big { font-size: clamp(40px, 6vw, 56px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.range { color: var(--text-secondary); margin-top: 4px; }
.rangebar { margin: 16px 0 4px; }
.rb-track { position: relative; height: 10px; background: var(--grid); border-radius: 99px; }
.rb-fill { position: absolute; top: 0; bottom: 0; background: var(--accent); opacity: .3; border-radius: 99px; }
.rb-dot { position: absolute; top: -4px; width: 18px; height: 18px; margin-left: -9px; background: var(--accent); border: 2px solid var(--surface-1); border-radius: 50%; }
.rb-labels { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.warnbox { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.whatif { list-style: none; padding: 0; margin: 0; }
.whatif li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.whatif li:last-child { border-bottom: 0; }
.whatif .d { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.whatif .d small { display: block; font-weight: 600; }
.whatif li span:first-child { padding-right: 12px; }
.whatif .down { color: var(--good); }
.whatif .up { color: var(--text-secondary); }
.sub { color: var(--text-secondary); margin: -8px 0 10px; font-size: 14px; }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis text { fill: var(--text-muted); font-size: 12px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .dl { font-size: 12px; fill: var(--text-secondary); font-weight: 600; }
.tip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }
.tip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
details summary { cursor: pointer; color: var(--text-secondary); font-size: 14px; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
td.n, th.n { text-align: right; }
tr.hl td { font-weight: 700; background: color-mix(in srgb, var(--accent) 8%, transparent); }
tr.bad td { color: var(--text-muted); }
.fact .num { font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.fact p { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; }
.about p { max-width: 820px; }
.foot { color: var(--text-muted); font-size: 13px; padding: 20px; text-align: center; }
