:root {
  --bg: #0b0d12;
  --surface: #161a22;
  --surface-hover: #1d222c;
  --border: #262c38;
  --text: #e8eaed;
  --text-dim: #9aa3b2;
  --accent: #4f8cff;
  --win: #3ecf7e;
  --loss: #f16565;
  --tie: #d8b34a;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-hover: #f0f2f5;
    --border: #e2e5ea;
    --text: #1a1d24;
    --text-dim: #666e7d;
  }
}

* { box-sizing: border-box; }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(16px, 4vw, 48px) 12px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13px;
}

#refresh-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

#refresh-btn:hover { background: var(--surface-hover); }
#refresh-btn.spinning { animation: spin 0.6s linear; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 48px) 48px;
}

.loading, .error {
  color: var(--text-dim);
  padding: 48px 0;
  text-align: center;
}

.error { color: var(--loss); }

.league-section {
  margin: 28px 0;
}

.league-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.league-body {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.team-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.standings-panel {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 860px) {
  .league-body {
    flex-direction: column;
  }
  .standings-panel {
    flex-basis: auto;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .standings-table {
    flex: 1 1 240px;
  }
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 12px;
}

.standings-table caption {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.standings-table td {
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table tr:first-child td {
  border-top: none;
}

.rank-col {
  color: var(--text-dim);
  width: 1%;
}

.team-col {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.standings-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.record-col, .pct-col {
  text-align: right;
  color: var(--text-dim);
  width: 1%;
}

.standings-table tr.highlight {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.standings-table tr.highlight td {
  color: var(--text);
  font-weight: 700;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  border-top: 3px solid var(--card-color, var(--accent));
}

.team-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

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

.team-name-block {
  flex: 1;
  min-width: 0;
}

.team-name {
  font-weight: 600;
  font-size: 15px;
  display: block;
}

.team-standing {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 1px;
}

.team-record {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.game-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.game-row:first-of-type { border-top: none; }

.game-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 44px;
  flex-shrink: 0;
}

.game-detail { flex: 1; text-align: right; }

.matchup { font-weight: 500; }
.matchup .win { color: var(--win); font-weight: 700; }
.matchup .loss { color: var(--loss); }
.game-meta { color: var(--text-dim); font-size: 12px; margin-top: 1px; }

.news-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.news-item {
  display: block;
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.35;
}

.news-item:hover { color: var(--accent); }

.empty-note {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 6px 0;
}

.stale-note {
  font-size: 11px;
  color: var(--tie);
  margin-top: 8px;
}

.page-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 0 16px 32px;
}
