/* Layout from Hugging Face's Gradio 6 leaderboard template; palette and type from
   principled-intelligence.com, which is dark-only. */
:root {
  color-scheme: dark;
  --background: #09090d;
  --block: rgba(255, 255, 255, 0.03);
  --raised: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.04);
  --text: #ffffff;
  --body-text: rgba(255, 255, 255, 0.84);
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.42);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --primary: #7df7d6; 
  --primary-soft: rgba(125, 247, 214, 0.12);
  --success: #7df7d6;
  --warning: #f5c26b;
  --warning-soft: rgba(245, 194, 107, 0.08);
  --danger: #ff7a7a;
  --series-task: #00ad79;
  --series-general: #9a73ff;
  --violet: #6644ff;
  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--sans); font-size: 14px;
  background:
    radial-gradient(900px 500px at 12% -90px, rgba(102, 68, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(125, 247, 214, 0.07), transparent 55%),
    var(--background);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
main { width: min(1520px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 52px; }

.app-header { max-width: 760px; margin: 0 auto 28px; text-align: center; }
.logo { display: block; width: fit-content; margin: 0 auto 22px; opacity: 0.92; }
.logo:hover { opacity: 1; }
.logo img { display: block; width: auto; height: 34px; }
.app-header h1 { margin: 0; font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -0.04em; text-wrap: balance; }
.app-header h1 .accent { color: var(--primary); }
.tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 24px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; 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); background: var(--hover); }
.tab.active { color: var(--primary); background: var(--block); border-color: var(--border); }

