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

:root {
  --violet: #a06bff;
  --lime: #c8ff4d;
  --amber: #ffcf5c;
  --danger: #ff5470;
  --bg: #0a0714;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #efeaff;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
}

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

.hud-left, .hud-right { display: flex; flex-direction: column; gap: 2px; }
.hud-right { text-align: right; }

.hud-row { display: flex; gap: 12px; align-items: baseline; }
.hud-right .hud-row { justify-content: flex-end; }

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #7a68a8;
}

.hud-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--lime);
  text-shadow: 0 0 10px rgba(200,255,77,.4);
  font-variant-numeric: tabular-nums;
}

#deaths { color: var(--danger); text-shadow: 0 0 10px rgba(255,84,112,.45); }

.hud-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.timeline {
  width: 210px;
  height: 9px;
  border: 1px solid rgba(160,107,255,.55);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(160,107,255,.07);
}

#timeline-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #5b3d99, var(--violet));
  box-shadow: 0 0 12px rgba(160,107,255,.6);
}

.timeline.critical { border-color: var(--danger); }
.timeline.critical #timeline-fill {
  background: linear-gradient(90deg, #8f1a34, var(--danger));
  box-shadow: 0 0 12px rgba(255,84,112,.7);
}

.sector-name {
  font-size: 11px;
  letter-spacing: 4px;
  color: #9d86d6;
  text-transform: uppercase;
}

#hintbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 2px;
  color: #67588f;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(16,9,32,.88) 0%, rgba(10,7,20,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(42px, 8.5vw, 90px);
  font-weight: 800;
  letter-spacing: 9px;
  line-height: 1;
  color: #f4efff;
}

.game-title span {
  color: var(--violet);
  text-shadow: 0 0 28px var(--violet), 0 0 70px rgba(160,107,255,.4);
}

.tagline {
  font-size: clamp(14px, 2.2vw, 19px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--lime);
  text-shadow: 0 0 16px rgba(200,255,77,.45);
}

.rules p {
  margin: 5px 0;
  color: #b3a4d6;
  font-size: clamp(13px, 1.7vw, 15.5px);
}

.rules strong { color: var(--violet); }
.rules p:nth-child(4) strong { color: var(--danger); }

.btn {
  margin-top: 6px;
  padding: 15px 44px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--violet);
  background: transparent;
  border: 2px solid var(--violet);
  border-radius: 40px;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 18px rgba(160,107,255,.22), inset 0 0 14px rgba(160,107,255,.07);
}

.btn:hover {
  background: rgba(160,107,255,.13);
  box-shadow: 0 0 32px rgba(160,107,255,.55), inset 0 0 22px rgba(160,107,255,.16);
  transform: translateY(-2px);
}

.best {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255,207,92,.4);
}

.dim   { color: #7d6fa3; }
.small { font-size: 12px; letter-spacing: 1px; }

h2 {
  font-size: clamp(28px, 5.5vw, 48px);
  letter-spacing: 7px;
  color: #f4efff;
}

.clear-title {
  color: var(--lime);
  text-shadow: 0 0 26px var(--lime);
}

.final-title {
  color: var(--amber);
  text-shadow: 0 0 26px var(--amber), 0 0 70px rgba(255,207,92,.35);
}

.bonus {
  font-size: clamp(16px, 2.6vw, 22px);
  color: var(--lime);
  text-shadow: 0 0 14px rgba(200,255,77,.4);
  white-space: pre-line;
  line-height: 1.7;
}

.final-wrap { display: flex; flex-direction: column; gap: 6px; }

.final-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: #7a68a8;
}

.final-score {
  font-size: clamp(44px, 8.5vw, 78px);
  font-weight: 800;
  color: var(--amber);
  text-shadow: 0 0 30px var(--amber);
  font-variant-numeric: tabular-nums;
}
