:root {
  --bg: #0b0716;
  --bg-elevated: #130d24;
  --card: #1a1230;
  --card-hover: #22183d;
  --border: #2f2350;
  --text: #f1ecfb;
  --text-dim: #a99bcf;
  --text-faint: #6e5e96;
  --accent: #a870ff;
  --accent-ink: #17092e;
  --accent-2: #ffc94d;
  --live: #ff5252;
  --win: #5ed6ff;
  --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: #3d2d68; }

.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],
[data-player-id] {
  cursor: pointer;
}
[data-team-id]:hover,
[data-player-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;
}

/* Box score 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; }

table.linescore {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}
table.linescore th, table.linescore td {
  text-align: center;
  padding: 5px 6px;
  font-size: 12px;
}
table.linescore td:first-child, table.linescore th:first-child {
  text-align: left;
}
table.linescore th { color: var(--text-faint); font-weight: 600; }
table.linescore td.total { font-weight: 800; }
table.linescore tr:not(:last-child) td { border-bottom: 1px solid var(--border); }

/* Scoring summary / penalties timeline */
.events-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.event-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.event-row:last-child { border-bottom: none; }
.event-clock {
  color: var(--text-faint);
  font-weight: 700;
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}
.event-icon { min-width: 18px; text-align: center; }
.event-text { flex: 1; color: var(--text-dim); }
.event-text b { color: var(--text); font-weight: 600; }
.event-assists { color: var(--text-faint); }
.event-row.event-goal .event-text { color: var(--text); }
.event-row.event-away { flex-direction: row-reverse; text-align: right; }
.event-row.event-away .event-text { text-align: right; }
.goal-tags { display: inline-flex; gap: 4px; margin-left: 4px; }
.goal-tag {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent-2);
  border-radius: 4px;
  padding: 1px 4px;
  letter-spacing: 0.02em;
}
.event-row.event-penalty .event-text { color: var(--text-dim); }
.penalty-mins {
  color: var(--text-faint);
  font-weight: 700;
  font-size: 11px;
}

/* Team stat comparison bars */
.stat-compare { display: flex; flex-direction: column; gap: 14px; }
.stat-compare-row { display: flex; flex-direction: column; gap: 4px; }
.stat-compare-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}
.stat-compare-labels .home-val { color: var(--text); }
.stat-compare-labels .away-val { color: var(--text); }
.stat-compare-name {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-compare-bar {
  display: flex;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
}
.stat-compare-bar .home-bar { background: var(--accent); }
.stat-compare-bar .away-bar { background: var(--accent-2); }

/* Pregame preview */
.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; }
.preview-form-stats { display: flex; gap: 10px; flex-shrink: 0; font-size: 11.5px; color: var(--text-dim); }
.preview-form-stats b { color: var(--text); }

.boxscore-toggle {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px 0 0;
}

.full-box table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}
.full-box th, .full-box td {
  text-align: right;
  padding: 4px 8px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
}
.full-box th:first-child, .full-box td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
}
.full-box th { color: var(--text-faint); font-weight: 600; }
.full-box .team-header td {
  font-weight: 800;
  padding-top: 12px;
  color: 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: 560px;
}
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: #3d2d68; }
.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: #3d2d68; }
.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-desc {
  font-size: 12px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.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 / Player detail views */
.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, .detail-headshot {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}
.detail-headshot { border-radius: 50%; background: var(--card); object-fit: cover; }

.avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  flex-shrink: 0;
}
.avatar-fallback.small {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

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

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

.detail-subtitle .team-click,
.detail-subtitle [data-team-id] {
  display: inline;
}

.detail-meta {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 2px;
}

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

.roster-position-group { margin-bottom: 18px; }
.roster-position-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.player-chip:hover { background: var(--card-hover); }
.player-chip-headshot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
  flex-shrink: 0;
}
.player-chip-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-chip-meta {
  font-size: 11px;
  color: var(--text-faint);
}

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

.full-box td.win { color: var(--win); }
.full-box td.loss { color: var(--text-faint); }

/* Generic HockeyTech "sections" stat tables (standings/teams/roster/career/gamelog) */
table.ht-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}
table.ht-table th, table.ht-table td {
  padding: 8px 10px;
  font-size: 12.5px;
  text-align: center;
  white-space: nowrap;
}
table.ht-table th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
table.ht-table td:first-child, table.ht-table th:first-child { text-align: left; }
table.ht-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }

/* 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;
}
