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

:root {
  --cyan: #00f0ff;
  --magenta: #ff2d78;
  --bg: #050510;
}

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

#game-container {
  position: fixed;
  inset: 0;
}

canvas {
  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;
  text-shadow: 0 0 12px currentColor;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: #7fd7e8;
  opacity: .8;
}

.hud-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.hud-value span {
  font-size: 13px;
  opacity: .7;
}

.hud-center { text-align: center; }
.hud-right  { text-align: right; }

.hearts span {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta), 0 0 22px rgba(255,45,120,.5);
  transition: transform .25s, opacity .25s;
}

.hearts span.lost {
  transform: scale(.4);
  opacity: .15;
  box-shadow: none;
  background: #553344;
}

/* ---------- flashes / popups ---------- */
#damage-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,30,60,.55) 100%);
  opacity: 0;
  transition: opacity .12s;
}

#damage-flash.on { opacity: 1; }

#combo-pop {
  position: fixed;
  top: 24%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan);
  pointer-events: none;
  animation: popup .7s ease-out forwards;
}

@keyframes popup {
  0%   { opacity: 0; transform: translateX(-50%) scale(.6); }
  25%  { opacity: 1; transform: translateX(-50%) scale(1.1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-46px) scale(1); }
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  background: rgba(4, 4, 14, .82);
  backdrop-filter: blur(6px);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

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

.game-title span {
  color: var(--cyan);
  text-shadow: 0 0 25px var(--cyan), 0 0 60px rgba(0,240,255,.45);
}

.tagline {
  font-size: clamp(15px, 2.4vw, 20px);
  letter-spacing: 4px;
  color: var(--magenta);
  text-shadow: 0 0 14px rgba(255,45,120,.6);
  text-transform: uppercase;
}

.rules p {
  margin: 6px 0;
  color: #9fc9d8;
  font-size: clamp(13px, 1.8vw, 16px);
}

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

.btn {
  margin-top: 8px;
  padding: 16px 46px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--cyan);
  background: transparent;
  border: 2px solid var(--cyan);
  border-radius: 40px;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 18px rgba(0,240,255,.25), inset 0 0 14px rgba(0,240,255,.08);
}

.btn:hover {
  background: rgba(0,240,255,.14);
  box-shadow: 0 0 32px rgba(0,240,255,.55), inset 0 0 22px rgba(0,240,255,.18);
  transform: translateY(-2px);
}

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

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

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

.crash-title {
  color: var(--magenta);
  text-shadow: 0 0 24px var(--magenta), 0 0 70px rgba(255,45,120,.4);
}

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

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

.final-score {
  font-size: clamp(48px, 10vw, 88px);
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 30px var(--cyan);
  font-variant-numeric: tabular-nums;
}
