/* ═══════════════════════════════════════════════════════════════════════
   SMASH STATS — Custom Dark Theme + Smash Bros Energy
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  /* Font families */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Rajdhani', 'Inter', sans-serif;

  /* Fluid type scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  /* 4px spacing system */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Surfaces — Dark Navy/Charcoal */
  --color-bg:             #0d1117;
  --color-surface:        #161b22;
  --color-surface-2:      #1c2333;
  --color-surface-offset: #21283b;
  --color-surface-offset-2: #2d3548;
  --color-divider:        #30363d;
  --color-border:         #3b4252;

  /* Text */
  --color-text:           #e6edf3;
  --color-text-muted:     #8b949e;
  --color-text-faint:     #484f58;
  --color-text-inverse:   #0d1117;

  /* Smash Red — Primary */
  --color-primary:        #e60012;
  --color-primary-hover:  #ff1a2e;
  --color-primary-active: #cc0010;
  --color-primary-highlight: rgba(230, 0, 18, 0.15);
  --color-smash-red:      #e60012;

  /* Electric Blue — Secondary */
  --color-blue:           #3b82f6;
  --color-blue-hover:     #60a5fa;
  --color-blue-active:    #2563eb;
  --color-blue-highlight: rgba(59, 130, 246, 0.15);

  /* Gold — Rankings/Medals */
  --color-gold:           #fbbf24;
  --color-gold-hover:     #fcd34d;
  --color-gold-active:    #f59e0b;
  --color-gold-highlight: rgba(251, 191, 36, 0.15);

  /* Status Colors */
  --color-success:        #22c55e;
  --color-success-highlight: rgba(34, 197, 94, 0.15);
  --color-error:          #ef4444;
  --color-error-highlight: rgba(239, 68, 68, 0.15);
  --color-warning:        #f97316;

  /* Team Colors */
  --color-team1:          #e60012;
  --color-team2:          #3b82f6;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows — dark theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow-red: 0 0 20px rgba(230, 0, 18, 0.2);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.2);
  --shadow-glow-gold: 0 0 20px rgba(251, 191, 36, 0.2);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* ── App Shell ───────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  padding: var(--space-3) var(--space-4);
}

.header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.logo-svg { flex-shrink: 0; }

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.logo-accent { color: var(--color-smash-red); }

.main-nav {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  min-height: 44px;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.nav-link.active {
  color: var(--color-smash-red);
  background: var(--color-primary-highlight);
}

.nav-link svg { flex-shrink: 0; }

/* ── Main Content Area ───────────────────────────────────────────────── */
.app-main {
  flex: 1;
  max-width: var(--content-wide);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.app-footer {
  text-align: center;
  padding: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.app-footer a {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  text-decoration: none;
}

.app-footer a:hover { color: var(--color-text-muted); }

/* ── Loading States ──────────────────────────────────────────────────── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) 0;
  color: var(--color-text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-divider);
  border-top-color: var(--color-smash-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Section Headers ─────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  letter-spacing: 0.02em;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: calc(-1 * var(--space-4));
  margin-bottom: var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════
   PLAYERS PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.player-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: transform var(--transition-interactive),
              box-shadow var(--transition-interactive),
              border-color var(--transition-interactive);
}

.player-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-red);
  border-color: var(--color-smash-red);
}

.player-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.player-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.player-tag {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.player-ranking-badge {
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-smash-red);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-smash-red);
  font-variant-numeric: tabular-nums lining-nums;
}

.player-stats-row {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.player-stat-mini {
  display: flex;
  flex-direction: column;
}

.player-stat-mini .label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-stat-mini .value {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
}

.player-main-char {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.player-main-char strong { color: var(--color-gold); }

/* ── Player Profile (expanded) ───────────────────────────────────────── */
.profile-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.profile-back:hover { color: var(--color-text); background: var(--color-surface); }

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: var(--color-primary-highlight);
  border: 2px solid var(--color-smash-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-smash-red);
  flex-shrink: 0;
}

/* Avatar system */
.player-avatar-img {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-surface-2);
}
.player-avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.player-avatar-img.avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 12px;
  margin-right: var(--space-2);
}
.player-avatar-img.avatar-sm {
  width: 40px;
  height: 40px;
  font-size: 16px;
  margin-right: var(--space-3);
}
.player-avatar-img.avatar-md {
  width: 56px;
  height: 56px;
  font-size: 20px;
}
.player-avatar-img.avatar-lg {
  width: 80px;
  height: 80px;
  font-size: 28px;
}

/* Profile avatar with upload overlay */
.profile-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.profile-avatar-wrap:hover .avatar-upload-overlay {
  opacity: 1;
}
.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-smash-red);
  display: block;
}
.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 24px;
  pointer-events: none;
}
.btn-remove-avatar {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 4px;
}
.btn-remove-avatar:hover {
  color: var(--color-smash-red);
  border-color: var(--color-smash-red);
}

/* Rankings table avatar cell */
.ranking-player-cell {
  display: flex;
  align-items: center;
  gap: 0;
}

.profile-info .profile-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}

.profile-info .profile-tag {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.profile-ranking {
  margin-left: auto;
  text-align: center;
}

.profile-ranking .rank-score {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-gold);
  font-variant-numeric: tabular-nums lining-nums;
}

.profile-ranking .rank-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.stat-card .stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
}

.stat-card .stat-detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.stat-card.gold { border-color: var(--color-gold); box-shadow: var(--shadow-glow-gold); }
.stat-card.red { border-color: var(--color-smash-red); box-shadow: var(--shadow-glow-red); }
.stat-card.blue { border-color: var(--color-blue); box-shadow: var(--shadow-glow-blue); }

