:root {
  /* Deep pitch-green + mint — sports-specific palette, replacing the
     generic dark-charcoal/single-teal-accent look. */
  --bg: #0b1a12;
  --surface: #13261b;
  --surface-2: #1b3325;
  --border: #2c4634;
  --text: #eef4ee;
  --text-dim: #9fb6a7;
  --text-faint: #66806e;
  --accent: #4ee8a8;
  --accent-dim: rgba(78, 232, 168, 0.14);
  --danger: #e2734a;

  /* Editorial pairing: Fraunces (a warm, distinctive serif) for
     display/headers/scores, Work Sans (clean, neutral) for body
     copy and data tables — deliberately not the default sans
     everything look. */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Generous spacing scale — used instead of arbitrary one-off
     padding values, so whitespace reads as intentional. */
  --sp-1: 6px;
  --sp-2: 10px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 36px;
  --sp-6: 52px;

  /* Mixed radii on purpose — one sharp corner, one soft — rather
     than the uniform "20px everywhere" rounded-box look. */
  --radius-card: 2px 18px 2px 18px;
  --radius-sm: 3px;
  --radius-pill: 999px;

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------------- Header ---------------- */
header {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  position: sticky;
  top: 0;
  background: rgba(11, 26, 18, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
  border-bottom: 1px solid rgba(44, 70, 52, 0.6);
}

.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  transform: translateX(-2px); /* slight intentional offset from the grid edge */
}

.brand .away { color: var(--accent); font-style: normal; font-weight: 700; }

#year-select {
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 4px 4px 0;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
}

/* Underline-style tabs instead of a filled pill-in-a-box — reads
   more like an editorial section switcher than a default UI kit
   segmented control. */
.tabs {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-faint);
  padding: 0 0 var(--sp-2);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.chip-row {
  display: flex;
  gap: var(--sp-1);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip-row-wrap { position: relative; }
.chip-row-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 4px;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--bg) 85%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.chip-row-wrap.scrollable::after { opacity: 1; }

.chip {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  white-space: nowrap;
}

.chip.selected {
  border-width: 1px;
}

/* Editorial-style scroll cues — plain oversized serif characters,
   no button chrome (border/circle/fill) — reads as typography
   pointing the way rather than a generic UI icon-button. */
.scroll-arrow {
  position: absolute;
  top: 0;
  width: 32px;
  height: 100%;
  border: none;
  background: none;
  color: var(--accent);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  line-height: 1;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.scroll-arrow:hover { opacity: 1; }
.scroll-arrow.left {
  left: 0;
  justify-content: flex-start;
  background: linear-gradient(to right, var(--bg) 40%, transparent);
}
.scroll-arrow.right {
  right: 0;
  justify-content: flex-end;
  background: linear-gradient(to left, var(--bg) 40%, transparent);
}
.scroll-arrow.hidden { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  .scroll-arrow { display: flex; }
}

/* ---------------- Main content ---------------- */
main {
  flex: 1;
  padding: var(--sp-4) var(--sp-3) 100px;
}

.view { display: none; }
.view.active { display: block; }

.offseason-banner {
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: var(--sp-4);
}

.section-label {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: 21px;
  color: var(--text);
  margin: var(--sp-5) 0 var(--sp-3);
  padding-left: 2px;
}
.section-label:first-child { margin-top: 0; }
.section-label-hint {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
}

/* ---------------- Game cards ---------------- */
/* Deliberately NOT a uniform boxed card — a thin top rule instead
   of a full border, asymmetric radius only on the score/detail
   corner, generous internal breathing room. */
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
  .game-card:hover {
    background: var(--surface-2);
    border-color: #3a413e;
    transform: translateY(-2px);
  }
}

.game-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
}

.broadcast-line {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  color: var(--text-faint);
  margin: -2px 0 var(--sp-2);
}

.status-tag {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.status-tag.final {
  color: var(--text-faint);
  border: 1px solid var(--border);
}
.status-tag.upcoming {
  color: var(--accent);
  border: 1px solid var(--accent);
}

.game-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}

.team-id-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.badge {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-body);
  flex-shrink: 0;
}

.team-name {
  font-size: 14px;
  font-family: var(--font-body);
  font-style: normal;
  color: var(--text);
}
.team-name.winner { font-weight: 600; }
.team-name.loser { color: var(--text-dim); }

.score {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.score.loser { color: var(--text-dim); font-weight: 500; }

.game-detail {
  display: none;
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
  text-align: left;
}
.game-card.expanded .game-detail { display: block; }

.scorer-line {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1);
  padding: 2px 0;
  text-align: left;
}
.scorer-line span { flex: 1; }
.scorer-line .badge {
  width: 16px;
  height: 16px;
  font-size: 7px;
  border-radius: 4px;
}
.assist-text { font-size: 11px; color: var(--text-faint); }
.card-swatch {
  display: inline-block;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  vertical-align: -2px;
}

