
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow: hidden;
  pointer-events: none;
  perspective: 600px;
}

.fx-confetti-host {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  perspective: 600px;
}

#pearl-open > .fx-confetti-host {
  z-index: 1;
}

#grid > .fx-confetti-host {
  z-index: 2;
  overflow: visible;
}

.fx-confetti {
  position: absolute;
  width: 0;
  height: 0;
  animation: confetti-flight 2200ms cubic-bezier(0.2, 0.6, 0.4, 1) both;
}

.fx-atlas {
  background-repeat: no-repeat;
  background-position-y: 0;
}

.fx-atlas-confetti { background-image: url("../art/fx/confetti.webp"); background-size: 2400% 100%; }
.fx-atlas-confetti-2 { background-image: url("../art/fx/confetti-2.webp"); background-size: 2400% 100%; }
.fx-atlas-stars { background-image: url("../art/fx/stars.webp"); background-size: 1600% 100%; }
.fx-atlas-sparkles { background-image: url("../art/fx/sparkles.webp"); background-size: 1600% 100%; }
.fx-atlas-sparks { background-image: url("../art/fx/sparks.webp"); background-size: 1600% 100%; }
.fx-atlas-celestial { background-image: url("../art/fx/celestial.webp"); background-size: 1600% 100%; }

.fx-confetti-flutter {
  position: absolute;
  left: calc(var(--s) / -2);
  top: calc(var(--s) / -2);
  width: var(--s);
  height: var(--s);
  animation: confetti-flutter 520ms linear infinite;
}

@keyframes confetti-flight {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  6% { opacity: 1; }
  30% { transform: translate(var(--dx), var(--up)) rotate(calc(var(--turn) * 0.35)); }
  65% { transform: translate(calc(var(--dx) + var(--sway)), calc(var(--up) + 40vh)) rotate(calc(var(--turn) * 0.7)); }
  85% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(calc(var(--dx) - var(--sway)), calc(var(--up) + 90vh)) rotate(var(--turn)); }
}

@keyframes confetti-flutter {
  0% { transform: rotateX(0) rotateY(0); }
  50% { transform: rotateX(180deg) rotateY(60deg); }
  100% { transform: rotateX(360deg) rotateY(0); }
}

.fx-sparkle {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  opacity: 0;
  transform: scale(0) rotate(0);
  animation: sparkle-pop 760ms ease-out both;
}

.fx-sparkle.big {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
}

.fx-spark {
  position: absolute;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  opacity: 0;
  animation: spark-fling 640ms cubic-bezier(0.15, 0.7, 0.3, 1) both;
}

@keyframes spark-fling {
  0% { opacity: 0; transform: translate(0, 0) rotate(var(--rot)) scale(0.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); }
}

@keyframes sparkle-pop {
  0% { opacity: 0; transform: scale(0) rotate(0); }
  35% { opacity: 1; transform: scale(1.15) rotate(45deg); }
  100% { opacity: 0; transform: scale(0.2) rotate(90deg); }
}

.big-win-title.fx-glimmer,
.big-win-amount.fx-glimmer {
  --sheen: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.95) 50%, transparent 60%);
  animation-name: var(--win-enter, big-win-step), glimmer-sweep;
  animation-duration: 520ms, 900ms;
  animation-timing-function: cubic-bezier(0.3, 1.5, 0.5, 1), ease-in-out;
}

.big-win-amount.fx-glimmer:not(.landed) {
  animation: glimmer-sweep 900ms ease-in-out;
}

@keyframes glimmer-sweep {
  from { background-position: 100% 0, 0 0; }
  to { background-position: 0 0, 0 0; }
}

.spin-glint {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.spin-glint::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.5) 50%, transparent 80%);
  transform: translateX(-120%);
  animation: spin-glint 5.2s ease-in-out 1.5s infinite;
  animation-play-state: var(--idle-play, running);
}

.spin-button:disabled .spin-glint,
.spin-button.broke .spin-glint,
.spin-button.busy .spin-glint,
.spin-button.stop .spin-glint,
.spin-button.auto .spin-glint {
  display: none;
}

@keyframes spin-glint {
  0% { transform: translateX(-120%); }
  22% { transform: translateX(200%); }
  100% { transform: translateX(200%); }
}

@media (prefers-reduced-motion: reduce) {
  .fx-confetti,
  .fx-sparkle,
  .fx-spark,
  .spin-glint {
    display: none;
  }
  .big-win-title.fx-glimmer,
  .big-win-amount.fx-glimmer {
    --sheen: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .big-win-title.fx-glimmer { animation: none; }
}
