/* === LUNA SHIP — visual element + state animations === */

.luna-ship {
  position: absolute;
  /* Position over the launch pad inside the base SVG.
     Base SVG: viewBox 380x160 displayed at 600x260 (scale 1.578 x 1.625).
     Pad surface in viewBox: y=115, x center=312.
     Pad in display px: x = 312/380 * 600 = 492.6 px from left of structLeft
                        y from top = 115 * 1.625 = 186.9 px
                        y from bottom (struct height 260) = 73 px
     Ship svg 150x225 with legs at viewBox y=82 of 90 → 225 - (82/90 * 225) = ~20px from svg bottom.
     So bottom = 73 - 20 = 53 px, left = 492.6 - 75 = 418 px. */
  left: 418px;
  bottom: 53px;
  width: 150px;
  height: 225px;
  z-index: 1; /* below the base-svg (z:5) so the pad covers the legs */
  pointer-events: auto;
  cursor: pointer;
  transform-origin: bottom center;
  transition: filter 0.3s ease;
}

/* Hover lift / glow when player is near */
.luna-ship.nearby {
  filter: drop-shadow(0 0 14px rgba(255, 200, 120, 0.55))
          drop-shadow(0 0 6px rgba(255, 140, 60, 0.7));
  animation: shipNearbyBob 1.6s ease-in-out infinite;
}
@keyframes shipNearbyBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

/* The thruster flame is hidden by default */
.luna-ship .ship-flame {
  opacity: 0;
  transform-origin: 30px 72px;
  transform: scaleY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================ */
/*  STATE: idle (default) — gentle bob           */
/* ============================================ */
.luna-ship[data-ship-state="idle"] {
  animation: shipIdle 4s ease-in-out infinite;
}
@keyframes shipIdle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1px); }
}

/* ============================================ */
/*  STATE: launching — flame on, lift off        */
/* ============================================ */
.luna-ship[data-ship-state="launching"] {
  animation: shipLaunch 1.8s cubic-bezier(0.4, 0, 0.7, 0.4) forwards;
}
.luna-ship[data-ship-state="launching"] .ship-flame {
  opacity: 1;
  transform: scaleY(1);
  animation: flameFlicker 0.12s ease-in-out infinite;
}
@keyframes shipLaunch {
  0%   { transform: translateY(0)    scale(1); opacity: 1; }
  10%  { transform: translateY(2px)  scale(1); opacity: 1; }
  30%  { transform: translateY(-20px) scale(1); opacity: 1; }
  70%  { transform: translateY(-180px) scale(0.8); opacity: 0.9; }
  100% { transform: translateY(-360px) scale(0.4); opacity: 0; }
}
@keyframes flameFlicker {
  0%, 100% { transform: scaleY(1)    scaleX(1); }
  50%      { transform: scaleY(1.15) scaleX(0.9); }
}

/* ============================================ */
/*  STATE: away — completely hidden               */
/* ============================================ */
.luna-ship[data-ship-state="away"] {
  opacity: 0;
  pointer-events: none;
}

/* ============================================ */
/*  STATE: returning — drop in from above        */
/* ============================================ */
.luna-ship[data-ship-state="returning"] {
  animation: shipReturn 2.2s cubic-bezier(0.3, 0.6, 0.3, 1) forwards;
}
.luna-ship[data-ship-state="returning"] .ship-flame {
  opacity: 1;
  transform: scaleY(1);
  animation: flameFlicker 0.12s ease-in-out infinite;
}
@keyframes shipReturn {
  0%   { transform: translateY(-360px) scale(0.4); opacity: 0; }
  20%  { transform: translateY(-360px) scale(0.4); opacity: 0.8; }
  60%  { transform: translateY(-80px)  scale(0.8); opacity: 1; }
  85%  { transform: translateY(-4px)   scale(1);   opacity: 1; }
  100% { transform: translateY(0)      scale(1);   opacity: 1; }
}

/* ============================================ */
/*  STATE: landed — pulse glow waiting for collect */
/* ============================================ */
.luna-ship[data-ship-state="landed"] {
  animation: shipLandedPulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 16px rgba(120, 255, 140, 0.6))
          drop-shadow(0 0 8px rgba(120, 255, 140, 0.8));
}
@keyframes shipLandedPulse {
  0%, 100% { transform: translateY(0)   scale(1);    }
  50%      { transform: translateY(-2px) scale(1.02); }
}

/* ============================================ */
/*  PROXIMITY HINT (R to interact)               */
/* ============================================ */
.ship-prompt {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(10, 6, 4, 0.85);
  border: 1px solid rgba(255, 160, 60, 0.45);
  border-radius: 5px;
  padding: 4px 9px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: #ffcf8a;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-shadow: 0 0 4px rgba(255, 140, 60, 0.5);
}
.ship-prompt.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ship-prompt .key {
  display: inline-block;
  background: rgba(255, 140, 60, 0.2);
  border: 1px solid rgba(255, 160, 60, 0.6);
  border-radius: 3px;
  padding: 0 4px;
  margin-right: 3px;
  color: #ffe7b3;
}
