/* === PLACED EGGS — eggs incubating on the ground === */

.placed-egg {
  position: absolute;
  bottom: 21vh;
  z-index: 10;
  pointer-events: none;
  transform-origin: bottom center;
  --rarity-glow: rgba(154, 154, 154, 0.5);
  --progress: 0;
}

.placed-egg-inner {
  display: inline-block;
  filter: drop-shadow(1px 3px 0 rgba(0, 0, 0, 0.6))
          drop-shadow(0 0 8px var(--rarity-glow));
  transform-origin: bottom center;
  animation: eggWobble 3.6s ease-in-out infinite;
}
@keyframes eggWobble {
  0%, 100% { transform: rotate(-1.5deg) translateY(0); }
  50%      { transform: rotate( 1.5deg) translateY(-2px); }
}

/* Birth pop when player places it */
.placed-egg.just-placed .placed-egg-inner {
  animation: eggPlace 0.7s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes eggPlace {
  0%   { transform: scale(0)  translateY(8px); opacity: 0; }
  60%  { transform: scale(1.2) translateY(-3px); opacity: 1; }
  100% { transform: scale(1)  translateY(0); opacity: 1; }
}

/* Hatch shake + flash */
.placed-egg.hatching .placed-egg-inner {
  animation: eggHatch 0.7s ease-out forwards;
}
@keyframes eggHatch {
  0%   { transform: scale(1)    translateX(0); filter: drop-shadow(0 0 0 var(--rarity-glow)); }
  20%  { transform: scale(1.1)  translateX(-3px); }
  35%  { transform: scale(1.1)  translateX(3px); }
  50%  { transform: scale(1.15) translateX(-3px); }
  65%  { transform: scale(1.2)  translateX(3px); }
  80%  { transform: scale(1.4)  translateX(0);
         filter: drop-shadow(0 0 30px var(--rarity-glow))
                 drop-shadow(0 0 50px var(--rarity-glow)); }
  100% { transform: scale(0)    translateX(0); opacity: 0; }
}

/* Progress ring under the egg (uses --progress 0..1) */
.placed-egg-progress {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 32px;
  height: 4px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}
.placed-egg-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  width: calc(var(--progress, 0) * 100%);
  background: var(--rarity-glow);
  box-shadow: 0 0 6px var(--rarity-glow);
  transition: width 0.5s ease;
}

/* Rarity scale (eggs grow with rarity, like plants) */
.placed-egg[data-rarity="comum"]    { --rarity-glow: rgba(154,154,154,0.5);  --rarity-scale: 1;    }
.placed-egg[data-rarity="incomum"]  { --rarity-glow: rgba(93,208,106,0.6);   --rarity-scale: 1.15; }
.placed-egg[data-rarity="raro"]     { --rarity-glow: rgba(74,163,255,0.7);   --rarity-scale: 1.35; }
.placed-egg[data-rarity="epico"]    { --rarity-glow: rgba(162,93,255,0.75);  --rarity-scale: 1.6;  }
.placed-egg[data-rarity="lendario"] { --rarity-glow: rgba(255,138,42,0.85);  --rarity-scale: 1.9;  }
.placed-egg[data-rarity="mitico"]   { --rarity-glow: rgba(255,58,58,0.9);    --rarity-scale: 2.2;  }
.placed-egg[data-rarity="cosmico"]  { --rarity-glow: rgba(61,240,255,1);     --rarity-scale: 2.6;  }
.placed-egg[data-rarity="desconhecido"] { --rarity-glow: rgba(255,255,255,1); --rarity-scale: 3; }

.placed-egg .placed-egg-inner svg {
  transform: scale(var(--rarity-scale, 1));
  transform-origin: bottom center;
}
