#hud {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(rgba(5, 2, 26, 0.85), rgba(5, 2, 26, 0.55));
  border-bottom: 1px solid rgba(255, 43, 214, 0.7);
  pointer-events: none;
}

#hud[hidden],
#controls[hidden],
#game-over[hidden],
#hud-boss[hidden] {
  display: none;
}

#hud p {
  margin: 0;
}

#hud-score {
  color: #3dfff2;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 0 8px #3dfff2;
}

#hud-wave {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

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

#hud-hearts {
  display: flex;
  gap: 4px;
}

.heart {
  width: 16px;
  height: 14px;
  background: #ff2bd6;
  clip-path: polygon(50% 100%, 0 38%, 12% 0, 38% 0, 50% 18%, 62% 0, 88% 0, 100% 38%);
}

.heart.is-empty {
  background: #3a1a4a;
}

#hud-weapon {
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 0 6px currentColor;
}

#hud-pips {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pip {
  background: #2a1a4a;
}

.pip--cell {
  width: 5px;
  height: 4px;
}

.pip--cell:nth-child(3) {
  margin-right: 6px;
}

.pip--cell.is-on {
  background: #f0a202;
}

.pip--tier {
  width: 11px;
  height: 6px;
}

#hud-effects {
  min-height: 1em;
  color: #f0a202;
  font-size: 11px;
  font-weight: 700;
}

#hud-boss {
  flex-basis: 100%;
  height: 8px;
  margin-top: 8px;
  border: 1px solid #f0a202;
  background: rgba(5, 2, 26, 0.8);
}

#hud-boss-fill {
  display: block;
  height: 100%;
  background: #ff2bd6;
}

#banner {
  position: absolute;
  top: 24%;
  left: 50%;
  margin: 0;
  font: 700 30px/1 ui-monospace, "Courier New", monospace;
  text-shadow: 0 0 10px currentColor;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#banner.is-showing {
  animation: banner 1.5s ease-out forwards;
}

@keyframes banner {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.8); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

#controls {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.stick {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  --tint: #3dfff2;
}

.stick--aim {
  --tint: #ff2bd6;
}

.stick-base,
.stick-knob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.stick-base {
  top: -52px;
  left: -52px;
  width: 104px;
  height: 104px;
  border: 3px solid var(--tint);
  background: color-mix(in srgb, var(--tint) 10%, transparent);
  opacity: 0.35;
}

.stick-knob {
  top: -22px;
  left: -22px;
  width: 44px;
  height: 44px;
  background: var(--tint);
  opacity: 0.5;
}

.stick.is-held .stick-base {
  opacity: 0.7;
}

.stick.is-held .stick-knob {
  opacity: 0.95;
}

.stick-label {
  position: absolute;
  top: 64px;
  left: 0;
  font: 700 11px/1 ui-monospace, "Courier New", monospace;
  transform: translateX(-50%);
  opacity: 0.75;
  pointer-events: none;
}

.stick.is-held .stick-label {
  opacity: 0;
}

#game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(320px, 90vw);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 18px 16px 20px;
  background: rgba(7, 4, 20, 0.94);
  border: 4px solid #ff2bd6;
  outline: 1px solid #3dfff2;
  outline-offset: -10px;
  text-align: center;
  transform: translate(-50%, -50%);
}

#game-over h2 {
  margin: 0 0 12px;
  color: #ff2bd6;
  font-size: 28px;
  text-shadow: 0 0 8px #ff2bd6;
}

#game-over p {
  margin: 6px 0;
  font-weight: 700;
}

#over-score {
  color: #3dfff2;
  font-size: 20px;
}

#over-best {
  color: #f0a202;
}

#over-prize {
  color: #f0a202;
  font-size: 16px;
  line-height: 1.35;
}

#over-prompt,
#board-note {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

#score-label,
#board-title {
  display: block;
  margin: 12px 0 0;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.04em;
}

#score-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

#board-title {
  color: #3dfff2;
}

#board-note {
  margin-top: 8px;
  opacity: 0.8;
}

#follow {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 16px;
  background: #ff2bd6;
  color: #070414;
  font-size: 15px;
  text-decoration: none;
}

#score-form {
  margin-top: 4px;
}

#score-name {
  flex: 1;
  min-width: 0;
  border: 3px solid #3dfff2;
  background: #070414;
  color: #f3e6c8;
  font: 700 14px ui-monospace, "Courier New", monospace;
  padding: 10px;
  touch-action: auto;
  user-select: text;
  -webkit-user-select: text;
}

#score-post {
  padding: 10px 12px;
  font-size: 14px;
}

#over-status {
  font-size: 12px;
  min-height: 1em;
}

#leaderboard {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 22vh;
  overflow: auto;
  text-align: left;
  font-size: 13px;
}

#leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-top: 2px solid rgba(61, 255, 242, 0.35);
}

#retry {
  margin-top: 12px;
  align-self: center;
}
