/* tool-use-arena — dark theme, single-file CSS */

:root {
  --bg: #0b0f17;
  --surface: #141a25;
  --surface-2: #1a2230;
  --border: #1f2a3a;
  --text: #e6edf3;
  --muted: #7d8aa1;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 20px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

/* ---- Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 20px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

main { padding: 16px 20px 60px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: var(--shadow); }

/* ---- Leaderboard */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters select, .filters input {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font-size: 13px;
  min-width: 140px;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
  vertical-align: top;
}
tbody tr:hover { background: var(--surface-2); }
.col-rank { font-weight: 700; color: var(--accent-2); }
.cell-na { color: var(--muted); }
.cell-model a { color: var(--text); }
.cell-model a:hover { color: var(--accent-2); }
.badge-org { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-license-open { color: var(--success); font-size: 11px; }
.badge-license-prop { color: var(--warning); font-size: 11px; }
.delta-up { color: var(--success); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }
.delta-flat { color: var(--muted); }

.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ---- Movers */
.movers-controls { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.movers-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.movers-controls select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.movers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.movers-list .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
  font-family: var(--mono); font-size: 12px;
}
.movers-list .row:last-child { border-bottom: none; }
.movers-list .model { color: var(--text); }
.movers-list .delta { font-weight: 700; }

/* ---- Cost vs Accuracy */
.cost-controls { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.cost-controls input[type=number] { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; width: 140px; }
.chart-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
#budget-results .row { padding: 6px 0; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; }
#budget-results .row:last-child { border-bottom: none; }

/* ---- Changelog */
#changelog-list .entry { border-bottom: 1px dashed var(--border); padding: 12px 0; }
#changelog-list .entry:last-child { border-bottom: none; }
#changelog-list h4 { margin: 0 0 6px; color: var(--accent-2); font-size: 14px; }
#changelog-list pre { white-space: pre-wrap; word-break: break-word; color: var(--muted); font-family: var(--mono); font-size: 12px; margin: 0; }

/* ---- Model detail */
#model-detail h2 { margin: 0 0 6px; }
#model-detail .meta-row { color: var(--muted); margin-bottom: 14px; font-size: 13px; }
#model-detail .subscores { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
#model-detail .sub { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
#model-detail .sub h5 { margin: 0 0 6px; color: var(--accent-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
#model-detail .sub .v { font-family: var(--mono); font-size: 14px; }
#model-detail .sub .v.muted { color: var(--muted); }
#model-detail .history-chart { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }

footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.muted { color: var(--muted); }

@media (max-width: 700px) {
  .meta { width: 100%; justify-content: flex-start; }
  .filters { gap: 8px; }
  .filters select { min-width: 110px; }
}
