/* ============================================
   FOREST FLASH CARDS -- Premium Edition v2
   The Nottingham Forest Card Game
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --forest-red: #E53233;
  --forest-red-dark: #b8282a;
  --forest-red-light: #ff4a4b;
  --forest-red-glow: rgba(229, 50, 51, 0.4);
  --bg-dark: #0a0a14;
  --bg-card: #141428;
  --bg-card-light: #1e1e3a;
  --bg-surface: #181830;
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-muted: #5a5a78;
  --gold: #ffd700;
  --gold-dark: #c7a600;
  --green-win: #2ecc71;
  --red-lose: #e74c3c;
  --blue-draw: #3498db;
  --card-width: 280px;
  --card-height: 420px;
  --rarity-common: #8892a0;
  --rarity-rare: #4a9eff;
  --rarity-epic: #a855f7;
  --rarity-legendary: #ffd700;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---- SCREEN MANAGEMENT ---- */
.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: 80px;
}
.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================================
   CONFETTI / PARTICLES OVERLAY
   ============================================ */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   SPLASH SCREEN
   ============================================ */
#splash-screen {
  padding: 0;
  padding-bottom: 0;
}

.splash-bg {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, rgba(229,50,51,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at center, #0f0f22 0%, var(--bg-dark) 100%);
}

/* Animated stadium light beams */
.splash-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  width: 200px;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(229,50,51,0.03), transparent);
  transform: rotate(20deg);
  animation: lightSweep 6s ease-in-out infinite;
}
.splash-bg::after {
  content: '';
  position: absolute;
  top: -50%;
  right: 40%;
  width: 150px;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
  transform: rotate(-15deg);
  animation: lightSweep 8s ease-in-out infinite reverse;
}

@keyframes lightSweep {
  0%, 100% { transform: rotate(20deg) translateX(-100px); opacity: 0.5; }
  50% { transform: rotate(20deg) translateX(100px); opacity: 1; }
}

.splash-trees {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.splash-tree-svg {
  position: absolute;
  color: var(--forest-red);
  width: 300px;
  height: 400px;
  top: 50%;
  left: 50%;
  transform: translate(-80%, -50%);
  animation: treeSway 8s ease-in-out infinite;
}
.splash-tree-svg.t2 {
  transform: translate(20%, -45%) scaleX(-1);
  animation-delay: -4s;
  width: 250px;
  height: 340px;
}

@keyframes treeSway {
  0%, 100% { transform: translate(-80%, -50%) rotate(-1deg); }
  50% { transform: translate(-80%, -50%) rotate(1deg); }
}

.splash-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeInUp 1s ease-out;
}

.splash-badge {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatBadge 4s ease-in-out infinite;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.splash-badge .forest-tree-icon {
  width: 80px;
  height: 100px;
  filter: drop-shadow(0 0 30px rgba(229,50,51,0.5));
}

.splash-title {
  font-size: 3.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1;
  color: white;
  text-shadow: 0 0 40px rgba(229,50,51,0.3);
}
.splash-title span {
  display: block;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--forest-red), var(--forest-red-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 400;
}

.splash-tagline {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.splash-enter {
  margin-top: 16px;
  font-size: 1rem;
  padding: 18px 48px;
  border-radius: 60px;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on CTA button */
.splash-enter::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: btnShimmer 3s ease-in-out infinite;
}
@keyframes btnShimmer {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

.splash-season {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 8px;
}

/* ============================================
   TITLE SCREEN
   ============================================ */
#title-screen {
  justify-content: flex-start;
  text-align: center;
  gap: 24px;
  padding-top: 40px;
  background: radial-gradient(ellipse at 50% 20%, rgba(229,50,51,0.08) 0%, transparent 50%),
              var(--bg-dark);
}

.title-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.title-tree-icon {
  width: 44px;
  height: 55px;
}

.title-name {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: white;
}

/* Player of the Match banner */
.potm-banner {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  padding: 12px 24px;
  text-align: center;
  width: 100%;
  max-width: 360px;
  animation: fadeInUp 0.5s ease-out;
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer on POTM banner */
.potm-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,215,0,0.04), transparent);
  animation: shimmerSlide 5s ease-in-out infinite;
  pointer-events: none;
}