.panel { display: none; }
.panel.active { display: block; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.updated { white-space: nowrap; font: 11px var(--mono) !important; }

.block, .toolbar, .table-shell { background: var(--block); border: 1px solid var(--border); border-radius: 10px; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr); grid-auto-columns: auto; grid-auto-flow: column; 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: 7px; background: var(--raised); }
.search > span { color: var(--muted); font-size: 18px; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.select-control { display: grid; gap: 4px; color: var(--muted); font: 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.select-control select {
  appearance: none; height: 38px; min-width: 150px; padding: 0 34px 0 10px; border: 1px solid var(--border-strong); border-radius: 7px; outline: 0;
  background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23ffffff' stroke-opacity='.55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px;
  color: var(--text); font: 13px var(--sans); letter-spacing: 0; text-transform: none;
}
.select-control select:hover, .select-control select:focus { border-color: var(--primary); }
.select-control select option { background: #141419; }
.view-switch { display: inline-flex; gap: 2px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--raised); }
.view, .display { padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: 500 12px var(--sans); white-space: nowrap; }
.view:hover, .display:hover { color: var(--text); background: var(--hover); }
.view.active, .display.active { color: var(--primary); background: var(--block); }
.view:disabled { background: transparent; color: var(--faint); opacity: 0.5; cursor: not-allowed; }
.toggle {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--raised); color: var(--body-text); font-size: 12px; white-space: nowrap; cursor: pointer;
}
.toggle:hover { border-color: var(--primary); }
.toggle:has(input:checked) { border-color: var(--primary); color: var(--primary); }
.toggle:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.toggle input { appearance: none; margin: 0; width: 14px; height: 14px; border: 1.5px solid var(--faint); border-radius: 4px; }
.toggle input:checked { border-color: var(--primary); background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat; }
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 20;
  width: max-content; max-width: 280px; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 6px; background: #141419; color: var(--body-text);
  font: 12px/1.3 var(--sans); text-align: left; white-space: normal; pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
[data-tip].tip-end::after { left: auto; right: 0; transform: none; }
[data-tip]:hover::after, [data-tip]:focus-visible::after, [data-tip]:has(:focus-visible)::after { opacity: 1; }

.icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hide-col { width: 1%; padding: 0 10px 0 4px; text-align: center; }
.hide-row {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s, border-color 0.15s;
}
tbody tr:hover .hide-row, .hide-row:focus-visible { opacity: 1; }
.hide-row:hover, .hide-row:focus-visible { color: var(--primary); background: var(--raised); border-color: var(--border-strong); }
@media (hover: none) { .hide-row { opacity: 1; } }
#show-hidden {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--raised); color: var(--body-text); font: 500 12px var(--sans); white-space: nowrap; cursor: pointer;
}
#show-hidden:hover { border-color: var(--primary); color: var(--primary); }
#show-hidden.hidden { display: none; }
.actions .action {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted); font: 500 12px var(--sans); white-space: nowrap; cursor: pointer;
}
.actions .action:hover:enabled, .actions .action:popover-open { color: var(--text); background: var(--hover); }
.menu { margin: 0; inset: auto; padding: 4px; border: 1px solid var(--border-strong); border-radius: 7px; background: #141419; color: var(--body-text); }
.menu:popover-open { display: grid; min-width: 120px; }
.menu button { padding: 8px 10px; border: 0; border-radius: 5px; background: transparent; color: inherit; font: 12px var(--mono); text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { color: var(--primary); background: var(--hover); }
.actions:has(~ .menu:popover-open) [data-tip]::after { opacity: 0; }

.table-shell { position: relative; overflow-x: auto; }
.table-shell.is-empty { min-height: 180px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th { height: 42px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--raised); color: var(--muted); text-align: right; font: 600 10px var(--mono); letter-spacing: 0.06em; 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(--text); }
td { height: 50px; padding: 0 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-family: var(--mono); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
.rank { width: 42px; color: var(--muted); }
.rank.top, .score.best { color: var(--primary); font-weight: 600; }
.score.primary { font-weight: 600; }
.score.no-refusal { color: var(--faint); }
.score.refused { color: #e89a9a; }
.model-cell { font-family: var(--sans); }
.org-logo { position: relative; display: inline-flex; margin-right: 8px; vertical-align: middle; isolation: isolate; }
.org-logo img { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
/* A blurred copy of the logo glows in its own colours. */
.org-logo img:first-child { position: absolute; z-index: -1; filter: blur(4px) saturate(1.3); opacity: 0.2; }
/* The only avatar that is a dark mark on a transparent background. */
.org-logo img[src*="/openai/"]:last-child { background: #fff; }
.model-cell a, .model-cell .name { color: var(--text); font-weight: 600; text-decoration: none; }
.model-cell a::after { content: " ↗"; color: var(--muted); font-size: 10px; }
.model-cell a:hover { color: var(--primary); }
.model-cell code { margin-left: 6px; padding: 1px 7px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font: 10.5px var(--mono); }
.pill { display: inline-flex; padding: 3px 7px; border-radius: 6px; background: var(--raised); color: var(--body-text); font: 11px var(--sans); }
.pill.task { background: color-mix(in srgb, var(--series-task) 16%, transparent); color: var(--series-task); }
.pill.general { background: color-mix(in srgb, var(--series-general) 16%, transparent); color: var(--series-general); }
.availability { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.availability.yes { background: var(--success); }
.table-footer { display: flex; justify-content: space-between; gap: 12px; padding: 8px 3px 0; color: var(--muted); font-size: 11px; }
.cost sup, .tokens sup, .latency sup, .score sup { margin-left: 2px; font: 10px var(--mono); }
.cost sup a, .tokens sup a, .latency sup a, .score sup a { color: var(--muted); text-decoration: none; }
.table-notes { margin: 12px 3px 0; padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.table-notes:empty { display: none; }
.table-notes li:target { color: var(--body-text); }
.legend { max-width: 110ch; margin: 18px 3px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.legend code { padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 999px; font: 11px var(--mono); }
.empty-state { position: absolute; inset: 43px 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; }
.chart { padding: 18px 20px 14px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 28px; margin-bottom: 14px; }
.chart-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.03em; }
.chart-sub { margin: 0; color: var(--muted); font-size: 13px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 2px; color: var(--body-text); font-size: 12px; }
.legend-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.legend-group > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-label { color: var(--faint); font: 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--body-text); }
.swatch.task { background: var(--series-task); }
.swatch.general { background: var(--series-general); }
.swatch.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--body-text); }
.swatch.line { width: 16px; height: 0; border-radius: 0; background: none; border-top: 2px solid var(--primary); }
.chart-plot { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; font-family: var(--mono); }
.chart .grid { stroke: var(--border); }
.chart .axis { stroke: var(--border-strong); }
.chart .tick { fill: var(--muted); font-size: 10px; }
.chart .axis-title { fill: var(--muted); font: 12px var(--sans); }
.chart .pareto { fill: none; stroke: var(--primary); stroke-opacity: 0.7; stroke-width: 2; stroke-linejoin: round; transition: opacity 0.15s; }
.chart .pareto-area { fill: url(#pareto-fill); transition: opacity 0.15s; }
#pareto-fill stop { stop-color: var(--primary); stop-opacity: 0.035; }
#pareto-fill stop + stop { stop-opacity: 0.005; }
.chart .pareto.tail { stroke-opacity: 1; stroke-dasharray: 1 5; stroke-linecap: round; }
.tail-fade stop { stop-color: var(--primary); stop-opacity: 0.8; }
.tail-fade stop + stop { stop-opacity: 0; }
.chart .guides line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart .dot { stroke: none; stroke-width: 2; transition: r 0.12s, opacity 0.15s; }
.chart .dot.task { fill: var(--series-task); }
.chart .dot.general { fill: var(--series-general); }
.chart .dot.hosted { fill: var(--background); }
.chart .dot.hosted.task { stroke: var(--series-task); }
.chart .dot.hosted.general { stroke: var(--series-general); }
.chart .dot.active { r: 8px; }
.chart svg.hovering .dot:not(.active), .chart svg.hovering .label, .chart svg.hovering .label-logo, .chart svg.hovering .pareto, .chart svg.hovering .pareto-area { opacity: 0.25; }
.chart .hit { fill: transparent; cursor: default; }
.chart .break { stroke: var(--border-strong); stroke-dasharray: 2 4; }
.chart .label { fill: var(--body-text); font: 500 11px var(--sans); transition: opacity 0.15s; paint-order: stroke; stroke: var(--background); stroke-width: 3px; stroke-linejoin: round; }
.chart .label-logo { overflow: visible; transition: opacity 0.15s; }
.chart .label-logo .org-logo { display: flex; margin: 0; }
.chart .label-logo .org-logo img { width: 14px; height: 14px; border-radius: 3px; }
.chart .label .variant { fill: var(--muted); font-weight: 400; }
.chart-tip {
  position: absolute; z-index: 1; display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: #141419; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); color: var(--muted); font-size: 11px; white-space: nowrap; pointer-events: none;
}
.chart-tip strong { color: var(--text); font-size: 12px; font-weight: 600; }
.chart-tip code { margin-left: 6px; padding: 1px 7px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); font: 10.5px var(--mono); }
.chart-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.skeleton { display: block; width: 48px; height: 10px; border-radius: 4px; background: var(--border-strong); }
.skeleton.wide { width: 160px; }

.about-copy, .citation-card, .request-copy { padding: 18px 22px; }
.prose { color: var(--body-text); font-size: 14px; line-height: 1.65; }
#panel-about, #panel-request { max-width: 900px; margin: 0 auto; }
.prose h2, .prose h3 { color: var(--text); font-weight: 600; }
.prose h2 { margin: 22px 0 6px; font-size: 18px; }
.prose h3 { margin: 18px 0 5px; font-size: 15px; }
.prose p, .prose ul { margin: 8px 0; }
.prose ul { padding-left: 20px; }
.prose code { font-family: var(--mono); font-size: .9em; }
.prose a { color: var(--primary); }
.about-copy { min-height: 160px; }
.about-copy h2:first-child { margin-top: 0; }
.citation-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 12px; }
.citation-card h3 { margin: 2px 0 4px; font-size: 15px; font-weight: 600; }
.citation-card p { margin: 0; color: var(--muted); font-size: 13px; }
.citation-card button { align-self: start; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--raised); color: var(--text); }
.citation-card button:hover { border-color: var(--primary); color: var(--primary); }
.citation-card pre { grid-column: 1 / -1; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: rgba(0, 0, 0, 0.3); color: var(--body-text); font: 12px/1.6 var(--mono); }

.notice { margin: 10px 0; padding: 10px 12px; border: 1px solid; border-radius: 7px; font-size: 12px; line-height: 1.45; }
.notice.warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(245, 194, 107, 0.3); }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .toolbar { grid-template-columns: 1fr 1fr; grid-auto-flow: row; }
  .search { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  main { width: min(100% - 24px, 1520px); padding-top: 24px; }
  .app-header h1 { font-size: 30px; }
  .tabs { justify-content: stretch; }
  .tab { flex: 1; padding-inline: 8px; }
  .panel-heading { display: block; }
  .updated { margin-top: 6px !important; }
  .toolbar { grid-template-columns: 1fr; }
  .search { grid-column: auto; }
  .select-control select { width: 100%; }
  .view-switch { width: 100%; }
  .view { flex: 1; }
  .table-footer span:last-child { display: none; }
}
