/* ========================================
   FALLING GAME – Düşen Ürünler Mini Oyunu
   QR Menü Ana Sayfa İnteraktif Oyun
======================================== */

/* ── Oyun Container ── */
.falling-game-container {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.5s ease;
  contain: strict; /* mobil perf: layout/paint izolasyonu */
}

.falling-game-container.game-fading-out {
  opacity: 0;
  pointer-events: none !important;
}

/* ── Düşen Ürün Wrapper (pozisyon/trajectory kontrolü) ── */
.falling-item-wrapper {
  position: absolute;
  width: 80px;
  height: 80px;
  pointer-events: none;
  contain: layout; /* mobil perf — 'paint' YOK: box-shadow + rüzgar izini kırpmasın */
}

/* ── Düşen Ürün ── */
.falling-item {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 0 14px rgba(255, 255, 255, 0.12),
    0 4px 18px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.22);
  -webkit-tap-highlight-color: transparent;
  will-change: transform, opacity;
}

.falling-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

/* ── Rüzgar / Düşme Çizgileri (::after ile 3 çizgi) ── */
.falling-item::after {
  content: '';
  position: absolute;
  top: -22px;
  left: 35%;
  width: 2px;
  height: 16px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3));
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    10px -5px 0 0 rgba(255, 255, 255, 0.22),
    -8px -3px 0 0 rgba(255, 255, 255, 0.15),
    22px -9px 0 0 rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s ease;
}

.falling-item.is-falling::after {
  /* mobil perf: infinite pulse kaldırıldı (ürün başına sürekli repaint);
     izi bir kez belirginleştir, statik bırak */
  opacity: 0.55;
  transform: translateY(-3px) scaleY(1.15);
}

@keyframes windTrailPulse {
  0% {
    transform: translateY(0) scaleY(0.7);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-7px) scaleY(1.5);
    opacity: 0.15;
  }
}

/* ── Patlama Parçacıkları ── */
.explosion-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  will-change: transform, opacity;
}

/* ── Patlama Halkası ── */
.explosion-ring {
  position: fixed;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
  animation: ringExpand 0.5s ease-out forwards;
}

@keyframes ringExpand {
  0% {
    width: 8px;
    height: 8px;
    opacity: 1;
    border-width: 3px;
  }
  100% {
    width: 130px;
    height: 130px;
    opacity: 0;
    border-width: 0.5px;
  }
}

/* ── Patlama Flash ── */
.explosion-flash {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.4) 40%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 7;
  animation: flashBurst 0.4s ease-out forwards;
}

@keyframes flashBurst {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.8);
    opacity: 0;
  }
}

/* ── Skor Barı ── */
.game-score-bar {
  position: fixed;
  top: 24px;
  left: 50%;

  display: flex;
  align-items: center;
  gap: 10px;

  /* mobil perf: backdrop-filter blur kaldırıldı (her karede yeniden derliyordu) */
  background: rgba(15, 15, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;

  padding: 10px 28px;
  z-index: 5;
  pointer-events: auto;

  opacity: 0;
  transform: translateX(-50%) scale(0) translateY(-20px);
}

.game-score-bar.game-score-visible {
  animation: scoreSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scoreSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) translateY(0);
  }
}

.game-score-icon {
  font-size: 26px;
  line-height: 1;
}

.game-score-value {
  font-family: 'Anton', sans-serif;
  font-size: 32px;
  color: #fff;
  min-width: 24px;
  text-align: center;
  letter-spacing: 1px;
}

.game-score-value.game-score-bump {
  animation: scoreBump 0.35s ease both;
}

@keyframes scoreBump {
  0% {
    transform: scale(1);
    color: #fff;
  }
  40% {
    transform: scale(1.55);
    color: #ffd700;
  }
  100% {
    transform: scale(1);
    color: #fff;
  }
}

/* ── "Ürünleri Patlat!" Yazısı ── */
.game-prompt-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-family: 'Anton', sans-serif;
  font-size: clamp(26px, 7.5vw, 48px);
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  text-transform: uppercase;
  letter-spacing: 2px;
  white-space: nowrap;

  z-index: 5;
  pointer-events: none;
  opacity: 0;
}

.game-prompt-text.game-prompt-show {
  animation: promptPopIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.game-prompt-text.game-prompt-hide {
  animation: promptFadeOut 0.7s ease-out forwards !important;
}

@keyframes promptPopIn {
  0% {
    transform: translate(-50%, -50%) scale(0.15) rotate(-6deg);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.08) rotate(1deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes promptGlow {
  0%, 100% {
    text-shadow:
      0 0 20px rgba(222, 58, 62, 0.9),
      0 0 60px rgba(222, 58, 62, 0.45),
      0 2px 8px rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    text-shadow:
      0 0 30px rgba(222, 58, 62, 1),
      0 0 80px rgba(222, 58, 62, 0.6),
      0 0 120px rgba(222, 58, 62, 0.2),
      0 2px 8px rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes promptFadeOut {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.35);
    opacity: 0;
  }
}

/* ── Geri Sayım (3 · 2 · 1) ── */
.game-countdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-family: 'Anton', sans-serif;
  font-size: clamp(96px, 32vw, 200px);
  line-height: 1;
  color: #fff;
  text-shadow:
    0 6px 30px rgba(0, 0, 0, 0.55),
    0 0 50px rgba(255, 255, 255, 0.18);

  z-index: 6;
  pointer-events: none;
  opacity: 0;
}

.game-countdown.tick {
  animation: countdownTick 1s ease-out forwards;
}

@keyframes countdownTick {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  18% {
    transform: translate(-50%, -50%) scale(1.06);
    opacity: 1;
  }
  68% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.55);
    opacity: 0;
  }
}

/* ── Kapatma Butonu ── */
.game-close-btn {
  position: fixed;
  top: 24px;
  right: 20px;

  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  /* mobil perf: backdrop-filter blur kaldırıldı */
  background: rgba(15, 15, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;

  color: rgba(255, 255, 255, 0.8);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;

  cursor: pointer;
  z-index: 5;
  pointer-events: auto;

  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.game-close-btn:hover {
  background: rgba(222, 58, 62, 0.6);
  color: #fff;
  transform: scale(1.1);
  border-color: rgba(222, 58, 62, 0.5);
}

.game-close-btn:active {
  transform: scale(0.92);
}
