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

:root {
  --primary-yellow: #ffd600;
  --primary-yellow-dark: #cc9900;
  --seeker-orange: #ff5500;
  --seeker-orange-dark: #cc3700;
  --accent-green: #3ad368;
  --accent-green-dark: #209944;
  --text-stroke: #161616;
  --bg-sky: #cce4f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #ffa726;
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#game-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #ffe082 0%, #ffb74d 28%, #f57c00 62%, #d84315 100%);
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* UI Layer */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.interactive {
  pointer-events: auto;
}

/* Top HUD */
#hud-top {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 14px) 16px 8px 16px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  z-index: 20;
}

/* Keys Pill (Top Center in Lobby, Top Left in Game) */
.keys-pill {
  background: rgba(255, 255, 255, 0.96);
  border: 3.5px solid #202020;
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
}

.key-slot {
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M12.65 10C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.key-slot.collected {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FFD700'%3E%3Cpath stroke='%23B28900' stroke-width='1' d='M12.65 10C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z'/%3E%3C/svg%3E");
  filter: drop-shadow(0 2px 5px rgba(255, 215, 0, 0.8));
  animation: keyPop 0.4s ease-out;
}

@keyframes keyPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Center HUD Title / Timer */
#hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.arena-title {
  font-size: 34px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow: 
    -3px -3px 0 #1b1b1b,  
     3px -3px 0 #1b1b1b,
    -3px  3px 0 #1b1b1b,
     3px  3px 0 #1b1b1b,
     0px  5px 0 #1b1b1b,
     0 8px 12px rgba(0, 0, 0, 0.25);
}

/* Timer Display */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stopwatch-icon {
  width: 38px;
  height: 38px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='23' r='14' fill='%23191C22' stroke='%230D0F12' stroke-width='2'/%3E%3Ccircle cx='20' cy='23' r='11' fill='%23FF8A00'/%3E%3Ccircle cx='20' cy='23' r='9.5' fill='%23FFA726'/%3E%3Cpath d='M20 23 L20 16' stroke='%23191C22' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M20 23 L24 23' stroke='%23191C22' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='20' cy='23' r='2' fill='%23191C22'/%3E%3Crect x='17' y='3' width='6' height='4' rx='2' fill='%23191C22'/%3E%3Cpath d='M29 11 L33 7' stroke='%23191C22' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.timer-text {
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 
    -3px -3px 0 #1b1b1b,  
     3px -3px 0 #1b1b1b,
    -3px  3px 0 #1b1b1b,
     3px  3px 0 #1b1b1b,
     0px  4px 0 #1b1b1b;
}

.timer-text.urgent {
  color: #55e03a;
}

/* Status Dots */
.status-dots {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 1px;
}

.hider-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #14181d;
  border: 2px solid #333a44;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hider-dot.caught {
  background: #4ade26;
  border: 2.2px solid #ffffff;
  box-shadow: 0 0 12px #a6ff00, 0 0 5px #4ade26, 0 2px 4px rgba(0, 0, 0, 0.4);
  transform: scale(1.20);
}

.hider-dot.dead {
  background: #ff3b30;
  border-color: #ffffff;
}

.hider-dot.bonus-slot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #14181d;
  border: 1.5px solid #333a44;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b8898;
  font-size: 11px;
  font-weight: 900;
}

/* Coins Display */
.coins-display {
  display: flex;
  align-items: center;
  gap: 5px;
}

.coins-val {
  font-size: 36px;
  font-weight: 900;
  color: #ffea00;
  text-shadow: 
    -3px -3px 0 #1b1b1b,  
     3px -3px 0 #1b1b1b,
    -3px  3px 0 #1b1b1b,
     3px  3px 0 #1b1b1b,
     0px  4px 0 #1b1b1b;
}

.coin-icon {
  width: 36px;
  height: 36px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='16' fill='%23FFC107' stroke='%231B1B1B' stroke-width='2.5'/%3E%3Ccircle cx='18' cy='18' r='12' fill='%23FFD54F' stroke='%23FFA000' stroke-width='2'/%3E%3Cpath d='M14 12 L22 12 A4 4 0 0 1 22 20 L14 20 Z' fill='none' stroke='%23FFA000' stroke-width='2'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
}

/* Bottom Lobby Controls */
#lobby-controls {
  width: 100%;
  padding-bottom: calc(env(safe-area-inset-bottom, 24px) + 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 20;
}

.mode-selector {
  display: flex;
  gap: 16px;
}

