body {
  background: black;
  overflow: hidden;
}

/* Apply both animations to the logo */
#faFa178Image {
  animation: floatLogo 3s ease-in-out infinite, glowLogo 2.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

/* ✨ Floating + glow animation for FAFA178 logo */
@keyframes floatLogo {

  0%,
  100% {
    transform: translate(-50%, 0);
  }

  50% {
    transform: translate(-50%, -10px);
  }
}

@keyframes glowLogo {

  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
  }

  50% {
    filter: drop-shadow(0 0 25px rgba(255, 255, 100, 0.9));
  }
}


/* Overlay image in the center reel */
.center-overlay-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#reelsContainer{
    top: 45%;
}
.hidden {
  display: none;
}

/* Slot Machine Grid - 3 column reels */
.slot-machine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  padding: 0 10px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 73%;
}

/* Individual reel column */
.reel-column {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Viewport that shows 3 visible symbols */
.reel-viewport {
  height: 200px;
  overflow: hidden;
  position: relative;
  border-radius: 8px;
  width: 100%;
}

/* Reel container that scrolls */
.reel {
  position: relative;
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translateY(0);
}

/* Individual reel item */
.reel-item {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.reel-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
  transition: filter 0.2s ease;
}

/* ==================== SPINNING ANIMATION ==================== */
/* Smooth reel spinning effect during animation */
.reel {
  transition: transform 3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Blur effect during fast spinning */
.reel-item img {
  transition: filter 0.3s ease;
}

.reel.spinning .reel-item img {
  filter: blur(2px) brightness(0.9);
}
.textbottom{
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.textbottom img{
    width: 70%;
    height: auto;
}

.alert img,
  .alert_winner img {
    width: 100%;
    max-width: 320px;
  }

  /* 🏆 Winner popup – stacked like design */
  .alert_winner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    border-radius: 16px;
    padding: 10px 0;
    text-align: center;
    z-index: 99998;
    opacity: 0;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.6s ease;
    animation: winnerFloatUpDown 0s ease-in-out infinite, winnerglowPulse 2.5s ease-in-out infinite;
  }

  .alert_winner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  #winnerTop {
    margin-bottom: 4px;
  }

/* Frame entrance animation */
@keyframes frame-entrance {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.03);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Golden border pulsing animation */
@keyframes golden-border-pulse {

  0%,
  100% {
    border-width: 3px;
    box-shadow:
      0 0 15px rgba(255, 215, 0, 1),
      0 0 30px rgba(255, 215, 0, 0.9),
      0 0 50px rgba(255, 180, 0, 0.7),
      0 0 70px rgba(255, 150, 0, 0.5),
      0 0 100px rgba(255, 100, 0, 0.3),
      inset 0 0 20px rgba(255, 215, 0, 0.6),
      inset 0 0 40px rgba(255, 180, 0, 0.3);
  }

  50% {
    border-width: 4px;
    box-shadow:
      0 0 25px rgba(255, 215, 0, 1),
      0 0 50px rgba(255, 215, 0, 1),
      0 0 75px rgba(255, 180, 0, 0.9),
      0 0 100px rgba(255, 150, 0, 0.7),
      0 0 130px rgba(255, 100, 0, 0.5),
      inset 0 0 30px rgba(255, 215, 0, 0.8),
      inset 0 0 50px rgba(255, 180, 0, 0.5);
  }
}

/* Corner shine animation */
@keyframes corner-shine {

  0%,
  100% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }
}

/* Winning slot highlight effect */
.slot-item.winner-slot {
  position: relative;
  z-index: 10;
  animation: winner-glow 1.5s ease-in-out infinite;
}

.slot-item.winner-slot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;

  animation: winner-border-pulse 1s ease-in-out infinite;
  pointer-events: none;
}

.slot-item.winner-pulse {
  animation: winner-scale-pulse 0.8s ease-in-out;
}

/* Winner glow animation */
@keyframes winner-glow {

  0%,
  100% {
    filter: brightness(1) drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
  }

  50% {
    filter: brightness(1.3) drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
  }
}

/* Winner border pulse */
@keyframes winner-border-pulse {

  0%,
  100% {
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow:
      0 0 20px rgba(255, 215, 0, 0.6),
      0 0 40px rgba(255, 100, 0, 0.4),
      inset 0 0 20px rgba(255, 215, 0, 0.3);
  }

  50% {
    border-color: rgba(255, 100, 0, 1);
    box-shadow:
      0 0 30px rgba(255, 215, 0, 0.9),
      0 0 60px rgba(255, 100, 0, 0.7),
      inset 0 0 30px rgba(255, 215, 0, 0.5);
  }
}

/* Winner scale pulse (initial pop) */
@keyframes winner-scale-pulse {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.15);
  }

  50% {
    transform: scale(0.95);
  }

  70% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.center-overlay-image {
  position: absolute;
  top: 140px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 850px;
  height: auto;
  border-radius: 6px;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8));
}

.center-overlay-image.show {
  opacity: 1;
}

.center-overlay-image {
  position: absolute;
  top: 140px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
  opacity: 0;
}

.center-overlay-image.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.alert {
  position: fixed;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  z-index: 9999;
  opacity: 0;
  transition: all 0.6s ease;
}

.alert.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.alert img {
  width: 250px;
  border-radius: 10px;
}

/* 💰 Coin Rain Effect */
.coin-rain-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100000;
  overflow: hidden;
}

