/* ====================================
   McCARTHY TRACKER
   Sports Broadcast Dashboard
   Tom McCarthy #18 — West Coast Eagles
   ==================================== */

:root {
  --blue: #003087;
  --gold: #F2A900;
  --navy: #001A4D;

  /* Dark theme (default — broadcast feel) */
  --bg: #080d19;
  --surface: #0f1628;
  --surface-2: #162035;
  --text-bright: #ffffff;
  --text: #c8d1dc;
  --text-muted: #7a8599;
  --text-dim: #4a5568;
  --border: rgba(255,255,255,0.05);

  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;

  --r: 4px;
  --pill: 100px;
  --max-w: 800px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f5;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --text-bright: #0f172a;
    --text: #334155;
    --text-muted: #94a3b8;
    --text-dim: #c5cdd8;
    --border: rgba(0,0,0,0.06);
  }
}
:root[data-theme="light"] {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --text-bright: #0f172a;
  --text: #334155;
  --text-muted: #94a3b8;
  --text-dim: #c5cdd8;
  --border: rgba(0,0,0,0.06);
}
:root[data-theme="dark"] {
  --bg: #080d19;
  --surface: #0f1628;
  --surface-2: #162035;
  --text-bright: #ffffff;
  --text: #c8d1dc;
  --text-muted: #7a8599;
  --text-dim: #4a5568;
  --border: rgba(255,255,255,0.05);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* Atmospheric gradient — subtle blue vignette at top */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 320px;
  background: radial-gradient(ellipse 120% 100% at 50% -20%, rgba(0,48,135,0.12), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) 12px 40px;
}

/* ============ HEADER ============ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header__logo img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.header__logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -0.5px;
}

.header__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header__name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.header__number {
  color: var(--gold);
}

.header__team {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.header__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot--live {
  background: var(--green);
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot--delayed {
  background: var(--amber);
}

/* ============ HERO CAROUSEL ============ */
.hero-carousel {
  margin: 10px -12px 0;
  position: relative;
  height: 160px;
  overflow: hidden;
  border-radius: 0;
}

.hero-carousel__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.hero-slide--active {
  opacity: 1;
  pointer-events: auto;
}

.hero-slide__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 40%, transparent 70%);
  pointer-events: none;
}

.hero-slide__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 20px;
  width: 100%;
}

.hero-slide__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.hero-slide__stat-num {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.hero-slide__stat-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hero-slide__text {
  flex: 1;
  min-width: 0;
}

.hero-slide__title {
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.hero-slide__subtitle {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  margin-top: 3px;
}

.hero-slide__caption {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
  line-height: 1.3;
}

.hero-carousel__dots {
  position: absolute;
  bottom: 8px;
  right: 16px;
  display: flex;
  gap: 5px;
  z-index: 2;
}

.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s;
}

.hero-dot--active {
  background: var(--gold);
  width: 16px;
  border-radius: 3px;
}

/* ============ SCORE BAR (broadcast overlay) ============ */
.score-bar {
  margin: 10px -12px 0;
  padding: 14px 20px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Broadcast gradient overlay */
.score-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 40%, rgba(0,0,0,0.12) 100%);
  pointer-events: none;
}

/* Gold accent stripe */
.score-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

.score-bar__side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.score-bar__side:first-of-type {
  justify-content: flex-end;
}

.score-bar__side--away {
  justify-content: flex-start;
}

.score-bar__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  object-fit: contain;
  flex-shrink: 0;
  display: none;
  background: rgba(255,255,255,0.06);
  padding: 3px;
}

.score-bar__logo[src]:not([src=""]) {
  display: block;
}

.score-bar__abbr {
  font-size: 14px;
  font-weight: 800;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-bar__abbr--wce {
  color: var(--gold);
}

.score-bar__score {
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  letter-spacing: -0.03em;
  min-width: 48px;
}

.score-bar__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.score-bar__badge {
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: var(--pill);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.score-bar__time {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-variant-numeric: tabular-nums;
}

/* ============ BENCH STATUS ============ */
.bench-status {
  text-align: center;
  padding: 12px 0 8px;
}

.bench-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-radius: var(--pill);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.3s;
}

.bench-pill--ground {
  background: var(--green);
  color: #fff;
}

.bench-pill--bench {
  background: var(--amber);
  color: #fff;
}

.bench-pill--unknown {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.bench-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: pulse 1.5s ease-in-out infinite;
}

.bench-pill--unknown .bench-pill__dot {
  background: var(--text-dim);
  animation: none;
}

.bench-tog {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============ DASHBOARD LAYOUT ============ */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 640px) {
  :root { --max-w: 960px; }
  .dashboard {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 16px;
    align-items: start;
  }
}

.dashboard__side {
  /* Activity sidebar — sticks on desktop */
}

@media (min-width: 640px) {
  .dashboard__side {
    position: sticky;
    top: 8px;
  }
  .dashboard__side .section-label { margin-top: 14px; }
}

/* ============ SECTION LABELS ============ */
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============ STAT GRID ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

@media (max-width: 420px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 4px 8px;
  text-align: center;
  transition: border-color 0.3s;
}

.stat-card--updated {
  animation: stat-highlight 0.6s ease;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card--updated .stat-card__value {
  color: var(--gold);
}

.stat-card__label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ ACTIVITY FEED ============ */
.activity {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  .activity {
    max-height: calc(100vh - 240px);
  }
}

.activity::-webkit-scrollbar { width: 3px; }
.activity::-webkit-scrollbar-track { background: transparent; }
.activity::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 3px; }

.activity__empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  animation: slide-in 0.2s ease;
}

