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

:root {
  --teal: #35f0d0;
  --danger: #ff5470;
  --bg: #010409;
}

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

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

/* ---------- 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 { display: flex; flex-direction: column; gap: 2px; }

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

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

.hud-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--teal);
  text-shadow: 0 0 10px rgba(53,240,208,.55);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
}

.hud-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.dots span {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
  transition: all .25s;
}

.dots span.lost {
  background: #233;
  box-shadow: none;
  transform: scale(.45);
  opacity: .35;
}

.energy-label { margin-top: 8px; }

.energy-bar {
  width: 170px;
  height: 10px;
  border: 1px solid rgba(53,240,208,.5);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(53,240,208,.06);
}

#energy-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #1a8f7c, var(--teal));
  box-shadow: 0 0 12px rgba(53,240,208,.7);
  transition: width .12s linear;
}

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

#hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 2px;
  color: #4f8b80;
  pointer-events: none;
  animation: hintPulse 3s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes hintPulse {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

/* ---------- 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(2,10,12,.88) 0%, rgba(1,4,9,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(44px, 9vw, 92px);
  font-weight: 800;
  letter-spacing: 10px;
  line-height: 1;
  color: #eafffa;
}

.game-title span {
  color: var(--teal);
  text-shadow: 0 0 28px var(--teal), 0 0 70px rgba(53,240,208,.4);
}

.tagline {
  font-size: clamp(14px, 2.2vw, 19px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--danger);
  text-shadow: 0 0 16px rgba(255,84,112,.55);
}

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

.rules strong { color: var(--teal); }

.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(--teal);
  background: transparent;
  border: 2px solid var(--teal);
  border-radius: 40px;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 18px rgba(53,240,208,.22), inset 0 0 14px rgba(53,240,208,.07);
}

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

.best {
  font-size: 13px;
  letter-spacing: 2px;
  color: #ffd76a;
  text-shadow: 0 0 10px rgba(255,215,106,.45);
}

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

h2 {
  font-size: clamp(30px, 6vw, 52px);
  letter-spacing: 8px;
  color: #eafffa;
}

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

.over-title {
  color: var(--danger);
  text-shadow: 0 0 26px var(--danger), 0 0 70px rgba(255,84,112,.4);
}

.bonus {
  font-size: clamp(18px, 3vw, 26px);
  color: var(--teal);
  text-shadow: 0 0 14px rgba(53,240,208,.5);
  white-space: pre-line;
}

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

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

.final-score {
  font-size: clamp(46px, 9vw, 84px);
  font-weight: 800;
  color: var(--teal);
  text-shadow: 0 0 30px var(--teal);
  font-variant-numeric: tabular-nums;
}