/* ── Profile Sections ────────────────────────────────────────────────── */
.profile-section {
  margin-bottom: var(--space-8);
}

.profile-section h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

/* Teammate list */
.teammate-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.teammate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}

.teammate-row .tm-name { font-weight: 600; }
.teammate-row .tm-wr {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
}

.tm-wr.good { color: var(--color-success); }
.tm-wr.bad { color: var(--color-error); }

/* Character breakdown table */
.char-breakdown {
  width: 100%;
  overflow-x: auto;
}

.char-breakdown table {
  min-width: 500px;
}

.char-breakdown th {
  text-align: left;
  padding: var(--space-3);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  background: var(--color-bg);
}

.char-breakdown td {
  padding: var(--space-3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Recent games */
.recent-game {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.recent-game .game-result {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-result.win { background: var(--color-success-highlight); color: var(--color-success); }
.game-result.loss { background: var(--color-error-highlight); color: var(--color-error); }

.recent-game .game-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.recent-game .game-stats {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
  margin-left: auto;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ═══════════════════════════════════════════════════════════════════════
   LOG GAME PAGE — WIZARD
   ═══════════════════════════════════════════════════════════════════════ */

.wizard-container {
  max-width: 720px;
  margin: 0 auto;
}

/* Progress bar */
.wizard-progress {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.wizard-step-dot {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-divider);
  transition: background 0.3s ease;
}

.wizard-step-dot.active { background: var(--color-smash-red); }
.wizard-step-dot.completed { background: var(--color-success); }

.wizard-step-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.wizard-step-label .step-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

.wizard-step-label .step-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Series selector */
.series-bar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.series-bar .series-badge {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.series-bar .series-badge.active {
  border-color: var(--color-smash-red);
  background: var(--color-primary-highlight);
  color: var(--color-smash-red);
}

.series-bar .series-badge:hover {
  border-color: var(--color-text-muted);
}

.btn-new-series {
  padding: var(--space-2) var(--space-4);
  background: var(--color-smash-red);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn-new-series:hover { background: var(--color-primary-hover); }

/* Team selection */
.team-selection {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-4);
  align-items: start;
}

.team-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.team-label {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  text-align: center;
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.team-label.team1 { color: var(--color-team1); background: rgba(230, 0, 18, 0.1); }
.team-label.team2 { color: var(--color-team2); background: rgba(59, 130, 246, 0.1); }

.vs-divider {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-faint);
  align-self: center;
  padding-top: var(--space-10);
}

.team-player-slot {
  padding: var(--space-3);
  background: var(--color-surface);
  border: 2px dashed var(--color-divider);
  border-radius: var(--radius-md);
  text-align: center;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.team-player-slot.filled {
  border-style: solid;
  cursor: pointer;
}

.team-player-slot.team1.filled { border-color: var(--color-team1); color: var(--color-text); }
.team-player-slot.team2.filled { border-color: var(--color-team2); color: var(--color-text); }

/* Player selection chips (for team assignment) */
.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.player-chip {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-divider);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-interactive);
}

.player-chip:hover { border-color: var(--color-text-muted); }
.player-chip.team1 { border-color: var(--color-team1); background: rgba(230, 0, 18, 0.1); color: var(--color-smash-red); }
.player-chip.team2 { border-color: var(--color-team2); background: rgba(59, 130, 246, 0.1); color: var(--color-blue); }

/* Character select grid */
.char-select-header {
  margin-bottom: var(--space-4);
}

.char-search {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  outline: none;
}

.char-search:focus { border-color: var(--color-smash-red); }

.char-search::placeholder { color: var(--color-text-faint); }

.favorites-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  margin: var(--space-3) 0 var(--space-2);
  font-weight: 600;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-2);
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-1);
}

.char-cell {
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--text-xs);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-interactive);
  word-break: break-word;
  line-height: 1.2;
}

.char-cell:hover { border-color: var(--color-smash-red); background: var(--color-primary-highlight); }
.char-cell.selected { border-color: var(--color-smash-red); background: var(--color-primary-highlight); color: var(--color-smash-red); font-weight: 600; }

/* Smashdown: character already used this series */
.char-cell.used {
  background: rgba(255, 170, 50, 0.12);
  border-color: rgba(255, 170, 50, 0.4);
  color: #d4943a;
  position: relative;
}
.char-cell.used::after {
  content: "\2713";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  color: #d4943a;
  opacity: 0.7;
}
.smashdown-note {
  font-size: var(--text-xs);
  color: #d4943a;
  padding: var(--space-1) 0;
  font-weight: 500;
}

/* Stat input — stepper */
.stat-input-group {
  margin-bottom: var(--space-5);
}

.stat-input-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stepper-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  font-size: var(--text-lg);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-width: 48px;
  user-select: none;
  -webkit-user-select: none;
}

.stepper-btn:hover { background: var(--color-surface-offset); border-color: var(--color-text-muted); }
.stepper-btn:active { background: var(--color-surface-offset-2); }

.stepper-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text);
}

.stepper-btn.accent { background: var(--color-primary-highlight); border-color: var(--color-smash-red); color: var(--color-smash-red); }
.stepper-btn.accent:hover { background: rgba(230, 0, 18, 0.25); }

