/* ==========================================================================
   SKYWARD DRONE — STYLESHEET
   Features: Parallax Sky, Drone Rig, Spotlight, Turbo FX & Controls
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-cyan: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --bg-dark: #0b1329;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #ffffff;
  user-select: none;
  -webkit-user-select: none;
}

/* Stage & Background */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, #0b1329 0%, #17153b 50%, #1e1b4b 100%);
  overflow: hidden;
}

.sky-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Moon */
.moon {
  position: absolute;
  top: 8%;
  right: 10%;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, #fef08a 0%, #fde047 70%);
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(253, 224, 71, 0.35);
}

/* Clouds */
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  pointer-events: none;
}

.cloud-1 {
  top: 12%;
  left: 5%;
  width: 220px;
  height: 60px;
  animation: floatCloud 30s linear infinite;
}

.cloud-2 {
  top: 30%;
  left: 60%;
  width: 280px;
  height: 70px;
  animation: floatCloud 40s linear infinite reverse;
}

.cloud-3 {
  top: 55%;
  left: 20%;
  width: 240px;
  height: 65px;
  animation: floatCloud 35s linear infinite;
}

.cloud-4 {
  top: 75%;
  left: 70%;
  width: 300px;
  height: 80px;
  animation: floatCloud 45s linear infinite reverse;
}

@keyframes floatCloud {
  0% { transform: translateX(-80px); }
  50% { transform: translateX(80px); }
  100% { transform: translateX(-80px); }
}

/* Controls Hint (Bottom Centered) */
.controls-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: 10px 24px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  font-size: 0.88rem;
  color: #94a3b8;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}

.controls-hint .hint-sep {
  color: #64748b;
  font-size: 1.1rem;
  user-select: none;
}

.controls-hint.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
}

.controls-hint code {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-family: inherit;
}

/* Info & Sound Action Buttons */
.top-actions {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 12;
}

.circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.circle-btn svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  transition: stroke 0.2s ease, transform 0.2s ease;
}

.circle-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.circle-btn:active {
  transform: scale(0.95);
}

/* Dropped Packages & Impact Particle FX */
#packageContainer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.package {
  position: absolute;
  width: 32px;
  height: 32px;
  background: url('assets/box.png') center/contain no-repeat;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  will-change: transform, opacity;
}

.landing-puff {
  position: absolute;
  width: 30px;
  height: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: puffFade 0.5s ease-out forwards;
}

@keyframes puffFade {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* Drone Character & Rig */
.character {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  margin-left: -75px;
  margin-top: -75px;
  will-change: transform;
  z-index: 5;
  transition: transform 0.08s linear;
}

.character.hover-idle .drone-rig {
  animation: hoverBob 2.5s ease-in-out infinite alternate;
}

@keyframes hoverBob {
  0% { transform: translateY(-8px) rotate(-1deg); }
  100% { transform: translateY(8px) rotate(1deg); }
}

.drone-rig {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 22px rgba(0, 0, 0, 0.5));
}

/* Spotlight Cone (Key: L) */
.spotlight-beam {
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 480px;
  background: linear-gradient(180deg, rgba(254, 240, 138, 0.35) 0%, rgba(254, 240, 138, 0.08) 50%, rgba(254, 240, 138, 0) 100%);
  clip-path: polygon(44% 0%, 56% 0%, 100% 100%, 0% 100%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(4px);
}

.spotlight-beam.active {
  opacity: 1;
}

/* Turbo Thruster Glow (Key: Shift / B) */
.turbo-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(56, 189, 248, 0) 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease;
  filter: blur(8px);
}

.turbo-glow.active {
  opacity: 1;
  animation: pulseTurbo 0.3s infinite alternate;
}

@keyframes pulseTurbo {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.15); opacity: 0.9; }
}

/* Drone Body */
.drone-body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
}

/* Propellers */
.propeller {
  position: absolute;
  width: 46%;
  height: 46%;
  pointer-events: none;
  z-index: 3;
  transform-origin: 50% 50%;
}

.propeller img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.prop-top-left {
  top: 29.8%;
  left: 7.0%;
  animation: spinPropellerCW 0.08s linear infinite;
}

.prop-top-right {
  top: 29.8%;
  left: 93.0%;
  animation: spinPropellerCCW 0.08s linear infinite;
}

.prop-bottom-left {
  top: 66.4%;
  left: 3.5%;
  animation: spinPropellerCCW 0.08s linear infinite;
}

.prop-bottom-right {
  top: 66.4%;
  left: 96.5%;
  animation: spinPropellerCW 0.08s linear infinite;
}

.character.turbo .prop-top-left,
.character.turbo .prop-bottom-right {
  animation: spinPropellerCW 0.03s linear infinite;
}

.character.turbo .prop-top-right,
.character.turbo .prop-bottom-left {
  animation: spinPropellerCCW 0.03s linear infinite;
}

@keyframes spinPropellerCW {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes spinPropellerCCW {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Navigation Lights */
.nav-light {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.light-front-left {
  top: 66.4%;
  left: 3.5%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
  animation: blinkNav 1s infinite alternate;
}

.light-front-right {
  top: 66.4%;
  left: 96.5%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
  animation: blinkNav 1s infinite alternate 0.5s;
}

@keyframes blinkNav {
  0% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* Cargo Box */
.cargo-box {
  position: absolute;
  top: 72%;
  left: 50%;
  transform: translateX(-50%) scale(1);
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  z-index: 1;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.1s ease;
  opacity: 1;
}

.cargo-box.empty {
  opacity: 0;
  transform: translateX(-50%) scale(0.2);
  transition: transform 0.06s ease-in, opacity 0.06s ease-in;
}

/* Mobile & Touch Controls */
.mobile-controls {
  display: none;
}

@media (max-width: 768px), (pointer: coarse) {
  .mobile-controls {
    display: flex;
    position: absolute;
    bottom: 25px;
    left: 0;
    right: 0;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 24px;
    pointer-events: none;
    z-index: 20;
  }

  .dpad, .space-btn {
    pointer-events: auto;
  }

  .dpad {
    position: relative;
    width: 135px;
    height: 135px;
  }

  .dpad-btn {
    position: absolute;
    width: 45px;
    height: 45px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: background 0.1s ease, transform 0.1s ease;
  }

  .dpad-btn:active, .dpad-btn.active {
    background: rgba(56, 189, 248, 0.85);
    border-color: #38bdf8;
    transform: scale(0.92);
  }

  .dpad-up { top: 0; left: 45px; border-radius: 12px 12px 4px 4px; }
  .dpad-down { bottom: 0; left: 45px; border-radius: 4px 4px 12px 12px; }
  .dpad-left { top: 45px; left: 0; border-radius: 12px 4px 4px 12px; }
  .dpad-right { top: 45px; right: 0; border-radius: 4px 12px 12px 4px; }

  .dpad-center {
    position: absolute;
    top: 45px;
    left: 45px;
    width: 45px;
    height: 45px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }

  .space-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 3px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
  }

  .space-btn:active, .space-btn.active {
    transform: scale(0.92);
    box-shadow: 0 2px 10px rgba(217, 119, 6, 0.4);
  }

  .top-actions {
    bottom: auto;
    top: 16px;
    left: 16px;
  }

  .controls-hint {
    bottom: auto;
    top: 16px;
    font-size: 0.75rem;
    padding: 6px 14px;
    max-width: 75%;
    text-align: center;
    gap: 8px;
    white-space: normal;
    justify-content: center;
  }
}