html, body { 
  margin: 0; 
  padding: 0; 
  background-color: #0a0a0f; 
  overflow: hidden; 
  user-select: none;
  touch-action: none;
  width: 100%;
  height: 100%;
}

/* ── Outer page: centers the device frame ────────── */
body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Subtle radial glow behind the "phone" on desktop */
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 70%);
}

/* ── Game container ──────────────────────────────── 
 * Default: full-screen on desktop & mobile.
 * On tablet-sized screens & smaller, keeps full-bleed.
 * On desktop (> 1024px width AND > 640px height), goes full viewport.
 */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* ── Tablet & below: phone-frame look ───────────── 
 * Between 481px and 1024px (tablets) show the phone frame.
 */
@media (min-width: 481px) and (max-width: 1024px) and (min-height: 481px) {
  #game-container {
    max-width: 430px;
    max-height: 932px;
    aspect-ratio: 9 / 19.5;
    border-radius: 32px;
    box-shadow:
      0 0 0 3px rgba(255, 255, 255, 0.08),
      0 0 0 6px rgba(0, 0, 0, 0.4),
      0 20px 60px rgba(0, 0, 0, 0.6),
      0 0 120px rgba(100, 140, 255, 0.06);
  }
}

/* Canvas fills the container */
#game-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── UI overlay – scoped inside container ────────── */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  font-family: 'Baloo 2', cursive, sans-serif;
  --ui-rotate: 0deg;
}

/* ── Scoreboard ─────────────────────────────────────────
 * Sits at the top-center of the screen. In portrait mode
 * the camera is rotated 90° so we counter-rotate the
 * scoreboard and reposition it to the visual "top" (which
 * is physically the right edge of the screen).
 */
.scoreboard {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 14px;
  padding: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

/* ── Landscape: centered at top ───────────────── */
#ui.landscape .scoreboard {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
}

/* ── Portrait: camera is rotated 90° CW visually,
 *    so "top of court" maps to the right edge of
 *    the physical screen. We rotate the scoreboard
 *    to match and anchor it to the right-center.
 */
#ui.portrait .scoreboard {
  top: 50%;
  right: 12px;
  left: auto;
  transform: translateY(-50%) rotate(90deg);
  flex-direction: row;
}

/* ── Individual score badge ─────────────────────── */
.score-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
  line-height: 1;
}

.score-badge.p1 {
  background: #3399ff;
}
.score-badge.p2 {
  background: #ff7f7f;
}

/* ── Separator dash ─────────────────────────────── */
.score-sep {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
  font-weight: 400;
  padding: 0 4px;
  line-height: 1;
}

/* ── Score pop animation ─────────────────────────── */
@keyframes scorePop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.score-badge.score-pop {
  animation: scorePop 0.3s ease-out;
}

/* ── Mute / Unmute Button ───────────────────────────── */
.mute-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mute-btn:hover {
  background: rgba(60, 60, 80, 0.85);
  transform: scale(1.08);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}

.mute-btn:active {
  transform: scale(0.94);
}

/* Unmuted state – subtle blue glow */
.mute-btn.unmuted {
  background: rgba(30, 70, 140, 0.65);
  border-color: rgba(100, 160, 255, 0.3);
  box-shadow: 0 2px 12px rgba(80, 140, 255, 0.25);
}

/* Muted state – reddish tint */
.mute-btn.muted {
  background: rgba(130, 40, 40, 0.65);
  border-color: rgba(255, 100, 100, 0.3);
  box-shadow: 0 2px 12px rgba(255, 80, 80, 0.2);
}

/* ── Portrait mode: reposition mute button ─────────── */
#ui.portrait .mute-btn {
  top: 12px;
  right: 12px;
}

/* ══════════════════════════════════════════════════════
   START SCREEN
   ══════════════════════════════════════════════════════ */

#start-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Sky-blue → tennis-green gradient */
  background: linear-gradient(165deg, #87CEEB 0%, #7EC8E3 25%, #5DBB63 60%, #4CA64C 100%);
  transition: opacity 0.5s ease;
}

#start-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ── Scattered Emoji Background ─────────────────── */
.scattered-emojis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.scatter-emoji {
  position: absolute;
  font-size: var(--size, 1.5rem);
  transform: rotate(var(--rot, 0deg));
  opacity: 0.25;
  animation: emojiBob 3.5s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes emojiBob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}

/* ── Main Content ────────────────────────────────── */
.start-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  position: relative;
  z-index: 2;
}

/* ── Beans Overlay ───────────────────────────────── */
.beans-overlay {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.18));
  animation: beansFloat 3s ease-in-out infinite;
}

@keyframes beansFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

/* ── Title ───────────────────────────────────────── */
.start-title {
  text-align: center;
}

.start-title h1 {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.1;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.12),
    0 2px 12px rgba(0, 0, 0, 0.18),
    0 0 40px rgba(255, 255, 255, 0.12);
  letter-spacing: 0.02em;
}

.start-subtitle {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  margin: 6px 0 0;
  letter-spacing: 0.06em;
}

/* ── Mode Buttons Container ──────────────────────── */
.mode-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 300px;
}

