:root {
  --bg: #0a0e14;
  --panel: #11161f;
  --panel-2: #161d28;
  --line: #1f2937;
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --accent: #7df9ff;
  --warning: #f5a623;
  --danger: #ff6b6b;
  --success: #4ade80;
  --grey: #6b7280;
  --dim: #374151;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  cursor: pointer;
}

/* ---- topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(10, 14, 20, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -2px;
  font-size: 18px;
}
.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-sub {
  color: var(--text-dim);
  font-size: 13px;
}
.status-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grey);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.04);
}
.dot.ok { background: var(--success); }
.dot.err { background: var(--danger); }
.dot.warn { background: var(--warning); }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--line); }

/* ---- stats strip ---- */
.stats-strip {
  max-width: 1280px;
  margin: 18px auto 6px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.tile {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.tile-label {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.tile-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}
.tile-value-sm { font-size: 16px; }

/* ---- controls ---- */
.controls {
  max-width: 1280px;
  margin: 18px auto 8px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
#search {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  min-width: 200px;
  font-size: 13px;
}
#search:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* ---- table ---- */
.table-wrap {
  max-width: 1280px;
  margin: 8px auto 60px;
  padding: 0 20px;
}
table.bench-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.bench-table thead th {
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.bench-table thead th.num { text-align: right; }
.bench-table thead th .caret {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  opacity: 0;
}
.bench-table thead th.sort-asc .caret::before  { content: '▲'; opacity: 1; }
.bench-table thead th.sort-desc .caret::before { content: '▼'; opacity: 1; }
.bench-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.bench-table tbody td.num { text-align: right; }
.bench-table tbody tr { cursor: pointer; transition: background 0.1s; }
.bench-table tbody tr:hover { background: rgba(125, 249, 255, 0.04); }
.bench-table tbody tr:last-child td { border-bottom: 0; }

.b-name {
  font-weight: 500;
  color: var(--text);
}
.b-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.status-SATURATED         { background: var(--grey);     color: #fff; }
.status-NEAR_SOLVED       { background: var(--warning);  color: #000; }
.status-ACTIVE            { background: var(--accent);   color: #0a0e14; }
.status-FRONTIER          { background: var(--success);  color: #0a0e14; }
.status-DEAD              { background: var(--danger);   color: #fff; }
.status-INSUFFICIENT_DATA { background: var(--dim);      color: var(--text-dim); }

.bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--dim);
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.empty-note {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}

/* ---- drawer ---- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.18s ease-out;
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: -20px 0 40px rgba(0,0,0,0.4);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-head h2 { margin: 0; font-size: 17px; color: var(--text); }
.drawer-body {
  padding: 16px 20px 60px;
  overflow-y: auto;
  flex: 1;
}
.d-headline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.big-number {
  font-size: 38px;
  font-weight: 700;
  color: var(--accent);
}
.d-delta { color: var(--success); font-size: 13px; }
.d-delta.neg { color: var(--danger); }
.d-meta {
  color: var(--text-dim);
  font-size: 12px;
  margin: 6px 0 18px;
}
.chart-wrap {
  height: 220px;
  margin: 8px 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.drawer-body h3 {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 0 8px;
}
.top-models {
  list-style: decimal inside;
  padding: 0;
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}
.top-models li {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.top-models li:last-child { border-bottom: 0; }
.top-models .perf { float: right; color: var(--accent); }
.embed-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  flex-wrap: wrap;
}
.embed-row code {
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 11px;
  flex: 1;
  word-break: break-all;
}
.d-source { color: var(--text-dim); font-size: 12px; }

/* ---- footer ---- */
.footer {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: rgba(10, 14, 20, 0.94);
  border-top: 1px solid var(--line);
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  z-index: 4;
  flex-wrap: wrap;
  gap: 8px;
  backdrop-filter: blur(8px);
}

@media (max-width: 800px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .brand-sub { display: none; }
  .bench-table thead th:nth-child(7),
  .bench-table tbody td:nth-child(7),
  .bench-table thead th:nth-child(8),
  .bench-table tbody td:nth-child(8) { display: none; }
}
