/* ============ BOLILLERO ANIMATION ============ */

/* Overlay */
.bolillero-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  animation: bolilleroFadeIn 0.2s ease;
}

@keyframes bolilleroFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Cage */
.bolillero-cage {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 4px solid rgba(233, 69, 96, 0.6);
  position: relative;
  animation: cageSpin 1.5s cubic-bezier(0.2, 0.8, 0.3, 1);
  overflow: hidden;
  box-shadow:
    0 0 30px rgba(233, 69, 96, 0.3),
    inset 0 0 20px rgba(233, 69, 96, 0.15);
}

@keyframes cageSpin {
  0%   { transform: rotate(0deg) scale(0.7); opacity: 0.5; }
  15%  { opacity: 1; transform: rotate(120deg) scale(1); }
  40%  { transform: rotate(360deg) scale(1); }
  70%  { transform: rotate(600deg) scale(1); }
  85%  { transform: rotate(700deg) scale(1.02); }
  100% { transform: rotate(720deg) scale(1); }
}

/* Small balls bouncing inside */
.bolillero-mini-ball {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3), inset 2px 2px 4px rgba(255,255,255,0.2);
}

.bolillero-mini-ball:nth-child(1) {
  background: #e94560;
  animation: ballBounce1 1.5s ease-in-out;
}
.bolillero-mini-ball:nth-child(2) {
  background: #7c3aed;
  animation: ballBounce2 1.5s ease-in-out;
}
.bolillero-mini-ball:nth-child(3) {
  background: #2ecc71;
  animation: ballBounce3 1.5s ease-in-out;
}
.bolillero-mini-ball:nth-child(4) {
  background: #f39c12;
  animation: ballBounce4 1.5s ease-in-out;
}
.bolillero-mini-ball:nth-child(5) {
  background: #3498db;
  animation: ballBounce5 1.5s ease-in-out;
}
.bolillero-mini-ball:nth-child(6) {
  background: #e74c3c;
  animation: ballBounce6 1.5s ease-in-out;
}

@keyframes ballBounce1 {
  0%   { top: 40%; left: 30%; }
  15%  { top: 20%; left: 60%; }
  30%  { top: 65%; left: 25%; }
  50%  { top: 15%; left: 50%; }
  65%  { top: 55%; left: 70%; }
  80%  { top: 30%; left: 20%; }
  100% { top: 50%; left: 45%; }
}

@keyframes ballBounce2 {
  0%   { top: 60%; left: 55%; }
  20%  { top: 25%; left: 30%; }
  40%  { top: 70%; left: 60%; }
  55%  { top: 20%; left: 45%; }
  75%  { top: 60%; left: 20%; }
  100% { top: 40%; left: 55%; }
}

@keyframes ballBounce3 {
  0%   { top: 30%; left: 65%; }
  18%  { top: 60%; left: 40%; }
  35%  { top: 20%; left: 20%; }
  55%  { top: 65%; left: 55%; }
  70%  { top: 35%; left: 70%; }
  100% { top: 55%; left: 35%; }
}

@keyframes ballBounce4 {
  0%   { top: 50%; left: 20%; }
  22%  { top: 25%; left: 65%; }
  45%  { top: 60%; left: 35%; }
  60%  { top: 30%; left: 55%; }
  80%  { top: 65%; left: 25%; }
  100% { top: 35%; left: 60%; }
}

@keyframes ballBounce5 {
  0%   { top: 20%; left: 45%; }
  25%  { top: 60%; left: 20%; }
  45%  { top: 30%; left: 65%; }
  65%  { top: 55%; left: 40%; }
  85%  { top: 25%; left: 30%; }
  100% { top: 45%; left: 50%; }
}

@keyframes ballBounce6 {
  0%   { top: 65%; left: 40%; }
  20%  { top: 30%; left: 55%; }
  40%  { top: 55%; left: 25%; }
  60%  { top: 20%; left: 60%; }
  80%  { top: 50%; left: 35%; }
  100% { top: 60%; left: 45%; }
}

/* The result ball that ejects */
.bolillero-result {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #c0392b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  box-shadow:
    0 0 40px rgba(233, 69, 96, 0.6),
    inset -3px -3px 8px rgba(0,0,0,0.3),
    inset 3px 3px 8px rgba(255,255,255,0.2);
  animation: ballEject 0.5s cubic-bezier(0.2, 0, 0.3, 1) 1.5s both;
  margin-top: 20px;
}

@keyframes ballEject {
  0% {
    transform: translateY(40px) scale(0.2);
    opacity: 0;
  }
  50% {
    transform: translateY(-20px) scale(1.15);
    opacity: 1;
  }
  70% {
    transform: translateY(5px) scale(0.95);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Number reveal text */
.bolillero-number {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  text-shadow: 0 0 40px rgba(233, 69, 96, 0.8), 0 4px 10px rgba(0,0,0,0.5);
  animation: numberReveal 0.5s ease-out 1.8s both;
  margin-top: 10px;
}

@keyframes numberReveal {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Column letter label */
.bolillero-column {
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: numberReveal 0.4s ease-out 2s both;
}

/* Fade out */
.bolillero-overlay.fade-out {
  animation: bolilleroFadeOut 0.3s ease forwards;
}

@keyframes bolilleroFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
