:root {
  --bg: #0f0a0d;
  --bg-elevated: #170f13;
  --card: #1f1418;
  --card-hover: #2a1b20;
  --border: #3a232a;
  --text: #f5ecee;
  --text-dim: #b89aa1;
  --text-faint: #7a5f65;
  --accent: #e0293f;
  --accent-ink: #2a0308;
  --accent-2: #f2b705;
  --live: #ff5252;
  --win: #6ee7b7;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent-2); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* Header */
header.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand img { width: 30px; height: 30px; }

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-text .plus { color: var(--accent); }

.tagline {
  font-size: 12px;
  color: var(--text-dim);
  display: none;
}

@media (min-width: 640px) {
  .tagline { display: block; }
}

nav.tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  overflow-x: auto;
  max-width: 100%;
}

nav.tabs button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

nav.tabs button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Date nav */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 6px;
}

.date-nav button.nav-arrow {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.date-nav button.nav-arrow:hover { background: var(--card-hover); }

.date-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 170px;
}

.date-label {
  font-weight: 700;
  font-size: 16px;
}

.date-picker-input {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.today-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Games grid */
#scores {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  #scores { grid-template-columns: 1fr 1fr; }
}

.status-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

.status-msg .retry-btn {
  display: inline-block;
  margin-top: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}

.skeleton {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 108px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.game-card:hover { background: var(--card-hover); border-color: #4a2e37; }

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.game-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.game-status.live { color: var(--live); }
.game-status.final { color: var(--text-faint); }

.round-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.broadcast {
  font-size: 11px;
  color: var(--text-faint);
}

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

.team-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-click {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

[data-team-id] {
  cursor: pointer;
}
[data-team-id]:hover {
  text-decoration: underline;
}

.fav-star {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px 0 0;
  line-height: 1;
}
.fav-star.on { color: var(--accent-2); }

.team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.team-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-record {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 4px;
}

.team-score {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

.team-row.winner .team-score,
.team-row.winner .team-name { color: var(--win); }

.game-card-footer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
}

/* Match info expand panel */
.boxscore-panel {
  grid-column: 1 / -1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: -4px;
  font-size: 13px;
}

.boxscore-panel h4 {
  margin: 18px 0 8px;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.boxscore-panel h4:first-of-type { margin-top: 0; }

/* Recent form */
.preview-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.preview-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.preview-form-team {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  min-width: 0;
}
.preview-form-team img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.form-badges { display: flex; gap: 4px; flex-shrink: 0; }
.form-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--text-faint);
}
.form-badge.win { background: var(--win); }
.form-badge.loss { background: var(--live); color: #2a0808; }
.form-badge.draw { background: var(--accent-2); }

.game-info-line {
  color: var(--text-faint);
  font-size: 12px;
  margin-bottom: 6px;
}

.close-panel {
  float: right;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
}

/* Standings */
#standings-view { padding-top: 20px; }
.standings-section { margin-bottom: 20px; }
.standings-section h3 {
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.standings-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.standings {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
table.standings th, table.standings td {
  padding: 9px 10px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}
table.standings th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
table.standings td:nth-child(2), table.standings th:nth-child(2) {
  text-align: left;
}
table.standings tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
table.standings td:first-child {
  border-left: 3px solid transparent;
}

.standings-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.standings-team img { width: 20px; height: 20px; object-fit: contain; }

.standings-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 2px 28px;
  font-size: 11px;
  color: var(--text-faint);
}
.standings-legend-item { display: flex; align-items: center; gap: 6px; }
.standings-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Teams grid */
#teams-view { padding-top: 20px; }
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.team-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.team-card:hover { background: var(--card-hover); border-color: #4a2e37; }
.team-card img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.team-card-name { font-weight: 700; font-size: 14px; }
.team-card-record { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* News */
#news-view { padding-top: 20px; }
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-card {
  display: flex;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.news-card:hover { background: var(--card-hover); border-color: #4a2e37; }
.news-card img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-elevated);
}
.news-card-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.news-card-headline { font-size: 14px; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.news-card-meta { font-size: 11px; color: var(--text-faint); margin-top: 6px; }
@media (max-width: 480px) {
  .news-card img { width: 84px; height: 64px; }
}

/* Team detail view */
.back-link {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 20px 0 16px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

.detail-title {
  margin: 0 0 4px;
  font-size: 20px;
}

.detail-subtitle {
  color: var(--text-dim);
  font-size: 13px;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  min-width: 78px;
}
.stat-pill-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.stat-pill-value {
  font-size: 15px;
  font-weight: 700;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.schedule-row[data-game-id] {
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.schedule-row[data-game-id]:hover {
  background: var(--card-hover);
}
.schedule-date {
  color: var(--text-faint);
  min-width: 56px;
}
.schedule-opp {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.schedule-atvs {
  color: var(--text-faint);
  font-size: 11px;
}
.team-logo-mini {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.schedule-result {
  font-weight: 700;
  min-width: 90px;
  text-align: right;
}
.schedule-result.win { color: var(--win); }
.schedule-result.draw { color: var(--accent-2); }
.schedule-result.loss { color: var(--text-faint); }
.schedule-result.live { color: var(--live); }

/* Footer */
footer.site-footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  padding: 30px 16px 40px;
  border-top: 1px solid var(--border);
  margin-top: 30px;
}
footer.site-footer a { color: var(--text-dim); }
footer.site-footer p { margin: 4px 0; }

.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;
}