/* ── OR Divider ──────────────────────────────────── */
.mode-or {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 80%;
  margin: 10px 0;
}

.mode-or-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
}

.mode-or-text {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Mode Button (shared) ────────────────────────── */
.mode-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 13px 24px;
  border: none;
  border-radius: 60px;
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mode-btn:hover {
  transform: scale(1.05);
}

.mode-btn:active {
  transform: scale(0.96);
}

/* ── Play vs AI – vibrant primary button ─────────── */
#btn-vs-ai {
  background: linear-gradient(135deg, #fff 0%, #fffde8 50%, #f0f7e0 100%);
  color: #2d6a2e;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.16),
    0 0 0 3px rgba(255, 255, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#btn-vs-ai:hover {
  box-shadow:
    0 6px 28px rgba(0, 0, 0, 0.22),
    0 0 0 3px rgba(255, 255, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* ── Play with Friend – secondary / outlined style ── */
#btn-vs-friend {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#btn-vs-friend:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Animated shine sweep across button */
.btn-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.5) 45%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0.5) 55%,
    transparent 70%
  );
  animation: shineSweep 3s ease-in-out infinite;
}

/* Subtler shine for the outlined friend button */
#btn-vs-friend .btn-shine {
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 45%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.15) 55%,
    transparent 70%
  );
}

@keyframes shineSweep {
  0%   { transform: translateX(-150%); }
  40%  { transform: translateX(150%); }
  100% { transform: translateX(150%); }
}

.btn-text {
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════════════════════
   LOADING SCREEN
   ══════════════════════════════════════════════════════ */

#loading-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #87CEEB 0%, #7EC8E3 25%, #5DBB63 60%, #4CA64C 100%);
  transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 70%;
  max-width: 320px;
}

.loading-label {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.loading-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.1);
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #fff 0%, #ffe066 50%, #ffb347 100%);
  box-shadow: 0 0 14px rgba(255, 224, 102, 0.5);
  transition: width 0.25s ease;
}

.loading-percent {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  letter-spacing: 0.06em;
}

/* ══════════════════════════════════════════════════════
   TAP HINT OVERLAY
   ══════════════════════════════════════════════════════ */

/* ── Full-screen overlay (transparent, above game, below score) */
.tap-hint-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.tap-hint-overlay.tap-hint-visible {
  opacity: 1;
}

.tap-hint-overlay.tap-hint-hidden {
  opacity: 0;
}

/* ── Reusable Hint Bubble ────────────────────────── */
.tap-hint-bubble {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  font-family: 'Baloo 2', cursive, sans-serif;
  font-weight: 600;
  border-radius: 20px;
  padding: 10px 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  animation: hintFloat 2.5s ease-in-out infinite;
}

.tap-hint-bubble.tap-hint-normal {
  font-size: 0.95rem;
  padding: 10px 20px;
}

.tap-hint-bubble.tap-hint-small {
  font-size: 0.78rem;
  padding: 8px 14px;
  border-radius: 16px;
  gap: 5px;
}

/* ── Emoji icon inside bubble ────────────────────── */
.tap-hint-emoji {
  font-size: 1.1em;
  line-height: 1;
  flex-shrink: 0;
}

.tap-hint-small .tap-hint-emoji {
  font-size: 1em;
}

/* ── Text inside bubble ──────────────────────────── */
.tap-hint-text {
  line-height: 1.2;
  letter-spacing: 0.02em;
}

/* ── Split layout for friend mode ────────────────── */
.tap-hint-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 16px;
  gap: 12px;
}

.tap-hint-split .tap-hint-bubble.tap-hint-left {
  animation-delay: 0s;
}

.tap-hint-split .tap-hint-bubble.tap-hint-right {
  animation-delay: 0.3s;
}

/* ── Subtle float animation ──────────────────────── */
@keyframes hintFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* ══════════════════════════════════════════════════════
   WIN BANNER
   ══════════════════════════════════════════════════════ */

/* ── Dark overlay backdrop ─────────────────────── */
.win-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 0, 0, 0);
  transition: background 0.6s ease;
  pointer-events: auto;
}

.win-overlay.win-visible {
  background: rgba(0, 0, 0, 0.55);
}

.win-overlay.win-dismissing {
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
}

/* ── Confetti layer ────────────────────────────── */
.win-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.win-confetti-piece {
  position: absolute;
  top: -10%;
  opacity: 0;
  animation: confettiFall 3.5s ease-in-out infinite;
}

.win-visible .win-confetti-piece {
  opacity: 1;
}

.win-dismissing .win-confetti-piece {
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 40px)) rotate(720deg) scale(1);
    opacity: 0;
  }
}

