:root {
  color-scheme: dark;
  --background: #0b0f1d;
  --block: #141a2c;
  --block-raised: #1a2138;
  --text: #e8ecf4;
  --body-text: #b8c0d4;
  --muted: #7d86a0;
  --border: #262f4e;
  --border-strong: #36416a;
  --primary: #8b5cf6;
  --primary-hover: #a78bfa;
  --primary-soft: rgba(139, 92, 246, 0.15);
  --gold: #fbbf24;
  --silver: #c9d2e3;
  --bronze: #d08a4e;
  --warning: #fbbf24;
  --danger: #f87171;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 480px at 50% -12%, rgba(139, 92, 246, 0.16), transparent 62%),
    radial-gradient(800px 380px at 88% -5%, rgba(99, 102, 241, 0.1), transparent 55%),
    var(--background);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 40px;
}

/* --- Header --------------------------------------------------------------- */

.app-header {
  margin-bottom: 32px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-hover);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.1;
}

.tagline {
  margin: 0 auto 26px;
  max-width: 540px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.stats {
  display: flex;
  justify-content: center;
  gap: clamp(28px, 6vw, 72px);
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.stat {
  text-align: center;
}

.stat dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}

/* --- Tabs ------------------------------------------------------------------ */

.tabs {
  display: flex;
  width: fit-content;
  margin: 0 auto 28px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--block);
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: #ffffff;
  background: var(--primary);
}

/* --- Panels ---------------------------------------------------------------- */

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.3;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* --- Toolbar ---------------------------------------------------------------- */

.block, .toolbar, .table-shell {
  background: var(--block);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--background);
}

.search > span {
  color: var(--muted);
  font-size: 18px;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search input::placeholder {
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.select-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.select-control select {
  height: 38px;
  min-width: 130px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: 0;
  background: var(--background);
  color: var(--text);
  font-size: 13px;
}

.select-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* --- Table ------------------------------------------------------------------- */

.table-shell {
  position: relative;
  overflow-x: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.table-shell.is-empty {
  min-height: 180px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--block-raised);
  color: var(--muted);
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

th:first-child, th:nth-child(2), td:first-child, td:nth-child(2) {
  text-align: left;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover, th.active-sort {
  color: var(--primary-hover);
}

td {
  height: 54px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--block-raised);
}

.rank {
  width: 46px;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 500;
}

.rank.medal-1 {
  color: var(--gold);
}

.rank.medal-2 {
  color: var(--silver);
}

.rank.medal-3 {
  color: var(--bronze);
}

.score.primary {
  color: var(--primary-hover);
  font-weight: 600;
}

.model-cell a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 290px;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
}

.model-cell a::after {
  content: "↗";
  color: var(--muted);
  font-size: 10px;
}

.model-cell a:hover {
  color: var(--primary-hover);
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--body-text);
  font-size: 11px;
}

.note {
  max-width: 240px;
  color: var(--muted);
  text-align: left;
  white-space: normal;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 3px 0;
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  position: absolute;
  inset: 45px 0 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0 0 4px;
  color: var(--body-text);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.skeleton {
  display: block;
  width: 48px;
  height: 10px;
  border-radius: 4px;
  background: var(--border);
}

.skeleton.wide {
  width: 160px;
}

/* --- About ------------------------------------------------------------------- */

.about-copy {
  min-height: 160px;
  padding: 22px;
}

.about-copy h2:first-child {
  margin-top: 0;
}

.benchmark-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.benchmark-list .pill {
  font-family: var(--font-display);
}

.prose {
  color: var(--body-text);
  font-size: 13px;
  line-height: 1.6;
}

.prose h2, .prose h3 {
  color: var(--text);
  font-family: var(--font-display);
}

.prose h2 {
  margin: 20px 0 6px;
  font-size: 17px;
}

.prose h3 {
  margin: 16px 0 5px;
  font-size: 14px;
}

.prose p {
  margin: 7px 0;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

/* --- Misc --------------------------------------------------------------------- */

.notice {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.notice.warning {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
}

.notice.error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.35);
}

.hidden {
  display: none !important;
}

/* --- Responsive --------------------------------------------------------------- */

@media (max-width: 820px) {
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 24px, 1180px);
    padding-top: 28px;
  }

  .stats {
    gap: 24px;
    flex-wrap: wrap;
  }

  .tab {
    flex: 1;
    padding-inline: 12px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .search {
    grid-column: auto;
  }

  .select-control select {
    width: 100%;
  }

  .table-footer span:last-child {
    display: none;
  }
}