.mode-btn {
  width: 120px;
  height: 52px;
  background: var(--primary-yellow);
  border: 3px solid #1b1b1b;
  border-radius: 26px;
  font-size: 24px;
  font-weight: 900;
  color: #1b1b1b;
  cursor: pointer;
  box-shadow: 0 4px 0 #1b1b1b, 0 6px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  animation: playPulse 2s infinite ease-in-out;
}

.mode-btn-seek {
  background: var(--seeker-orange);
  color: #ffffff;
}

.mode-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1b1b1b;
  animation: none;
}

.seekers-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seekers-label {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 
    -2px -2px 0 #1b1b1b,  
     2px -2px 0 #1b1b1b,
    -2px  2px 0 #1b1b1b,
     2px  2px 0 #1b1b1b,
     0px  3px 0 #1b1b1b;
}

.seeker-counts {
  display: flex;
  gap: 10px;
}

.seeker-count-btn {
  min-width: 64px;
  height: 42px;
  padding: 0 14px;
  border-radius: 21px;
  border: 3px solid #1b1b1b;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #3a3a3a;
  color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 3px 0 #1b1b1b;
  transform: scale(0.92);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seeker-count-btn .check-icon {
  display: none;
  font-size: 16px;
  line-height: 1;
}

.seeker-count-btn.active {
  background: #ffe600;
  color: #1b1b1b;
  transform: scale(1.08);
  box-shadow: 0 4px 0 #1b1b1b, 0 0 16px rgba(255, 230, 0, 0.55);
}

.seeker-count-btn.active .check-icon {
  display: inline;
}

.seeker-count-btn:active {
  transform: translateY(2px) scale(1);
  box-shadow: 0 1px 0 #1b1b1b;
}

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

/* In-Game Countdown Banner */
#countdown-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 25;
  pointer-events: none;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-title {
  font-size: 34px;
  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 
    -3px -3px 0 #1b1b1b,  
     3px -3px 0 #1b1b1b,
    -3px  3px 0 #1b1b1b,
     3px  3px 0 #1b1b1b,
     0px  5px 0 #1b1b1b;
}

.countdown-num {
  font-size: 48px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 
    -3px -3px 0 #1b1b1b,  
     3px -3px 0 #1b1b1b,
    -3px  3px 0 #1b1b1b,
     3px  3px 0 #1b1b1b,
     0px  5px 0 #1b1b1b;
}

@keyframes popIn {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Drag to Move Hint */
#drag-hint {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 24px) + 30px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.infinity-track {
  width: 130px;
  height: 52px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 52'%3E%3Cpath d='M36 10 C18 10 10 26 26 36 C42 46 54 26 65 26 C76 26 88 6 104 16 C120 26 112 42 94 42 C76 42 65 26 65 26 C65 26 54 10 36 10 Z' fill='none' stroke='rgba(30,30,30,0.55)' stroke-width='9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  position: relative;
}

.hand-cursor {
  position: absolute;
  width: 38px;
  height: 38px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff' stroke='%231b1b1b' stroke-width='1.5'%3E%3Cpath d='M9 11.24V7.5a2.5 2.5 0 0 1 5 0v3.74c1.21-.81 2-2.18 2-3.74a4.5 4.5 0 0 0-9 0c0 1.56.79 2.93 2 3.74zm9.84 4.63l-4.54-2.26a1.5 1.5 0 0 0-.67-.16h-.63v-5.95a1.5 1.5 0 0 0-3 0v8.66l-2.61-1.31a1.5 1.5 0 0 0-2.07.67l-.46.92a1.5 1.5 0 0 0 .39 1.84l5.3 4.53c.6.51 1.36.79 2.15.79h5.1c1.54 0 2.83-1.16 2.98-2.69l.48-4.78a2 2 0 0 0-1.42-2.06z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  top: 10px;
  left: 10px;
  animation: traceInfinity 2.4s ease-in-out infinite;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
}

@keyframes traceInfinity {
  0% { transform: translate(10px, 12px); }
  25% { transform: translate(48px, 2px); }
  50% { transform: translate(84px, 14px); }
  75% { transform: translate(48px, 20px); }
  100% { transform: translate(10px, 12px); }
}

.drag-label {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 
    -2px -2px 0 #1b1b1b,  
     2px -2px 0 #1b1b1b,
    -2px  2px 0 #1b1b1b,
     2px  2px 0 #1b1b1b,
     0px  3px 0 #1b1b1b;
}

/* Virtual Joystick indicator */
#virtual-joystick {
  position: absolute;
  width: 84px;
  height: 84px;
  margin-left: -42px;
  margin-top: -42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 15;
  display: none;
}

