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

body {
  background: #1a0d2e;
  color: #fff;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Hiragino Maru Gothic Pro', 'BIZ UDPGothic', sans-serif;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  display: block;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 30;
}
.overlay.hidden { display: none; }

.overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.big-emoji  { font-size: 3.5rem; }
.ov-title   { font-size: 2.2rem; font-weight: bold; }
.ov-sub     { font-size: 1rem; opacity: 0.75; }
.ov-score, .ov-best { font-size: 1.1rem; opacity: 0.85; }
.ov-hint {
  font-size: 0.9rem;
  opacity: 0.5;
  margin-top: 6px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
}
#hud.hidden { display: none; }

.hud-row {
  display: flex;
  gap: 16px;
  padding: 6px 16px;
  background: rgba(0,0,0,0.5);
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.hud-item { white-space: nowrap; }

#btn-next-wave {
  pointer-events: all;
  display: block;
  margin: 4px auto 0;
  padding: 6px 20px;
  border: none;
  border-radius: 20px;
  background: #f59e0b;
  color: #fff;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
#btn-next-wave.hidden { display: none; }
#btn-next-wave:active { opacity: 0.7; }

/* Tower menu */
.tower-menu {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 10, 40, 0.95);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  padding: 14px 18px;
  z-index: 25;
  min-width: 280px;
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tower-menu.hidden { display: none; }

.tower-menu-title {
  font-size: 0.85rem;
  opacity: 0.6;
  text-align: center;
}

#tower-menu-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tower-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: bold;
  transition: opacity 0.15s;
}
.tower-btn:active { opacity: 0.65; }
.tower-btn.disabled { opacity: 0.35; pointer-events: none; }
.tower-btn.cancel {
  background: rgba(255,255,255,0.08);
  color: #fff;
  grid-column: 1/-1;
  font-weight: normal;
  font-size: 0.8rem;
}
.tower-btn .t-name  { font-size: 0.82rem; }
.tower-btn .t-cost  { font-size: 0.7rem; opacity: 0.8; }
.tower-btn .t-emoji { font-size: 1.4rem; }
