/**
 * Victory Animations System
 * Celebratory animations when a player wins
 */

/* ============================================
   VICTORY ANIMATIONS
   ============================================ */

.victory-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.victory-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, transparent 70%);
  animation: victory-pulse 2s ease-in-out;
  opacity: 0;
}

@keyframes victory-pulse {
  0%, 100% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Trophy Animation */
.victory-trophy {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 150px;
  animation: trophy-appear 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 0 30px gold);
}

@keyframes trophy-appear {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.3) rotate(10deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Confetti Animation */
.victory-confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--confetti-color, gold);
  animation: confetti-fall var(--fall-duration, 3s) linear forwards;
  will-change: transform, opacity;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(
      var(--drift-x, 0),
      100vh,
      0
    ) rotate(var(--rotation, 720deg));
    opacity: 0;
  }
}

/* Victory Banner */
.victory-banner {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -200%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px 60px;
  border-radius: 20px;
  font-size: 48px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: banner-drop 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;
  will-change: transform;
}

@keyframes banner-drop {
  0% {
    transform: translate(-50%, -200%);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.victory-banner-text {
  display: block;
  font-size: 32px;
  margin-top: 10px;
  color: rgba(255,255,255,0.9);
}

/* Fireworks */
.victory-firework {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  animation: firework-explode 1s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes firework-explode {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(
      var(--explode-x, 0),
      var(--explode-y, 0),
      0
    ) scale(0);
    opacity: 0;
  }
}

/* Spotlight Effect */
.victory-spotlight {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: spotlight-sweep 3s ease-in-out infinite;
  will-change: transform;
}

@keyframes spotlight-sweep {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.8;
  }
}

/* Star Burst */
.victory-star {
  position: absolute;
  width: 20px;
  height: 20px;
  background: gold;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  animation: star-burst 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: transform, opacity;
}

@keyframes star-burst {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) 
               translate(var(--burst-x, 0), var(--burst-y, 0))
               scale(1) 
               rotate(var(--rotation, 720deg));
    opacity: 0;
  }
}

/* Crown Animation for Winner */
.winner-crown {
  display: inline-block;
  animation: crown-bounce 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  filter: drop-shadow(0 0 10px gold);
}

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

/* Glitter Trail */
.victory-glitter {
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: glitter-twinkle 0.5s ease-in-out infinite;
  will-change: opacity, transform;
}

@keyframes glitter-twinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Podium Animation */
.victory-podium {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  animation: podium-rise 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes podium-rise {
  0% {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.podium-place {
  background: linear-gradient(135deg, var(--place-color-1) 0%, var(--place-color-2) 100%);
  border-radius: 10px 10px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.3);
  position: relative;
}

.podium-place-1 {
  height: 200px;
  --place-color-1: #ffd700;
  --place-color-2: #ffa500;
  animation-delay: 0s;
}

.podium-place-2 {
  height: 150px;
  --place-color-1: #c0c0c0;
  --place-color-2: #a8a8a8;
  animation-delay: 0.2s;
}

.podium-place-3 {
  height: 100px;
  --place-color-1: #cd7f32;
  --place-color-2: #b87333;
  animation-delay: 0.4s;
}

.podium-player {
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  margin-top: 10px;
}

.podium-score {
  font-size: 18px;
  color: rgba(255,255,255,0.9);
  margin-top: 5px;
}

/* Ribbon Animation */
.victory-ribbon {
  position: absolute;
  width: 100%;
  height: 150px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,215,0,0.5) 25%,
    rgba(255,215,0,0.8) 50%,
    rgba(255,215,0,0.5) 75%,
    transparent 100%
  );
  top: 50%;
  transform: translateY(-50%) scaleX(0);
  animation: ribbon-expand 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s forwards;
}

@keyframes ribbon-expand {
  0% {
    transform: translateY(-50%) scaleX(0);
    opacity: 0;
  }
  100% {
    transform: translateY(-50%) scaleX(1);
    opacity: 1;
  }
}

/* Golden Particles */
.victory-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, gold 0%, transparent 70%);
  border-radius: 50%;
  animation: particle-float 3s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes particle-float {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(
      var(--float-x, 0),
      var(--float-y, -200px),
      0
    ) scale(0);
    opacity: 0;
  }
}

/* Text Shimmer Effect */
.victory-text-shimmer {
  background: linear-gradient(
    90deg,
    gold 0%,
    white 50%,
    gold 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shimmer 2s linear infinite;
}

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

/* Combo Display for Victory */
.victory-combo {
  position: absolute;
  top: 30%;
  right: 10%;
  background: rgba(0,0,0,0.8);
  padding: 20px 30px;
  border-radius: 15px;
  border: 3px solid gold;
  animation: combo-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.victory-combo-text {
  font-size: 36px;
  font-weight: bold;
  color: gold;
  text-shadow: 0 0 20px rgba(255,215,0,0.8);
}

.victory-combo-detail {
  font-size: 18px;
  color: white;
  margin-top: 10px;
}