/* Damage number input */
.stat-number-input {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums lining-nums;
  padding: 0 var(--space-3);
  outline: none;
  transition: border-color 0.15s ease;
}
.stat-number-input:focus {
  border-color: var(--color-smash-red);
  background: var(--color-surface);
}
.stat-number-input::placeholder {
  color: var(--color-text-faint);
  font-weight: 400;
}
/* Hide number input spinners */
.stat-number-input::-webkit-inner-spin-button,
.stat-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stat-number-input { -moz-appearance: textfield; }

/* Player stat entry card */
.player-stat-entry {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.player-stat-entry-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.player-stat-entry-header .pse-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
}

.player-stat-entry-header .pse-team {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-weight: 600;
}

.pse-team.team1 { background: rgba(230, 0, 18, 0.15); color: var(--color-team1); }
.pse-team.team2 { background: rgba(59, 130, 246, 0.15); color: var(--color-team2); }

/* Stage select */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
  max-height: 400px;
  overflow-y: auto;
}

.stage-cell {
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-interactive);
}

.stage-cell:hover { border-color: var(--color-blue); background: var(--color-blue-highlight); }
.stage-cell.selected { border-color: var(--color-blue); background: var(--color-blue-highlight); color: var(--color-blue); font-weight: 600; }

/* Winner selection */
.winner-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.winner-btn {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-divider);
  background: var(--color-surface);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-interactive);
}

.winner-btn:hover { transform: scale(1.02); }

.winner-btn.team1 { border-color: var(--color-team1); color: var(--color-team1); }
.winner-btn.team1:hover { background: rgba(230, 0, 18, 0.1); box-shadow: var(--shadow-glow-red); }
.winner-btn.team1.selected { background: rgba(230, 0, 18, 0.2); box-shadow: var(--shadow-glow-red); }

.winner-btn.team2 { border-color: var(--color-team2); color: var(--color-team2); }
.winner-btn.team2:hover { background: rgba(59, 130, 246, 0.1); box-shadow: var(--shadow-glow-blue); }
.winner-btn.team2.selected { background: rgba(59, 130, 246, 0.2); box-shadow: var(--shadow-glow-blue); }

.winner-btn .team-members {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-weight: 400;
}

/* Wizard navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-6);
  gap: var(--space-4);
}

.btn-wizard {
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-wizard:hover { background: var(--color-surface-offset); }

.btn-wizard.primary {
  background: var(--color-smash-red);
  border-color: var(--color-smash-red);
  color: #fff;
}

.btn-wizard.primary:hover { background: var(--color-primary-hover); }

.btn-wizard:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-wizard.submit {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
  font-size: var(--text-base);
  padding: var(--space-4) var(--space-8);
}

.btn-wizard.submit:hover { opacity: 0.9; }

/* Confirmation overlay */
.confirmation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.confirmation-card {
  background: var(--color-surface);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.2);
}

.confirmation-card .check-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--color-success-highlight);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
  font-size: var(--text-xl);
}

.confirmation-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.confirmation-card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════
   RANKINGS PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.rankings-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider);
}

.rankings-table {
  min-width: 700px;
}

.rankings-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rankings-table th:hover { color: var(--color-text-muted); }

.rankings-table th.sort-active {
  color: var(--color-smash-red);
}

.rankings-table th .sort-arrow {
  margin-left: var(--space-1);
  opacity: 0.5;
}

.rankings-table th.sort-active .sort-arrow { opacity: 1; }

.rankings-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.rankings-table tr:hover td { background: var(--color-surface); }

.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
}

.rank-medal.gold { background: var(--color-gold-highlight); color: var(--color-gold); border: 1px solid var(--color-gold); }
.rank-medal.silver { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid #94a3b8; }
.rank-medal.bronze { background: rgba(217, 119, 6, 0.15); color: #d97706; border: 1px solid #d97706; }
.rank-medal.normal { color: var(--color-text-muted); }

/* ═══════════════════════════════════════════════════════════════════════
   SUGGESTIONS / AWARDS PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.medals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.medal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.medal-icon {
  font-size: var(--text-xl);
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--color-gold-highlight);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.medal-info .medal-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-gold);
}

.medal-info .medal-player {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-1);
}

.medal-info .medal-detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* Balanced teams */
.balanced-teams-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.balanced-teams-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.balanced-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-4);
  align-items: center;
}

.balanced-team {
  text-align: center;
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

.balanced-team.t1 { background: rgba(230, 0, 18, 0.1); border: 1px solid rgba(230, 0, 18, 0.3); }
.balanced-team.t2 { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); }

.balanced-team .bt-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.balanced-team.t1 .bt-label { color: var(--color-team1); }
.balanced-team.t2 .bt-label { color: var(--color-team2); }

.balanced-team .bt-players {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.6;
}

.balanced-team .bt-score {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  font-variant-numeric: tabular-nums lining-nums;
}

.balanced-vs {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-faint);
}

/* Tips */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tip-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-left: 3px solid var(--color-blue);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.tip-card .tip-player {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.tip-card .tip-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════
   WEIGHTS & MEASURES PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.info-page {
  max-width: var(--content-narrow);
  margin: 0 auto;
}

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.info-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--color-smash-red);
}

.info-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.info-card p:last-child { margin-bottom: 0; }

.formula-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}

.formula-row:last-child { border-bottom: none; }

.formula-row .fw-name { color: var(--color-text); font-weight: 500; }
.formula-row .fw-weight {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-gold);
  font-variant-numeric: tabular-nums lining-nums;
}

.info-highlight {
  background: var(--color-primary-highlight);
  border-left: 3px solid var(--color-smash-red);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin: var(--space-4) 0;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}