#joystick-thumb {
  position: absolute;
  width: 40px;
  height: 40px;
  left: 19px;
  top: 19px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #a8d5ff 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 3px 6px rgba(0,0,0,0.35);
}

/* Defeat / Found Overlay */
#overlay-found {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 50%, rgba(18, 28, 42, 0.68) 0%, rgba(8, 14, 24, 0.90) 100%);
  z-index: 50;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.defeat-content-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin: 0 auto;
}

.found-banner {
  margin: 0;
  font-size: clamp(38px, 11vw, 64px);
  font-weight: 900;
  color: #ff5252;
  letter-spacing: 2px;
  white-space: nowrap;
  text-align: center;
  text-shadow: 
    -4px -4px 0 #1b1b1b,  
     4px -4px 0 #1b1b1b,
    -4px  4px 0 #1b1b1b,
     4px  4px 0 #1b1b1b,
     0px  8px 0 #7b0000,
     0 12px 24px rgba(0, 0, 0, 0.6);
  animation: foundPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes foundPop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.defeat-stars-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: -6px 0 4px 0;
}

.defeat-star {
  font-size: 42px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.28);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  transform: scale(0.9);
}

.defeat-star.defeat-star-center {
  font-size: 52px;
  margin-top: -6px;
}

.defeat-buttons {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  width: calc(100% - 40px);
  max-width: 380px;
}

.btn-play-again {
  flex: 1;
  height: 48px;
  background: rgba(18, 26, 38, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 24px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 6px 14px rgba(0, 0, 0, 0.25);
  text-shadow: 
    -1.5px -1.5px 0 #1b1b1b,  
     1.5px -1.5px 0 #1b1b1b,
    -1.5px  1.5px 0 #1b1b1b,
     1.5px  1.5px 0 #1b1b1b;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
}

.btn-play-again:active {
  transform: translateY(2px);
  background: rgba(18, 26, 38, 0.9);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.2);
}

.replay-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  filter: drop-shadow(0 1.5px 0 #1b1b1b);
}

.btn-leaders {
  flex: 1;
  height: 48px;
  background: linear-gradient(180deg, #3bb3ff 0%, #177de8 100%);
  border: none;
  border-radius: 24px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 #0d5bb0, 0 8px 18px rgba(13, 91, 176, 0.35);
  text-shadow: 
    -1.5px -1.5px 0 #083c77,  
     1.5px -1.5px 0 #083c77,
    -1.5px  1.5px 0 #083c77,
     1.5px  1.5px 0 #083c77,
     0px    2px   0 #083c77;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
}

.btn-leaders:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0d5bb0, 0 3px 8px rgba(13, 91, 176, 0.25);
}

.leaders-icon {
  width: 20px;
  height: 20px;
  fill: #ffd600;
  filter: drop-shadow(0 1.5px 0 #0d5bb0);
  flex-shrink: 0;
}

/* Victory Overlay */
#overlay-victory {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: radial-gradient(circle at 50% 50%, rgba(15, 25, 40, 0.6) 0%, rgba(8, 14, 25, 0.88) 100%);
  z-index: 50;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.victory-content-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  transform: translateY(-25px);
}

