/* === Desert Outbreak — Zombie TDS === */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1206;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #f4e9d2;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #c9a163;
  image-rendering: -webkit-optimize-contrast;
  cursor: crosshair;
}
@media (hover: none) and (pointer: coarse) {
  #game { cursor: default; }
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: env(safe-area-inset-left, 12px);
  padding: 12px 14px;
  background: rgba(20, 14, 6, 0.55);
  border: 2px solid rgba(244, 200, 110, 0.4);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.2;
  z-index: 10;
  min-width: 220px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.hud-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.hud-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  image-rendering: -webkit-optimize-contrast;
}
.hud-text {
  font-weight: 700;
  color: #ffe9a8;
  font-size: 15px;
}
.hud-sub {
  color: #c8b890;
  font-size: 12px;
  opacity: 0.85;
}
.bar {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(244, 200, 110, 0.4);
  border-radius: 6px;
  overflow: hidden;
  min-width: 80px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(180deg, #ff5b46, #b71b1b);
  transition: width 0.15s ease-out;
}
.bar-fill.hp { background: linear-gradient(180deg, #6fd66f, #1d8a2c); }

/* ===== Touch controls (mobile) ===== */
#touch-controls { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#touch-controls.hidden { display: none; }
.joy {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.joy.active { opacity: 1; }
.joy-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(40, 30, 12, 0.4);
  border: 3px solid rgba(244, 200, 110, 0.5);
}
.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: rgba(244, 200, 110, 0.85);
  border: 2px solid #1a1206;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.tbtn {
  position: absolute;
  pointer-events: auto;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(40, 30, 12, 0.6);
  border: 3px solid rgba(244, 200, 110, 0.6);
  color: #ffd066;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
}
.tbtn:active { background: rgba(244, 200, 110, 0.85); color: #1a1206; }
#btn-dash   { right: 24px; bottom: 130px; }
#btn-weapon { right: 130px; bottom: 24px; }

/* ===== Overlays ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(20, 14, 6, 0.85) 0%, rgba(10, 6, 2, 0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.overlay.hidden { display: none; }
.panel {
  background: rgba(35, 22, 8, 0.92);
  border: 2px solid rgba(244, 200, 110, 0.6);
  border-radius: 14px;
  padding: 30px 36px;
  text-align: center;
  max-width: 480px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
.panel h1 {
  font-size: clamp(28px, 6vw, 44px);
  color: #ffd066;
  letter-spacing: 2px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  margin-bottom: 6px;
}
.panel .sub {
  color: #d8c79a;
  font-size: 14px;
  margin-bottom: 18px;
}
.controls-help {
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.controls-help .ch { display: flex; gap: 8px; margin: 4px 0; }
.controls-help .ch b { color: #ffd066; min-width: 60px; }
.controls-help .ch span { color: #e0d2a8; }
.btn {
  background: linear-gradient(180deg, #ffd066, #b8841a);
  color: #1a1206;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 12px 36px;
  border: 2px solid #6b4a0c;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 #6b4a0c, 0 6px 12px rgba(0,0,0,0.5);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #6b4a0c, 0 2px 6px rgba(0,0,0,0.5);
}
.credit {
  margin-top: 16px;
  font-size: 11px;
  color: #998667;
  opacity: 0.8;
}

/* ===== Wave banner ===== */
.banner {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  pointer-events: none;
  background: rgba(20, 14, 6, 0.75);
  border: 2px solid rgba(244, 200, 110, 0.8);
  padding: 18px 40px;
  border-radius: 12px;
  animation: banner-in 1.8s ease forwards;
}
.banner.hidden { display: none; }
.banner span {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: 4px;
  color: #ffd066;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
@keyframes banner-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  35%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

@media (max-width: 600px) {
  #hud { font-size: 12px; min-width: 180px; padding: 8px 10px; }
  .hud-icon { width: 22px; height: 22px; }
  .hud-text { font-size: 13px; }
  .panel { padding: 22px 18px; }
}