.potm-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.potm-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
}

.potm-rarity {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

/* Record bar */
.record-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 24px;
  border: 1px solid rgba(255,255,255,0.04);
  width: 100%;
  max-width: 360px;
}

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

.record-value {
  font-size: 1.4rem;
  font-weight: 900;
  font-family: 'Space Mono', monospace;
  color: white;
}

.record-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.record-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.08);
}

.streak-item .record-value {
  color: var(--forest-red);
}

/* Menu buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  color: white;
  position: relative;
  overflow: hidden;
}

/* Subtle press effect for all buttons */
.btn:active {
  transform: scale(0.97) !important;
}

.btn-large {
  padding: 18px 48px;
  font-size: 1.1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--forest-red), var(--forest-red-dark));
  color: white;
  box-shadow: 0 4px 20px var(--forest-red-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(229, 50, 51, 0.6);
}

.btn-secondary {
  background: var(--bg-card-light);
  color: var(--text-primary);
  border: 2px solid rgba(229, 50, 51, 0.2);
}
.btn-secondary:hover {
  border-color: var(--forest-red);
  transform: translateY(-2px);
}

/* Season Mode button -- special gold accent */
.btn-season {
  background: linear-gradient(135deg, #1a1a3a, #242450);
  color: var(--gold);
  border: 2px solid rgba(255,215,0,0.3);
}
.btn-season:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255,215,0,0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 12px 24px;
  font-size: 0.85rem;
}
.btn-ghost:hover {
  border-color: rgba(255,255,255,0.2);
  color: white;
}

.btn-share {
  background: var(--bg-card-light);
  color: white;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 28px;
  font-size: 0.85rem;
  gap: 8px;
}
.btn-share:hover {
  border-color: var(--forest-red);
  background: var(--bg-card);
}

.btn-small {
  padding: 10px 20px;
  font-size: 0.85rem;
}

.btn-icon {
  font-size: 1.2rem;
}

.mode-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: -6px;
  letter-spacing: 0;
  text-transform: none;
}

.menu-secondary {
  width: 100%;
  max-width: 360px;
}

.collection-progress {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  background: var(--forest-red);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.sound-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.sound-toggle:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}
.sound-toggle.active {
  border-color: var(--forest-red);
  color: var(--forest-red);
}

/* ============================================
   GAME SCREEN
   ============================================ */
#game-screen {
  padding: 10px 16px;
  gap: 10px;
  padding-bottom: 20px;
  background: radial-gradient(ellipse at 50% 80%, rgba(229,50,51,0.04) 0%, transparent 50%),
              var(--bg-dark);
}

/* Stadium atmosphere overlay -- subtle */
#game-screen::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(229,50,51,0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(229,50,51,0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* Top HUD */
.game-hud {
  width: 100%;
  max-width: 700px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(20,20,40,0.95) 0%, rgba(20,20,40,0.85) 100%);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.hud-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hud-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.hud-cards {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-primary);
  transition: all 0.3s ease;
}
.hud-cards.bump {
  animation: hudBump 0.3s ease;
}
@keyframes hudBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); color: var(--forest-red); }
  100% { transform: scale(1); }
}
.hud-score {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hud-round {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.hud-mode {
  font-size: 0.85rem;
  color: var(--forest-red);
  font-weight: 700;
}
.hud-lives {
  font-size: 1rem;
  color: var(--forest-red);
}

/* In-game streak display */
.hud-streak {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--gold);
  letter-spacing: 1px;
  min-height: 16px;
}
.hud-streak.active {
  animation: streakPulse 0.5s ease;
}
@keyframes streakPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Battle Area */
.battle-area {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.card-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.card-slot-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ---- THE CARD ---- */
.card {
  width: var(--card-width);
  height: var(--card-height);
  perspective: 1000px;
  cursor: default;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.15, 1);
}
.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
}

/* Card Back (face-down) */
.card-back {
  background: linear-gradient(135deg, var(--forest-red-dark) 0%, #6b1415 50%, var(--forest-red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--forest-red);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.card-back-design {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.back-tree-svg {
  width: 60px;
  height: 75px;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}
.card-back-design .back-text {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: rgba(255,255,255,0.5);
  font-weight: 700;
}
.card-back-pattern {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px);
  pointer-events: none;
}

