* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #2a1830; font-family: 'Bricolage Grotesque', sans-serif; }
#scene-container { position: fixed; inset: 0; touch-action: none; }

.hidden { display: none !important; }

/* Loader */
#loader {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #ffcf8a; font-family: 'JetBrains Mono', monospace; font-size: 14px;
  letter-spacing: 2px; text-transform: uppercase; background: #2a1830; z-index: 50;
}

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }

#title-flourish {
  position: absolute; top: 18px; left: 20px;
  text-shadow: 0 0 18px rgba(255,140,66,0.7);
}
.title-main {
  font-weight: 800; font-size: clamp(20px, 4vw, 32px); color: #ffe0b0;
  letter-spacing: 1px; line-height: 1;
}
.title-sub {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 4px;
  color: #7dffd0; text-transform: uppercase; margin-top: 4px; opacity: 0.85;
}

#scoreboard {
  position: absolute; top: 16px; right: 16px; text-align: center;
  background: rgba(20,10,25,0.55); border: 1px solid rgba(255,160,80,0.35);
  border-radius: 14px; padding: 10px 18px; backdrop-filter: blur(8px);
  box-shadow: 0 0 24px rgba(255,120,40,0.25);
}
.sb-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 4px; color: #ffb060; }
.sb-digits {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: clamp(30px, 7vw, 46px); color: #ff9c3a; line-height: 1;
  text-shadow: 0 0 16px rgba(255,120,30,0.8); font-variant-numeric: tabular-nums;
}
.sb-best { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 2px; color: #9fe8ff; margin-top: 3px; }

#wind-indicator {
  position: absolute; top: 120px; left: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 3px;
  color: rgba(159,232,255,0.75); text-transform: uppercase;
}
.wind-arrow {
  display: inline-block; color: #9fe8ff; font-size: 16px;
  animation: windDrift 2.4s ease-in-out infinite;
}
@keyframes windDrift { 0%,100% { transform: translateX(0); opacity: 0.5; } 50% { transform: translateX(8px); opacity: 1; } }

#mute-btn {
  position: absolute; bottom: 18px; right: 18px; pointer-events: auto;
  width: 46px; height: 46px; border-radius: 50%; font-size: 20px; cursor: pointer;
  background: rgba(20,10,25,0.55); border: 1px solid rgba(255,160,80,0.35);
  backdrop-filter: blur(8px); color: #fff;
}
#mute-btn:active { transform: scale(0.92); }

#control-hint {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 1px;
  color: rgba(255,224,176,0.85); background: rgba(20,10,25,0.5);
  padding: 8px 16px; border-radius: 20px; backdrop-filter: blur(6px);
  transition: opacity 1s ease; text-align: center; white-space: nowrap;
}
#control-hint.faded { opacity: 0; }

/* floating score text */
.floater {
  position: absolute; font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: 18px; pointer-events: none; text-shadow: 0 0 10px currentColor;
  transform: translate(-50%,-50%); will-change: transform, opacity;
}

/* ---- mobile joystick + leap ---- */
.mobile-only { display: none; }
#joystick {
  position: absolute; bottom: 30px; left: 30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(20,10,25,0.4); border: 2px solid rgba(159,232,255,0.4);
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; top: 50%; left: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%; background: rgba(159,232,255,0.55); box-shadow: 0 0 16px rgba(159,232,255,0.6);
}
#leap-pad {
  position: absolute; bottom: 40px; right: 30px; width: 100px; height: 100px;
  border-radius: 50%; background: rgba(255,120,40,0.35); border: 2px solid rgba(255,160,80,0.6);
  display: flex; align-items: center; justify-content: center; pointer-events: auto;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #ffe0b0; letter-spacing: 2px;
  box-shadow: 0 0 24px rgba(255,120,40,0.4); touch-action: none;
}
#leap-pad:active { transform: scale(0.9); background: rgba(255,120,40,0.55); }

@media (hover: none) and (pointer: coarse) {
  .mobile-only { display: flex; }
  #control-hint { bottom: 170px; font-size: 9px; white-space: normal; max-width: 60vw; }
  #mute-btn { bottom: 160px; }
}

/* ---- start overlay ---- */
#start-overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 120%, #ff8c42 0%, #6a3560 45%, #2a1830 100%);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#start-overlay.gone { opacity: 0; transform: scale(1.1); pointer-events: none; }
.overlay-inner {
  text-align: center; max-width: 520px; padding: 30px; color: #ffe8d0;
  animation: rise 0.8s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.planet-badge {
  font-size: 64px; animation: bob 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(255,140,66,0.8));
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }
.overlay-inner h1 {
  font-weight: 800; font-size: clamp(40px, 10vw, 72px); letter-spacing: 2px;
  margin: 10px 0; color: #fff; text-shadow: 0 0 30px rgba(255,120,30,0.7);
}
.poem {
  font-size: 15px; line-height: 1.7; color: rgba(255,232,208,0.9);
  font-style: italic; margin: 8px auto 24px; max-width: 440px;
}
#drift-in {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 18px; letter-spacing: 4px;
  padding: 16px 44px; border: none; border-radius: 40px; cursor: pointer; color: #2a1830;
  background: linear-gradient(135deg, #ffd54a, #ff9c3a); text-transform: uppercase;
  box-shadow: 0 8px 30px rgba(255,120,30,0.5); transition: transform 0.2s, box-shadow 0.2s;
}
#drift-in:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 40px rgba(255,120,30,0.7); }
#drift-in:active { transform: scale(0.97); }
.tiny { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 1px; color: rgba(159,232,255,0.8); margin-top: 22px; }
.tiny b { color: #ffd54a; }
.overlay-foot { margin-top: 24px; }
.overlay-foot a {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 2px;
  color: rgba(255,232,208,0.55); text-decoration: none; border-bottom: 1px dotted rgba(255,232,208,0.4);
}
.overlay-foot a:hover { color: #ffd54a; }