.empty-state .empty-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 400px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-2);
  }

  .main-nav {
    width: 100%;
    justify-content: space-between;
  }

  .nav-link {
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
    font-size: var(--text-xs);
  }

  .nav-link span {
    font-size: 0.625rem;
  }

  .team-selection {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .vs-divider {
    text-align: center;
    padding: 0;
  }

  .winner-buttons {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .profile-ranking { margin-left: 0; }

  .player-grid {
    grid-template-columns: 1fr;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .balanced-matchup {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .stage-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .recent-game {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .recent-game .game-stats {
    margin-left: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: var(--space-4) var(--space-3);
  }

  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }

  .medals-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-content {
  animation: fadeIn 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════════════
   BENCH / ROSTER MANAGEMENT
   ═══════════════════════════════════════════════════════════════════════ */

/* Bench toggle row */
.bench-toggle-row {
  margin-bottom: var(--space-4);
}

.bench-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  user-select: none;
  -webkit-user-select: none;
}

.bench-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-smash-red);
  cursor: pointer;
}

.bench-toggle-label {
  font-weight: 500;
}

/* Bench section label */
.bench-section-label {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text-faint);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Bench player cards */
.player-card.bench {
  opacity: 0.5;
  border-color: var(--color-divider);
}

.player-card.bench:hover {
  opacity: 0.75;
  box-shadow: none;
  border-color: var(--color-text-faint);
}

/* Bench badge */
.bench-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  background: var(--color-surface-offset);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
}

.bench-badge-sm {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  background: var(--color-surface-offset);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: var(--space-1);
}

/* Rankings bench row */
.bench-row td {
  opacity: 0.5;
}

/* Roster section label in wizard */
.roster-section-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: var(--space-2);
  margin-top: var(--space-3);
}

.roster-section-label.bench-label {
  color: var(--color-text-faint);
  margin-top: var(--space-4);
}

/* Bench player chips in wizard */
.player-chip.bench-chip {
  opacity: 0.55;
  border-style: dashed;
}

.player-chip.bench-chip.team1,
.player-chip.bench-chip.team2 {
  opacity: 1;
}

/* ── Roster Management Page ─────────────────────────────────────────── */

.roster-panel {
  max-width: 640px;
}

.roster-heading {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-3);
  margin-top: var(--space-6);
}

.roster-heading:first-child {
  margin-top: 0;
}

.active-heading {
  color: var(--color-success);
}

.bench-heading {
  color: var(--color-text-faint);
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.roster-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.roster-player-row.bench {
  opacity: 0.55;
  border-style: dashed;
}

.roster-player-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.roster-player-name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.roster-player-tag {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.roster-player-games {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-surface-offset-2);
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--color-text-faint);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-success-highlight);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--color-success);
}

/* Add player form */
.add-player-section {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.add-player-form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.roster-input {
  flex: 1;
  min-width: 120px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
}

.roster-input:focus {
  border-color: var(--color-smash-red);
}

.roster-input::placeholder {
  color: var(--color-text-faint);
}

.btn-add-player {
  padding: var(--space-3) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-smash-red);
  border-radius: var(--radius-md);
  color: var(--color-smash-red);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}

.btn-add-player:hover {
  background: var(--color-primary-highlight);
}

/* Stage search */
.stage-search {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  outline: none;
  margin-bottom: var(--space-3);
}

.stage-search:focus { border-color: var(--color-blue); }
.stage-search::placeholder { color: var(--color-text-faint); }

/* Current player indicator in wizard */
.current-player-indicator {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-smash-red);
}

.current-player-indicator .cpi-team {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
  font-weight: 600;
}

.cpi-team.team1 { background: rgba(230, 0, 18, 0.15); color: var(--color-team1); }
.cpi-team.team2 { background: rgba(59, 130, 246, 0.15); color: var(--color-team2); }

/* Backup & Restore */
.backup-section {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.backup-desc {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  max-width: 100%;
}
.backup-buttons {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.btn-backup, .btn-restore {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-interactive);
}
.btn-backup {
  background: var(--color-accent);
  color: #fff;
  border: none;
}
.btn-backup:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}
.btn-restore {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-restore:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.backup-status {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  min-height: 1.5em;
}
.backup-status.success {
  color: #4ade80;
}
.backup-status.error {
  color: var(--color-accent);
}

/* ── Lobby System ────────────────────────────────────── */

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-1);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.mode-btn:hover {
  border-color: var(--color-smash-red);
  background: var(--color-surface-2);
}
.mode-btn svg {
  flex-shrink: 0;
  color: var(--color-smash-red);
}
.mode-title {
  display: block;
  font-weight: 700;
  font-size: var(--text-base);
  font-family: var(--font-display);
}
.mode-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.lobby-back-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0;
  margin-bottom: var(--space-2);
}
.lobby-back-btn:hover { color: var(--color-text); }

.lobby-code-display {
  text-align: center;
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface-1);
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-smash-red);
  margin: var(--space-4) 0;
}
.lobby-code-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.lobby-code {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--color-gold);
}

.lobby-player-list {
  background: var(--color-surface-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-4);
}
.lobby-list-header {
  padding: var(--space-3) var(--space-4);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}
.lobby-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.lobby-player-row:last-child { border-bottom: none; }
.lobby-player-name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.lobby-player-status {
  font-size: var(--text-xs);
  font-weight: 500;
}
.lobby-player-status.waiting { color: var(--color-text-muted); }
.lobby-player-status.joined { color: var(--color-smash-blue); }
.lobby-player-status.submitted { color: var(--color-success); }