/* Card Front (face-up) */
.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--bg-card) 0%, #0c0c1e 100%);
  border: 3px solid var(--forest-red);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

/* Rarity borders */
.card.rarity-legendary .card-front {
  border-color: var(--rarity-legendary);
  box-shadow: 0 0 20px rgba(255,215,0,0.3), 0 8px 30px rgba(0,0,0,0.5);
}
.card.rarity-epic .card-front {
  border-color: var(--rarity-epic);
  box-shadow: 0 0 15px rgba(168,85,247,0.3), 0 8px 30px rgba(0,0,0,0.5);
}
.card.rarity-rare .card-front {
  border-color: var(--rarity-rare);
  box-shadow: 0 0 12px rgba(74,158,255,0.2), 0 8px 30px rgba(0,0,0,0.5);
}
.card.rarity-common .card-front {
  border-color: var(--rarity-common);
}

/* Card back rarity */
.card.rarity-legendary .card-back {
  border-color: var(--rarity-legendary);
  background: linear-gradient(135deg, #8b7500, #4a3d00 50%, #8b7500 100%);
}
.card.rarity-epic .card-back {
  border-color: var(--rarity-epic);
  background: linear-gradient(135deg, #6b2fa0, #3a1a5c 50%, #6b2fa0 100%);
}
.card.rarity-rare .card-back {
  border-color: var(--rarity-rare);
}

/* Card Header */
.card-header {
  background: linear-gradient(135deg, var(--forest-red), var(--forest-red-dark));
  padding: 10px 14px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.card.rarity-legendary .card-header {
  background: linear-gradient(135deg, #c7a600, #8b7500);
}
.card.rarity-epic .card-header {
  background: linear-gradient(135deg, #8b45d6, #6b2fa0);
}

.card-player-name {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
  flex: 1;
}
.card-position {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(0,0,0,0.3);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  margin-left: 8px;
}

.card-rarity-badge {
  position: absolute;
  top: -1px;
  right: 10px;
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 0 0 4px 4px;
  color: white;
}
.card-rarity-badge.legendary { background: var(--rarity-legendary); color: #000; }
.card-rarity-badge.epic { background: var(--rarity-epic); }
.card-rarity-badge.rare { background: var(--rarity-rare); }

/* Card Overall Rating Badge */
.card-overall-badge {
  position: absolute;
  top: 8px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.card-overall-number {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.card-overall-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.6);
}

/* Adjust header layout when overall badge present */
.card-header.has-overall {
  padding-left: 58px;
}

/* Card Info */
.card-info {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(0,0,0,0.3);
  font-size: 0.65rem;
  color: var(--text-secondary);
}
.card-info span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.card-info .info-label {
  font-family: 'Space Mono', monospace;
  color: var(--text-muted);
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Card Stats */
.card-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
  gap: 5px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.stat-row:hover {
  background: rgba(229, 50, 51, 0.1);
  transform: translateX(2px);
}
.stat-row.won {
  background: rgba(46, 204, 113, 0.15);
  box-shadow: inset 0 0 0 1px var(--green-win);
}
.stat-row.lost {
  background: rgba(231, 76, 60, 0.15);
  box-shadow: inset 0 0 0 1px var(--red-lose);
}
.stat-row.drawn {
  background: rgba(52, 152, 219, 0.15);
  box-shadow: inset 0 0 0 1px var(--blue-draw);
}

/* CPU card: no hover/pointer */
.card-slot.cpu .stat-row {
  cursor: default;
}
.card-slot.cpu .stat-row:hover {
  background: transparent;
  transform: none;
}

.stat-name {
  width: 62px;
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
}
.stat-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  background: linear-gradient(90deg, var(--forest-red), var(--forest-red-light));
  width: 0; /* Start at 0, animated in */
}

/* Rarity stat bar colours */
.card.rarity-legendary .stat-bar {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
}
.card.rarity-epic .stat-bar {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}
.card.rarity-rare .stat-bar {
  background: linear-gradient(90deg, #2563eb, #4a9eff);
}

.stat-value {
  width: 28px;
  text-align: right;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Winning stat value highlight */
.stat-row.won .stat-value {
  color: var(--green-win);
  font-weight: 900;
}
.stat-row.lost .stat-value {
  color: var(--red-lose);
}

/* Card Bio */
.card-bio {
  padding: 6px 14px 8px;
  font-size: 0.58rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-top: 1px solid rgba(255,255,255,0.04);
  min-height: 36px;
}

/* Holographic overlay for legendary cards */
.card.rarity-legendary .card-front::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 215, 0, 0.05) 20%,
    transparent 40%,
    rgba(255, 215, 0, 0.03) 60%,
    transparent 80%,
    rgba(255, 215, 0, 0.05) 100%
  );
  pointer-events: none;
  border-radius: 13px;
  animation: holoShift 4s ease-in-out infinite alternate;
}
@keyframes holoShift {
  0% { background-position: 0% 0%; opacity: 0.5; }
  100% { background-position: 100% 100%; opacity: 1; }
}

/* ---- GAME ACTION AREA ---- */
.action-area {
  width: 100%;
  max-width: 700px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.action-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  min-height: 28px;
  font-weight: 600;
  transition: all 0.3s ease;
}
.action-message.win { color: var(--green-win); font-weight: 800; }
.action-message.lose { color: var(--red-lose); font-weight: 800; }
.action-message.draw { color: var(--blue-draw); font-weight: 800; }

/* Animated result message */
.action-message.win,
.action-message.lose,
.action-message.draw {
  animation: messagePopIn 0.3s ease-out;
}
@keyframes messagePopIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   SEASON TABLE SCREEN
   ============================================ */
#season-table-screen {
  justify-content: center;
  text-align: center;
  gap: 24px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,215,0,0.06) 0%, transparent 50%),
              var(--bg-dark);
}

.season-table-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: fadeInUp 0.5s ease-out;
}

.season-table-title {
  font-size: 1.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
}

.season-table-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.season-table-box {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid rgba(255,215,0,0.15);
  width: 100%;
  overflow: hidden;
}

.season-table-row {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
}
.season-table-row:last-child {
  border-bottom: none;
}
.season-table-row.header {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(0,0,0,0.3);
  padding: 8px 20px;
}
.season-table-row.you {
  background: rgba(229,50,51,0.1);
  border-left: 3px solid var(--forest-red);
}
.season-table-row .st-pos {
  width: 30px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  color: var(--text-muted);
}
.season-table-row .st-name {
  flex: 1;
  font-weight: 700;
  color: white;
}
.season-table-row .st-w,
.season-table-row .st-d,
.season-table-row .st-l,
.season-table-row .st-pts {
  width: 40px;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
}
.season-table-row .st-pts {
  color: var(--gold);
  font-weight: 700;
}
.season-table-row.header .st-pts {
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================
   RESULT SCREEN
   ============================================ */
#result-screen {
  justify-content: center;
  text-align: center;
  gap: 24px;
  background: radial-gradient(ellipse at 50% 30%, rgba(229,50,51,0.08) 0%, transparent 50%),
              var(--bg-dark);
}

.result-icon {
  font-size: 72px;
  animation: bounceIn 0.6s ease;
}

.result-title {
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.result-title.win { color: var(--green-win); }
.result-title.lose { color: var(--red-lose); }
.result-title.draw { color: var(--blue-draw); }
.result-title.champions { color: var(--gold); }

.result-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
}
.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.result-stat-value {
  font-family: 'Space Mono', monospace;
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
}
.result-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-detail-box {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px 28px;
  border: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.result-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-detail-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-detail-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}

/* Season final box */
.season-final-box {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255,215,0,0.05) 100%);
  border: 2px solid rgba(255,215,0,0.3);
  border-radius: 16px;
  padding: 20px 28px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.season-final-standing {
  font-size: 1.4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
}
.season-final-record {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.season-unlock-msg {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
  animation: pulse 1.5s ease infinite;
}

.share-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.share-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.share-copied {
  font-size: 0.7rem;
  color: var(--green-win);
  min-height: 18px;
}

/* Share card preview */
.share-card-preview {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  animation: fadeInUp 0.3s ease-out;
}
.share-card-preview canvas {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.share-card-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.result-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   COLLECTION SCREEN -- Visual Card Gallery
   ============================================ */
#collection-screen {
  padding-top: 20px;
  gap: 16px;
}

.collection-header {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-back {
  padding: 8px 12px;
  font-size: 0.8rem;
  gap: 6px;
  border: none;
}

.collection-title {
  font-size: 1.3rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
}

.collection-counter {
  font-family: 'Space Mono', monospace;
  font-size: 0.7rem;
  color: var(--forest-red);
  background: rgba(229,50,51,0.1);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(229,50,51,0.2);
}

/* Collection progress bar */
.collection-progress-bar {
  width: 100%;
  max-width: 700px;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
.progress-segment {
  height: 100%;
  transition: width 0.5s ease;
}
.progress-segment.legendary { background: var(--rarity-legendary); }
.progress-segment.epic { background: var(--rarity-epic); }
.progress-segment.rare { background: var(--rarity-rare); }
.progress-segment.common { background: var(--rarity-common); }

.collection-filter-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 700px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.12);
}
.filter-btn.active {
  background: var(--forest-red);
  color: white;
  border-color: var(--forest-red);
}

/* Visual card grid -- 5 columns desktop, 3 mobile */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 700px;
  padding-bottom: 20px;
}

