/* ============ SPACE DISCOVERER — HUD & TITLE ============ */
:root {
  --cyan: #6ff3ff;
  --cyan-dim: rgba(111, 243, 255, 0.55);
  --amber: #ffc46b;
  --panel-bg: rgba(4, 14, 22, 0.55);
  --panel-border: rgba(111, 243, 255, 0.28);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; font-family: var(--font); }
#gl { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
.key {
  font-family: var(--mono); font-size: 10px; color: var(--cyan);
  border: 1px solid var(--panel-border); border-radius: 3px;
  padding: 1px 5px; background: rgba(111, 243, 255, 0.07);
  white-space: nowrap;
}
.dim { opacity: 0.55; font-weight: 400; }

/* ================= TITLE SCREEN ================= */
#title-screen {
  position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(ellipse 120% 90% at 50% 110%, #0b1a33 0%, #050a18 45%, #01030a 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.4s ease;
}
#title-screen.fade-out { opacity: 0; pointer-events: none; }
.title-stars { position: absolute; inset: 0; overflow: hidden; }
.title-stars::before, .title-stars::after {
  content: ""; position: absolute; inset: -50%;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff 100%, transparent),
    radial-gradient(1px 1px at 40% 70%, #cfe6ff 100%, transparent),
    radial-gradient(1.5px 1.5px at 65% 20%, #fff 100%, transparent),
    radial-gradient(1px 1px at 80% 55%, #ffe9c9 100%, transparent),
    radial-gradient(1px 1px at 10% 80%, #fff 100%, transparent),
    radial-gradient(1.5px 1.5px at 90% 85%, #cfe6ff 100%, transparent),
    radial-gradient(1px 1px at 55% 45%, #fff 100%, transparent),
    radial-gradient(1px 1px at 33% 12%, #fff 100%, transparent),
    radial-gradient(1px 1px at 72% 68%, #ffe9c9 100%, transparent),
    radial-gradient(1.5px 1.5px at 5% 45%, #fff 100%, transparent);
  background-size: 640px 640px;
  animation: starDrift 120s linear infinite;
  opacity: 0.9;
}
.title-stars::after { background-size: 340px 340px; animation-duration: 70s; opacity: 0.5; }
@keyframes starDrift { from { transform: translateY(0); } to { transform: translateY(640px); } }

.title-inner { position: relative; text-align: center; color: #dceeff; padding: 24px; max-width: 720px; }
.title-glyph { font-size: 30px; color: var(--cyan); text-shadow: 0 0 22px var(--cyan); margin-bottom: 6px; }
#title-screen h1 {
  font-size: clamp(38px, 7vw, 74px); font-weight: 200; letter-spacing: 0.32em;
  text-indent: 0.32em; color: #f2faff;
  text-shadow: 0 0 14px rgba(111,243,255,.65), 0 0 60px rgba(111,243,255,.35);
}
.subtitle { margin-top: 10px; font-weight: 300; letter-spacing: 0.22em; font-size: 13px; color: rgba(190, 220, 255, 0.75); text-transform: uppercase; }
.controls-grid {
  margin: 34px auto 0; display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 9px 26px; font-size: 12px; color: rgba(200, 225, 255, 0.8); text-align: left; max-width: 640px;
}
#launch-btn {
  margin-top: 38px; font-family: var(--font); font-size: 17px; font-weight: 300; letter-spacing: 0.35em; text-indent: 0.35em;
  color: var(--cyan); background: rgba(111, 243, 255, 0.05);
  border: 1px solid var(--cyan-dim); border-radius: 3px; padding: 15px 58px; cursor: pointer;
  transition: all 0.25s ease;
}
#launch-btn:hover { background: rgba(111, 243, 255, 0.16); box-shadow: 0 0 32px rgba(111, 243, 255, 0.4); color: #fff; }
.title-hint { margin-top: 20px; font-size: 11px; letter-spacing: 0.14em; color: rgba(160, 195, 230, 0.5); }

/* ================= HUD GENERIC ================= */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.panel {
  position: absolute; background: var(--panel-bg); border: 1px solid var(--panel-border);
  border-radius: 4px; padding: 10px 14px; color: #cfeaff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.45), inset 0 0 18px rgba(111, 243, 255, 0.03);
  pointer-events: auto;
}
.panel-title {
  font-size: 10px; letter-spacing: 0.3em; color: var(--cyan); margin-bottom: 8px;
  border-bottom: 1px solid rgba(111, 243, 255, 0.18); padding-bottom: 5px;
}
.stat-row { display: flex; justify-content: space-between; gap: 18px; font-size: 11px; padding: 2px 0; letter-spacing: 0.08em; }
.stat-row span { color: rgba(160, 205, 235, 0.7); }
.stat-row b { font-family: var(--mono); font-weight: 400; color: #eaf7ff; }

/* status (top-left) */
#status-panel { top: 18px; left: 18px; width: 216px; }
.throttle-bar {
  position: relative; height: 12px; margin: 7px 0; border: 1px solid rgba(111, 243, 255, 0.25);
  border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, 0.35);
}
#throttle-fill {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, rgba(111, 243, 255, 0.25), rgba(111, 243, 255, 0.75));
  transition: width 0.08s linear;
}
#throttle-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; color: #eaf7ff; text-shadow: 0 0 4px #000;
}
#stat-boost.boost-active { color: var(--amber); }
#stat-warp.warp-active { color: var(--amber); animation: pulse 0.5s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

/* target (top-right) */
#target-panel { top: 18px; right: 18px; width: 264px; }
.tp-name { font-size: 19px; font-weight: 300; letter-spacing: 0.18em; color: #fff; margin-bottom: 6px; text-shadow: 0 0 12px rgba(111, 243, 255, 0.5); }
#tp-desc { margin-top: 8px; font-size: 11px; line-height: 1.55; color: rgba(190, 220, 250, 0.8); }
.tp-warp-hint { margin-top: 9px; font-size: 11px; color: var(--amber); letter-spacing: 0.1em; }

/* nav (bottom-left) */
#nav-panel { bottom: 18px; left: 18px; width: 236px; max-height: 44vh; display: flex; flex-direction: column; }
#nav-list { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent; }
#nav-list::-webkit-scrollbar { width: 4px; }
#nav-list::-webkit-scrollbar-thumb { background: var(--cyan-dim); }
.nav-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 12px; padding: 4px 7px; cursor: pointer; border-radius: 2px; letter-spacing: 0.06em;
  color: rgba(200, 228, 255, 0.85); border-left: 2px solid transparent;
}
.nav-item:hover { background: rgba(111, 243, 255, 0.1); }
.nav-item.selected { border-left-color: var(--amber); background: rgba(255, 196, 107, 0.09); color: #fff; }
.nav-item .nav-dist { font-family: var(--mono); font-size: 10px; color: rgba(140, 190, 225, 0.6); }
.nav-item .nav-type { font-size: 9px; letter-spacing: 0.14em; color: rgba(120, 180, 215, 0.55); margin-right: 6px; }
.nav-sep { font-size: 9px; letter-spacing: 0.25em; color: var(--cyan-dim); padding: 8px 7px 3px; }

/* help (bottom-right) */
#help-panel { bottom: 18px; right: 18px; width: 232px; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 11px; color: rgba(190, 220, 250, 0.8); }

/* reticle */
#reticle { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ret-ring {
  width: 34px; height: 34px; border: 1px solid rgba(111, 243, 255, 0.5); border-radius: 50%;
  box-shadow: 0 0 10px rgba(111, 243, 255, 0.25);
}
.ret-dot { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; background: var(--cyan); border-radius: 50%; transform: translate(-50%, -50%); }

/* target marker */
#target-marker { position: absolute; transform: translate(-50%, -50%); text-align: center; transition: opacity 0.2s; }
.tm-diamond {
  width: 18px; height: 18px; margin: 0 auto; border: 1.5px solid var(--amber);
  transform: rotate(45deg); box-shadow: 0 0 12px rgba(255, 196, 107, 0.5);
}
.tm-label { margin-top: 8px; white-space: nowrap; font-size: 11px; letter-spacing: 0.14em; color: var(--amber); text-shadow: 0 0 6px #000; }
.tm-label span { display: block; }
#tm-dist { font-family: var(--mono); font-size: 10px; color: rgba(255, 214, 150, 0.8); }

/* body labels */
#labels { position: absolute; inset: 0; overflow: hidden; }
.body-label {
  position: absolute; transform: translate(-50%, -50%); font-size: 10px; letter-spacing: 0.2em;
  color: rgba(180, 220, 255, 0.85); text-shadow: 0 0 5px #000, 0 0 2px #000; white-space: nowrap;
  cursor: pointer; pointer-events: auto; padding: 3px 6px;
}
.body-label:hover { color: #fff; }
.body-label::before { content: "◈ "; color: var(--cyan-dim); }

/* alert */
#alert {
  position: absolute; left: 50%; top: 26%; transform: translateX(-50%);
  font-size: 21px; font-weight: 200; letter-spacing: 0.5em; text-indent: 0.5em; color: var(--amber);
  text-shadow: 0 0 18px rgba(255, 196, 107, 0.7); opacity: 0; transition: opacity 0.4s; white-space: nowrap;
}
#alert.show { opacity: 1; }

/* overlays */
#warp-overlay {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(120, 200, 255, 0.25) 75%, rgba(200, 235, 255, 0.65) 100%);
  transition: opacity 0.3s;
}
#fade-overlay { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }
