/* The rare-goods games over the live park: the avalanche (ice) and the meganeura (amber). Shared: the counter with the
   good's icon and the +1 flying to it. */
.rg-got {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rg-got.pop {
  animation: rgPop 0.35s ease-out;
}
@keyframes rgPop {
  40% {
    transform: scale(1.35);
  }
}
.rg-fly {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  transition:
    transform 0.6s cubic-bezier(0.5, -0.3, 0.7, 1),
    opacity 0.6s ease-in;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}
.mg .vb-layer.shake {
  animation: rgShake 0.3s ease-out;
}
@keyframes rgShake {
  20% {
    transform: translate(4px, -2px);
  }
  45% {
    transform: translate(-3px, 2px);
  }
  70% {
    transform: translate(2px, 1px);
  }
}

/* ---------- Avalanche ---------- */
/* frost round the edges of the screen and snow drifting over it */
.av-frost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(220, 240, 255, 0) 55%, rgba(200, 230, 250, 0.55) 100%),
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 1.5px, transparent 2.5px) 0 0 / 90px 90px,
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 2px) 30px 45px / 60px 60px;
  animation: avSnow 6s linear infinite;
}
@keyframes avSnow {
  to {
    background-position:
      0 0,
      40px 360px,
      -30px 285px;
  }
}
.av-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.av-lines line {
  stroke: rgba(235, 248, 255, 0.85);
  stroke-width: 3;
  stroke-dasharray: 7 7;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 1px rgba(20, 50, 80, 0.6));
  animation: avDash 0.6s linear infinite;
}
.av-lines line.near {
  stroke: #ffb0a0;
}
@keyframes avDash {
  to {
    stroke-dashoffset: -14;
  }
}
/* the finger's stroke: a bright blade of light */
.av-trail {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px #7ad0ff) drop-shadow(0 0 2px #fff);
}
.av-r {
  position: absolute;
  left: 0;
  top: 0;
  filter: drop-shadow(0 0 5px rgba(160, 225, 255, 0.8));
}
.av-r img {
  display: block;
  width: 100%;
}
.av-sh {
  position: absolute;
  left: 0;
  top: 0;
  aspect-ratio: 2.4;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(20, 40, 60, 0.45), rgba(20, 40, 60, 0) 70%);
}
.av-ring {
  border-color: #8fd8ff;
}
.av-ring span {
  background: #2a6ea8;
}
/* the newcomer's hint: a finger stroke drawn across the first boulder (avDraw places it) */
.av-hint {
  position: absolute;
  left: 0;
  top: 0;
  height: 5px;
  transform-origin: 0 50%;
}
.av-hint::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #fff 40%, #fff 60%, transparent);
  box-shadow: 0 0 8px #7ad0ff;
  transform-origin: 0 50%;
  animation: avHint 0.9s ease-in-out infinite;
}
@keyframes avHint {
  from {
    transform: scaleX(0);
    opacity: 1;
  }
  70% {
    transform: scaleX(1);
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
.av-burst {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}
.av-burst .puff {
  position: absolute;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95),
    rgba(220, 240, 255, 0.6) 45%,
    rgba(220, 240, 255, 0) 70%
  );
  animation: avPuff 0.7s ease-out forwards;
}
@keyframes avPuff {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(1.3);
    opacity: 0;
  }
}
/* a shard of ice: a pale blue sliver that spins away and falls */
.av-burst .sh {
  position: absolute;
  width: 12px;
  height: 18px;
  margin: -9px 0 0 -6px;
  clip-path: polygon(50% 0, 100% 40%, 70% 100%, 0 70%);
  background: linear-gradient(135deg, #fff, #a8e4ff 50%, #3f86b8);
  animation: avShard 0.75s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes avShard {
  from {
    transform: translate(0, 0) rotate(0) scale(var(--z));
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), calc(var(--dy) + 40px)) rotate(var(--r)) scale(var(--z));
    opacity: 0;
  }
}

