:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #15181e;
  --muted: #5c6573;
  --line: #e1e5eb;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --accent-soft: #edf1ff;
  --t1: #dbe6ff;
  --t2: #ffe3d1;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #e8ebf0;
    --muted: #9aa4b2;
    --line: #272c36;
    --accent: #8ea2ff;
    --accent-ink: #0f1115;
    --accent-soft: #1d2440;
    --t1: #253462;
    --t2: #5a3a26;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
header.wrap { padding-top: 40px; padding-bottom: 8px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 18px 0 4px; }
.lede { color: var(--muted); margin: 0; max-width: 62ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}
.label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
textarea, input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92rem; }
textarea:focus, input:focus, select:focus, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { margin-top: 10px; }
button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: var(--accent-ink);
}
button.ghost { background: transparent; color: var(--text); }
button.ghost:hover { background: var(--accent-soft); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat.primary { background: var(--accent-soft); border-color: transparent; }
.stat .k { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .note { font-size: 0.75rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.viz { margin-top: 16px; }
.viz summary { cursor: pointer; font-weight: 600; }
.tokens {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
}
.tokens span { border-radius: 3px; }
.tokens span:nth-child(odd) { background: var(--t1); }
.tokens span:nth-child(even) { background: var(--t2); }
.tablewrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }
table.prices { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.prices th, table.prices td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.prices th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; position: sticky; top: 0; background: var(--card); }
table.prices tr:last-child td { border-bottom: 0; }
table.prices td:not(:first-child), table.prices th:not(:first-child) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.prices .mid { display: block; color: var(--muted); font-size: 0.75rem; word-break: break-all; }
.filters { margin: 12px 0; align-items: end; }
.check label { display: flex; gap: 8px; align-items: center; font-size: 0.95rem; padding: 10px 0; }
.check input { width: auto; }
.nav { font-size: 0.9rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; font-size: 0.85rem; }
.chips a:hover { background: var(--accent-soft); }
.filter { margin: 12px 0; }
h2 .small { font-weight: 400; margin-left: 8px; }
ul { padding-left: 1.2rem; margin: 0; }
li { margin: 8px 0; }
a { color: var(--accent); }
footer.wrap { padding-bottom: 40px; }
@media (max-width: 480px) {
  .card { padding: 16px; }
  .stat .v { font-size: 1.4rem; }
}
