.viz-root {
    color-scheme: light;
    --surface-0: #f4f3f0;
    --surface-1: #fcfcfb;
    --border: #e2e1dc;
    --grid: #ecebe7;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #77766f;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
}
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme='light'])) .viz-root {
        color-scheme: dark;
        --surface-0: #121211;
        --surface-1: #1a1a19;
        --border: #2e2e2c;
        --grid: #262624;
        --text-primary: #f0efec;
        --text-secondary: #c3c2b7;
        --text-muted: #8f8e86;
        --series-1: #3987e5;
        --series-2: #d95926;
        --series-3: #199e70;
    }
}

* { box-sizing: border-box; }
body { margin: 0; }
.viz-root {
    min-height: 100vh;
    background: var(--surface-0);
    color: var(--text-primary);
    font: 15px/1.5 ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
    padding: 40px 24px 64px;
}
main { max-width: 880px; margin: 0 auto; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 4px; }
.sub { color: var(--text-secondary); margin: 0 0 28px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 20px 22px; margin-bottom: 20px; }
.card p.note { color: var(--text-secondary); margin: 0 0 14px; font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; }
.tile .label { color: var(--text-secondary); font-size: 13px; }
.tile .value { font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .delta { color: var(--text-muted); font-size: 13px; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: -1px; }

svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { fill: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
svg .axis-label { fill: var(--text-muted); }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .hit { fill: transparent; cursor: default; }

.tip {
    position: fixed; pointer-events: none; z-index: 10; display: none;
    background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
    font-variant-numeric: tabular-nums;
}
.tip b { display: block; margin-bottom: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-secondary); font-weight: 550; }
.table-wrap { overflow-x: auto; }

ul.method { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 14px; }
ul.method li { margin-bottom: 6px; }
code { font-size: 12.5px; background: var(--grid); padding: 1px 4px; border-radius: 4px; }

@media (max-width: 640px) { .tiles { grid-template-columns: 1fr; } }
