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

body {
  background: #000;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ─── SPACE CANVAS ──────────────────────────────────────────────────────────── */
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
}
canvas:active { cursor: grabbing; }

/* ─── EARTH HORIZON ─────────────────────────────────────────────────────────── */
#earthHorizon {
  position: fixed;
  bottom: -10vh;
  left: 50%;
  transform: translateX(-50%);
  min-width: 200vw;
  max-height: 40vh;
  object-fit: cover;
  object-position: top;
  z-index: 10;
  pointer-events: none;
}

/* ─── GALACTIC SPINNER ───────────────────────────────────────────────────────── */
#galaxy-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
}

.spinner-orbit {
  position: relative;
  width: 64px;
  height: 64px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(100,160,255,0.12);
  border-top-color:   #7eb8f7;
  border-right-color: rgba(160,215,255,0.45);
  animation: galaxySpin 1.2s linear infinite;
  box-shadow: 0 0 18px rgba(100,160,255,0.28);
}

.spinner-ring-2 {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(200,169,110,0.08);
  border-bottom-color: rgba(200,169,110,0.55);
  animation: galaxySpin 0.85s linear infinite reverse;
}

.spinner-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 9px; height: 9px;
  background: #7eb8f7;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(100,160,255,0.9), 0 0 24px rgba(100,160,255,0.45);
  animation: coreBreath 1.5s ease-in-out infinite;
}

.spinner-label {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #5a88c0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: spinnerPulse 1.5s ease-in-out infinite;
}

@keyframes galaxySpin  { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes coreBreath  {
  0%,100% { opacity:0.7; transform:translate(-50%,-50%) scale(1);   }
  50%     { opacity:1;   transform:translate(-50%,-50%) scale(1.3); }
}
@keyframes spinnerPulse { 0%,100% { opacity:0.4; } 50% { opacity:1; } }

/* ─── MENU ───────────────────────────────────────────────────────────────────── */

/* Wrapper — anchors both pill and dropdown at top-left */
#menu-container {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 110;      /* above all other HUD elements */
  width: 186px;      /* pill and dropdown share this width */
}

/* The pill itself */
#menu-pill {
  width: 100%;
  padding: 8px 20px;
  border-radius: 40px;
  border: 1px solid rgba(255,210,60,0.55);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-align: center;
  user-select: none;
  /* Standout gold-cosmic gradient */
  background: linear-gradient(135deg, #b87c00 0%, #f5c518 45%, #b87c00 100%);
  color: #0d0800;
  box-shadow:
    0 0 18px rgba(220,170,0,0.55),
    0 0 40px rgba(220,170,0,0.20),
    0 4px 12px rgba(0,0,0,0.55);
  transition: box-shadow 0.2s, transform 0.15s, background 0.2s;
}
#menu-pill:hover {
  background: linear-gradient(135deg, #cc9000 0%, #ffd700 45%, #cc9000 100%);
  box-shadow:
    0 0 28px rgba(255,200,0,0.75),
    0 0 60px rgba(255,200,0,0.25),
    0 4px 16px rgba(0,0,0,0.6);
  transform: translateY(-1px);
}
#menu-pill:active { transform: translateY(0); }

/* Slide-down dropdown */
#menu-dropdown {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(160deg, #080f22 0%, #0b1a38 100%);
  border: 1px solid rgba(220,170,0,0.28);
  border-radius: 16px;
  overflow: hidden;

  /* Hidden state */
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    max-height 0.38s cubic-bezier(0.4,0,0.2,1),
    opacity    0.25s ease,
    transform  0.25s ease;
}
#menu-dropdown.open {
  max-height: 320px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-item {
  display: block;
  padding: 13px 20px;
  color: #b8d4f9;
  font-size: 13px;
  text-decoration: none;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(220,170,0,0.09);
  transition: background 0.15s, color 0.15s, padding-left 0.15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover {
  background: rgba(220,170,0,0.09);
  color: #f5c518;
  padding-left: 26px;
}

/* ─── HUD HINTS ─────────────────────────────────────────────────────────────── */
.info-hint {
  position: fixed; bottom: 16px; left: 16px;
  color: #c8dff8; background: rgba(10,20,50,0.82);
  padding: 10px 20px; border-radius: 40px;
  backdrop-filter: blur(6px); font-size: 14px;
  border: 1px solid #3a5a9f;
  cursor: pointer;
  z-index: 100; box-shadow: 0 4px 16px rgba(0,0,0,0.55);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  user-select: none;
}
.info-hint:hover {
  background: rgba(20,40,90,0.92);
  box-shadow: 0 0 22px rgba(80,140,255,0.45);
  transform: translateY(-1px);
}

.controls-hint {
  position: fixed; bottom: 16px; right: 16px;
  color: #ccd; background: rgba(20,20,40,0.7);
  padding: 8px 16px; border-radius: 40px;
  backdrop-filter: blur(4px); font-size: 14px;
  border: 1px solid #446; pointer-events: none;
  z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.star-note {
  position: fixed; top: 16px; right: 16px;
  color: #9cb6d9; background: rgba(0,0,0,0.5);
  padding: 6px 14px; border-radius: 30px; font-size: 13px;
  backdrop-filter: blur(2px); border: 1px solid #2a3a55;
  pointer-events: none; z-index: 100;
}

/* ─── MOBILE ─────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Menu centres horizontally, sitting just below star-note */
  #menu-container {
    top: 56px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  /* Bottom pills stack centred */
  .info-hint {
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .info-hint:hover {
    transform: translateX(-50%) translateY(-1px);
  }
  .controls-hint {
    bottom: 16px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
  }
}
