* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #2a3d4d; }
body { font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif; color: #efe3cf; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; }
.hud-label { font-size: 11px; letter-spacing: 2px; color: #c98f5a; margin-bottom: 2px; }
#hud-left { position: absolute; top: 14px; left: 14px; }
#hud-right { position: absolute; top: 14px; right: 14px; text-align: right; }
#hp-bar { width: 190px; height: 14px; border: 2px solid #7a5233; background: #241a12; border-radius: 3px; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #3fb8af, #7ad9a0); transition: width .2s; }
#hp-fill.hurt { background: linear-gradient(90deg, #e8543f, #ffb45e); }
#score { font-size: 26px; font-weight: bold; color: #ffd97a; text-shadow: 0 2px 4px #000; }
#wave, #foes { font-size: 16px; color: #efe3cf; margin-bottom: 6px; }
#lives { margin-top: 6px; font-size: 14px; color: #7ad9a0; }
#banner {
  position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
  font-size: clamp(20px, 4vw, 34px); letter-spacing: 4px; color: #ffd97a;
  text-shadow: 0 2px 8px #000; opacity: 0; transition: opacity .4s; white-space: nowrap;
}
#banner.show { opacity: 1; }

#crosshair {
  position: absolute; left: 50%; top: 52%; width: 34px; height: 34px;
  transform: translate(-50%, -50%); border: 2px solid rgba(255, 217, 122, .75);
  border-radius: 50%;
}
#cross-dot { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px;
  transform: translate(-50%, -50%); background: #ffd97a; border-radius: 50%; }

/* touch controls: visible on coarse pointers, off on desktop */
#touch-controls { display: none; }
.touch #touch-controls { display: block; }
#pad-drive { position: fixed; left: 14px; bottom: 14px; width: 168px; height: 168px; }
#pad-drive button {
  position: absolute; width: 54px; height: 54px; border-radius: 12px;
  border: 2px solid #7a5233; background: rgba(36, 26, 18, .65); color: #efe3cf;
  font-size: 20px; pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none;
}
#pad-drive button:active { background: rgba(122, 82, 51, .8); }
#t-fwd { left: 57px; top: 0; }
#t-back { left: 57px; bottom: 0; }
#t-left { left: 0; top: 57px; }
#t-right { right: 0; top: 57px; }
#pad-aim { position: fixed; right: 14px; bottom: 14px; }
#t-fire {
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid #e8543f; background: rgba(232, 84, 63, .35);
  color: #ffd97a; font-size: 18px; letter-spacing: 2px;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
#t-fire:active { background: rgba(232, 84, 63, .7); }

/* overlays */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(18, 14, 10, .72); z-index: 10;
}
.overlay.hidden { display: none; }
.panel {
  max-width: 560px; width: min(92vw, 560px); padding: 28px 30px;
  background: linear-gradient(160deg, #2c2118, #1c1510);
  border: 2px solid #7a5233; border-radius: 14px; text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}
.panel h1 { font-size: clamp(28px, 6vw, 44px); letter-spacing: 5px; color: #ffd97a; text-shadow: 0 3px 0 #7a5233; }
.tag { color: #c98f5a; margin: 8px 0 18px; font-style: italic; }
.howto { list-style: none; text-align: left; display: inline-block; margin-bottom: 20px; }
.howto li { margin: 6px 0; color: #efe3cf; font-size: 15px; }
.howto b { color: #ffd97a; }
.cta {
  font: inherit; font-size: 19px; font-weight: bold; letter-spacing: 2px;
  padding: 13px 38px; border-radius: 10px; cursor: pointer;
  border: 2px solid #3fb8af; background: linear-gradient(180deg, #2f8f86, #1d6b64); color: #eafff9;
}
.cta:hover { background: linear-gradient(180deg, #37a39a, #24807a); }
#end-title.win { color: #7ad9a0; }
#end-title.lose { color: #e8543f; }

body.noanim #banner { transition: none; }
body.noanim #hp-fill { transition: none; }