.activity-item:last-child { border-bottom: none; }

.activity-item__marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--blue);
}

.activity-item__marker--goal { background: var(--green); }
.activity-item__marker--bench-on { background: var(--green); }
.activity-item__marker--bench-off { background: var(--amber); }
.activity-item__marker--stat { background: var(--blue); }
.activity-item__marker--negative { background: var(--red); }

.activity-item__content { flex: 1; min-width: 0; }

.activity-item__event {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.activity-item__event--bench-on { color: var(--green); }
.activity-item__event--bench-off { color: var(--amber); }

.activity-item__meta {
  font-size: 9px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* ============ SETTINGS ============ */
.settings-section {
  margin-top: 16px;
}

.settings {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
}

.settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.settings__row + .settings__row {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
}

.settings__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.settings__sublabel {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

.toggle {
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: var(--text-dim);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle--active { background: var(--green); }

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle--active::after { transform: translateX(16px); }

.install-hint {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  display: none;
}

.install-hint--visible { display: block; }
.install-hint strong { color: var(--text); }

/* ============ NO GAME ============ */
.no-game {
  text-align: center;
  padding: 48px 20px;
}

.no-game__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.no-game__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 20px;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

.countdown__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.countdown__number {
  font-size: 40px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  letter-spacing: -0.03em;
}

.countdown__label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.next-match-info {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.next-match-info__teams {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
}

.next-match-info__detail {
  font-size: 10px;
  color: var(--text-dim);
}

/* ============ STALE BANNER ============ */
.stale-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 6px 0;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.12);
  border-radius: var(--r);
  font-size: 10px;
  font-weight: 600;
  color: var(--amber);
}

.stale-banner--visible { display: flex; }

/* ============ ANIMATIONS ============ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes stat-highlight {
  0% { border-color: var(--border); }
  25% { border-color: var(--gold); }
  100% { border-color: var(--border); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 360px) {
  .score-bar { padding: 10px 14px; }
  .score-bar__score { font-size: 28px; min-width: 38px; }
  .score-bar__center { padding: 0 12px; }
  .score-bar__logo { width: 26px; height: 26px; }
}

/* ============ LAST MATCH REEL ============ */
.last-match {
  margin-top: 8px;
}

.lm-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.lm-result::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--gold));
}

.lm-result__scoreline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.lm-team {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.lm-team--away {
  justify-content: flex-start;
}

.lm-team__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: var(--r);
  display: none;
}

.lm-team__logo[src]:not([src=""]) {
  display: block;
}

.lm-team__abbr {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lm-team__abbr--wce {
  color: var(--gold);
}

.lm-team__score {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 36px;
}

.lm-result__center {
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lm-result__badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--pill);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-muted);
}

.lm-result__badge--w {
  background: var(--green);
  color: #fff;
}

.lm-result__badge--l {
  background: var(--red);
  color: #fff;
}

.lm-result__badge--d {
  background: var(--amber);
  color: #fff;
}

.lm-result__meta {
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* Hero stats row */
.lm-heroes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 8px;
}

@media (max-width: 420px) {
  .lm-heroes {
    grid-template-columns: repeat(2, 1fr);
  }
}

.lm-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 4px 10px;
  text-align: center;
  animation: hero-pop 0.5s ease both;
}

.lm-hero__value {
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.lm-hero__label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 4px;
}

@keyframes hero-pop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Highlights */
.lm-highlights {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.lm-highlight {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
}

.lm-highlight__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
}

.lm-highlight__info {
  flex: 1;
}

.lm-highlight__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-bright);
}

.lm-highlight__note {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 1px;
}

.lm-highlight__note--high {
  color: var(--gold);
}

/* ============ SEASON SUMMARY ============ */
.season {
  margin-top: 4px;
}

