* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; }
body {
  background: #0a0a0c;
  color: #d8d8d8;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
canvas {
  background: #2a3a22;
  border: none;
  display: block;
  cursor: crosshair;
  image-rendering: auto;
}
#panel {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 240px;
  background: rgba(21, 23, 28, .82);
  backdrop-filter: blur(2px);
  border: 2px solid #333;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  z-index: 5;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
h1 { font-size: 16px; color: #f3c96b; margin-bottom: 8px; letter-spacing: 1px; }
.stat { margin: 3px 0; color: #cfcfcf; }
.stat b { color: #fff; }
.bar { height: 12px; background: #222; border: 1px solid #444; border-radius: 3px; overflow: hidden; margin: 2px 0 8px; }
.bar > div { height: 100%; transition: width .15s; }
#ccHp > div { background: linear-gradient(90deg,#5c9,#3c6); }
.btn {
  display: block; width: 100%; margin: 6px 0;
  padding: 8px 10px; border: 1px solid #555;
  background: #23262d; color: #eee; border-radius: 4px;
  cursor: pointer; font-size: 13px; text-align: left;
}
.btn:hover { background: #2f333c; }
.btn.active { background: #3d4a2a; border-color: #8bb24a; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .cost { float: right; color: #f3c96b; }
.btn .hot { color: #888; font-size: 11px; }
#waveBtn { background: #3a2222; border-color: #a44; text-align: center; font-weight: bold; }
#waveBtn:hover:not(:disabled) { background: #4a2a2a; }
#msg { margin-top: 8px; min-height: 32px; color: #f3c96b; font-size: 12px; }

.hint { color:#777; font-size:11px; margin-top:6px; line-height:1.4; }
#gameover {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; color: #f33; font-size: 28px;
}
#gameover.show { display: flex; }
#gameover button { margin-top: 18px; padding: 10px 22px; font-size: 16px; cursor: pointer; }