/* Improved spin animations */
@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes wobble {
  15% {
    transform: translate(-50%, -50%) rotate(-5deg);
  }
  30% {
    transform: translate(-50%, -50%) rotate(3deg);
  }
  45% {
    transform: translate(-50%, -50%) rotate(-3deg);
  }
  60% {
    transform: translate(-50%, -50%) rotate(2deg);
  }
  75% {
    transform: translate(-50%, -50%) rotate(-1deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

.spin-animation {
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spin-text {
  animation: spin 0.7s ease-in-out infinite;
}

.wobble-animation {
  animation: wobble 0.5s ease-in-out;
}

/* Scale animation */
@keyframes scale {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.scale-animation {
  animation: scale 0.5s ease-in-out;
}

/* Fade animation */
@keyframes fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.fade-animation {
  animation: fade 0.3s ease-in-out;
}

/* Overlay styles */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Remove background from child overlays so only parent darkens */
#messageOverlay,
#claimOverlay {
  background: none;
  position: static;
  width: auto;
  height: auto;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transition: none;
  pointer-events: auto;
}

.overlay-content {
  width: 100%;
  max-width: 400px;
  animation: fade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    scale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
  animation: fadeOut 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Button styles */
.spin-button {
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
}

.spin-button:hover {
  transform: scale(1.05);
}

.spin-button:active {
  transform: scale(0.95);
}

.spin-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Spinning state */
.spinning {
  pointer-events: none;
}

/* Progress Wheel Animation */
@keyframes progress-wheel {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(1440deg); /* 4 full spins for progress effect */
  }
}

.progress-wheel-animation {
  animation: progress-wheel 2.7s cubic-bezier(0.5, 0, 0.5, 1);
}

/* Popup animation for overlay content */
@keyframes popup {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.overlay.show .overlay-content {
  animation: popup 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