.season__header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.season__games {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-bright);
}

.season__record {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.season__averages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

@media (max-width: 420px) {
  .season__averages {
    grid-template-columns: repeat(2, 1fr);
  }
}

.season-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 4px 8px;
  text-align: center;
}

.season-stat__avg {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.season-stat__label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 3px;
}

.season-stat__total {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Best performance */
.season__best {
  margin-top: 8px;
}

.season-best {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  border-left: 3px solid var(--gold);
}

.season-best__value {
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.season-best__info {
  flex: 1;
}

.season-best__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
}

.season-best__meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Sparklines */
.season__chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.sparkline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px 4px;
  position: relative;
}

.sparkline--detailed {
  padding: 8px 12px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sparkline__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.sparkline__label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.sparkline__value {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sparkline__svg {
  width: 100%;
  height: 100px;
  display: block;
}

@media (min-width: 600px) {
  .sparkline__svg {
    height: 120px;
  }
}

.sparkline__dot {
  opacity: 0.7;
  transition: r 0.15s, opacity 0.15s;
  pointer-events: none; /* hits go to the larger invisible target */
}
.sparkline__dot--selected {
  r: 5;
  opacity: 1;
}
.sparkline__hit {
  cursor: pointer;
}

.sparkline__xlabel {
  font-size: 7px;
  fill: var(--text-dim);
  font-weight: 600;
}

.sparkline__vlabel {
  font-size: 7px;
  fill: var(--text-muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sparkline__tooltip {
  display: none;
  font-size: 10px;
  color: var(--text-bright);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 4px;
  text-align: center;
  white-space: nowrap;
}
.sparkline__tooltip--visible {
  display: block;
}

/* ============ MATCH HISTORY ============ */
.match-history {
  margin-top: 12px;
}

.match-history__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mh-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
}

.mh-row:active {
  background: var(--surface-2);
}

.mh-row__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.mh-row__result {
  width: 24px;
  height: 24px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.mh-row--w .mh-row__result { background: var(--green); }
.mh-row--l .mh-row__result { background: var(--red); opacity: 0.8; }
.mh-row--d .mh-row__result { background: var(--amber); }

.mh-row__match {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mh-row__round {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mh-row__opponent {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-row__score {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.mh-row__key {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mh-row__key span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.mh-row__disp { color: var(--gold) !important; }

.mh-row__chevron {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.mh-row--open .mh-row__chevron {
  transform: rotate(180deg);
}

/* Expanded detail */
.mh-row__detail {
  display: none;
  padding: 0 12px 12px;
}

.mh-row--open .mh-row__detail {
  display: block;
}

.mh-row__meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.mh-row__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mh-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: var(--surface-2);
  border-radius: var(--r);
}

.mh-stat__val {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.mh-stat__label {
  font-size: 7px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 2px;
}

/* ============ AFL RANKINGS ============ */
.rankings {
  margin-top: 4px;
}

.rankings__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px 8px;
}

.rank-row__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.rank-row__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.rank-row__value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
}

.rank-row__badge {
  font-size: 8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--pill);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rank-row__badge--elite {
  background: var(--gold);
  color: #000;
}

.rank-row__badge--above {
  background: rgba(0,48,135,0.15);
  color: var(--blue);
}

:root[data-theme="dark"] .rank-row__badge--above,
:root:not([data-theme="light"]) .rank-row__badge--above {
  background: rgba(0,48,135,0.4);
  color: rgba(255,255,255,0.8);
}

.rank-row__bar-bg {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.rank-row__bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.rank-row__meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.rank-row__toggle {
  cursor: pointer;
  user-select: none;
}

.rank-row__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.rank-row--expanded .rank-row__chevron {
  transform: rotate(-135deg);
}

/* Leaderboard panel (collapsed by default) */
.lb-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease;
  margin-top: 0;
}

.rank-row--expanded .lb-panel {
  max-height: 400px;
  margin-top: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text);
}

.lb-row:nth-child(even) {
  background: var(--surface-2);
}

.lb-row--tom {
  background: rgba(242, 169, 0, 0.15) !important;
  border: 1px solid rgba(242, 169, 0, 0.3);
  font-weight: 700;
  color: var(--gold);
}

.lb-row__rank {
  width: 22px;
  font-weight: 800;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lb-row--tom .lb-row__rank {
  color: var(--gold);
}

.lb-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-row__team {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 400;
}

.lb-row--tom .lb-row__team {
  color: rgba(242, 169, 0, 0.6);
}

.lb-row__val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-bright);
}

.lb-gap {
  height: 1px;
  margin: 2px 8px;
  border-top: 1px dashed var(--border);
}

/* ============ UTILITIES ============ */
.hidden { display: none !important; }
