:root {
  --c-bg: #000000;
  --c-line: #ffffff;
  --c-thrust: #ff7a59;
  --c-bullet: #ffffff;
  --c-hyper: #6ec6ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--c-bg);
  overflow: hidden;
  font-family: 'VT323', 'Courier New', monospace;
  color: var(--c-line);
  -webkit-user-select: none;
  user-select: none;
}

#game {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--c-bg);
  touch-action: none;
}

.fallback-msg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  font-size: 20px;
  color: var(--c-line);
  background: var(--c-bg);
  z-index: 999;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px;
  pointer-events: none;
  z-index: 20;
}

.hud-panel {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.85), 0 0 12px rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

#hud-lives {
  display: flex;
  gap: 8px;
  align-items: center;
}

#hud-lives svg { display: block; filter: drop-shadow(0 0 4px rgba(255,255,255,0.8)); }

#hyperspace-indicator {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  color: var(--c-hyper);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
  text-shadow: 0 0 6px rgba(110, 198, 255, 0.9);
  pointer-events: none;
}

#hyperspace-bar {
  display: inline-block;
  width: 90px;
  height: 8px;
  border: 1px solid var(--c-hyper);
  border-radius: 3px;
  overflow: hidden;
}

#hyperspace-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--c-hyper);
  box-shadow: 0 0 8px var(--c-hyper);
  transition: width 0.08s linear;
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.overlay[hidden] { display: none; }
.overlay.fade-out { opacity: 0; }

.overlay-box {
  text-align: center;
  padding: 32px 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.08);
  max-width: 520px;
}

.title {
  font-size: 64px;
  letter-spacing: 0.35em;
  margin: 0 0 18px 4px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 26px rgba(255, 255, 255, 0.5);
  font-weight: normal;
}

.legend {
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.9);
}

.hint {
  font-size: 22px;
  letter-spacing: 0.1em;
  color: var(--c-line);
}

.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { opacity: 0.15; } }

.mobile-hint {
  display: none;
  font-size: 16px;
  color: var(--c-thrust);
  margin-top: 14px;
  letter-spacing: 0.04em;
}

.final-score, .best-score {
  font-size: 28px;
  margin: 6px 0;
  letter-spacing: 0.08em;
}

.best-score { color: var(--c-hyper); }

.restart-btn {
  margin-top: 22px;
  font-family: 'VT323', monospace;
  font-size: 26px;
  letter-spacing: 0.12em;
  padding: 10px 30px;
  background: transparent;
  color: var(--c-thrust);
  border: 2px solid var(--c-thrust);
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(255, 122, 89, 0.8);
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.restart-btn:hover, .restart-btn:focus {
  box-shadow: 0 0 18px rgba(255, 122, 89, 0.9), 0 0 34px rgba(255, 122, 89, 0.4);
  background: rgba(255, 122, 89, 0.08);
  outline: none;
}

@media (max-width: 767px) {
  .title { font-size: 42px; letter-spacing: 0.22em; }
  .legend { font-size: 15px; }
  .hint { font-size: 18px; }
  .overlay-box { padding: 24px 22px; max-width: 90vw; }
  .hud-panel { font-size: 20px; padding: 5px 10px; }
  .mobile-hint { display: block; }
  #hyperspace-indicator { font-size: 15px; }
}

.fallback-msg[hidden] { display: none; }
