/* ============================================
   SOCCER FLY — World Cup 2026
   Premium Game Stylesheet v2.0
   Glassmorphism · Dark · FIFA Mobile Inspired
   ============================================ */

/* ─── CSS Custom Properties ─── */
:root {
  --bg-dark: #0a1628;
  --bg-card: rgba(15, 25, 50, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --color-teal: #00b4d8;
  --color-green: #2ecc71;
  --color-magenta: #e6007e;
  --color-gold: #ffd700;
  --color-light: #e0e6f0;
  --color-muted: rgba(224, 230, 240, 0.5);
  --color-white: #ffffff;
  --color-silver: #c0c0c0;
  --color-bronze: #cd7f32;
  --font-title: 'Russo One', sans-serif;
  --font-body: 'Poppins', sans-serif;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow-teal: 0 0 30px rgba(0, 180, 216, 0.4);
  --shadow-glow-magenta: 0 0 30px rgba(230, 0, 126, 0.4);
  --shadow-glow-gold: 0 0 30px rgba(255, 215, 0, 0.4);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0a1628 0%, #1a2a4a 50%, #0d2137 100%);
  padding-top: env(safe-area-inset-top, 0px);
}

/* ─── Canvas ─── */
canvas,
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
}

/* ─── Utility ─── */
.hidden {
  display: none !important;
}

/* ─── Ad Slots ─── */
.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.ad-slot:empty {
  display: none;
}

/* ─── Game Wrapper ─── */
#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 9 / 16;
  max-height: 100vh;
  overflow: hidden;
  border-radius: 12px;
  box-shadow:
    0 0 60px rgba(0, 180, 216, 0.15),
    0 0 120px rgba(230, 0, 126, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ─── Overlays ─── */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  padding: 30px 24px;
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Universal text color for all overlay children */
.overlay,
.overlay * {
  color: var(--color-light);
}

/* ─── Overlay Container Common ─── */
.menu-container,
.start-container,
.ball-select-container,
.team-select-container {
  text-align: center;
  width: 90%;
  max-width: 400px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Start screen extras */
.start-best {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--color-light);
  margin-bottom: 20px;
  opacity: 0.7;
}

.start-controls {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 8px;
  letter-spacing: 1px;
}

/* Button groups (gameover, victory, defeat, champion) */
.gameover-buttons,
.victory-buttons,
.defeat-buttons,
.champion-buttons,
.revive-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

/* Score row labels in game over */
.score-row span:first-child {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--color-light);
  opacity: 0.6;
  letter-spacing: 2px;
}


/* ═══════════════════════════════════════
   1.  GAME TITLE / LOGO
   ═══════════════════════════════════════ */
.game-logo {
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 12px;
  animation: ballBounce 1.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 20px rgba(0, 180, 216, 0.4));
}

@keyframes ballBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-18px) rotate(15deg); }
}

.game-title,
.game-logo h1 {
  font-family: var(--font-title);
  font-size: 36px;
  color: var(--color-white);
  letter-spacing: 3px;
  line-height: 1.1;
  text-shadow:
    0 0 20px rgba(0, 180, 216, 0.6),
    0 0 40px rgba(230, 0, 126, 0.3);
}

.game-subtitle,
.subtitle {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-teal);
  letter-spacing: 4px;
  margin-top: 8px;
  text-transform: uppercase;
}

.best-score-display {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--color-light);
  margin-bottom: 28px;
  min-height: 22px;
  opacity: 0.7;
}


/* ═══════════════════════════════════════
   2.  MENU BUTTONS (glassmorphism cards)
   ═══════════════════════════════════════ */
.menu-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.menu-btn:hover {
  border-color: var(--color-teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(0, 180, 216, 0.25);
}

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

.menu-btn + .menu-btn {
  margin-top: 10px;
}

.btn-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.btn-text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Mode variant (larger) */
.mode-btn {
  padding: 22px 28px;
  max-width: 300px;
}

.mode-btn .btn-text {
  font-size: 17px;
}

/* Balls variant — SAME width as mode buttons */
.balls-btn {
  padding: 22px 28px;
  max-width: 300px;
  margin-top: 16px;
}

.balls-btn .btn-text {
  font-size: 17px;
}


/* ═══════════════════════════════════════
   3.  PLAY BUTTON (primary CTA)
   ═══════════════════════════════════════ */
.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #00b4d8, #0090b0);
  color: var(--color-white);
  font-family: var(--font-title);
  font-size: 18px;
  padding: 14px 40px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow:
    0 4px 20px rgba(0, 180, 216, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
  animation: pulseBtn 2s ease-in-out infinite;
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 30px rgba(0, 180, 216, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.play-btn:active {
  transform: scale(0.95);
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 180, 216, 0.25); }
  50%      { box-shadow: 0 4px 35px rgba(0, 180, 216, 0.5); }
}

.btn-hint {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--color-teal);
  opacity: 0.6;
  letter-spacing: 1px;
}