/* ---------- Meganeura ---------- */
/* warm, humid air: a golden haze at the edges and drifting pollen */
.mn-air {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 220, 140, 0) 55%, rgba(120, 150, 40, 0.35) 100%),
    radial-gradient(circle, rgba(255, 240, 170, 0.8) 1.5px, transparent 2.5px) 0 0 / 110px 110px,
    radial-gradient(circle, rgba(255, 255, 220, 0.6) 1px, transparent 2px) 40px 60px / 70px 70px;
  animation: mnPollen 9s linear infinite;
}
@keyframes mnPollen {
  to {
    background-position:
      0 0,
      110px -220px,
      -70px -140px;
  }
}
/* a drop over a ride: the twig, a thread of resin, the drop; under it the gnawing ring */
.mn-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}
.mn-drop .tw {
  position: absolute;
  width: calc(110px * var(--z));
  min-width: 70px;
  transform: translate(-50%, -80%);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
}
.mn-drop .th {
  position: absolute;
  left: -1.5px;
  top: -4px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(#c87010, #f0a838);
}
.mn-drop .dr {
  position: absolute;
  left: 0;
  top: 6px;
  width: calc(30px * var(--z));
  min-width: 22px;
  transform-origin: 50% 0;
  filter: drop-shadow(0 0 6px rgba(255, 170, 40, 0.7));
}
.mn-drop.hang .dr {
  animation: mnGlow 1.2s ease-in-out infinite alternate;
}
.mn-drop.grow .dr {
  opacity: 0.85;
}
.mn-drop.fall .th,
.mn-drop.grow .th {
  height: 6px;
}
@keyframes mnGlow {
  to {
    filter: drop-shadow(0 0 12px rgba(255, 200, 60, 1));
  }
}
.mn-drop .gn {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(54px * var(--z));
  min-width: 40px;
  margin-top: calc(-27px * var(--z));
  opacity: 0;
  transition: opacity 0.2s;
}
.mn-drop.gnaw .gn {
  opacity: 1;
}
.mn-drop .gn svg {
  display: block;
  width: 100%;
  transform: rotate(-90deg);
}
.mn-drop .gn circle {
  fill: rgba(168, 48, 30, 0.15);
  stroke: #ff6a3a;
  stroke-width: 4;
  stroke-dasharray: 100.5;
  stroke-dashoffset: calc(100.5 * (1 - var(--p, 0)));
}
.mn-fly {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 42%;
}
.mn-fly img {
  display: block;
  width: 100%;
}
.mn-fly img.b {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
}
.mn-fly.flap img.a {
  visibility: hidden;
}
.mn-fly.flap img.b {
  visibility: visible;
}
.mn-sh {
  position: absolute;
  left: 0;
  top: 0;
  aspect-ratio: 2.2;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(20, 30, 10, 0.35), rgba(20, 30, 10, 0) 70%);
}
/* caught: a glowing piece of amber pops out where the dragonfly was */
.mn-amber {
  position: absolute;
  width: 64px;
  pointer-events: none;
  animation: mnAmber 0.9s ease-out forwards;
}
.mn-amber img {
  display: block;
  width: 100%;
  filter: drop-shadow(0 0 10px rgba(255, 190, 60, 0.95));
}
@keyframes mnAmber {
  from {
    transform: translate(-50%, -50%) scale(0.2) rotate(-30deg);
    opacity: 1;
  }
  35% {
    transform: translate(-50%, -50%) scale(1.25) rotate(8deg);
  }
  70% {
    transform: translate(-50%, -60%) scale(1) rotate(0);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -90%) scale(0.8);
    opacity: 0;
  }
}
.mn-splat {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 16px;
  margin: -8px 0 0 -20px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #f0a030, #b85a08 60%, rgba(184, 90, 8, 0) 72%);
  animation: mnSplat 0.9s ease-out forwards;
}
@keyframes mnSplat {
  from {
    transform: scale(0.3);
  }
  20% {
    transform: scale(1.1);
  }
  to {
    transform: scale(1);
    opacity: 0;
  }
}
