:root {
  --cyan: #6ee7ff;
  --cyan-dim: #3a7f96;
  --amber: #ffc46b;
  --danger: #ff5a5a;
  --panel-bg: rgba(6, 14, 24, 0.55);
  --panel-border: rgba(110, 231, 255, 0.25);
  --font: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

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

html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: var(--font); color: #cfe8f5; }

#scene { position: fixed; inset: 0; display: block; cursor: crosshair; }

.hidden { display: none !important; }

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

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 10px 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  letter-spacing: 0.08em;
}

#topleft { position: absolute; top: 16px; left: 16px; }
#topleft h1 {
  font-size: 15px; letter-spacing: 0.5em; color: var(--cyan);
  text-shadow: 0 0 12px rgba(110, 231, 255, 0.6);
  margin-bottom: 6px; font-weight: 600;
}

#topright { position: absolute; top: 16px; right: 16px; text-align: right; }

#bottomleft { position: absolute; bottom: 16px; left: 16px; min-width: 170px; }
#bottomleft .big { font-size: 26px; color: #fff; text-shadow: 0 0 10px rgba(110,231,255,.5); }
#bottomleft .big small { font-size: 12px; color: var(--cyan-dim); }
#bottomleft .mode { margin-top: 4px; color: var(--cyan); font-size: 11px; letter-spacing: 0.3em; }
#bottomleft .mode.warp { color: var(--amber); text-shadow: 0 0 10px rgba(255,196,107,.8); }
#bottomleft .mode.auto { color: #9dff9d; }

#target-panel { position: absolute; bottom: 16px; right: 16px; min-width: 220px; text-align: right; }
#info-panel { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); max-width: 420px; text-align: center; }

.label { font-size: 10px; color: var(--cyan-dim); letter-spacing: 0.35em; margin-bottom: 4px; }
.tname { font-size: 16px; color: #fff; margin-bottom: 2px; }
.ttype { font-size: 11px; color: var(--amber); margin-bottom: 6px; }
.flavor { font-size: 11px; color: #9fc3d4; font-style: italic; line-height: 1.5; }
.row { color: #8fb3c4; }
.val { color: #fff; }
.hint { margin-top: 6px; font-size: 10px; color: var(--cyan-dim); }

#crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 26px; height: 26px; opacity: 0.85;
}
#crosshair::before, #crosshair::after, #crosshair span {
  content: ""; position: absolute; background: var(--cyan);
  box-shadow: 0 0 6px rgba(110,231,255,.9);
}
#crosshair::before { left: 50%; top: 0; width: 1px; height: 7px; transform: translateX(-50%); }
#crosshair::after { left: 50%; bottom: 0; width: 1px; height: 7px; transform: translateX(-50%); }
#crosshair span { top: 50%; left: 0; height: 1px; width: 7px; transform: translateY(-50%); }
#crosshair span::after {
  content: ""; position: absolute; right: -19px; top: 0; height: 1px; width: 7px;
  background: var(--cyan); box-shadow: 0 0 6px rgba(110,231,255,.9);
}

#reticle { position: absolute; transform: translate(-50%, -50%); text-align: center; }
#reticle .dia {
  width: 30px; height: 30px; margin: 0 auto;
  border: 1px solid var(--amber); transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(255,196,107,.5), inset 0 0 10px rgba(255,196,107,.25);
}
#reticle.offscreen .dia { border-style: dashed; opacity: .7; }
#reticle-label {
  margin-top: 6px; font-size: 10px; color: var(--amber);
  letter-spacing: 0.15em; text-shadow: 0 0 6px #000; white-space: nowrap;
}

#toast {
  position: absolute; top: 14%; left: 50%; transform: translateX(-50%);
  font-size: 14px; letter-spacing: 0.25em; color: #fff; text-align: center;
  text-shadow: 0 0 14px var(--cyan); opacity: 0; transition: opacity .4s ease;
  pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ---------- Galaxy map ---------- */
#map-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(2, 6, 12, 0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#map { border: 1px solid var(--panel-border); border-radius: 6px; cursor: pointer;
  box-shadow: 0 0 60px rgba(110,231,255,.08); }
#map-hint { margin-top: 12px; font-size: 11px; color: var(--cyan-dim); letter-spacing: .15em; }

/* ---------- Help ---------- */
#help {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 30; min-width: 340px;
}
#help table { border-collapse: collapse; width: 100%; }
#help td { padding: 3px 8px; font-size: 12px; color: #b9d9e8; }
#help td:first-child { color: var(--cyan); text-align: right; white-space: nowrap; }

/* ---------- Intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20,40,70,.55), rgba(0,0,0,.92) 70%);
}
#intro .inner { text-align: center; max-width: 640px; padding: 24px; }
#intro h1 {
  font-size: clamp(34px, 7vw, 64px); letter-spacing: 0.45em; color: #fff;
  text-shadow: 0 0 30px rgba(110,231,255,.8), 0 0 80px rgba(110,231,255,.4);
  margin-bottom: 10px; font-weight: 600; padding-left: 0.45em;
}
#intro .sub { color: #9fc3d4; font-size: 13px; letter-spacing: .15em; margin-bottom: 30px; }
#intro .cols { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 34px; }
#intro .cols div {
  border: 1px solid var(--panel-border); border-radius: 4px; padding: 10px 14px;
  font-size: 10px; color: #8fb3c4; letter-spacing: .1em; line-height: 1.8;
  background: var(--panel-bg); min-width: 120px;
}
#intro .cols b { color: var(--cyan); font-size: 11px; }
#launch {
  font-family: var(--font); font-size: 15px; letter-spacing: 0.3em;
  color: #001018; background: var(--cyan); border: none; border-radius: 3px;
  padding: 14px 34px; cursor: pointer;
  box-shadow: 0 0 30px rgba(110,231,255,.5);
  transition: transform .15s ease, box-shadow .15s ease;
}
#launch:hover { transform: scale(1.05); box-shadow: 0 0 46px rgba(110,231,255,.9); }
#intro .fine { margin-top: 22px; font-size: 10px; color: var(--cyan-dim); letter-spacing: .2em; }

/* ---------- Death ---------- */
#death-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; text-align: center;
  animation: deathfade .6s ease;
}
@keyframes deathfade { from { opacity: 0; } to { opacity: 1; } }
#death-overlay h2 {
  color: var(--danger); font-size: 30px; letter-spacing: 0.4em;
  text-shadow: 0 0 26px rgba(255,90,90,.8); margin-bottom: 14px;
}
#death-overlay p { color: #b78; font-size: 12px; letter-spacing: .2em; line-height: 2; }
