/* ── Gold collect ── */
@keyframes coin-collect {
  0%   { transform: translateY(0)    scale(1);    opacity: 1; }
  40%  { transform: translateY(-18px) scale(1.3); opacity: 1; }
  100% { transform: translateY(-40px) scale(0.4); opacity: 0; }
}

.tile-icon-wrap.collecting {
  animation: coin-collect 0.55s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

/* ── Icon bob ── */
@keyframes icon-bob {
  0%, 100% { transform: translateY(0);    }
  50%      { transform: translateY(-5px); }
}

/* ── Keyframes ── */
@keyframes pulse-danger {
  0%, 100% { box-shadow: inset 0 0 14px rgba(220,0,0,0.3), 0 0 8px rgba(200,0,0,0.3); }
  50%       { box-shadow: inset 0 0 24px rgba(255,0,0,0.5), 0 0 16px rgba(220,0,0,0.5); }
}

/* ── Blinding Light flash ── */
@keyframes flash-blind {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(4) saturate(0.2); }
  60%  { filter: brightness(2); }
  100% { filter: brightness(1); }
}

.flash-blind {
  animation: flash-blind 0.6s ease-out forwards;
}

/* ── Lantern mode: unrevealed tiles glow ── */
.lantern-mode .tile:not(.revealed) {
  box-shadow: 0 0 10px 2px rgba(255, 200, 60, 0.55);
  cursor: crosshair;
}

/* Ricochet targeting: living enemies */
.ricochet-mode .tile.enemy-alive {
  cursor: crosshair;
  box-shadow: 0 0 8px 1px rgba(56, 200, 255, 0.4);
}

/* Triple Volley: any revealed tile can be the 3×3 center.
   tiles.css sets .tile.revealed { pointer-events: none } except for a few types;
   slain enemy (ashes) and similar tiles need explicit re-enable here. */
#grid-container.arrow-barrage-mode .tile.revealed:not(.locked) {
  pointer-events: all;
  cursor: crosshair;
}

.arrow-barrage-mode .tile.enemy-alive {
  box-shadow: 0 0 8px 1px rgba(255, 180, 80, 0.45);
}

/* 3×3 AoE preview — blinking outline */
.tile.triple-volley-aoe-preview {
  position: relative;
  z-index: 2;
}

.tile.triple-volley-aoe-preview .tile-inner {
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 170, 70, 0.95),
    0 0 12px rgba(255, 140, 40, 0.65);
  animation: triple-volley-aoe-blink 0.75s ease-in-out infinite;
}

@keyframes triple-volley-aoe-blink {
  0%, 100% {
    box-shadow:
      inset 0 0 0 2px rgba(255, 170, 70, 0.85),
      0 0 10px rgba(255, 140, 40, 0.5);
  }
  50% {
    box-shadow:
      inset 0 0 0 3px rgba(255, 220, 140, 1),
      0 0 18px rgba(255, 180, 80, 0.9);
  }
}

.poison-arrow-shot-mode .tile.enemy-alive {
  cursor: crosshair;
  box-shadow: 0 0 8px 1px rgba(100, 200, 90, 0.45);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(3px); }
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  15%  { opacity: 1; transform: translateY(-8px) scale(1.25); }
  100% { opacity: 0; transform: translateY(-55px) scale(0.85); }
}

/* ── Tile shake ── */
.tile.shaking {
  animation: shake 0.35s ease;
}

/* ── Triple Volley rain overlay ── */
.arrow-rain-overlay {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  pointer-events: none;
  z-index: 18;
  image-rendering: pixelated;
}

/* ── Cannon ball (Engineer ballistic turret) ── */
.cannon-ball {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #aaa, #333 70%, #111);
  box-shadow: 0 0 4px 1px rgba(0,0,0,0.7), inset 0 1px 2px rgba(255,255,255,0.2);
  pointer-events: none;
  z-index: 30;
  transform: translate(-50%, -50%);
}

/* ── Tesla arc (Engineer turret) ── */
@keyframes tesla-arc-fade {
  0%   { opacity: 1; filter: brightness(1.4); }
  60%  { opacity: 0.9; }
  100% { opacity: 0; }
}

.tesla-arc {
  position: absolute;
  height: 3px;
  background: linear-gradient(90deg, rgba(140,100,255,0.9), rgba(200,160,255,1), rgba(140,100,255,0.9));
  border-radius: 2px;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 30;
  box-shadow: 0 0 6px 2px rgba(180,120,255,0.8), 0 0 12px 4px rgba(120,80,255,0.5);
  animation: tesla-arc-fade 0.4s ease-out forwards;
}

/* ── Ranger arrow projectile ── */
.arrow-projectile {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 72px;
  height: auto;
  pointer-events: none;
  z-index: 20;
  image-rendering: pixelated;
}

/* ── Spirit rising on enemy death (with ash pile) ── */
.enemy-spirit-fx {
  position: absolute;
  left: 50%;
  bottom: 20%;
  width: 58%;
  max-width: 68px;
  height: auto;
  pointer-events: none;
  z-index: 25;
  image-rendering: auto;
  animation: spirit-rise-fade 1.35s ease-out forwards;
}

@keyframes spirit-rise-fade {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
    filter: drop-shadow(0 0 8px rgba(120, 210, 255, 0.55));
  }
  55% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -135%);
    filter: drop-shadow(0 0 4px rgba(120, 210, 255, 0.2));
  }
}

/* ── Strike slash effect ── */
.strike-slash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: 80%;
  max-width: 72px;
  height: auto;
  pointer-events: none;
  z-index: 20;
  image-rendering: pixelated;
}

/* ── Slam full-screen overlay ── */
@keyframes slam-fadeout {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

#slam-overlay {
  position: absolute;
  inset: 0;
  z-index: 600;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

#slam-overlay.hidden { display: none; }

#slam-overlay.fading {
  animation: slam-fadeout 0.35s ease-out forwards;
}

#slam-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ── Float text ── */
.float-text {
  position: fixed;
  font-size: 1rem;
  font-weight: bold;
  font-family: sans-serif;
  pointer-events: none;
  animation: float-up 1.1s ease-out forwards;
  z-index: 999;
  white-space: nowrap;
}

.float-text.damage { color: #ff5555; text-shadow: 0 0 8px rgba(255,0,0,0.7); }
.float-text.gold   { color: #ffd700; text-shadow: 0 0 8px rgba(255,200,0,0.7); }
.float-text.xp     { color: #88aaff; text-shadow: 0 0 8px rgba(100,150,255,0.7); }
.float-text.heal   { color: #55ff99; text-shadow: 0 0 8px rgba(0,220,100,0.7); }
.float-text.mana   { color: #55aaff; text-shadow: 0 0 8px rgba(0,150,255,0.7); }
