/* The public scoreboard (pqtctl web leaderboard): readable from the back of a room, fine on a phone. */
:root {
  --bg: #f1f2f4;
  --panel: #ffffff;
  --line: #dee1e6;
  --line-soft: #eef0f3;
  --ink: #16181d;
  --muted: #5b616e;
  --band: #15171c;
  --band-muted: #a6adb8;
  --band-line: #3a3f48;
  --up: #15803d;
  --down: #b42318;
  --live: #b42318;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a20;
    --line: #2b3038;
    --line-soft: #22262d;
    --ink: #e7eaee;
    --muted: #a0a7b2;
    --band: #0a0b0e;
    --band-line: #2b3038;
    --up: #4cc074;
    --down: #ff7b72;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: clamp(15px, 1.15vw, 22px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.35;
}
.muted { color: var(--muted); }

.band {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem 3rem; padding: 1.4rem clamp(16px, 3vw, 3rem);
  background: var(--band); color: #ffffff;
}
.event { color: var(--band-muted); font-size: 1rem; letter-spacing: 0.02em; }
h1 { margin: 0.15rem 0 0; font-size: 2.1rem; font-weight: 650; }
.status {
  display: flex; align-items: center; gap: 1.2rem; padding: 0.7rem 1.2rem;
  border: 1px solid var(--band-line); border-radius: 10px;
}
.status-text { text-align: right; }
.status-label { color: var(--band-muted); font-size: 0.9rem; }
.status-main { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.chip {
  padding: 0.2rem 0.6rem; border-radius: 4px; background: var(--live); color: #ffffff;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em;
}

main {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.4rem clamp(16px, 3vw, 3rem) 1rem;
}
.banner { padding: 0.6rem 0.9rem; border: 1px solid var(--down); border-radius: 8px; color: var(--down); }
.empty { margin: 2rem 0; font-size: 1.2rem; color: var(--muted); text-align: center; }

.leaders { display: flex; flex-wrap: wrap; gap: 1rem; }
.leader {
  flex: 1 1 18rem; min-width: 0; padding: 1.1rem 1.4rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.leader.first { border: 2px solid var(--ink); }
.leader .top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem; }
.leader .place { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.leader .team { margin-top: 0.4rem; font-size: 1.9rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.leader .bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.4rem 1rem; margin-top: 0.9rem; font-variant-numeric: tabular-nums;
}
.leader .total { font-size: 2.7rem; font-weight: 700; line-height: 1; }
.leader .unit { font-size: 1rem; font-weight: 500; color: var(--muted); }
.leader .rounds { font-size: 1rem; color: var(--muted); }

.rest {
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 3rem; padding: 0.5rem 1.5rem 0.8rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.rest.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.rest .col { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 1.3rem; }
th {
  padding: 0.6rem 1rem 0.5rem 0; font-size: 0.85rem; font-weight: 500; color: var(--muted);
  text-align: right;
}
th.team-h { text-align: left; }
td { padding: 0.55rem 1rem 0.55rem 0; text-align: right; border-top: 1px solid var(--line-soft); }
td.rank { color: var(--muted); font-weight: 600; width: 2.5rem; }
/* the team column takes whatever room the numbers leave, and a long name ends in "…" */
td.team { width: 100%; max-width: 0; text-align: left; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.round { color: var(--muted); }
th.round, td.round, td.total { padding-left: 1.2rem; }
.compact .round { display: none; }
td.total { font-weight: 700; }
td.move, .move { font-size: 0.85em; white-space: nowrap; color: var(--muted); }
th:last-child, td:last-child { padding-right: 0; }
.up { color: var(--up); }
.down { color: var(--down); }
.voided { font-style: italic; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 2rem;
  padding: 0.8rem clamp(16px, 3vw, 3rem) 1.2rem; font-size: 0.95rem; color: var(--muted);
}
.foot #rule-note { max-width: 60rem; }

@media (max-width: 640px) {
  .status { width: 100%; justify-content: space-between; }
  .status-text { text-align: left; }
  h1 { font-size: 1.6rem; }
  .leader .total { font-size: 2.2rem; }
  table { font-size: 1.05rem; }
  .rest { padding: 0.3rem 0.9rem 0.6rem; }
}

/* pqtctl scoreboard: each session's status, and why a running session shows no scores */
.sessions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; font-size: 1.15rem; }
.session { padding: 0.1rem 0.6rem; border: 1px solid var(--band-line); border-radius: 6px; color: var(--band-muted); white-space: nowrap; }
.session b { color: #ffffff; font-weight: 700; }
.session.running { border-color: var(--live); color: #ffffff; }
.session.final { border-color: #4cc074; }
.note { margin: 0; padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); }
.rest td.round, .rest td.total, .rest th { white-space: nowrap; }