.falling-coin {
  position: absolute;
  top: -100px;
  left: 50%;
  width: 50px;
  height: 50px;
  object-fit: contain;
  animation: coin-dropdown 2.5s cubic-bezier(0.33, 0.0, 0.2, 1) forwards;
  opacity: 0;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 25px rgba(255, 180, 0, 0.6));
  transform-origin: center center;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Smooth dropdown burst effect - coins explode from center then fall naturally */
@keyframes coin-dropdown {
  0% {
    transform: translate(-50%, -80px) scale(0.5) rotate(0deg);
    opacity: 0;
  }

  8% {
    transform: translate(-50%, 0px) scale(1) rotate(90deg);
    opacity: 1;
  }

  100% {
    transform: translate(calc(-50% + var(--drift, 0) * 200px),
        110vh) scale(0.8) rotate(var(--rotation, 1080deg));
    opacity: 0;
  }
}

/* 🎉 Win Alert - Appears 1 second after spin stops */
.win-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 100000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: none;
}

.win-alert.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: win-bounce 0.6s ease-out;
}

.win-text {
  font-size: 80px;
  font-weight: 900;
  color: #FFD700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 1),
    0 0 40px rgba(255, 215, 0, 0.8),
    0 0 60px rgba(255, 180, 0, 0.6),
    0 0 80px rgba(255, 150, 0, 0.4),
    3px 3px 0 rgba(255, 100, 0, 0.8),
    6px 6px 0 rgba(200, 50, 0, 0.6);
  letter-spacing: 8px;
  display: block;
  animation: text-glow-pulse 0.3s ease-in-out infinite alternate;
}

@keyframes win-bounce {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-180deg);
  }

  50% {
    transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
  }

  70% {
    transform: translate(-50%, -50%) scale(0.9) rotate(-5deg);
  }

  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes text-glow-pulse {
  0% {
    text-shadow:
      0 0 20px rgba(255, 215, 0, 1),
      0 0 40px rgba(255, 215, 0, 0.8),
      0 0 60px rgba(255, 180, 0, 0.6),
      0 0 80px rgba(255, 150, 0, 0.4),
      3px 3px 0 rgba(255, 100, 0, 0.8),
      6px 6px 0 rgba(200, 50, 0, 0.6);
  }

  100% {
    text-shadow:
      0 0 30px rgba(255, 255, 255, 1),
      0 0 50px rgba(255, 215, 0, 1),
      0 0 70px rgba(255, 180, 0, 0.8),
      0 0 100px rgba(255, 150, 0, 0.6),
      3px 3px 0 rgba(255, 100, 0, 1),
      6px 6px 0 rgba(200, 50, 0, 0.8);
  }
}

/* 🏆 Winner popup */
.alert_winner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  border-radius: 16px;
  padding: 15px;
  text-align: center;
  z-index: 99998;
  opacity: 0;
  transition: all 0.6s ease;
  transition: transform 0.3s ease;
  animation: text-glow-pulse 0.3s ease-in-out infinite alternate;
}

.alert_winner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.alert_winner #winner1 {
  width: 450px;
  display: block;
  margin: auto;
  margin-bottom: 30px;
}

.alert_winner #winner2 {
  width: 600px;
  display: block;
  margin: auto;
}

/* ✨ Floating animation for both characters */
@keyframes winnerFloatUpDown {

  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }

  50% {
    transform: translate(-50%, -50%) translateY(-15px);
  }
}

/* 🌟 Glow effect for extra life */
@keyframes winnerglowPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 6px rgba(148, 202, 253, 0.459));
  }

  50% {
    filter: drop-shadow(0 0 20px rgba(252, 146, 208, 0.9));
  }
}

#playButton {
  top: 90%;
  left: 50%;
  transform: translate(-50%, -50%);
  position: absolute;
  width: 110px;
  height: 100px;
}

#spinNowButton {
  cursor: pointer;
}

#spinButtonWrapper {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#chara {
  z-index: 9999;
  top: 75%;
  left: 21%;
  transform: translate(-50%, -50%);
  position: absolute;
  width: 100px;
  height: 100px;
  animation: floatUpDown 3s ease-in-out infinite, glowPulse 2.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

#chara_right {
  z-index: 9999;
  top: 75%;
  left: 82%;
  transform: translate(-50%, -50%);
  position: absolute;
  width: 100px;
  height: 100px;
  animation: floatUpDown 3s ease-in-out infinite, glowPulse 2.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

/* ✨ Floating animation for both characters */
@keyframes floatUpDown {

  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }

  50% {
    transform: translate(-50%, -50%) translateY(-15px);
  }
}

/* 🌟 Glow effect for extra life */
@keyframes glowPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
  }

  50% {
    filter: drop-shadow(0 0 20px rgba(255, 255, 100, 0.9));
  }
}

/* ✨ Sweet pulse animation for popup */
@keyframes sweetPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    filter: drop-shadow(0 0 40px rgba(255, 215, 0, 1));
  }
}

/* ✨ Sparkle effect */
.sparkle {
  position: fixed;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #fff 0%, #ffd700 50%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  animation: sparkleFade 1s ease-out forwards;
  animation-delay: var(--delay, 0s);
  box-shadow: 
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 20px rgba(255, 215, 0, 0.6),
    0 0 30px rgba(255, 215, 0, 0.4);
}

@keyframes sparkleFade {
  0% {
    opacity: 1;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.5) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg);
  }
}

