/* Game HUD: score, wave, pause. Everything else lives around the ship. */
.hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: calc(env(safe-area-inset-left, 0px) + 20px);
  right: calc(env(safe-area-inset-right, 0px) + 20px);
  z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none;
  contain: layout style paint;
}
.hud-stat {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 88px;
}
.hud-stat span {
  font: 600 10px/1 var(--mono);
  letter-spacing: .26em;
  color: rgba(191, 255, 216, .6);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}
.hud-stat b {
  font: 700 25px/1.05 var(--display);
  letter-spacing: .03em;
  color: #f2fff8;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(68, 255, 136, .32), 0 2px 10px rgba(0, 0, 0, .8);
}
.hud-wave {
  display: flex; align-items: flex-start; gap: 12px;
}
.hud-wave .hud-stat { align-items: flex-end; text-align: right; }
.hud-pause {
  pointer-events: auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  margin-top: 2px;
  background: rgba(4, 14, 11, .5);
  border: 1px solid rgba(191, 255, 216, .22);
  border-radius: 4px;
  color: rgba(232, 241, 255, .7);
  font: 700 11px/1 var(--mono); letter-spacing: .1em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hud-pause:hover { border-color: rgba(77, 255, 155, .6); color: #eafff2; }
.hud-pause:active { background: rgba(77, 255, 155, .18); }

/* Boss health: fixed at the top so it never hides behind an off-screen boss. */
.boss-hud {
  --bc: 255, 223, 106;
  position: absolute; top: 2px; left: 50%;
  transform: translateX(-50%);
  width: min(320px, 38vw);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .7));
}
.boss-hud-name {
  font: 600 10px/1 var(--mono);
  letter-spacing: .3em;
  color: rgb(var(--bc));
  text-shadow: 0 0 16px rgba(var(--bc), .4);
}
.boss-hud-track {
  position: relative;
  width: 100%; height: 6px;
  background: rgba(3, 8, 12, .78);
  border: 1px solid rgba(var(--bc), .42);
  overflow: hidden;
}
.boss-hud-track i {
  display: block; height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(var(--bc), .62), rgb(var(--bc)));
  box-shadow: 0 0 14px rgba(var(--bc), .55);
  transition: width .14s linear;
}
.boss-hud-track::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0 34.6%, rgba(0, 0, 0, .55) 34.6% 35.4%,
    transparent 35.4% 64.6%, rgba(0, 0, 0, .55) 64.6% 65.4%, transparent 65.4%);
}

/* Landscape phones: keep the readout clear of the notch and the pause button
   thumb-sized without eating the field. */
@media (max-height: 500px) {
  .hud {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: calc(env(safe-area-inset-left, 0px) + 14px);
    right: calc(env(safe-area-inset-right, 0px) + 14px);
  }
  .hud-stat b { font-size: 19px; }
  .hud-stat span { font-size: 9px; }
  .hud-pause { width: 36px; height: 36px; }
}