/* ═══════════════════════════════════════
   4.  BACK BUTTON
   ═══════════════════════════════════════ */
.back-btn {
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 8px 20px;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.25s ease;
  letter-spacing: 0.5px;
}

.back-btn:hover {
  color: var(--color-light);
  border-color: var(--color-light);
}


/* ═══════════════════════════════════════
   5.  SCORE HUD (in-game)
   ═══════════════════════════════════════ */
.score-hud,
#score-hud {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
}

#score-hud.hidden,
.score-hud.hidden {
  display: none;
}

#current-score {
  font-family: var(--font-title);
  font-size: 56px;
  color: var(--color-white);
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(0, 180, 216, 0.3);
  letter-spacing: 2px;
}

.score-pop {
  animation: scorePop 0.25s ease-out;
}

@keyframes scorePop {
  0%   { transform: translateX(-50%) scale(1); }
  50%  { transform: translateX(-50%) scale(1.3); }
  100% { transform: translateX(-50%) scale(1); }
}


/* ═══════════════════════════════════════
   6.  BALL SELECTION GRID
   ═══════════════════════════════════════ */
.ball-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 16px;
}

.ball-card {
  background: var(--glass-bg);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ball-card.selected {
  border-color: var(--color-teal);
  background: rgba(0, 180, 216, 0.1);
  box-shadow: 0 0 16px rgba(0, 180, 216, 0.2);
}

.ball-card:hover {
  transform: scale(1.05);
}

.ball-card:active {
  transform: scale(0.96);
}

.ball-card canvas {
  width: 50px;
  height: 50px;
  display: block;
  margin: 0 auto;
}

.ball-card-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  color: var(--color-light);
  margin-top: 4px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ball-card-year {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 9px;
  color: var(--color-muted);
  margin-top: 1px;
}


/* ═══════════════════════════════════════
   7.  TEAM SELECTION GRID
   ═══════════════════════════════════════ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 16px;
}

.team-card {
  background: var(--glass-bg);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.team-card.selected {
  border-color: var(--color-gold);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.15);
}

.team-card:hover {
  transform: scale(1.08);
}

.team-card:active {
  transform: scale(0.94);
}

.team-card img {
  width: 36px;
  height: auto;
  border-radius: 2px;
  display: block;
  margin: 0 auto;
}

.team-card-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 8px;
  color: var(--color-light);
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ═══════════════════════════════════════
   8.  BRACKET SCREEN
   ═══════════════════════════════════════ */
.bracket-container {
  max-width: 360px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: left;
}

.bracket-team-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.bracket-flag {
  width: 40px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bracket-team-banner span {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-light);
}

.bracket-rounds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bracket-round-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-left: 3px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.bracket-round-item.completed {
  border-left-color: var(--color-green);
}

.bracket-round-item.current {
  border-left-color: var(--color-gold);
  background: rgba(255, 215, 0, 0.06);
}

.bracket-round-item.locked {
  opacity: 0.4;
  border-left-color: transparent;
}

.round-info-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.round-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--color-light);
}

.round-status {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
}

.round-status.won {
  color: var(--color-green);
}

.round-status.locked {
  color: var(--color-muted);
}

.round-rival {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  color: var(--color-light);
}

/* Bracket inline play/replay buttons */
.bracket-play-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.bracket-play-btn.primary {
  background: linear-gradient(135deg, var(--color-gold), #e6a800);
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
  animation: pulseGold 2s ease-in-out infinite;
}

@keyframes pulseGold {
  0%, 100% { box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 2px 16px rgba(255, 215, 0, 0.6); }
}

.bracket-play-btn.primary:active {
  transform: scale(0.95);
}

.bracket-play-btn.replay {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-green);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.bracket-play-btn.replay:active {
  background: rgba(46, 204, 113, 0.3);
}

.rival-flag-small {
  width: 22px;
  height: auto;
  border-radius: 2px;
}

.replay-match-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.replay-match-btn:hover {
  opacity: 1;
}


/* ═══════════════════════════════════════
   9.  STAR SELECTOR
   ═══════════════════════════════════════ */
.star-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.star-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 6px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--color-muted);
  transition: all 0.25s ease;
}