.lobby-ready-banner {
  background: var(--color-smash-red);
  color: #fff;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 700;
  margin-top: var(--space-4);
}

.lobby-join-form {
  margin-top: var(--space-4);
}
.lobby-code-input {
  display: block;
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  background: var(--color-surface-1);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  outline: none;
}
.lobby-code-input:focus {
  border-color: var(--color-smash-red);
}

.player-identity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.player-identity-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-1);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s;
}
.player-identity-btn:hover:not(.taken) {
  border-color: var(--color-smash-red);
}
.player-identity-btn.taken {
  opacity: 0.4;
  cursor: not-allowed;
}
.pid-name {
  font-weight: 700;
  font-size: var(--text-base);
}
.pid-tag {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.pid-status {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.lobby-stats-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lobby-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: var(--space-1);
}
.lobby-stat-row:last-child { border-bottom: none; }
.lobby-stat-name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.lobby-stat-detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono, monospace);
}

/* ── Matchup Predictor Panel ────────────────────────────────────────── */
.matchup-panel {
  margin-top: var(--space-6);
  background: linear-gradient(135deg, rgba(255,59,48,0.05), rgba(0,122,255,0.05));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}
.matchup-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-team1), var(--color-team2));
}
.matchup-panel.loading {
  opacity: 0.7;
}
.matchup-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: var(--space-4);
}
.matchup-header svg { color: var(--color-gold); }
.matchup-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: var(--space-4) 0;
}

/* Ratings row */
.matchup-ratings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-2);
}
.matchup-team-rating {
  text-align: center;
  flex: 1;
}
.matchup-team-rating.team1 .mtr-value { color: var(--color-team1); }
.matchup-team-rating.team2 .mtr-value { color: var(--color-team2); }
.mtr-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}
.mtr-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}
.matchup-gap {
  text-align: center;
  min-width: 60px;
}
.gap-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}
.gap-value.close { color: var(--color-success); }
.gap-value.moderate { color: var(--color-warning, #f5a623); }
.gap-value.wide { color: var(--color-error); }
.gap-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Probability bars */
.matchup-probabilities {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.prob-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.prob-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prob-bar-container {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-surface-2);
}
.prob-bar {
  transition: width 0.4s ease;
}
.prob-bar.team1 { background: var(--color-team1); }
.prob-bar.team2 { background: var(--color-team2); }
.prob-values {
  display: flex;
  justify-content: space-between;
}
.pv {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-display);
}
.pv.team1 { color: var(--color-team1); }
.pv.team2 { color: var(--color-team2); }

/* Most likely result */
.matchup-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: var(--space-3);
}
.mr-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
}
.mr-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

/* Win value multiplier */
.matchup-weights {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}
.mw-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.mw-teams {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}
.mw-team {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.mw-team strong { color: var(--color-text-primary); }
.underdog-boost { color: var(--color-success) !important; }

/* ── Handicap Panel ─────────────────────────────────────────────────── */
.handicap-panel {
  margin-top: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4);
  background: var(--color-surface-1);
}
.handicap-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.handicap-header svg { color: var(--color-text-muted); }
.handicap-suggestion-badge {
  font-size: var(--text-xs);
  background: var(--color-warning, #f5a623);
  color: #000;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: auto;
}
.handicap-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.hs-text {
  font-size: var(--text-xs);
  color: var(--color-warning, #f5a623);
}
.btn-apply-suggested {
  font-size: var(--text-xs);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--color-warning, #f5a623);
  background: rgba(245,166,35,0.15);
  color: var(--color-warning, #f5a623);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn-apply-suggested:hover {
  background: rgba(245,166,35,0.3);
}

/* Handicap list */
.handicap-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.handicap-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface-2);
  gap: var(--space-2);
  flex-wrap: wrap;
}
.handicap-item.suggested {
  border: 1px solid rgba(245,166,35,0.3);
  background: rgba(245,166,35,0.05);
}
.hc-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.hc-name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
}
.hc-severity {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.hc-factor {
  font-size: var(--text-xs);
  color: var(--color-gold);
  font-weight: 600;
  white-space: nowrap;
}
.hc-team-btns {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}
.hc-team-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  min-width: 36px;
  text-align: center;
  transition: all 0.15s;
}
.hc-team-btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text-primary);
}
.hc-team-btn.active.team1 {
  background: var(--color-team1);
  border-color: var(--color-team1);
  color: #fff;
}
.hc-team-btn.active.team2 {
  background: var(--color-team2);
  border-color: var(--color-team2);
  color: #fff;
}

/* Handicap summary */
.handicap-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm, 6px);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.hs-team {
  font-weight: 600;
}
.hs-team.team1 { color: var(--color-team1); }
.hs-team.team2 { color: var(--color-team2); }
.btn-clear-handicaps {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--color-error);
  background: transparent;
  color: var(--color-error);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
}
.btn-clear-handicaps:hover {
  background: rgba(255,59,48,0.15);
}

