/**
 * PARTICLES — стили для системы частиц.
 * Все анимации — CSS, без JS-обновлений.
 */

.particle {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  image-rendering: pixelated;
  will-change: transform, opacity;
}

/* ── Искры (крит) ── */
.particle-spark {
  border-radius: 0;
  animation: sparkFly 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  box-shadow: 0 0 6px currentColor;
}

@keyframes sparkFly {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 40px)), calc(-50% + var(--dy, 40px))) scale(0.2);
    opacity: 0;
  }
}

/* ── Монеты (апгрейд) ── */
.particle-coin {
  border-radius: 0;
  animation: coinFly 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  box-shadow: 0 0 4px rgba(232, 184, 64, 0.6);
}

@keyframes coinFly {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -80%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -300%) scale(0.8);
    opacity: 0;
  }
}

/* ── Конфетти (ачивка) ── */
.particle-confetti {
  animation: confettiFall 2s linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translate(20px, calc(100vh + 50px)) rotate(var(--rot, 360deg));
    opacity: 0.3;
  }
}

/* ── Вспышка на сцене при крите ── */
.crit-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(224, 64, 64, 0.4), transparent 70%);
  pointer-events: none;
  z-index: 15;
  animation: critFlash 0.4s ease-out forwards;
}

@keyframes critFlash {
  0%   { opacity: 0.8; }
  100% { opacity: 0; }
}