/**
 * forge/map-life.css — burn pits, fire, lightning, flowing water, scurriers
 */
#world-layer #map-life-layer,
#world-layer .map-life-layer {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  /* Above barriers/blockers (4), just under mobs (20) — was too easy to miss */
  z-index: 16 !important;
  pointer-events: none !important;
  overflow: visible !important;
}

.map-life {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
  z-index: 1;
}

.map-life__img {
  display: block !important;
  max-width: 220px;
  height: auto;
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Heat shimmer for fire / burn pits */
.map-life--heat {
  animation: map-life-heat 2.4s ease-in-out infinite;
}
.map-life--heat .map-life__img {
  filter: drop-shadow(0 0 10px rgba(255, 100, 20, 0.55));
}
@keyframes map-life-heat {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

/* Flowing water / lava ribbons sit flat on the ground */
.map-life--water,
.map-life--flowing_water,
.map-life--lava,
.map-life--lava_stream {
  transform-origin: 50% 50%;
  z-index: 1;
}
.map-life--water .map-life__img,
.map-life--flowing_water .map-life__img {
  max-width: none !important;
  /* normal blend — screen was washing out on many zone BGs */
  mix-blend-mode: normal;
  opacity: 1 !important;
  filter: drop-shadow(0 2px 8px rgba(0, 40, 60, 0.65));
}
.map-life--lava .map-life__img,
.map-life--lava_stream .map-life__img {
  max-width: none !important;
  mix-blend-mode: normal;
  opacity: 1 !important;
  filter: drop-shadow(0 0 14px rgba(255, 90, 0, 0.7))
    drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  animation: map-life-lava-pulse 1.8s ease-in-out infinite;
}
@keyframes map-life-lava-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 80, 0, 0.45))
      drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(255, 140, 20, 0.75))
      drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  }
}

/* Lightning occasional full flash */
.map-life--lightning-flash {
  animation: map-life-bolt 5.5s steps(1, end) infinite;
  animation-delay: var(--life-delay, 0ms);
}
.map-life--lightning-flash .map-life__img {
  max-height: 120px;
  filter: drop-shadow(0 0 12px rgba(180, 210, 255, 0.8));
}
@keyframes map-life-bolt {
  0%,
  8%,
  100% {
    opacity: 0;
  }
  2%,
  5% {
    opacity: 1;
  }
  3% {
    opacity: 0.35;
  }
  6% {
    opacity: 0.85;
  }
}

/* Scurry path across floor */
.map-life--scurry-run {
  left: 0 !important;
  top: 0 !important;
  animation: map-life-scurry var(--life-dur, 9s) linear infinite;
  animation-delay: var(--life-delay, 0s);
}
.map-life--scurry-run .map-life__img {
  max-width: 52px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}
@keyframes map-life-scurry {
  0% {
    transform: translate(var(--sx), var(--sy)) translate(-50%, -50%);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--ex), var(--ey)) translate(-50%, -50%);
    opacity: 0;
  }
}

/* Iso: keep life on the ground plane (slight lift for fire) */
body.forge-iso #map-life-layer .map-life--heat {
  transform: translate(-50%, -70%) translateZ(6px);
}
body.forge-iso #map-life-layer .map-life--water {
  transform: translate(-50%, -50%) translateZ(1px);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .map-life--heat,
  .map-life--lightning-flash,
  .map-life--scurry-run {
    animation: none !important;
  }
  .map-life--lightning-flash {
    opacity: 0.35;
  }
}
