:root {
  --ink: #10181f;
  --muted: #4a5663;
  --bg: #f2f4f7;
  --card: #ffffff;
  --line: #dde3e9;
  --track: #eef1f4;
  --accent: #e8742a;
  --ok: #0b5a4c;
  --ok-soft: #e1f3ef;
  --ok-border: #9fd3c7;
  --warn: #8a3b05;
  --warn-soft: #fdebdd;
  --warn-border: #f2be98;
  --bad: #b5470a;
  --blue: #1f5fbf;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; }
button { font: inherit; cursor: pointer; }

.page { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 20px; }

/* Hero */
.hero { background: var(--ink); color: #fff; border-radius: 18px; padding: 22px 18px 18px; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-end; }
.hero-text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: #f2a66b; }
h1 { margin: 0; font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 44px; line-height: 0.95; letter-spacing: 0.01em; }
.lede { margin: 0; font-size: 15px; line-height: 1.4; color: #c5ced8; }
.status { margin: 4px 0 0; font-size: 12px; color: #9aa7b5; }
.hero-people { display: flex; gap: 16px; }
.hero-person { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 72px; font-size: 13px; font-weight: 500; text-align: center; }
.avatar { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--accent); background: #243241; display: flex; align-items: center; justify-content: center; overflow: hidden; font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 30px; color: #fff; }
.avatar.has-photo > span { visibility: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.small { width: 40px; height: 40px; border-width: 2px; font-size: 20px; flex: none; }

/* Leaderboard */
.leaderboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.board-head { display: flex; align-items: center; gap: 10px; }
.board-name { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 24px; flex-grow: 1; }
.board-score { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 28px; color: var(--ok); }
.board-of { font-size: 13px; color: var(--muted); }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--track); }
.stack i { display: block; height: 10px; }
.tallies { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.locks-line { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; border-top: 1px solid #e6eaee; padding-top: 10px; }

/* Controls */
.controls { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.tabs button { min-height: 44px; min-width: 72px; padding: 0 16px; border: 0; border-radius: 9px; font-size: 15px; font-weight: 700; background: transparent; color: var(--ink); }
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.locks-toggle { min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.locks-toggle[aria-pressed="true"] { background: var(--ink); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.count { margin: 0; font-size: 13px; color: var(--muted); }

/* Team cards */
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.team { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.team-head { display: flex; align-items: center; gap: 10px; }
.team-logo { width: 36px; height: 36px; flex: none; object-fit: contain; }
.team-code { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 24px; line-height: 1; }
.team-name { flex-grow: 1; font-size: 14px; color: var(--muted); }
.team-record { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 22px; }
.bar-wrap { display: flex; flex-direction: column; gap: 6px; }
.bar { position: relative; height: 10px; border-radius: 5px; background: var(--track); }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--blue); }
.bar svg { position: absolute; top: -5px; margin-left: -10px; }
.bar-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar-meta b { color: var(--ink); }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chip { border-radius: 10px; padding: 8px 10px; min-height: 56px; display: flex; flex-direction: column; gap: 2px; border: 1px solid; }
.chip-top { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.chip-top span { flex-grow: 1; }
.chip-main { display: flex; align-items: baseline; gap: 6px; font-size: 15px; font-weight: 700; }
.chip-main span:first-child { flex-grow: 1; }

/* Pick states: colour plus a distinct symbol, so colour is never the only signal */
.st-clinched_correct { background: var(--ok); color: #fff; border-color: var(--ok); }
.st-on_pace { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.st-off_pace { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.st-clinched_wrong { background: var(--bad); color: #fff; border-color: var(--bad); }
.st-push, .st-pending { background: var(--track); color: var(--muted); border-color: #cbd3db; }

.foot { font-size: 12px; color: var(--muted); line-height: 1.5; }
.empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--muted); }

@media (min-width: 720px) {
  .page { padding: 32px 24px 56px; }
  .hero { padding: 28px 32px; }
  h1 { font-size: 56px; }
  .lede { font-size: 16px; }
  .hero-people { gap: 24px; }
  .hero-person { min-width: 96px; font-size: 14px; }
  .avatar { width: 88px; height: 88px; font-size: 38px; }
}