/* Collection card -- playing card proportions */
.collection-card {
  aspect-ratio: 2.5 / 3.5;
  background: var(--bg-card);
  border-radius: 12px;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.04);
  transition: all 0.3s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
}
.collection-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255,255,255,0.15);
}

/* Mastered cards */
.collection-card.mastered {
  border-color: var(--forest-red);
}
.collection-card.mastered .collection-card-overall {
  color: var(--forest-red);
}

/* Locked cards -- dark silhouette */
.collection-card.locked {
  background: linear-gradient(180deg, #0d0d1e 0%, #08081a 100%);
  border-color: rgba(255,255,255,0.04);
}
.collection-card.locked .collection-card-name,
.collection-card.locked .collection-card-pos,
.collection-card.locked .collection-card-overall {
  display: none;
}
.collection-card.locked .collection-card-rarity {
  opacity: 0.6;
}

/* Lock overlay for locked cards */
.collection-card-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.collection-card-lock .lock-icon {
  font-size: 1.5rem;
  opacity: 0.4;
}
.collection-card-lock .lock-question {
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(255,255,255,0.15);
}

/* Rarity borders on collection cards */
.collection-card.rarity-legendary { border-color: rgba(255,215,0,0.3); }
.collection-card.rarity-epic { border-color: rgba(168,85,247,0.25); }
.collection-card.rarity-rare { border-color: rgba(74,158,255,0.2); }

.collection-card.rarity-legendary.locked { border-color: rgba(255,215,0,0.15); }
.collection-card.rarity-epic.locked { border-color: rgba(168,85,247,0.12); }
.collection-card.rarity-rare.locked { border-color: rgba(74,158,255,0.1); }

/* Legendary mastered shimmer / glow */
.collection-card.rarity-legendary.mastered {
  border-color: var(--rarity-legendary);
  animation: legendaryGlow 3s ease infinite;
}
@keyframes legendaryGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255,215,0,0.2), 0 0 20px rgba(255,215,0,0.1);
  }
  50% {
    box-shadow: 0 0 16px rgba(255,215,0,0.4), 0 0 40px rgba(255,215,0,0.15);
  }
}