/* ── Main ribbon banner ────────────────────────── */
.win-ribbon {
  position: relative;
  width: 110%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px 22px;
  /* Same sky-blue → tennis-green gradient as start screen */
  background: linear-gradient(135deg, #87CEEB 0%, #7EC8E3 25%, #5DBB63 60%, #4CA64C 100%);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(93, 187, 99, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  z-index: 2;
}

.win-visible .win-ribbon {
  transform: scaleY(1);
  opacity: 1;
}

.win-dismissing .win-ribbon {
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.4s ease-in, opacity 0.3s ease;
}

/* ── Finish-line checkered borders ─────────────── */
.win-finish-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    #fff 0px,
    #fff 8px,
    #1a1a2e 8px,
    #1a1a2e 16px
  );
  opacity: 0.6;
}

.win-finish-top {
  top: 0;
}

.win-finish-bottom {
  bottom: 0;
}

/* ── Trophy ────────────────────────────────────── */
.win-trophy {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.25));
  animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.08); }
}

/* ── Winner title ──────────────────────────────── */
.win-title {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.1;
  text-align: center;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.15),
    0 2px 16px rgba(0, 0, 0, 0.25),
    0 0 40px rgba(255, 255, 255, 0.15);
  letter-spacing: 0.02em;
}

/* ── Score row ─────────────────────────────────── */
.win-score-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
}

.win-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.win-score-sep {
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 0 2px;
}

/* ── Play Again button ─────────────────────────── */
.win-play-again {
  position: relative;
  overflow: hidden;
  margin-top: 4px;
  padding: 10px 28px;
  border: none;
  border-radius: 60px;
  background: linear-gradient(135deg, #fff 0%, #fffde8 50%, #f0f7e0 100%);
  color: #2d6a2e;
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.2),
    0 0 0 3px rgba(255, 255, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  pointer-events: auto;
}

.win-play-again:hover {
  transform: scale(1.06);
  box-shadow:
    0 6px 28px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(255, 255, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.win-play-again:active {
  transform: scale(0.96);
}

.win-btn-text {
  position: relative;
  z-index: 1;
}

/* Reuse the shine sweep from start screen */
.win-play-again .btn-shine {
  animation: shineSweep 3s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════
   PRE-MATCH COUNTDOWN
   ══════════════════════════════════════════════════════ */

/* ── Full-screen overlay ──────────────────────── */
.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, background 0.4s ease;
}

.countdown-overlay.countdown-visible {
  opacity: 1;
  background: rgba(0, 0, 0, 0.45);
}

.countdown-overlay.countdown-fade-out {
  opacity: 0;
  background: rgba(0, 0, 0, 0);
  transition: opacity 0.45s ease, background 0.45s ease;
}

/* ── Center content ───────────────────────────── */
.countdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ── "First to N wins!" pill ──────────────────── */
.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 40px;
  padding: 10px 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: countdownPillIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.countdown-pill.countdown-pill-hide {
  opacity: 0;
  transform: scale(0.8) translateY(-10px);
}

.countdown-pill-emoji {
  font-size: 1.2rem;
  line-height: 1;
  animation: countdownTrophySpin 2s ease-in-out infinite;
}

.countdown-pill-text {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

@keyframes countdownPillIn {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes countdownTrophySpin {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  25%      { transform: rotate(8deg) scale(1.1); }
  50%      { transform: rotate(-4deg) scale(1.05); }
  75%      { transform: rotate(6deg) scale(1.08); }
}

/* ── Big countdown number / GO! ───────────────── */
.countdown-big {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.02em;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-big.countdown-num {
  font-size: 4.5rem;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.15),
    0 0 40px rgba(255, 255, 255, 0.3),
    0 0 80px rgba(93, 187, 99, 0.25);
}

.countdown-big.countdown-go {
  font-size: 3.2rem;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.15),
    0 0 50px rgba(255, 224, 100, 0.5),
    0 0 100px rgba(255, 180, 60, 0.3);
  color: #ffe866;
}

/* ── Pop-in keyframe for each number ──────────── */
@keyframes countdownPop {
  0% {
    opacity: 0;
    transform: scale(2.2) translateY(5px);
  }
  40% {
    opacity: 1;
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.08);
  }
  80% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}

.countdown-big.countdown-pop {
  animation: countdownPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ══════════════════════════════════════════════════════
   DESKTOP FULL-SCREEN ENHANCEMENTS
   ══════════════════════════════════════════════════════ */

/* On large desktop screens, scale up UI elements slightly */
@media (min-width: 1025px) and (min-height: 641px) {
  .start-title h1 {
    font-size: 3.2rem;
  }

  .start-subtitle {
    font-size: 1rem;
  }

  .beans-overlay {
    width: 220px;
  }

  .mode-btn {
    padding: 16px 28px;
    font-size: 1.2rem;
  }

  .countdown-big.countdown-num {
    font-size: 5.5rem;
  }

  .countdown-big.countdown-go {
    font-size: 4rem;
  }

  .countdown-pill-text {
    font-size: 1.15rem;
  }

  .score-badge {
    min-width: 48px;
    height: 38px;
    font-size: 1.15rem;
    padding: 0 14px;
  }

  .scoreboard {
    padding: 5px;
    border-radius: 16px;
  }

  .win-title {
    font-size: 2rem;
  }

  .win-trophy {
    font-size: 3rem;
  }

  .win-play-again {
    padding: 12px 36px;
    font-size: 1.05rem;
  }
}

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