:root {
  --bg: #0b0e14;
  --bg-soft: #121722;
  --panel: #161c28;
  --line: #232c3d;
  --text: #e6ecf5;
  --muted: #8a98ad;
  --accent: #ffd23f;
  --accent-2: #4ade80;
  --spot: #38bdf8;
  --up: #f87171;
  --down: #4ade80;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #1a2336 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.hero h1 {
  font-size: clamp(28px, 6vw, 52px);
  line-height: 1.05;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero .accent {
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 210, 63, 0.25);
}
.tagline {
  color: var(--muted);
  font-size: 16px;
  max-width: 640px;
  line-height: 1.5;
  margin: 0;
}
code {
  font-family: var(--mono);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.85em;
  color: var(--accent-2);
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 28px 0 8px;
}
.ctrl { display: flex; flex-direction: column; gap: 6px; }
.ctrl.grow { flex: 1 1 240px; }
.ctrl > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.ctrl select,
.ctrl input {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  min-width: 180px;
}
.ctrl input { width: 100%; min-width: 0; }
.ctrl select:focus,
.ctrl input:focus { border-color: var(--accent); }
.ctrl input::placeholder { color: #5d6b80; }

.result-meta {
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
  margin: 18px 0 4px;
}

.fam-count {
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  margin-left: 6px;
  font-weight: 500;
}

.stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}
.stat {
  flex: 1 1 150px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.stat-num {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.family { margin-top: 36px; }
.family h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 720px;
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(35, 44, 61, 0.5);
  font-family: var(--mono);
}
tbody tr:last-child td { border-bottom: none; }

.data-row { cursor: pointer; transition: background 0.12s; }
.data-row:hover { background: rgba(255, 255, 255, 0.025); }
.data-row.open { background: rgba(255, 210, 63, 0.05); }
td.type { font-weight: 600; color: var(--text); white-space: nowrap; }
.caret { color: var(--muted); margin-right: 8px; font-family: var(--mono); }
td.strong { color: var(--accent); font-weight: 600; }
td.spot { color: var(--spot); }

.delta { font-size: 12px; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); }

.detail-row td { background: var(--bg-soft); padding: 18px 22px; }
.detail-title { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.detail-loading, .sparkline-empty { color: var(--muted); font-size: 13px; font-family: var(--mono); }

.sparkline { width: 100%; height: 120px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(255, 210, 63, 0.08); stroke: none; }
.spark-dot { fill: var(--accent); }

.loading, .empty, .error, .detail-loading { padding: 24px 0; color: var(--muted); }
.error { color: var(--up); }

.foot {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.foot a { color: var(--accent-2); }
.foot .built { margin-top: 8px; opacity: 0.8; }

@media (max-width: 560px) {
  .wrap { padding: 32px 14px 60px; }
}