/* Legendary shimmer overlay */
.collection-card.rarity-legendary.mastered::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,215,0,0.08), transparent);
  animation: shimmerSlide 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmerSlide {
  0% { left: -100%; }
  50% { left: 150%; }
  100% { left: 150%; }
}

.collection-card-rarity {
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.collection-card-rarity.legendary { color: var(--rarity-legendary); }
.collection-card-rarity.epic { color: var(--rarity-epic); }
.collection-card-rarity.rare { color: var(--rarity-rare); }
.collection-card-rarity.common { color: var(--rarity-common); }

.collection-card-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
  margin-bottom: 2px;
  line-height: 1.15;
}

.collection-card-pos {
  font-size: 0.5rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.collection-card-overall {
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-secondary);
}

/* Mastered check badge */
.collection-card.mastered .collection-card-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--forest-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: white;
  font-weight: 900;
}

/* ============================================
   ABOUT SCREEN
   ============================================ */
#about-screen {
  justify-content: center;
  gap: 24px;
}

.about-content {
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.about-body {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.about-tree {
  width: 60px;
  height: 75px;
}

.about-tagline {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  line-height: 1.5;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  transition: all 0.2s;
}
.about-link:hover {
  border-color: var(--forest-red);
  color: white;
}

/* ============================================
   BOTTOM NAV
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(20,20,40,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  justify-content: center;
  gap: 0;
  z-index: 100;
  padding: 0 20px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav.hidden {
  display: none;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}
.nav-btn span {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-btn:hover, .nav-btn.active {
  color: var(--forest-red);
}

/* ============================================
   VS BADGE
   ============================================ */
.vs-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin-top: 120px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card-light);
  border: 2px solid rgba(229,50,51,0.2);
  font-weight: 900;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  color: var(--forest-red);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* VS badge pulse on comparison */
.vs-badge.comparing {
  animation: vsPulse 0.6s ease;
  border-color: var(--forest-red);
  background: rgba(229,50,51,0.2);
}
@keyframes vsPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); box-shadow: 0 0 20px var(--forest-red-glow); }
  100% { transform: scale(1); }
}