/* Man Down disabled state */
.handicap-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.handicap-item.disabled .hc-team-btn {
  cursor: not-allowed;
  opacity: 0.3;
}
.hc-note {
  font-size: 0.7rem;
  color: var(--red-500, #ef4444);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════════════════ */

[data-theme="light"] {
  --color-bg:             #f5f5f5;
  --color-surface:        #ffffff;
  --color-surface-2:      #f0f0f0;
  --color-surface-offset: #e8e8e8;
  --color-surface-offset-2: #ddd;
  --color-divider:        #d0d0d0;
  --color-border:         #bbb;
  --color-text:           #1a1a2e;
  --color-text-muted:     #555;
  --color-text-faint:     #999;
  --color-text-inverse:   #fff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.15);
  --shadow-glow-red: 0 0 20px rgba(230,0,18,0.1);
  --shadow-glow-blue: 0 0 20px rgba(59,130,246,0.1);
  --shadow-glow-gold: 0 0 20px rgba(251,191,36,0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════ */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-interactive);
}
.theme-toggle:hover { color: var(--color-text); border-color: var(--color-text-muted); }

[data-theme="dark"] .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: block; }
[data-theme="light"] .theme-icon-moon { display: none; }

/* ═══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 380px;
}
.toast {
  pointer-events: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast.achievement { border-color: var(--color-gold); box-shadow: 0 0 24px rgba(251,191,36,0.3); }
.toast.milestone { border-color: var(--color-blue); }
.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  line-height: 1;
}
.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: 2px;
}
.toast-msg {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════
   GAME HISTORY TAB
   ═══════════════════════════════════════════════════════════════════════ */

.history-session-header {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text-muted);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.history-session-header:first-child { margin-top: 0; }
.history-game-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: border-color var(--transition-interactive);
}
.history-game-card:hover { border-color: var(--color-text-faint); }
.history-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.history-game-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.history-game-stage {
  font-size: var(--text-xs);
  color: var(--color-blue);
  font-weight: 600;
}
.history-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-3);
  align-items: start;
}
.history-team { display: flex; flex-direction: column; gap: var(--space-1); }
.history-team-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.history-team-label.team1 { color: var(--color-team1); }
.history-team-label.team2 { color: var(--color-team2); }
.history-team-label.winner { position: relative; }
.history-team-label.winner::after {
  content: " WIN";
  color: var(--color-success);
  font-size: 0.6rem;
  margin-left: 4px;
}
.history-player-row {
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.history-player-name { font-weight: 600; }
.history-player-stats { color: var(--color-text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.history-vs {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-faint);
  align-self: center;
}
.history-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}
.btn-history-action {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
}
.btn-history-action:hover { border-color: var(--color-text-muted); color: var(--color-text); }
.btn-history-action.danger { border-color: var(--color-error); color: var(--color-error); }
.btn-history-action.danger:hover { background: var(--color-error-highlight); }
.btn-load-more {
  display: block;
  width: 100%;
  padding: var(--space-3);
  margin-top: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-interactive);
}
.btn-load-more:hover { border-color: var(--color-smash-red); color: var(--color-smash-red); }

/* Undo button */
.btn-undo {
  background: var(--color-surface);
  border: 1px solid var(--color-warning);
  color: var(--color-warning);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  width: 100%;
}
.btn-undo:hover { background: rgba(249,115,22,0.1); }
.undo-timer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-align: center;
}

/* Confirm modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}
.confirm-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.confirm-modal h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}
.confirm-modal p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}
.confirm-modal-btns {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════
   ACHIEVEMENTS
   ═══════════════════════════════════════════════════════════════════════ */

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}
.achievement-badge {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  transition: all 0.3s ease;
}
.achievement-badge.unlocked {
  border-color: var(--color-gold);
  box-shadow: 0 0 16px rgba(251,191,36,0.2);
}
.achievement-badge.locked {
  opacity: 0.45;
}
.achievement-badge .ach-icon {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.achievement-badge .ach-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}
.achievement-badge.unlocked .ach-name { color: var(--color-gold); }
.achievement-badge .ach-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}
.achievement-badge .ach-date {
  font-size: 0.6rem;
  color: var(--color-text-faint);
  margin-top: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════════════════
   HEAD-TO-HEAD
   ═══════════════════════════════════════════════════════════════════════ */

.h2h-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.h2h-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-interactive);
}
.h2h-card:hover { border-color: var(--color-smash-red); }
.h2h-opponent { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.h2h-record {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.h2h-record .wins { color: var(--color-success); font-weight: 700; }
.h2h-record .losses { color: var(--color-error); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   RATING SPARKLINE
   ═══════════════════════════════════════════════════════════════════════ */

.sparkline-container {
  display: inline-block;
  vertical-align: middle;
}
.sparkline-container svg {
  display: block;
}
.trend-arrow { font-weight: 700; font-size: var(--text-sm); margin-left: var(--space-1); }
.trend-arrow.up { color: var(--color-success); }
.trend-arrow.down { color: var(--color-error); }
.trend-arrow.flat { color: var(--color-text-muted); }

/* ═══════════════════════════════════════════════════════════════════════
   COMPARE MODE
   ═══════════════════════════════════════════════════════════════════════ */

.compare-container {
  max-width: 720px;
  margin: 0 auto;
}
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}
.compare-player-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}
.compare-player-name.p1 { color: var(--color-team1); }
.compare-player-name.p2 { color: var(--color-team2); }
.compare-vs {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-faint);
}
.compare-stat-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.compare-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 80px;
  text-align: center;
  flex-shrink: 0;
}
.compare-bar-wrap {
  flex: 1;
  display: flex;
  height: 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-2);
}
.compare-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: #fff;
  transition: width 0.4s ease;
  min-width: 32px;
}
.compare-bar.p1 { background: var(--color-team1); }
.compare-bar.p2 { background: var(--color-team2); }
.compare-bar.winner { filter: brightness(1.2); }

/* ═══════════════════════════════════════════════════════════════════════
   CHARACTER MATRIX HEATMAP
   ═══════════════════════════════════════════════════════════════════════ */

