:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f5f9;
  --ink: #1d1b24;
  --muted: #6b6878;
  --line: #e4e2ea;
  --model: #5b3fa0;
  --system: #b6698d;
  --baseline: #b4b9c0;
  --accent: #3f2670;
  --alpha: #b6698d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1e1f25;
    --ink: #ecebf1;
    --muted: #9c99a8;
    --line: #2d2e36;
    --model: #7c6ce4;
    --system: #d87aa3;
    --baseline: #5e636b;
    --accent: #b3a6f0;
  }
}

* { box-sizing: border-box; }

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

main { max-width: 980px; margin: 0 auto; padding: 36px 20px 48px; }

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

h1 { margin: 0; font-size: 44px; line-height: 1; letter-spacing: -0.02em; color: var(--accent); }

.alpha-mark {
  margin-left: 4px;
  font-size: 0.6em;
  vertical-align: super;
  color: var(--alpha);
}

.tagline { margin: 8px 0 0; color: var(--muted); }

.intro { max-width: 720px; margin: 20px 0 0; }
.intro a, footer a { color: var(--accent); }

nav { display: flex; gap: 8px; flex-wrap: wrap; }

nav a {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

nav a:hover { border-color: var(--accent); }
nav a.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.alpha {
  margin: 16px 0 20px;
  padding: 10px 14px;
  border-left: 4px solid var(--alpha);
  border-radius: 4px;
  background: color-mix(in srgb, var(--alpha) 10%, transparent);
}

.bar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface); font-variant-numeric: tabular-nums; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

.switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); }

.switch button {
  border: 0;
  border-radius: 999px;
  padding: 5px 14px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.switch button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px #0002; }

.chart {
  position: relative;
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span[hidden] { display: none; }

.swatch { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.swatch.model { background: var(--model); }
.swatch.system { background: repeating-linear-gradient(135deg, var(--system) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--system); }
.swatch.baseline { background: var(--baseline); }

.axis, .row { display: grid; grid-template-columns: 270px 1fr 64px; align-items: center; }

.axis { height: 22px; font-size: 12px; color: var(--muted); }
.axis .value { text-align: right; }

.track { position: relative; height: 100%; }

.tick { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tick.anchor { color: var(--ink); }

.row { height: 28px; border-radius: 4px; cursor: default; outline: none; }
.row:hover, .row:focus-visible { background: var(--surface); }

.row .name {
  padding-right: 12px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .value { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.grid.anchor { background: var(--muted); opacity: 0.6; }

.bar { position: absolute; top: 7px; height: 14px; border-radius: 0 4px 4px 0; background: var(--model); }
.row.system .bar {
  background: repeating-linear-gradient(135deg, var(--system) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1.5px var(--system);
}
.row.baseline .bar { background: var(--baseline); }

.whisker { position: absolute; top: 13.5px; height: 1.5px; background: var(--ink); opacity: 0.75; }
.whisker::before, .whisker::after { content: ""; position: absolute; top: -4px; width: 1.5px; height: 9.5px; background: var(--ink); }
.whisker::before { left: 0; }
.whisker::after { right: 0; }

.dot { position: absolute; top: 10px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--bg); }

.tooltip {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 6px 20px #0003;
  font-size: 13px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.tooltip[hidden] { display: none; }
.tooltip span { color: var(--muted); }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; }
th:first-child, td:first-child, th:nth-child(n+4), td:nth-child(n+4) { text-align: right; }

.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; }
.kinds > div { padding: 12px 14px; border-radius: 8px; background: var(--surface); }
.kinds dt { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.kinds dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.kinds a { color: var(--accent); }

.note { margin-top: 16px; color: var(--muted); font-size: 13px; }

footer { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer summary { cursor: pointer; color: var(--ink); margin: 6px 0; }
footer pre { overflow-x: auto; padding: 12px; border-radius: 6px; background: var(--surface); font-size: 12px; white-space: pre-wrap; }

@media (max-width: 640px) {
  h1 { font-size: 34px; }
  .axis, .row { grid-template-columns: 1fr 52px; }
  .axis .name { display: none; }
  .row { height: auto; padding: 4px 0; row-gap: 0; }
  .row .name { grid-column: 1 / -1; font-size: 12px; }
  .row .track { height: 28px; }
  .row .value { font-size: 12px; }
  th, td { padding: 7px 4px; }
  .kinds { grid-template-columns: 1fr; }
  .chart { padding: 12px 8px 8px; }
  .tick.minor { display: none; }
}