/* ============================================
   ROUND RESULT OVERLAY
   ============================================ */
.round-result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.round-result-overlay.visible {
  opacity: 1;
}
.round-result-text {
  font-size: 3rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 4px 30px rgba(0,0,0,0.8);
  animation: roundResultPop 0.8s ease-out forwards;
}
.round-result-text.win { color: var(--green-win); }
.round-result-text.lose { color: var(--red-lose); }
.round-result-text.draw { color: var(--blue-draw); }

@keyframes roundResultPop {
  0% { transform: scale(0.5); opacity: 0; }
  40% { transform: scale(1.2); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 0; }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(229, 50, 51, 0.3); }
  50%      { box-shadow: 0 0 25px rgba(229, 50, 51, 0.6); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.animate-in {
  animation: slideUp 0.4s ease-out;
}

/* Card deal animation - slides up from below */
.card.deal-in {
  animation: dealCard 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes dealCard {
  0% { transform: translateY(60px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.card.pulse {
  animation: pulse 0.3s ease;
}

.card.glow {
  animation: glow 1s ease infinite;
}

/* Win/lose flash on the whole card */
@keyframes flashGreen {
  0%   { box-shadow: 0 0 0 rgba(46, 204, 113, 0); }
  50%  { box-shadow: 0 0 40px rgba(46, 204, 113, 0.7); }
  100% { box-shadow: 0 0 0 rgba(46, 204, 113, 0); }
}
@keyframes flashRed {
  0%   { box-shadow: 0 0 0 rgba(231, 76, 60, 0); }
  50%  { box-shadow: 0 0 40px rgba(231, 76, 60, 0.7); }
  100% { box-shadow: 0 0 0 rgba(231, 76, 60, 0); }
}
.card.flash-win .card-front  { animation: flashGreen 0.8s ease; }
.card.flash-lose .card-front { animation: flashRed 0.8s ease; }

/* Card slam animation for wins */
.card.slam-win {
  animation: cardSlam 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes cardSlam {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Legendary shimmer */
.card.rarity-legendary .card-header {
  background: linear-gradient(135deg, #c7a600, #8b7500, #ffd700, #8b7500);
  background-size: 300% 100%;
  animation: shimmer 3s ease infinite;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 720px) {
  :root {
    --card-width: 150px;
    --card-height: 240px;
  }

  .battle-area {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }
  .vs-badge {
    margin-top: 70px;
    width: 32px;
    height: 32px;
    font-size: 0.6rem;
  }

  .card-player-name {
    font-size: 0.65rem;
  }
  .card-position {
    font-size: 0.45rem;
    padding: 2px 4px;
    margin-left: 4px;
  }
  .card-header {
    padding: 6px 8px 5px;
  }
  .card-header.has-overall {
    padding-left: 36px;
  }
  .card-overall-number {
    font-size: 1rem;
  }
  .card-overall-label {
    font-size: 0.3rem;
  }
  .card-info {
    padding: 3px 8px;
    font-size: 0.5rem;
  }
  .card-info .info-label {
    font-size: 0.4rem;
  }
  .card-stats {
    padding: 4px 6px;
    gap: 2px;
  }
  .stat-row {
    padding: 2px 4px;
    gap: 4px;
  }
  .stat-name {
    width: 38px;
    font-size: 0.42rem;
  }
  .stat-bar-bg {
    height: 4px;
  }
  .stat-value {
    width: 20px;
    font-size: 0.55rem;
  }
  .card-bio {
    padding: 3px 8px 5px;
    font-size: 0.42rem;
    min-height: 24px;
    line-height: 1.3;
  }
  .card-rarity-badge {
    font-size: 0.38rem;
    padding: 1px 4px;
    right: 6px;
  }

  .card-slot-label {
    font-size: 0.55rem;
    letter-spacing: 1px;
  }

  .splash-title {
    font-size: 2.8rem;
  }
  .splash-title span {
    font-size: 1.6rem;
  }

  .game-hud {
    padding: 8px 12px;
  }
  .hud-cards {
    font-size: 1.2rem;
  }

  .result-stats {
    gap: 24px;
  }

  /* Collection: 3 columns on mobile */
  .collection-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .collection-card-name {
    font-size: 0.6rem;
  }
  .collection-card-overall {
    font-size: 1rem;
  }
  .collection-card-rarity {
    font-size: 0.45rem;
  }

  .round-result-text {
    font-size: 2rem;
  }

  .action-message {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  :root {
    --card-width: 135px;
    --card-height: 220px;
  }
  .stat-name {
    width: 32px;
    font-size: 0.38rem;
  }
  .card-player-name {
    font-size: 0.58rem;
  }
  .splash-title {
    font-size: 2.2rem;
  }
  .splash-title span {
    font-size: 1.3rem;
  }
}

/* Desktop: cards side by side */
@media (min-width: 721px) {
  :root {
    --card-width: 280px;
    --card-height: 420px;
  }
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 200px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(229,50,51,0.2);
  border-top-color: var(--forest-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide bottom nav on splash, game, result, and season table screens */
#splash-screen.active ~ .bottom-nav,
#game-screen.active ~ .bottom-nav,
#season-table-screen.active ~ .bottom-nav {
  display: none;
}

/* ============================================
   CARD TILT 3D EFFECT (applied via JS)
   ============================================ */
.card.tilt-active .card-inner {
  transition: transform 0.1s ease-out;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-light) 100%);
  border: 1px solid var(--forest-red);
  border-radius: 12px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6), 0 0 20px var(--forest-red-glow);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast-notification.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.toast-message {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

/* ============================================
   STATS OVERLAY / MODAL
   ============================================ */
.stats-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.stats-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.stats-modal {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-dark) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.stats-overlay.visible .stats-modal {
  transform: translateY(0) scale(1);
}

/* Scrollbar styling for stats modal */
.stats-modal::-webkit-scrollbar {
  width: 4px;
}
.stats-modal::-webkit-scrollbar-track {
  background: transparent;
}
.stats-modal::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.stats-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-modal-title {
  font-size: 1.4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: white;
}

.stats-close-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.stats-close-btn:hover {
  border-color: var(--forest-red);
  color: var(--forest-red);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stats-card-wide {
  grid-column: 1 / -1;
}
.stats-card-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stats-card-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.stats-card-value {
  font-family: 'Space Mono', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  color: white;
  line-height: 1;
}
.stats-card-value.stats-green { color: var(--green-win); }
.stats-card-value.stats-red { color: var(--red-lose); }
.stats-card-value.stats-gold { color: var(--gold); }
.stats-card-value.stats-favourite {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--forest-red);
}

.stats-card-sublabel {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Milestone progress bar */
.stats-milestone-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.stats-milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-red), var(--forest-red-light));
  border-radius: 3px;
  transition: width 0.6s ease;
  width: 0%;
}
.stats-milestone-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Win rate circle */
.stats-win-circle {
  position: relative;
  width: 90px;
  height: 90px;
}
.stats-circle-svg {
  width: 100%;
  height: 100%;
}
.stats-circle-svg circle {
  transition: stroke-dashoffset 0.8s ease;
}
.stats-circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--forest-red);
}

/* Collection progress in stats */
.stats-collection-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.stats-collection-row .stats-card-value {
  font-size: 1.4rem;
}
.stats-collection-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.stats-collection-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-red), var(--gold));
  border-radius: 4px;
  transition: width 0.6s ease;
  width: 0%;
}

/* Reset button */
.stats-reset-btn {
  align-self: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  gap: 6px;
  padding: 10px 20px;
  border-color: rgba(255,255,255,0.06);
}
.stats-reset-btn:hover {
  color: var(--red-lose);
  border-color: var(--red-lose);
}

/* ============================================
   SEEN PROGRESS BAR (Title Screen)
   ============================================ */
.seen-progress-bar {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seen-progress-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}
.seen-progress-label svg {
  color: var(--forest-red);
  opacity: 0.6;
}
.seen-progress-label span {
  font-family: 'Space Mono', monospace;
  color: var(--text-secondary);
  font-weight: 700;
}
.seen-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.seen-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-red), var(--gold));
  border-radius: 2px;
  transition: width 0.6s ease;
  width: 0%;
}