.star-btn:hover {
  color: var(--color-light);
  border-color: var(--color-light);
}

.star-btn.active {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
}


/* ═══════════════════════════════════════
   10. PRE-MATCH SCREEN
   ═══════════════════════════════════════ */
.prematch-container {
  text-align: center;
}

.prematch-round {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.prematch-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
}

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

.prematch-flag {
  width: 64px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.prematch-name,
#prematch-name1,
#prematch-name2 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-light);
}

.prematch-vs-text {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--color-magenta);
  text-shadow: 0 0 20px rgba(230, 0, 126, 0.4);
}

.prematch-info {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 8px;
  line-height: 1.5;
}


/* ═══════════════════════════════════════
   11. VICTORY / DEFEAT / CHAMPION SCREENS
   ═══════════════════════════════════════ */

/* — Victory — */
.victory-container {
  text-align: center;
  max-width: 320px;
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.victory-title {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--color-gold);
  text-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.victory-message {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--color-light);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* — Defeat — */
.defeat-container {
  text-align: center;
  max-width: 320px;
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.defeat-title {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--color-magenta);
  text-shadow: 0 0 25px rgba(230, 0, 126, 0.5);
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.defeat-message {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--color-light);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* — Champion — */
.champion-container {
  text-align: center;
  max-width: 320px;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.champion-title {
  font-size: 72px;
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 8px;
}

.champion-text {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--color-gold);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
  letter-spacing: 3px;
  margin-bottom: 12px;
}

.champion-stars {
  display: flex;
  gap: 4px;
  justify-content: center;
  font-size: 24px;
  margin: 16px 0;
}


/* ═══════════════════════════════════════
   12. REVIVE SCREEN
   ═══════════════════════════════════════ */
.revive-container {
  text-align: center;
  max-width: 300px;
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.revive-title {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--color-gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.revive-heart {
  font-size: 48px;
  display: block;
  margin: 12px auto;
  animation: heartbeat 1s ease-in-out infinite;
}

.revive-lives {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.revive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #00b4d8, #0090b0);
  color: var(--color-white);
  font-family: var(--font-title);
  font-size: 16px;
  padding: 12px 36px;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 4px 20px rgba(0, 180, 216, 0.35);
  transition: all 0.3s ease;
}

.revive-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0, 180, 216, 0.5);
}

.revive-btn:active {
  transform: scale(0.95);
}


/* ═══════════════════════════════════════
   13. WORLD CUP HUD (in-game progress bar)
   ═══════════════════════════════════════ */
.wc-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 6px 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.wc-hud.hidden {
  display: none;
}

.wc-hud-flag {
  width: 20px;
  border-radius: 2px;
  flex-shrink: 0;
}

.wc-hud-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.wc-hud-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-teal), var(--color-green));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.wc-hud-round {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
}


/* ═══════════════════════════════════════
   14. GAME OVER
   ═══════════════════════════════════════ */