.matrix-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider);
}
.matrix-table {
  min-width: 100%;
  font-size: var(--text-xs);
}
.matrix-table th, .matrix-table td {
  padding: var(--space-2);
  text-align: center;
  border: 1px solid var(--color-divider);
  white-space: nowrap;
  min-width: 48px;
}
.matrix-table th {
  background: var(--color-surface);
  font-weight: 700;
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
}
.matrix-table th:first-child { position: sticky; left: 0; z-index: 2; }
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  font-weight: 700;
  color: var(--color-text-muted);
  z-index: 1;
}
.matrix-cell-green { background: rgba(34,197,94,0.25); color: var(--color-success); font-weight: 600; }
.matrix-cell-red { background: rgba(239,68,68,0.25); color: var(--color-error); font-weight: 600; }
.matrix-cell-neutral { background: var(--color-surface-offset); color: var(--color-text-muted); }
.matrix-cell-self { background: var(--color-surface-offset-2); color: var(--color-text-faint); }

/* ═══════════════════════════════════════════════════════════════════════
   STAGE STATS
   ═══════════════════════════════════════════════════════════════════════ */

.stage-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}
.stage-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.stage-stat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
}
.stage-stat-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.stage-player-wr {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-divider);
}
.stage-player-wr:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.settings-page { max-width: 720px; }
.settings-section {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
}
.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.settings-section-header:hover { background: var(--color-surface-offset); }
.settings-section-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
}
.settings-section-arrow {
  color: var(--color-text-muted);
  transition: transform 0.3s ease;
  font-size: var(--text-sm);
}
.settings-section.open .settings-section-arrow { transform: rotate(180deg); }
.settings-section-body {
  padding: 0 var(--space-5) var(--space-5);
  display: none;
}
.settings-section.open .settings-section-body { display: block; }

/* Rankings season filter */
.rankings-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.season-select {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
  cursor: pointer;
}
.season-select:focus { border-color: var(--color-smash-red); }

/* Rank movement */
.rank-movement { font-size: var(--text-xs); font-weight: 700; }
.rank-movement.up { color: var(--color-success); }
.rank-movement.down { color: var(--color-error); }
.rank-movement.flat { color: var(--color-text-faint); }
.rank-movement.new-badge {
  background: var(--color-gold-highlight);
  color: var(--color-gold);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.6rem;
}

/* Compare select mode */
.compare-select-hint {
  background: var(--color-blue-highlight);
  border: 1px solid var(--color-blue);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-blue);
  text-align: center;
  margin-bottom: var(--space-4);
}
.rankings-table tr.compare-selected td { background: var(--color-blue-highlight); }

/* Current form */
.current-form-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-left: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════════════
   ANALYTICS SUBTABS
   ═══════════════════════════════════════════════════════════════════════ */

.analytics-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: var(--space-2);
}
.analytics-tab-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-interactive);
}
.analytics-tab-btn:hover { color: var(--color-text); }
.analytics-tab-btn.active { color: var(--color-smash-red); border-bottom-color: var(--color-smash-red); }

/* Mobile fix for theme toggle */
@media (max-width: 768px) {
  .header-inner { position: relative; }
  .theme-toggle { position: absolute; top: 0; right: 0; }
}

/* ── Seasons Tab ────────────────────────────────────────────────────── */

/* Generate Card */
.season-generate-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  max-width: 520px;
  margin: var(--space-8) auto;
}
.season-generate-icon { margin-bottom: var(--space-6); }
.season-generate-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.season-generate-card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}
.season-generate-form {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}
.season-generate-form .form-input {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
}

/* Season Header */
.season-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-4);
}
.season-header-info .section-title { margin-bottom: var(--space-1); }
.season-header-actions {
  display: flex;
  gap: var(--space-3);
}

/* Progress Bar */
.season-progress { margin-bottom: var(--space-8); }
.season-progress-bar {
  height: 8px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.season-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-smash-red), var(--color-gold));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}
.season-progress-stats {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Section Title */
.season-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}

/* Schedule */
.season-schedule {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

/* Match Card */
.season-match-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.season-match-card:hover {
  border-color: var(--color-text-faint);
}
.season-match-card.completed {
  border-left: 3px solid var(--color-success);
}
.season-match-card.in-progress {
  border-left: 3px solid var(--color-gold);
}
.season-match-card.pending {
  border-left: 3px solid var(--color-text-faint);
  opacity: 0.8;
}

/* Match Number */
.season-match-number {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-faint);
  min-width: 28px;
  text-align: center;
}

/* Match Body */
.season-match-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.season-match-teams {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.season-team {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.season-team .team-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.season-team .team-players {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
}
.season-team.favored .team-players {
  color: var(--color-gold);
}
.season-team.winner .team-players {
  color: var(--color-success);
  font-weight: 700;
}

.vs-badge {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 700;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-offset);
  border-radius: var(--radius-sm);
}

/* Score */
.season-match-score {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-muted);
}
.season-match-score .winner {
  color: var(--color-success);
}
.score-divider {
  color: var(--color-text-faint);
}

