:root {
  --page: #eef4f6;
  --surface: #ffffff;
  --ink: #0c3337;
  --muted: #587175;
  --teal: #00686f;
  --on-teal: #ffffff;
  --orange: #e87722;
  --orange-text: #b35200;
  --on-orange: #1a0d00;
  --line: #c4d6da;
  --board: #0c3337;
  --board-ink: #eaf4f5;
  --board-muted: #8fb3b7;
  --board-line: rgba(234, 244, 245, 0.14);
  --tone-1: #00686f;
  --tone-2: #3f6e74;
  --tone-3: #2a7f71;
  --tone-4: #5e7478;
  --tone-5: #1e4a50;
  --display: "Big Shoulders", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #07191c;
    --surface: #0e2629;
    --ink: #e6f0f1;
    --muted: #93afb3;
    --teal: #4fb7bd;
    --on-teal: #041013;
    --orange: #ff8b3d;
    --orange-text: #ff9a55;
    --line: #24474b;
    --board: #031114;
    --board-line: rgba(230, 240, 241, 0.12);
    --tone-1: #4fb7bd;
    --tone-2: #8cb5ba;
    --tone-3: #5cc2ae;
    --tone-4: #a3b8bb;
    --tone-5: #6fa0a6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--body);
  -webkit-text-size-adjust: 100%;
}

.masthead-inner, main, footer { width: min(100% - 2rem, 60rem); margin-inline: auto; }

/* Painted-teal banner. The 55% overlay keeps white text at 5.5:1 or better over the
   texture's lightest strokes; #04464e is its average color, shown until the image loads. */
.masthead {
  margin-bottom: 1.5rem;
  padding: 2.25rem 0 1.5rem;
  color: #ffffff;
  background-color: #04464e;
  background-image: linear-gradient(rgba(3, 30, 34, 0.55), rgba(3, 30, 34, 0.55)), url("/assets/teal-texture-840.webp");
  background-image: linear-gradient(rgba(3, 30, 34, 0.55), rgba(3, 30, 34, 0.55)),
    image-set(url("/assets/teal-texture-840.webp") 1x, url("/assets/teal-texture-1680.webp") 2x);
  background-size: cover;
  background-position: center top;
}

h1 {
  margin: 0;
  font: 800 clamp(2.6rem, 9vw, 5rem)/0.88 var(--display);
}
h1 span { display: block; }
.wordmark { display: block; width: auto; height: 1.75rem; margin: 0 0 0.6rem; }

h2 { margin: 0 0 0.75rem; font: 700 1.9rem/1.05 var(--display); }
h3 { margin: 0; }

.status-line { margin: 0.9rem 0 0; max-width: 60ch; }

/* The scoreboard: the one loud element on the page. */
.board {
  background: var(--board);
  color: var(--board-ink);
  border-radius: 6px;
  padding: 1.1rem 1.25rem 0.6rem;
}
.board h2 { color: var(--board-muted); font-size: 1.3rem; margin-bottom: 0.25rem; }
.board-message { margin: 0.25rem 0 0.8rem; font-size: 1.1rem; max-width: 52ch; }

.standings { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--board-line);
}
.row:first-child { border-top: 0; }
.rank {
  font: 800 2rem/1 var(--display);
  text-align: center;
  color: var(--board-muted);
  padding: 0.3rem 0;
  border-radius: 4px;
}
.row.leader .rank { background: var(--orange); color: var(--on-orange); }
.name { display: block; font: 700 clamp(1.6rem, 6vw, 2.4rem)/1 var(--display); }
.detail { display: block; margin-top: 0.25rem; color: var(--board-muted); font-size: 0.92rem; }
.tag {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--board-muted);
  border-radius: 3px;
  font: 600 0.75rem/1 var(--body);
}
.pts { text-align: right; font: 800 clamp(2.2rem, 8vw, 3.4rem)/0.9 var(--display); font-variant-numeric: tabular-nums; }
.pts small { display: block; font: 500 0.8rem/1.2 var(--body); color: var(--board-muted); }

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1.5rem;
  border-top: 3px solid var(--teal);
}
.fact { padding: 0.9rem 1rem 0.9rem 0; }
.fact + .fact { border-left: 1px solid var(--line); padding-left: 1rem; }
.fact h3 { color: var(--teal); font: 700 1.3rem/1.1 var(--display); margin-bottom: 0.2rem; }
.fact p { margin: 0; }