.share-btn {
  display: block;
  margin-top: var(--sp-2);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

/* ---------------- Standings table ---------------- */
table.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-body);
}
table.standings th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: var(--sp-1) 4px var(--sp-2);
  border-bottom: 1px solid var(--border);
}
table.standings td {
  padding: var(--sp-2) 4px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
tr.highlighted td {
  background: var(--accent-dim);
  border-left: 2px solid var(--accent);
}
tr.highlighted td:first-child { padding-left: 8px; }

/* Home/away split table: force numeric columns to align consistently
   (equal width, centered) instead of drifting based on digit count,
   with a clear thick divider between the Home and Away column groups
   and lighter dividers between W/D/L within each group. */
.split-table th,
.split-table td {
  text-align: center;
  width: 44px;
}
.split-table th:first-child,
.split-table td:first-child {
  text-align: left;
  width: auto;
}
.split-table th:nth-child(3),
.split-table th:nth-child(4),
.split-table th:nth-child(6),
.split-table th:nth-child(7),
.split-table td:nth-child(3),
.split-table td:nth-child(4),
.split-table td:nth-child(6),
.split-table td:nth-child(7) {
  border-left: 1px solid var(--border);
}
.split-table .split-divider,
.split-table th:nth-child(5) {
  border-left: 2px solid var(--text-dim) !important;
}

/* Main standings table: same divider language — light lines between
   the per-game record columns (P/W/D/L), a heavier one marking the
   shift into goal-difference/points totals. */
.main-standings th,
.main-standings td {
  text-align: center;
}
.main-standings th:nth-child(1),
.main-standings th:nth-child(2),
.main-standings td:nth-child(1),
.main-standings td:nth-child(2) {
  text-align: left;
}
.main-standings th:nth-child(4),
.main-standings th:nth-child(5),
.main-standings th:nth-child(6),
.main-standings th:nth-child(8),
.main-standings td:nth-child(4),
.main-standings td:nth-child(5),
.main-standings td:nth-child(6),
.main-standings td:nth-child(8) {
  border-left: 1px solid var(--border);
}
.main-standings th:nth-child(7),
.main-standings td:nth-child(7) {
  border-left: 2px solid var(--text-dim);
}

.standings-team-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.form-strip {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  padding-left: 32px; /* roughly lines up under the team name, past the badge */
}
.form-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #04140c;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-w { background: var(--accent); }
.form-d { background: var(--text-faint); }
.form-l { background: var(--danger); }

.h2h-pickers {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.h2h-pickers select {
  flex: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-family: var(--font-body);
  font-size: 13px;
}
.h2h-vs {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-faint);
  font-size: 13px;
}
.h2h-summary {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-2);
}

/* ---------------- Chart ---------------- */
.chart-wrap {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.chart-wrap.shown { display: block; }

.chart-inner {
  display: flex;
  height: 420px;
}

.chart-axis {
  flex-shrink: 0;
  width: 26px;
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}
.chart-axis span { font-size: 8px; color: var(--text-faint); line-height: 1; }

.chart-scroll-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.chart-scroll {
  overflow-x: auto;
  width: 100%;
  height: 100%;
}

/* ---------------- Golden Boot ---------------- */
.golden-boot-list { margin-top: 4px; }
.gb-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.gb-row.highlighted { background: var(--accent-dim); border-radius: var(--radius-sm); }
.gb-rank { width: 18px; color: var(--text-faint); font-size: 12px; font-family: var(--font-display); }
.gb-name { flex: 1; }
.gb-team { color: var(--text-faint); font-size: 11px; }
.gb-goals {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  min-width: 20px;
  text-align: right;
}

/* ---------------- Today button ---------------- */
.today-btn {
  position: fixed;
  bottom: 20px;
  left: 16px;
  background: var(--accent);
  color: #04140c;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: none;
  z-index: 20;
}
.today-btn.shown { display: block; }

.empty-state, .loading-state, .error-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 48px 20px;
  font-family: var(--font-display);
  font-style: italic;
}
.error-state { color: var(--danger); }

/* ---------------- Footer / issue form ---------------- */
.footer-link {
  text-align: center;
  padding: var(--sp-5) var(--sp-3) 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.footer-link button {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 6px 4px;
  letter-spacing: 0.02em;
}
.footer-link button::before {
  content: "✎ ";
  opacity: 0.7;
}
.legal-link {
  color: var(--text-faint);
  font-size: 11px;
  text-decoration: none;
}
.legal-link:hover { color: var(--text-dim); }
.footer-link button:hover { color: var(--text-dim); }

.issue-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.issue-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: var(--sp-4) var(--sp-3) 60px;
  width: 100%;
  max-width: 520px;
}
.issue-panel h3 {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 19px;
}
.issue-panel textarea,
.issue-panel input[type="email"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: var(--sp-2);
  margin-bottom: var(--sp-2);
  resize: vertical;
}
.honeypot { position: absolute; left: -9999px; }
.issue-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.issue-actions button {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
}
#issue-submit-btn { background: var(--accent); color: #04140c; border-color: var(--accent); font-weight: 600; }
#issue-thanks {
  color: var(--accent);
  font-size: 14px;
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
  padding: var(--sp-3) 0;
}
