:root {
  color-scheme: light;
  --background: #ffffff;
  --block: #ffffff;
  --text: #111827;
  --body-text: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --warning: #a16207;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 52px; }

.app-header { max-width: 760px; margin: 0 auto 28px; text-align: center; }
.app-header h1 { margin: 0 0 10px; font-size: 32px; line-height: 1.2; font-weight: 700; }
.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: #f3f4f6; }
.tab.active { color: var(--text); background: var(--block); border-color: var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }

.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; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.updated { white-space: nowrap; font-size: 11px !important; }

.block, .toolbar, .table-shell, .queue-card { background: var(--block); border: 1px solid var(--border); border-radius: 10px; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto 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: 7px; background: var(--block); }
.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-size: 11px; }
.select-control select { height: 38px; min-width: 130px; padding: 0 28px 0 10px; border: 1px solid var(--border-strong); border-radius: 7px; outline: 0; background: var(--block); color: var(--text); font-size: 13px; }
.toggle { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 9px; color: var(--body-text); font-size: 12px; white-space: nowrap; }
.toggle input { width: 15px; height: 15px; accent-color: var(--primary); }

.table-shell { position: relative; overflow-x: auto; }
.table-shell.is-empty { min-height: 180px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { height: 42px; padding: 0 12px; border-bottom: 1px solid var(--border); background: #f9fafb; color: var(--muted); text-align: right; font-size: 11px; font-weight: 600; 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: 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: #fafafa; }
.rank { width: 42px; color: var(--muted); }
.rank.top, .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:hover { color: var(--primary-hover); }
.pill { display: inline-flex; padding: 3px 7px; border-radius: 6px; background: #f3f4f6; color: var(--body-text); font-size: 11px; }
.availability { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.availability.yes { background: var(--success); }
.table-footer { display: flex; justify-content: space-between; padding: 8px 3px 0; color: var(--muted); font-size: 11px; }
.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; }
.skeleton { display: block; width: 48px; height: 10px; border-radius: 4px; background: #e5e7eb; }
.skeleton.wide { width: 160px; }

.queue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.queue-card { padding: 14px; }
.queue-card header { display: flex; align-items: center; justify-content: space-between; }
.queue-card h3 { margin: 0; font-size: 13px; }
.queue-card strong { font-size: 18px; }
.queue-card p { margin: 7px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.queue-card.finished strong { color: var(--success); }
.queue-card.running strong { color: var(--primary-hover); }
.queue-card.pending strong { color: var(--warning); }

.submit-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 14px; align-items: start; }
.submit-card, .guidance-card, .about-copy, .citation-card { padding: 18px; }
.block-heading { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.block-heading h3, .guidance-card > h3 { margin: 0 0 4px; font-size: 15px; }
.block-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; padding: 16px 0; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field > span { color: var(--body-text); font-size: 12px; font-weight: 500; }
.field b { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.field small { color: var(--muted); font-weight: 400; }
.field input, .field select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 7px; outline: 0; background: var(--block); color: var(--text); font-size: 13px; }
.field input:focus, .field select:focus, .search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.primary-button { min-height: 38px; padding: 0 14px; border: 1px solid var(--primary-hover); border-radius: 7px; background: var(--primary); color: #fff; font-weight: 600; }
.primary-button:hover { background: var(--primary-hover); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.guidance-card { max-height: 560px; overflow: auto; }

.prose { color: var(--body-text); font-size: 13px; line-height: 1.6; }
.prose h2, .prose h3 { color: var(--text); }
.prose h2 { margin: 20px 0 6px; font-size: 17px; }
.prose h3 { margin: 16px 0 5px; font-size: 14px; }
.prose p { margin: 7px 0; }
.prose pre { margin: 10px 0; overflow-wrap: anywhere; white-space: pre-wrap; padding: 11px; border: 1px solid var(--border); border-radius: 7px; background: #f9fafb; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.prose pre code { font-size: inherit; }
.prose a { color: #2563eb; }
.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: 5px 0 0; font-size: 14px; }
.citation-card button { align-self: start; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--block); color: var(--text); }
.citation-card pre { grid-column: 1 / -1; overflow: auto; margin: 0; padding: 10px; border-radius: 6px; background: #f9fafb; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

.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: #fffbeb; border-color: #fde68a; }
.notice.error { color: var(--danger); background: #fef2f2; border-color: #fecaca; }
.notice.success { color: var(--success); background: #f0fdf4; border-color: #bbf7d0; }
.hidden { display: none !important; }
@media (max-width: 820px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search { grid-column: 1 / -1; }
  .submit-layout { grid-template-columns: 1fr; }
  .guidance-card { max-height: none; }
}

@media (max-width: 560px) {
  main { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .app-header h1 { font-size: 26px; }
  .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%; }
  .queue-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .table-footer span:last-child { display: none; }
}

/* Equal-width leaderboard controls, aligned to the left. */
.toolbar { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: end; }
.toolbar .select-control { flex: 0 0 160px; width: 160px; }
.toolbar .select-control select { width: 100%; min-width: 0; }

.toolbar .select-control select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}
#leaderboard-head th { height: 54px; line-height: 1.4; }

#leaderboard-head th.sortable:not(:nth-child(2)), td.score { text-align: center; }

.resource-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 9px; margin-top: 14px; font-size: 13px; line-height: 1.7; }
.resource-links a { color: var(--body-text); text-decoration: none; white-space: nowrap; }
.resource-links a:hover { color: var(--primary-hover); text-decoration: underline; }
.resource-links [aria-disabled], .resource-links .separator { color: var(--muted); }

.submit-output-control { display: grid; gap: 4px; margin-left: auto; width: 242px; flex: 0 0 242px; }
.submit-output-control > span { color: var(--muted); font-size: 11px; }
.submit-output-card {
  display: flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 18px; border: 1px solid transparent; border-radius: 7px;
  background: linear-gradient(115deg, #147ac7, #315ee5 65%, #5145ed);
  color: #fff; text-decoration: none; font-size: 15px; font-weight: 600;
  box-shadow: 0 2px 5px rgb(37 99 235 / 14%);
}
.submit-output-card:hover { filter: brightness(1.06); }
.submit-output-card:focus-visible, .select-control select:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.submission-page { max-width: 700px; margin: 0 auto; }
.submission-page > a { color: var(--primary); text-decoration: none; }
.submission-page .block { margin-top: 20px; padding: 24px; }
.submission-page h2 { margin: 0 0 16px; font-size: 20px; }
.submission-page p, .submission-page li { color: var(--body-text); line-height: 1.7; }
.submission-page ol { padding-left: 20px; }
.submission-page .submit-output-card { display: inline-flex; margin-top: 12px; }
@media (max-width: 820px) {
  .submit-output-control { margin-left: 0; }
}

/* Match the card to the complete label-and-select controls. */
.toolbar { align-items: center; }
.submit-output-control { display: block; }
.submit-output-control .submit-output-card {
  height: 55px;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 7px 18px;
}
.submit-output-control .submit-output-card span { color: #dbeafe; font-size: 11px; font-weight: 400; line-height: 1.35; }
.submit-output-control .submit-output-card strong { font-size: 17px; font-weight: 650; line-height: 1.35; }

.submission-page fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.submission-page fieldset:disabled { opacity: .6; }
.submission-page .field small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.submission-page input[readonly] { background: #f3f4f6; cursor: default; }
.submission-page input[type=file] { height: auto; padding: 10px; }
.submission-page .field a { color: var(--primary); }
.signin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0 12px; }
.signin-row .primary-button { display: inline-flex; align-items: center; text-decoration: none; font-size: 13px; }
.signin-row > span { color: var(--muted); font-size: 12px; }
.signin-row button { background: white; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; }
.signin-row .unavailable { opacity: .6; cursor: not-allowed; }
.submission-privacy { font-size: 12px; }
#upload-progress { margin-top: 20px; }
#upload-progress progress { width: 100%; accent-color: var(--primary); }
#progress-text { font-size: 12px; }

/* Keep paired fields aligned even when only one has help text. */
.submission-page .form-grid { align-items: start; }
.submission-page .field > label { color: var(--body-text); font-size: 12px; font-weight: 500; }
.archive-picker { position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px; }
.submission-page .archive-picker input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; opacity: 0; overflow: hidden; }
.archive-button { flex-shrink: 0; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 5px; background: #f9fafb; color: var(--body-text); font-size: 12px; cursor: pointer; }
.archive-picker:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
#archive-name { min-width: 0; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
fieldset:disabled .archive-button { cursor: not-allowed; }
