.viz-root {
  color-scheme: light;
  --surface-0: #f4f3ef;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --grid: #e4e3de;
  --series-1: #2a78d6;
  --series-2: #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --grid: #2e2e2c;
    --series-1: #3987e5;
    --series-2: #d95926;
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --grid: #2e2e2c;
  --series-1: #3987e5;
  --series-2: #d95926;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f3ef; }
@media (prefers-color-scheme: dark) { body { background: #111110; } }
.viz-root {
  display: block; min-height: 100vh; background: var(--surface-0); color: var(--text-primary);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px; line-height: 1.7; max-width: 880px; margin: 0 auto; padding: 16px 16px 48px;
}
.back { color: var(--text-secondary); text-decoration: none; }
h1 { font-size: 30px; margin: 8px 0 4px; }
h2 { font-size: 19px; margin: 0; }
.lead { color: var(--text-secondary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface-1); border-radius: 12px; padding: 14px 16px; }
.tile .num { font-size: 34px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .num span { font-size: 16px; margin-left: 2px; }
.tile .cap { color: var(--text-secondary); font-size: 14px; }
.chart-card { background: var(--surface-1); border-radius: 12px; padding: 16px; margin: 16px 0; }
.sub { color: var(--text-secondary); margin: 2px 0 8px; font-size: 15px; }
.src { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-secondary); font-size: 12px; font-family: inherit; }
.chart text.val { fill: var(--text-primary); font-weight: 700; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .mark, .chart g.on .mark { opacity: .8; }
.legend { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--text-secondary); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.s1 { background: var(--series-1); }
.sw.s2 { background: var(--series-2); }
details { margin-top: 8px; font-size: 14px; }
summary { cursor: pointer; color: var(--text-secondary); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid var(--grid); padding: 4px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
.notes { background: var(--surface-1); border-radius: 12px; padding: 16px; }
.notes ol { padding-left: 1.4em; margin: 8px 0 0; }
.tip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--grid); border-radius: 8px; padding: 6px 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.15);
  max-width: 240px;
}
.tip b { font-variant-numeric: tabular-nums; }