/* ============================================
   RESPONSIVE STATS
   ============================================ */
@media (max-width: 380px) {
  .stats-modal {
    padding: 20px 16px;
  }
  .stats-card-value {
    font-size: 1.5rem;
  }
  .stats-win-circle {
    width: 76px;
    height: 76px;
  }
  .stats-circle-text {
    font-size: 0.9rem;
  }
}

/* ============================================
   HOUSE PICKER
   ============================================ */
.house-picker {
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
}

.house-picker-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: white;
  margin-bottom: 4px;
}

.house-picker-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.house-picker-row {
  display: flex;
  gap: 10px;
}

.house-pick-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Outfit', sans-serif;
  color: white;
}

.house-pick-btn:hover {
  border-color: var(--house-color);
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(255,255,255,0.1);
}

.house-pick-btn:active {
  transform: scale(0.97);
}

.house-pick-emoji {
  font-size: 1.6rem;
}

.house-pick-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   HOUSE LEADERBOARD
   ============================================ */
.house-leaderboard {
  width: 100%;
  max-width: 360px;
  display: flex;
  gap: 10px;
  animation: fadeInUp 0.4s ease-out;
}

.house-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.04);
  border-radius: 14px;
  transition: all 0.3s ease;
  position: relative;
}

.house-col.your-house {
  border-color: var(--house-color);
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(255,255,255,0.04) 100%);
  box-shadow: 0 0 16px rgba(255,255,255,0.08);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
  .house-col.your-house {
    background: linear-gradient(180deg, var(--bg-card) 0%, color-mix(in srgb, var(--house-color) 8%, var(--bg-card)) 100%);
    box-shadow: 0 0 16px color-mix(in srgb, var(--house-color) 20%, transparent);
  }
}

.house-emoji {
  font-size: 1.2rem;
}

.house-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.house-col.your-house .house-name {
  color: white;
}

.house-score {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  color: white;
  line-height: 1;
}

.house-wins-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.house-yours-tag {
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--house-color);
  margin-top: 2px;
  font-weight: 700;
}

/* ============================================
   KIT SELECTOR
   ============================================ */
.kit-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kit-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 2px;
}

.kit-btn {
  background: none;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kit-btn:hover {
  border-color: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.kit-btn.active {
  border-color: var(--forest-red);
  box-shadow: 0 0 8px var(--forest-red-glow);
}

.kit-swatch {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.title-footer {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS FOR NEW FEATURES
   ============================================ */
@media (max-width: 380px) {
  .house-pick-btn {
    padding: 12px 6px;
  }
  .house-pick-emoji {
    font-size: 1.3rem;
  }
  .house-pick-name {
    font-size: 0.65rem;
  }
  .house-score {
    font-size: 1.3rem;
  }
  .kit-swatch {
    width: 16px;
    height: 16px;
  }
}