/* Ribbon Victory Banner matching original */
.victory-ribbon {
  position: relative;
  background: linear-gradient(180deg, #ffc83b 0%, #f39c12 100%);
  padding: 10px 45px;
  box-shadow: 0 5px 0 #b76b00, 0 8px 16px rgba(0,0,0,0.3);
  clip-path: polygon(0 0, 100% 0, 93% 50%, 100% 100%, 0 100%, 7% 50%);
  animation: bannerBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bannerBounce {
  0% { transform: scale(0.3) rotate(-6deg); }
  60% { transform: scale(1.1) rotate(1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.victory-text {
  font-size: 40px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 
    -2.5px -2.5px 0 #1b1b1b,  
     2.5px -2.5px 0 #1b1b1b,
    -2.5px  2.5px 0 #1b1b1b,
     2.5px  2.5px 0 #1b1b1b,
     0px    3.5px 0 #1b1b1b;
}

/* Victory Stars Container */
.stars-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 2px;
}

.star-badge {
  font-size: 46px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.22);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: color 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.star-badge.star-badge-center {
  font-size: 58px;
  margin-top: -8px;
}

.star-badge.lit {
  color: #ffd700;
  text-shadow: 
    -2px -2px 0 #b38600,
     2px -2px 0 #b38600,
    -2px  2px 0 #b38600,
     2px  2px 0 #b38600,
     0px  4px 0 #7a5800,
     0 0 20px rgba(255, 215, 0, 0.95),
     0 0 40px rgba(255, 180, 0, 0.5);
  animation: starPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.35) forwards;
}

.star-badge.star-badge-center.lit {
  animation: starPopCenter 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.35) forwards;
}

@keyframes starPop {
  0% { transform: scale(0.35) rotate(-24deg); opacity: 0.3; }
  65% { transform: scale(1.32) rotate(8deg); opacity: 1; }
  100% { transform: scale(1.12) rotate(0deg); opacity: 1; }
}

@keyframes starPopCenter {
  0% { transform: scale(0.35) rotate(-24deg); opacity: 0.3; }
  65% { transform: scale(1.42) rotate(8deg); opacity: 1; }
  100% { transform: scale(1.22) rotate(0deg); opacity: 1; }
}

/* Victory Stats Pill */
.victory-stats-pill {
  background: rgba(15, 23, 38, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  margin-top: -6px;
  margin-bottom: 2px;
}

/* 3-Column Player Scoreboard Grid matching original */
.victory-grid {
  width: 100%;
  max-width: 440px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 6px;
  margin: 0 auto;
  box-sizing: border-box;
}

.player-card {
  height: 32px;
  border-radius: 16px;
  padding: 0 3px 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #5dd408 0%, #46bf04 100%);
  border: 1.5px solid #1c6d00;
  box-shadow: 0 3px 0 #1b6300, 0 4px 6px rgba(0, 0, 0, 0.25);
}

.player-card.survived {
  background: linear-gradient(180deg, #5dd408 0%, #46bf04 100%);
  border: 1.5px solid #1c6d00;
  box-shadow: 0 3px 0 #1b6300, 0 4px 6px rgba(0, 0, 0, 0.25);
}

.player-card.caught {
  background: linear-gradient(180deg, #ff4c24 0%, #e93610 100%);
  border: 1.5px solid #7e1903;
  box-shadow: 0 3px 0 #7e1903, 0 4px 6px rgba(0, 0, 0, 0.25);
}

.player-name {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 3px;
  letter-spacing: 0.2px;
  text-shadow: 
    -1.2px -1.2px 0 #1b1b1b,  
     1.2px -1.2px 0 #1b1b1b,
    -1.2px  1.2px 0 #1b1b1b,
     1.2px  1.2px 0 #1b1b1b,
     0px    1.8px 0 #1b1b1b;
}

.player-flag-badge {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Victory CTA Container (Bottom of Screen) */
.victory-buttons {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: calc(100% - 40px);
  max-width: 380px;
  z-index: 10;
}

.victory-buttons-secondary {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-next-level {
  width: 100%;
  height: 52px;
  background: linear-gradient(180deg, #3ae47a 0%, #29cf67 100%);
  border: none;
  border-radius: 26px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #1ca34e, 0 8px 18px rgba(0, 0, 0, 0.25);
  text-shadow: 
    -2px -2px 0 #1b1b1b,  
     2px -2px 0 #1b1b1b,
    -2px  2px 0 #1b1b1b,
     2px  2px 0 #1b1b1b,
     0px  2.5px 0 #1b1b1b;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
}

.btn-next-level:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #1ca34e, 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Confetti Canvas */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* 3D Floating Speech Bubbles ("Help me") */
#speech-bubbles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

.speech-bubble {
  position: absolute;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #222222;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  color: #222222;
  box-shadow: 0 3px 6px rgba(0,0,0,0.25);
  transform: translate(-50%, -100%);
  white-space: nowrap;
  animation: floatBubble 1.2s ease-in-out infinite alternate;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: #222222 transparent;
  display: block;
  width: 0;
}

@keyframes floatBubble {
  0% { transform: translate(-50%, -100%) translateY(0); }
  100% { transform: translate(-50%, -100%) translateY(-4px); }
}

.floating-score-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'Fredoka', -apple-system, sans-serif;
  font-size: 30px;
  font-weight: 900;
  color: #ffea00;
  text-shadow: 
    -2.5px -2.5px 0 #121212,  
     2.5px -2.5px 0 #121212,
    -2.5px  2.5px 0 #121212,
     2.5px  2.5px 0 #121212,
     0px  4px 0 #000000;
  pointer-events: none;
  z-index: 50;
  animation: floatScoreUp 0.85s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes floatScoreUp {
  0% { transform: translate(-50%, -10px) scale(0.5); opacity: 0; }
  25% { transform: translate(-50%, -30px) scale(1.3); opacity: 1; }
  70% { transform: translate(-50%, -56px) scale(1.0); opacity: 0.95; }
  100% { transform: translate(-50%, -80px) scale(0.85); opacity: 0; }
}

.hidden {
  display: none !important;
}
