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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  color: #cfe;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: none; /* in-canvas crosshair doubles as the sonar-ready indicator */
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  background: #000;
  display: block;
}

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  pointer-events: none;
  z-index: 5;
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #6aa;
  width: 46px;
}

.bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(120,220,255,0.25);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.08s linear;
}

.bar-fill.heat { background: linear-gradient(90deg,#3fe,#f55); }
.bar-fill.sonar { background: linear-gradient(90deg,#39f,#8ef); }
.bar-fill.dash { background: linear-gradient(90deg,#5be,#bef); }
.bar-fill.boss { background: linear-gradient(90deg,#a3f,#e7f); }

#health-row {
  display: flex;
  gap: 5px;
}

.heart {
  width: 16px;
  height: 16px;
  background: #f34d6b;
  clip-path: polygon(50% 15%, 61% 5%, 75% 5%, 90% 20%, 90% 40%, 50% 90%, 10% 40%, 10% 20%, 25% 5%, 39% 5%);
  box-shadow: 0 0 6px #f34d6b;
}
.heart.empty {
  background: rgba(255,255,255,0.08);
  box-shadow: none;
}

#hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 13px;
  letter-spacing: 1px;
  color: #8fe;
  text-shadow: 0 0 6px rgba(100,255,230,0.5);
}

#wave-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  letter-spacing: 8px;
  color: #7ff;
  text-shadow: 0 0 20px #3ef, 0 0 60px #0af;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.4s ease;
}
#wave-banner.show { opacity: 1; }

#boss-bar {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 60vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 5;
}
#boss-bar.hidden { display: none; }
#boss-bar #boss-name {
  font-size: 11px;
  letter-spacing: 4px;
  color: #d9a4ff;
  text-shadow: 0 0 10px rgba(200,92,255,0.7);
}
#boss-bar .bar.boss {
  width: 100%;
  border-color: rgba(200,92,255,0.4);
}

#pause-hint {
  position: absolute;
  bottom: 10px;
  right: 16px;
  font-size: 11px;
  color: rgba(140,220,255,0.35);
  letter-spacing: 1px;
  z-index: 5;
}

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at center, rgba(6,14,20,0.96) 0%, rgba(0,0,0,0.98) 75%);
  z-index: 20;
  text-align: center;
  padding: 20px;
}

.overlay.hidden { display: none; }
.overlay { cursor: default; }

#best-line {
  font-size: 13px;
  letter-spacing: 3px;
  color: #ffd97a;
  text-shadow: 0 0 10px rgba(255,215,120,0.5);
}
#best-line:empty { display: none; }

.overlay h1 {
  font-size: 48px;
  letter-spacing: 6px;
  color: #d9f7ff;
  text-shadow: 0 0 18px rgba(120,220,255,0.6);
}

.overlay h2 {
  font-size: 24px;
  letter-spacing: 3px;
  color: #9ef;
}

.accent { color: #ff5577; text-shadow: 0 0 16px rgba(255,80,110,0.7); }

.tagline {
  color: #7cd;
  font-size: 14px;
  letter-spacing: 1px;
  opacity: 0.85;
}

.panel {
  border: 1px solid rgba(120,220,255,0.25);
  background: rgba(10,25,35,0.5);
  padding: 18px 26px;
  border-radius: 8px;
  max-width: 420px;
}

.panel h2 { font-size: 15px; margin-bottom: 10px; letter-spacing: 2px; }

.panel ul { list-style: none; text-align: left; font-size: 13px; line-height: 1.9; }
.panel ul b { color: #7ff; }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: #6ab;
  opacity: 0.8;
  line-height: 1.5;
}

button {
  font-family: inherit;
  background: transparent;
  border: 2px solid #4ef;
  color: #bff;
  padding: 12px 34px;
  font-size: 16px;
  letter-spacing: 3px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(70,230,255,0.25);
  transition: all 0.15s ease;
}
button:hover {
  background: rgba(70,230,255,0.15);
  box-shadow: 0 0 26px rgba(70,230,255,0.55);
  transform: translateY(-1px);
}

#upgrade-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
}

.upgrade-card {
  width: 220px;
  border: 1px solid rgba(120,220,255,0.3);
  background: rgba(8,20,30,0.6);
  border-radius: 10px;
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.upgrade-card:hover {
  border-color: #6ff;
  box-shadow: 0 0 22px rgba(90,240,255,0.35);
  transform: translateY(-3px);
}
.upgrade-card h3 {
  font-size: 14px;
  color: #9ff;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.upgrade-card p {
  font-size: 12px;
  color: #9cd;
  line-height: 1.5;
}
.upgrade-card .lvl {
  margin-top: 10px;
  font-size: 10px;
  color: #6ab;
  letter-spacing: 1px;
}

#upgrade-sub {
  font-size: 12px;
  color: #7cd;
  opacity: 0.85;
  max-width: 420px;
}

#final-stats {
  font-size: 14px;
  color: #9cd;
  line-height: 1.8;
}
