:root {
  color-scheme: light;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --border: #e4e3df;
  --grid: #ecebe7;
  --baseline: #8a8984;
  --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: #1a1a19;
    --surface-raised: #242423;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --border: #353533;
    --grid: #2c2c2a;
    --baseline: #8a8984;
    --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: #1a1a19;
  --surface-raised: #242423;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --border: #353533;
  --grid: #2c2c2a;
  --baseline: #8a8984;
  --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);
  color: var(--text-primary);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
h2 { margin: 40px 0 8px; font-size: 18px; }

select {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 200px;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 16px 0 8px;
  color: var(--text-secondary);
}

.status {
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 14px;
}

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.message { color: var(--text-secondary); margin-top: 24px; }

.chart-wrap {
  position: relative;
  height: 360px;
  margin: 8px 0 24px;
}

.tooltip {
  position: absolute;
  top: 8px;
  pointer-events: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  white-space: nowrap;
  z-index: 1;
}
.tooltip .when { color: var(--text-secondary); margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; }
.tooltip .row .num { margin-left: auto; padding-left: 12px; }

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.standings td:first-child { color: var(--text-muted); width: 2em; }
.player { display: flex; align-items: center; gap: 8px; }
.ticker { color: var(--text-muted); font-size: 13px; }
.pizza { white-space: nowrap; color: var(--text-secondary); font-size: 14px; }

.shame ol { margin: 0; padding: 0; list-style: none; }
.shame li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.shame .count { margin-left: auto; font-variant-numeric: tabular-nums; }

#checksum { word-break: break-all; }

footer { margin-top: 40px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (max-width: 560px) {
  .chart-wrap { height: 280px; }
  .ticker { display: block; }
  th, td { padding: 8px 4px; }
  select { min-width: 0; }
}
