:root {
  --ink: #16181d;
  --muted: #626b7a;
  --line: #d9dee6;
  --surface: #ffffff;
  --sunken: #f6f7f9;
  --accent: #0b5cad;
  --navy: #0b1c3a;
  --gold: #a8873c;
  --win: #1f7a4d;
  --loss: #a63a3a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9edf3;
    --muted: #9aa5b4;
    --line: #2b323c;
    --surface: #14171c;
    --sunken: #1b2027;
    --accent: #7db4f0;
    --gold: #c8a24a;
    --win: #6fce9d;
    --loss: #f08a8a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  max-width: 66rem;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.55rem; margin: 0 0 .2rem; letter-spacing: -.015em; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }

.muted { color: var(--muted); font-size: .875rem; }

/* ---------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  padding: .2rem;
}
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.logo { border-radius: 50%; display: block; width: 60px; height: 60px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.wordmark { font-weight: 700; letter-spacing: -.01em; font-size: 1.05rem; }
.sub { color: var(--muted); font-size: .8rem; }

.controls { display: flex; align-items: center; gap: .5rem; }

select {
  font: inherit;
  font-size: .85rem;
  padding: .35rem .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  max-width: 16rem;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
}
pre {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem;
  overflow-x: auto;
}

/* ------------------------------------------------------------------- views */

.view-head { margin-bottom: .75rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }

.chip-button {
  font: inherit;
  font-size: .8rem;
  padding: .3rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chip-button:hover { border-color: var(--accent); color: var(--accent); }
.chip-button.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .chip-button.is-on { background: var(--gold); border-color: var(--gold); color: #14171c; }
}

/* ------------------------------------------------------------------ tables */

table { border-collapse: collapse; width: 100%; }

th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom-width: 2px;
  background: var(--surface);
}
tbody tr:hover { background: var(--sunken); }

.num { text-align: right; white-space: nowrap; }
.strong { font-weight: 650; }
.ha { color: var(--muted); font-size: .8rem; }

.scroll { overflow-x: auto; }

.cut { color: var(--accent); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

.team-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.team-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.team-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-block;
  margin-left: .4rem;
  padding: 0 .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
}
.muted-chip { opacity: .85; }

/* --------------------------------------------------------------- team page */

.back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-size: .85rem;
}
.back:hover { text-decoration: underline; }

.team-head { margin-bottom: 1.25rem; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  background: var(--sunken);
}
.kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.kpi-sub { font-size: .72rem; color: var(--muted); }

.equation {
  font-weight: 650;
  font-size: 1rem;
  padding: .6rem .9rem;
  border-left: 3px solid var(--gold);
  background: var(--sunken);
  border-radius: 0 8px 8px 0;
  margin-bottom: 1rem;
}

table.games td.result { font-weight: 700; }
tr.won td.result { color: var(--win); }
tr.lost td.result { color: var(--loss); }
table.games tfoot td {
  border-top: 2px solid var(--line);
  border-bottom: 0;
  font-weight: 650;
  padding-top: .6rem;
}

.note { margin-top: .9rem; max-width: 46rem; }

/* ------------------------------------------------------------------ footer */

footer { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1rem; }
footer a { color: var(--accent); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 46rem) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  body { padding: 1rem .75rem 3rem; }
  .masthead { flex-direction: column; align-items: stretch; gap: .75rem; }
  .brand-text { min-width: 0; }
  .controls { width: 100%; flex-wrap: wrap; }
  select { flex: 1 1 8rem; width: auto; max-width: none; }
  .wordmark { font-size: 1rem; }
  th, td { padding: .45rem .35rem; }
  .hide-sm { display: none; }
  .logo { width: 52px; height: 52px; }
  .kpi-value { font-size: 1.25rem; }
}
