:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6b6a65;
  --grid: #e3e2de;
  --border: #d8d7d2;
  --accent: #2a78d6;
  --warning-bg: #fdf1d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --grid: #33332f;
    --border: #3d3d38;
    --accent: #3987e5;
    --warning-bg: #3a2e12;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #121211;
  --surface-1: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --grid: #33332f;
  --border: #3d3d38;
  --accent: #3987e5;
  --warning-bg: #3a2e12;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 40px 0 8px; }
h3 { font-size: 0.95rem; margin: 0; }
.lede, .metric { color: var(--text-secondary); margin: 0 0 16px; }
code { font-size: 0.9em; }
a { color: var(--accent); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 16px 0;
}

select, .controls button {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  max-width: 100%;
}

.controls button { cursor: pointer; }
.controls button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.card, .panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
dt { color: var(--text-secondary); }
dd { margin: 0; overflow-wrap: anywhere; }

.notice {
  background: var(--warning-bg);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.panel .runtime { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 8px; }
.panel svg { display: block; width: 100%; overflow: visible; }
.panel .empty { color: var(--text-muted); }

svg text { fill: var(--text-secondary); font-size: 12px; }
svg .value { fill: var(--text-primary); }
svg .gridline { stroke: var(--grid); stroke-width: 1; }
svg .hit { fill: transparent; cursor: default; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; color: var(--text-secondary); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface-1); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; }
td.number, th.number { text-align: right; }
details summary { cursor: pointer; color: var(--accent); margin-bottom: 8px; }
.method { color: var(--text-secondary); padding-left: 20px; }

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
  max-width: 280px;
  z-index: 10;
}
.tooltip .muted { color: var(--text-secondary); }
