:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #6e6e73;
  --accent: #007aff;
  --green: #34c759;
  --border: rgba(60, 60, 67, 0.12);
  --header-bg: rgba(60, 60, 67, 0.06);
  --stripe: rgba(60, 60, 67, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --text-secondary: #98989d;
    --accent: #0a84ff;
    --green: #30d158;
    --border: rgba(255, 255, 255, 0.14);
    --header-bg: rgba(255, 255, 255, 0.08);
    --stripe: rgba(255, 255, 255, 0.03);
  }
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

nav.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

nav.top a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

nav.top a.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

h1 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 16px;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 8px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.card + .card { margin-top: 12px; }

a.game-row {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
}

a.game-row:last-child { border-bottom: none; }

.game-row .title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 16px;
}

.game-row .meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 3px;
}

.badge-published {
  color: var(--green);
  font-size: 13px;
}

.empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 16px;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 16px;
}

.score-box {
  padding: 16px;
}

table.scoregrid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.scoregrid th, table.scoregrid td {
  text-align: center;
  padding: 6px 4px;
}

table.scoregrid th:first-child, table.scoregrid td:first-child {
  text-align: left;
}

table.scoregrid th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
}

table.scoregrid td.total {
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.stats {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
  white-space: nowrap;
}

table.stats th, table.stats td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

table.stats th {
  background: var(--header-bg);
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  white-space: pre-line;
  line-height: 1.2;
}

table.stats td:nth-child(2), table.stats th:nth-child(2) {
  text-align: left;
  white-space: normal;
}

table.stats tr:nth-child(even) td {
  background: var(--stripe);
}

.game-header {
  margin-bottom: 16px;
}

.game-header .opponent {
  font-size: 22px;
  font-weight: 800;
}

.game-header .date {
  color: var(--text-secondary);
  font-size: 15px;
}

.sort-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
}

.sort-bar button {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.sort-bar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.season-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.season-row:last-child { border-bottom: none; }

.season-row .name {
  font-size: 15px;
}

.season-row .jersey {
  color: var(--text-secondary);
  margin-right: 8px;
}

.season-row .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

footer.credit {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 32px;
}
