:root {
  --bg: #0b0d12;
  --bg-elev: #131722;
  --bg-elev2: #1a1f2c;
  --line: #232b3d;
  --line-soft: #1c2233;
  --text: #e6e8ee;
  --text-dim: #9aa3b6;
  --text-muted: #6b7387;
  --accent: #7ea7ff;
  --accent-soft: #2a3a64;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --chip-bg: #1c2233;
  --chip-bg-active: #2a3a64;
  --chip-border: #2c344a;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { line-height: 1.5; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--bg-elev2); padding: 0 0.3em; border-radius: 3px; font-size: 0.92em; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fbbf24, #f87171);
  color: #1a1f2c; font-weight: 800;
  border-radius: 8px; font-size: 1.2rem;
}
.brand-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-subtitle { color: var(--text-muted); font-size: 0.78rem; }

.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.tab {
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.tab:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.tab.active { background: var(--accent-soft); color: var(--text); }

.refresh-info {
  margin-left: auto;
  font-size: 0.78rem; color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
}

main {
  max-width: 1400px; margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
.panel { margin-bottom: 2rem; }
.panel.hidden { display: none; }
.panel-head h1 { font-size: 1.6rem; margin: 0.25rem 0 0.5rem; letter-spacing: -0.015em; }
.panel-head h2 { font-size: 1.2rem; letter-spacing: -0.01em; }
.muted { color: var(--text-dim); }
.small { font-size: 0.85rem; }
.prose p { max-width: 70ch; }
.prose ul { max-width: 70ch; }

.controls {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line-soft); margin-bottom: 1rem;
}
.control-group { display: flex; flex-direction: column; gap: 0.4rem; }
.control-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg); color: var(--text-dim);
  font-size: 0.85rem; padding: 0.35rem 0.7rem;
  border-radius: 999px; cursor: pointer; font-family: inherit;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--chip-bg-active); color: var(--text); border-color: #3c4a72; }
.select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--chip-border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: inherit; font-size: 0.9rem;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-elev); }
.lb {
  width: 100%; border-collapse: collapse;
  font-size: 0.92rem;
}
.lb th, .lb td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.lb thead th {
  font-weight: 600; color: var(--text-dim); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--bg-elev2);
  position: sticky; top: 0;
}
.lb tbody tr:hover { background: var(--bg-elev2); }
.lb .num { text-align: right; font-variant-numeric: tabular-nums; }
.lb td.num.score { font-weight: 700; }
.lb .loading, .lb .empty { color: var(--text-muted); text-align: center; padding: 2rem; }

.model-cell { display: flex; align-items: center; gap: 0.5rem; }
.model-name { font-weight: 600; }
.model-slug { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }
.pill {
  display: inline-block; font-size: 0.68rem;
  padding: 0.1rem 0.4rem; border-radius: 999px;
  background: var(--bg-elev2); color: var(--text-dim);
  border: 1px solid var(--chip-border);
}
.pill.sys { background: #25304a; color: #cfe; border-color: #34467b; }

.provider {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: lowercase;
}
.provider.anthropic { background: #3a2317; color: #ffd2b0; }
.provider.openai    { background: #173628; color: #b8f3d4; }
.provider.google    { background: #19264a; color: #b8c8ff; }
.provider.x-ai      { background: #29222e; color: #d6c0e2; }
.provider.meta      { background: #1c2840; color: #b6ccff; }
.provider.deepseek  { background: #1a3030; color: #b6e3e3; }
.provider.mistral   { background: #312818; color: #ffd8a8; }
.provider.qwen      { background: #2c1d2c; color: #f0b6e0; }
.provider.cohere    { background: #1f2934; color: #b3cdd9; }
.provider.other     { background: #2a2a2a; color: #c8c8c8; }

.delta-pos { color: var(--bad); font-weight: 600; }
.delta-neg { color: var(--good); font-weight: 600; }
.delta-zero { color: var(--text-muted); }

.card-list { display: grid; gap: 0.85rem; }
.card-list.small .card { padding: 0.7rem 0.9rem; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.card h3 { margin: 0 0 0.35rem; font-size: 1.02rem; }
.card-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.35rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.card p { margin: 0.35rem 0; color: var(--text-dim); }
.card .chips-row { margin-top: 0.5rem; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.card .chip-tag {
  font-size: 0.7rem; padding: 0.1rem 0.45rem; background: var(--bg-elev2);
  border-radius: 999px; color: var(--text-dim); border: 1px solid var(--chip-border);
}

.chart-canvas-wrap {
  border: 1px solid var(--line-soft);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
}
#sysImpactCanvas { display: block; width: 100%; height: auto; min-height: 540px; }

.footer {
  max-width: 1400px; margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--text-muted); font-size: 0.82rem;
  border-top: 1px solid var(--line-soft);
}
.footer .dot { color: var(--line); margin: 0 0.5rem; }

@media (max-width: 720px) {
  .topbar-inner { gap: 0.6rem; }
  .tabs { width: 100%; order: 3; }
  .refresh-info { order: 2; }
  .lb th, .lb td { padding: 0.5rem 0.55rem; font-size: 0.85rem; }
  .panel-head h1 { font-size: 1.3rem; }
}