/* Prediction */
.season-match-prediction {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.prediction-label {
  color: var(--color-text-faint);
}
.prediction-value {
  color: var(--color-gold);
  font-weight: 600;
}

/* Match Detail Section */
.season-match-details {
  width: 100%;
  margin-top: var(--space-2);
}
.match-detail-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}
.match-actual-score {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-muted);
}
.match-actual-score .winner {
  color: var(--color-success);
}
.result-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.upset-badge {
  background: var(--color-error-highlight);
  color: var(--color-error);
}
.dominant-badge {
  background: var(--color-blue-highlight);
  color: var(--color-blue);
}
.match-detail-sub {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.detail-muted {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.detail-stat {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.detail-stat strong {
  color: var(--color-text);
  font-weight: 600;
}
.prediction-favored {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-gold);
}
.prediction-pct {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Score probability bars */
.score-probs {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.prob-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.prob-label {
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 26px;
  text-align: right;
}
.prob-fill-wrap {
  flex: 1;
  height: 8px;
  background: var(--color-surface-offset);
  border-radius: 4px;
  overflow: hidden;
  max-width: 120px;
}
.prob-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.prob-fill.fav {
  background: var(--color-gold);
}
.prob-fill.dog {
  background: var(--color-text-faint);
}
.prob-pct {
  font-size: 10px;
  color: var(--color-text-faint);
  min-width: 32px;
}

/* Outcome Icons */
.season-match-status { min-width: 32px; text-align: center; }

.outcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
}
.outcome-icon.correct {
  background: var(--color-success-highlight);
  color: var(--color-success);
}
.outcome-icon.upset {
  background: var(--color-error-highlight);
  color: var(--color-error);
}
.outcome-icon.sleepy {
  background: var(--color-blue-highlight);
  color: var(--color-blue);
  font-size: 16px;
}
.outcome-icon.in-progress {
  background: var(--color-gold-highlight);
  color: var(--color-gold);
  font-size: 10px;
}
.outcome-icon.pending {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  font-size: 10px;
}

/* Projected Rankings Table */
.season-rankings-table {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-8);
}
.season-rankings-table table {
  width: 100%;
  border-collapse: collapse;
}
.season-rankings-table th,
.season-rankings-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}
.season-rankings-table th {
  background: var(--color-surface-offset);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
}
.season-rankings-table tbody tr:hover {
  background: var(--color-surface-offset);
}
.season-rankings-table tbody tr:last-child td {
  border-bottom: none;
}

/* Rank arrows */
.rank-up { color: var(--color-success); font-size: 12px; }
.rank-down { color: var(--color-error); font-size: 12px; }
.rank-same { color: var(--color-text-faint); }

/* Responsive */
@media (max-width: 640px) {
  .season-match-card {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
  }
  .season-match-body {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .season-match-teams {
    flex-direction: column;
    gap: var(--space-2);
  }
  .season-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .season-rankings-table { overflow-x: auto; }
  .score-probs { margin-top: var(--space-1); }
  .prob-fill-wrap { max-width: 80px; }
}

/* Season History */
.season-history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}
.season-history-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.season-history-card:hover {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 1px var(--color-gold);
}
.season-history-name {
  font-weight: 600;
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
}
.season-history-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.season-history-games {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

/* ── Season Analytics ──────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.analytics-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.analytics-card-header {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}
.analytics-big-stat {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: var(--space-1);
}
.analytics-unit {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}
.analytics-sub {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}

/* Distribution bars */
.analytics-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-2);
}
.analytics-dist-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.dist-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-width: 56px;
  text-align: right;
  font-weight: 500;
}
.dist-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--color-surface-offset);
  border-radius: 5px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.dist-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  min-width: 16px;
  text-align: right;
}
.dist-pct {
  font-size: 10px;
  color: var(--color-text-faint);
  min-width: 32px;
}

/* Range estimates */
.analytics-range {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-2);
}
.range-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.range-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.range-val {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}
.range-val.highlight {
  color: var(--color-gold);
  font-weight: 700;
}

/* Prediction stats */
.analytics-stat-row {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mini-val {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
}
.mini-label {
  font-size: 10px;
  color: var(--color-text-faint);
}
.upset-color { color: var(--color-error); }
.sweep-color { color: var(--color-gold); }
.dominant-color { color: var(--color-blue); }
.analytics-active {
  color: var(--color-success);
  font-weight: 600;
  font-size: var(--text-xs);
}

/* Analytics tables */
.analytics-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-4);
  overflow-x: auto;
}
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.analytics-table th {
  background: var(--color-surface-offset);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
}
.analytics-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table tr:hover td { background: var(--color-surface-offset); }

@media (max-width: 640px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .analytics-stat-row {
    gap: var(--space-3);
  }
}

/* ── Performance Arc ──────────────────────────────────────── */
.arc-chart-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  height: 340px;
  position: relative;
}
.arc-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.arc-player-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: border-color var(--transition-interactive);
}
.arc-player-card:hover {
  border-color: var(--color-text-faint);
}
.arc-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.arc-player-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
}

/* Trend badges */
.trend-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.trend-badge.heat {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.trend-badge.warm {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.trend-badge.cold {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.trend-badge.cool {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
.trend-badge.steady {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
}

/* Stats row */
.arc-player-stats {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.arc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.arc-stat-label {
  font-size: 10px;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.arc-stat-val {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.arc-stat.shift-up .arc-stat-val { color: var(--color-success); }
.arc-stat.shift-down .arc-stat-val { color: var(--color-error); }
.arc-stat.shift-flat .arc-stat-val { color: var(--color-text-muted); }

.arc-expected {
  font-size: 10px;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}

/* Sparkline */
.arc-sparkline {
  width: 100%;
  height: 40px;
}

@media (max-width: 640px) {
  .arc-chart-wrap { height: 260px; }
  .arc-player-grid { grid-template-columns: 1fr; }
}
