:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-alt: #1c232c;
  --line: #2a323d;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3fb950;
  --accent-dim: #2a7f3a;
  --gold: #e3b341;
  --danger: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  padding: 32px 20px 8px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #12261a, transparent);
}

/* The crest ships on a solid black square; `lighten` drops that block out
   against the dark page instead of leaving a visible patch. */
.crest-hero {
  display: block;
  width: 108px;
  height: auto;
  margin: 0 auto 10px;
  mix-blend-mode: lighten;
}

.site-header h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.subtitle { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 { margin: 0; font-size: 17px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

.explainer {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.explainer summary {
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.explainer summary::-webkit-details-marker { display: none; }
.explainer summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.explainer[open] summary::before { content: "▾ "; }
.explainer summary:hover { color: var(--text); }

.explainer p {
  color: var(--muted);
  font-size: 12.5px;
  margin: 10px 0 0;
  max-width: 68ch;
}

.explainer strong { color: var(--text); }
.legend { color: var(--muted); font-size: 12px; }

.tag {
  display: inline-block;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 6px;
  font-weight: 600;
  color: var(--text);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 13px;
  cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: var(--muted); }

/* rounds & fixtures */

.round + .round { margin-top: 16px; }

.round-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.round-name { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.bye { color: var(--muted); font-size: 12px; }

.fixture {
  display: grid;
  grid-template-columns: 78px 1fr 46px 16px 46px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.fixture + .fixture { margin-top: 4px; }
.fixture.decided { background: var(--panel-alt); border-color: var(--accent-dim); }

.when { color: var(--muted); font-size: 12px; }
.side { font-size: 13.5px; font-weight: 600; }
.side.home { text-align: right; }

.x { color: var(--muted); text-align: center; font-size: 12px; }

input.score {
  width: 100%;
  background: #0b0f14;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
}
input.score:focus { outline: 2px solid var(--accent-dim); outline-offset: -1px; }

/* Appears only on a tied score, spanning the row under the scoreline. */
.pen-pick {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.pen-pick[hidden] { display: none; }
.pen-label { color: var(--muted); font-size: 12px; margin-right: 2px; }

.pen-btn {
  display: inline-flex;
  align-items: center;
  background: #0b0f14;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.pen-btn:hover { border-color: var(--muted); color: var(--text); }

.pen-btn[aria-pressed="true"] {
  background: rgba(63, 185, 80, .12);
  border-color: var(--accent);
  color: var(--text);
}

.pen-btn[aria-pressed="true"]::before { content: "🏆"; margin-right: 6px; font-size: 11px; }

/* history */

.fixture.result { grid-template-columns: 1fr 74px 1fr 168px; }
.final { text-align: center; font-weight: 700; }
.winner { color: var(--muted); font-size: 12px; text-align: right; }

/* standings */

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th, td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

th.team, td.team { text-align: left; font-weight: 600; }
td.pts { font-weight: 700; color: var(--accent); }

tr.qualified td { background: rgba(63, 185, 80, .07); }
tr.qualified td.pos { box-shadow: inset 3px 0 0 var(--accent); }
tr.cut td { border-bottom: 2px solid var(--accent-dim); }
tr.leader td.team { color: var(--gold); }

.move { font-size: 10px; margin-left: 3px; }
.move.up { color: var(--accent); }
.move.down { color: var(--danger); }

/* bracket */

.tie {
  display: grid;
  grid-template-columns: 92px 1fr 16px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  background: var(--panel-alt);
  font-size: 13.5px;
}

.tie + .tie { margin-top: 6px; }
.tie-label { color: var(--muted); font-size: 12px; }

.seeded {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}

.seeded b { color: var(--gold); font-size: 12px; flex: none; }

/* chances */

.chance {
  display: grid;
  grid-template-columns: 150px 1fr 56px 66px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
}

.chance-first { color: var(--muted); font-size: 11.5px; text-align: right; }

.chance-team { font-weight: 600; }
.chance.out { opacity: .4; }

.bar {
  display: block;
  height: 8px;
  background: var(--panel-alt);
  border-radius: 4px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 4px;
  transition: width .25s ease;
}

.chance-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 16px 40px;
}

@media (max-width: 640px) {
  .fixture { grid-template-columns: 1fr 44px 14px 44px 1fr; row-gap: 6px; }
  .when { grid-column: 1 / -1; }
  .pen-label { flex-basis: 100%; text-align: center; margin: 0; }
  .fixture.result { grid-template-columns: 1fr 66px 1fr; }
  .winner { grid-column: 1 / -1; text-align: center; }
  .chance { grid-template-columns: 108px 1fr 48px 58px; font-size: 12px; gap: 8px; }
  .tie { grid-template-columns: 1fr 16px 1fr; row-gap: 4px; }
  .tie-label { grid-column: 1 / -1; }
}