.game-over-content {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.game-over-title,
.gameover-title {
  font-family: var(--font-title);
  font-size: 36px;
  color: var(--color-magenta);
  margin-bottom: 24px;
  text-shadow: 0 0 30px rgba(230, 0, 126, 0.5);
  letter-spacing: 4px;
}

.gameover-container {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: 340px;
  margin: 0 auto;
}

/* — Medal — */
.medal-container {
  margin-bottom: 24px;
}

.medal-container.hidden {
  display: none;
}

.medal {
  font-size: 56px;
  margin-bottom: 6px;
  animation: medalReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes medalReveal {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.medal-label {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.medal-label.bronze   { color: var(--color-bronze); }
.medal-label.silver   { color: var(--color-silver); }
.medal-label.gold     { color: var(--color-gold); }
.medal-label.worldcup {
  color: var(--color-gold);
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* — Score Board — */
.score-board {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 28px;
  margin-bottom: 24px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.score-row + .score-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.score-label {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--color-light);
  opacity: 0.6;
  letter-spacing: 2px;
}

.score-value {
  font-family: var(--font-title);
  font-size: 28px;
  color: var(--color-white);
}

/* — New Record — */
.new-record {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-gold);
  margin-top: 10px;
  animation: newRecordPulse 0.8s ease-in-out infinite alternate;
}

.new-record.hidden {
  display: none;
}

/* — Motivational Message — */
.motive-message {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-teal);
  margin-top: 12px;
  margin-bottom: 8px;
  opacity: 0.9;
  min-height: 20px;
  line-height: 1.4;
}

.motive-message.hidden {
  display: none;
}

/* — Score Difference — */
.score-diff {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--color-light);
  opacity: 0.5;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

.score-diff.hidden {
  display: none;
}

/* — Retry Button — */
.retry-btn {
  animation: none;
  border: 2px solid var(--color-magenta);
  background: linear-gradient(135deg, rgba(230, 0, 126, 0.15), rgba(0, 180, 216, 0.1));
}

.retry-btn:hover {
  background: linear-gradient(135deg, rgba(230, 0, 126, 0.3), rgba(0, 180, 216, 0.15));
  box-shadow: var(--shadow-glow-magenta);
}


/* ═══════════════════════════════════════
   15. CUSTOM SCROLLBAR
   ═══════════════════════════════════════ */
.ball-grid::-webkit-scrollbar,
.team-grid::-webkit-scrollbar,
.bracket-container::-webkit-scrollbar {
  width: 4px;
}

.ball-grid::-webkit-scrollbar-track,
.team-grid::-webkit-scrollbar-track,
.bracket-container::-webkit-scrollbar-track {
  background: transparent;
}

.ball-grid::-webkit-scrollbar-thumb,
.team-grid::-webkit-scrollbar-thumb,
.bracket-container::-webkit-scrollbar-thumb {
  background: rgba(0, 180, 216, 0.35);
  border-radius: 2px;
}

.ball-grid::-webkit-scrollbar-thumb:hover,
.team-grid::-webkit-scrollbar-thumb:hover,
.bracket-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 180, 216, 0.6);
}

/* Firefox thin scrollbar */
.ball-grid,
.team-grid,
.bracket-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 180, 216, 0.35) transparent;
}


/* ═══════════════════════════════════════
   SCREEN TITLES (generic heading for overlays)
   ═══════════════════════════════════════ */
.screen-title {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--color-white);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 18px;
  text-shadow:
    0 0 16px rgba(0, 180, 216, 0.4),
    0 0 30px rgba(230, 0, 126, 0.2);
}

/* Ball info panel below ball grid */
.ball-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 8px 0 12px;
}

#ball-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-light);
}

#ball-host {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--color-muted);
}

/* Team info panel */
.team-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 10px 0 16px;
}

.team-flag-large {
  width: 64px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

#team-name-preview {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-light);
}

/* Button groups */
.ball-select-buttons,
.team-select-buttons,
.bracket-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}


/* ═══════════════════════════════════════
   16. ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes newRecordPulse {
  from { opacity: 0.6; transform: scale(0.97); }
  to   { opacity: 1;   transform: scale(1.03); }
}


/* ═══════════════════════════════════════
   17. RESPONSIVE
   ═══════════════════════════════════════ */

/* Ball grid: 5 columns on wider screens */
@media (min-width: 420px) {
  .ball-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Small height */
@media (max-height: 600px) {
  .game-title,
  .game-logo h1 { font-size: 28px; }
  .logo-icon { font-size: 48px; }
  .game-over-title { font-size: 28px; }
  #current-score { font-size: 44px; }
  .champion-title { font-size: 56px; }
  .prematch-flag { width: 48px; }
}

/* Narrow width */
@media (max-width: 360px) {
  .game-title,
  .game-logo h1 { font-size: 26px; }
  .game-subtitle,
  .subtitle { font-size: 11px; letter-spacing: 3px; }
  .play-btn { padding: 12px 32px; font-size: 16px; }
  .btn-text { font-size: 14px; }
  .menu-btn { padding: 14px 18px; max-width: 240px; }
  .team-grid { grid-template-columns: repeat(5, 1fr); }
  .prematch-flag { width: 48px; }
  .prematch-vs { gap: 16px; }
}

/* Ensure minimum tap target for touch */
@media (pointer: coarse) {
  .menu-btn,
  .play-btn,
  .back-btn,
  .star-btn,
  .ball-card,
  .team-card {
    min-height: 44px;
  }
}