.panel { margin-top: 2.75rem; }
.note { margin: -0.35rem 0 1rem; color: var(--muted); max-width: 62ch; }

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-family: var(--body); font-size: 12px; }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .end-label { font-family: var(--body); font-size: 13px; font-weight: 600; }
.chart .tone-leader { stroke: var(--orange); stroke-width: 3.5; }
.chart .tone-house { stroke: var(--ink); stroke-dasharray: 6 5; }
.chart .tone-1 { stroke: var(--tone-1); }
.chart .tone-2 { stroke: var(--tone-2); }
.chart .tone-3 { stroke: var(--tone-3); }
.chart .tone-4 { stroke: var(--tone-4); }
.chart .tone-5 { stroke: var(--tone-5); }
.chart text.tone-leader { fill: var(--orange-text); stroke: none; font-weight: 700; }
.chart text.tone-house { fill: var(--ink); stroke: none; }
.chart text.tone-1, .chart circle.tone-1 { fill: var(--tone-1); stroke: none; }
.chart text.tone-2, .chart circle.tone-2 { fill: var(--tone-2); stroke: none; }
.chart text.tone-3, .chart circle.tone-3 { fill: var(--tone-3); stroke: none; }
.chart text.tone-4, .chart circle.tone-4 { fill: var(--tone-4); stroke: none; }
.chart text.tone-5, .chart circle.tone-5 { fill: var(--tone-5); stroke: none; }
.chart circle.tone-leader { fill: var(--orange); stroke: none; }
.chart circle.tone-house { fill: var(--ink); stroke: none; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); column-gap: 2rem; }
.category { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.category h3 { font: 700 1.4rem/1.1 var(--display); margin-bottom: 0.35rem; }
.podium { list-style: none; margin: 0; padding: 0; }
.podium li { display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.5rem; padding: 0.12rem 0; font-variant-numeric: tabular-nums; }
.podium .place { color: var(--muted); font-weight: 600; }
.podium li:first-child .player { font-weight: 600; }
.podium li.empty { display: block; color: var(--muted); }
.fav { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.92rem; }
.fav.leading { color: var(--teal); font-weight: 600; }

.picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.picker button {
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1rem/1 var(--body);
  cursor: pointer;
}
.picker button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.ballot-total { margin: 0 0 0.5rem; font-weight: 600; }
.ballot { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); column-gap: 2rem; }
.ballot-cat { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.ballot-cat h3 { font: 700 1.25rem/1.1 var(--display); margin-bottom: 0.3rem; }
.ballot-cat ul { list-style: none; margin: 0; padding: 0; }
.pick {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  grid-template-areas: "slot name result" "slot now result";
  column-gap: 0.5rem;
  padding: 0.35rem 0;
}
.pick .slot { grid-area: slot; color: var(--muted); font-weight: 600; }
.pick .pick-name { grid-area: name; font-weight: 600; }
.pick .pick-now { grid-area: now; color: var(--muted); font-size: 0.875rem; }
.pick .pick-result {
  grid-area: result;
  align-self: center;
  padding: 0.22rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.result-exact .pick-result { background: var(--orange); color: var(--on-orange); }
.result-partial .pick-result { border-color: var(--teal); color: var(--teal); }
.result-miss .pick-result, .result-duplicate .pick-result { color: var(--muted); }
.result-duplicate .pick-name { color: var(--muted); text-decoration: line-through; }

footer { margin-top: 3rem; padding: 1rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
footer p { margin: 0 0 0.5rem; max-width: 72ch; }

@media (min-width: 40rem) {
  .masthead { padding: 3.5rem 0 2.25rem; margin-bottom: 2rem; }
  .wordmark { height: 2.25rem; }
}

@media (max-width: 40rem) {
  .facts { grid-template-columns: 1fr; }
  .fact + .fact { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .row { grid-template-columns: 2.4rem 1fr auto; gap: 0.7rem; }
  .rank { font-size: 1.6rem; }
}
