/* Real-World AVSE Challenge — leaderboard site.
   Palette lifted from real-world-avse.github.io/style.css: white page,
   #17202a ink, burnt-orange #d04f2f accent, warm borders/tints, Inter. */

:root {
  --accent: #d04f2f;
  --accent-dark: #b9421f;
  --text: #17202a;
  --muted: #4d5b66;
  --border: #e7e2d6;
  --border-faint: #f0ece2;     /* per-metric column dividers */
  --bg-soft: #faf8f3;
  --tint: #fbf2ef;             /* light orange wash (hover, highlights) */
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

/* ---- top navigation -------------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 3.2rem;
}
nav .brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
nav .brand-icon { height: 2.3rem; width: auto; }
nav .links { display: flex; gap: 1.1rem; overflow-x: auto; margin-left: auto; }
nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
nav a:hover, nav a.active { color: var(--accent); }

main { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* ---- hero ------------------------------------------------------------ */
header.hero { text-align: center; padding: 1.8rem 0 0.6rem; }
header.hero h1 { font-size: 1.9rem; margin: 0 0 0.4rem; }
header.hero p.sub { color: var(--muted); margin: 0 auto; max-width: 46rem; }
header.hero .meta-line { color: var(--muted); font-size: 0.85rem; margin-top: 0.7rem; }
header.hero .important-note {
  display: inline-block; margin: 0.7rem auto 0; max-width: 46rem;
  font-size: 0.92rem; font-weight: 600; color: var(--accent-dark);
  background: var(--tint); border: 1px solid var(--accent);
  border-radius: 8px; padding: 0.45rem 0.9rem;
}

/* ---- controls -------------------------------------------------------- */
.tabs { display: flex; justify-content: center; gap: 0.5rem; margin: 1.4rem 0 0.8rem; }
.tabs button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.45rem 1.4rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.controls {
  display: flex; justify-content: center; align-items: center;
  gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: 0.88rem;
}
.controls select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.25rem 0.5rem; font-size: 0.88rem; background: #fff; color: var(--text);
  text-align: center;
}
.controls select option { text-align: center; }

/* ---- tables ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
/* tabular-nums: equal-width digits so decimal points line up per column. */
table { border-collapse: collapse; width: 100%; font-size: 0.8rem;
        font-variant-numeric: tabular-nums; }
th, td { padding: 0.45rem 0.35rem; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0.7rem; }
th:last-child, td:last-child { padding-right: 0.7rem; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) { text-align: left; }
/* Metric columns (4th on): centered "boxes" separated by faint dividers —
   header label and value share the same horizontal center. */
th:nth-child(n+4), td:nth-child(n+4) { text-align: center; }
th:nth-child(n+5), td:nth-child(n+5) { border-left: 1px solid var(--border-faint); }
/* Divider between the identity columns (Team/Subs/Date) and the metrics. */
th.sep, td.sep { border-left: 1px solid var(--border); }
thead th {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  position: sticky; top: 0;
}
thead th.sorted { color: var(--accent); }
/* Sort arrow as a corner badge: absolutely positioned (th is sticky, hence
   the containing block), so it never nudges the centered label. */
thead th .dir {
  position: absolute; top: 0.1rem; right: 0.2rem;
  font-size: 0.55rem; line-height: 1;
}
/* Display-only marker: star on DNS-P808/SIG/BAK headers + the note under the
   scope controls explaining that they don't enter the OVRL ranking. */
sup.star { color: var(--accent); font-weight: 700; }
.display-note {
  text-align: center; color: var(--accent-dark); font-weight: 600;
  font-size: 0.85rem; margin: -0.3rem 0 0.9rem;
}
tbody tr:nth-child(even) { background: var(--bg-soft); }
tbody tr:hover { background: var(--tint); }
td.rank { font-weight: 700; color: var(--muted); }
td.team { font-weight: 600; text-align: left; }
td.primary-col, th.primary-col { background: rgba(208, 79, 47, 0.07); }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ---- generic bits ---------------------------------------------------- */
.note {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.8rem 1rem; font-size: 0.88rem; color: var(--muted);
  margin: 1rem 0;
}
.note code, td code { background: #f0eee8; padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.82em; }
.note ol { margin: 0.45rem 0 0; padding-left: 1.5rem; }
.note ol li { margin: 0.3rem 0; line-height: 1.5; }
a { color: var(--accent); }
footer { text-align: center; color: var(--muted); font-size: 0.83rem; margin-top: 3rem; }

.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; border: 1px solid transparent;
}
.badge.queued, .badge.ingesting { background: #f0eee8; color: var(--muted); }
.badge.uploading { background: #fff8c5; color: var(--warn); }
.badge.downloading, .badge.validating, .badge.scoring { background: var(--tint); color: var(--accent-dark); }
.badge.scored { background: #dafbe1; color: var(--ok); }
.badge.failed, .badge.aborted { background: #ffebe9; color: var(--bad); }

/* ---- submit page ----------------------------------------------------- */
.panel {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 1.2rem 1.4rem; margin: 1rem 0; background: #fff;
}
.panel h2 { margin: 0 0 0.8rem; font-size: 1.1rem; }
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.field input[type="text"], .field input[type="password"], .field select,
.field textarea {
  width: 100%; max-width: 480px; padding: 0.45rem 0.6rem;
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.92rem;
}
.field textarea { font-family: inherit; resize: vertical; }
.field input[type="file"] { font-size: 0.9rem; }

button.primary {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 0.55rem 1.6rem; font-size: 0.95rem; cursor: pointer;
}
button.primary:hover { background: var(--accent-dark); }
button.primary:disabled { background: #eba58f; cursor: not-allowed; }
button.ghost {
  background: #fff; color: var(--bad); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer;
}

.progress-outer {
  height: 10px; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden; margin: 0.6rem 0 0.3rem;
}
.progress-inner { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; }
.progress-label { font-size: 0.83rem; color: var(--muted); }
#upload-status { font-size: 0.9rem; margin-top: 0.5rem; }
#upload-status.error { color: var(--bad); }
#upload-status.ok { color: var(--ok); }

details.err-details { max-width: 420px; white-space: normal; }

/* ---- status guide (submit page) --------------------------------------- */
.status-flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  padding-bottom: 0.8rem; border-bottom: 1px solid var(--border);
}
.status-flow .arrow { color: var(--muted); font-size: 0.8rem; }
.status-flow .flow-alt { color: var(--muted); font-size: 0.85rem; margin-left: 0.3rem; }
.status-legend {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 0.55rem 0.9rem; align-items: baseline;
  margin-top: 0.9rem; font-size: 0.88rem; color: var(--muted);
}
.legend-note {
  margin: 0.9rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--border);
  font-size: 0.88rem; color: var(--muted);
}
/* Description column: solid divider on its left (via .sep), content centered,
   long notes wrap instead of stretching the table. */
#mine td.desc { max-width: 320px; white-space: normal; text-align: center; }
details.err-details summary { cursor: pointer; color: var(--bad); }
details.err-details pre {
  white-space: pre-wrap; font-size: 0.78rem; background: var(--bg-soft);
  padding: 0.5rem; border-radius: 6px; max-height: 220px; overflow: auto;
}
