/* ============ HUD MOBILE-FIRST ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #000; }

#canvas-wrap { position: fixed; inset: 0; touch-action: none; }

/* ============ HUD SUPERIOR ============ */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 12px; pointer-events: none;
  font: 12px system-ui;
}

/* Esquerda: Status vital */
#hud-left { pointer-events: auto; }
#hp-bar-wrap {
  width: 140px; height: 12px; background: rgba(0,0,0,0.5); 
  border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); overflow: hidden;
}
#hp-bar { height: 100%; background: linear-gradient(90deg, #e0523f, #ff7a5c); transition: width 0.2s; }
#hp-label { font-size: 10px; color: #fff; margin-top: 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
#xp-wrap { width: 140px; height: 4px; background: rgba(0,0,0,0.4); border-radius: 2px; margin-top: 4px; }
#xp-bar { height: 100%; background: linear-gradient(90deg, #5b8def, #8b5cf6); border-radius: 2px; }
#gold-wrap { 
  font-size: 13px; color: #ffd166; font-weight: 700; margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Direita: Missions + Status */
#hud-right { pointer-events: auto; text-align: right; }
#wave-chip {
  background: rgba(0,0,0,0.5); color: #6ee7c8; padding: 4px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 600; display: inline-block;
  border: 1px solid rgba(110,231,200,0.4);
}
#enemy-count-chip {
  font-size: 11px; color: #fde047; margin-top: 4px;
}

/* ============ BOTÃO DE AÇÃO GIGANTE (mobile central) ============ */
#action-btn {
  position: fixed; bottom: 120px; right: 16px; z-index: 30;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(110,231,200,0.25); border: 2px solid #6ee7c8;
  color: #fff; font-size: 24px; font-weight: 700;
  touch-action: manipulation; cursor: pointer;
  box-shadow: 0 4px 20px rgba(110,231,200,0.5);
  display: none; /* aparece quando perto de algo */
  transition: transform 0.15s, background 0.15s;
}
#action-btn:active { transform: scale(0.92); background: rgba(110,231,200,0.5); }

/* ============ BOTÃO ATACAR (não muda, sempre grande) ============ */
#attack-btn {
  position: fixed; bottom: 16px; right: 16px; z-index: 30;
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #e0523f, #ff7a5c);
  border: 3px solid rgba(255,255,255,0.3); color: #fff;
  font-size: 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 20px rgba(224,82,63,0.5);
  touch-action: manipulation;
}
#attack-btn:active { transform: scale(0.92); }

/* ============ JOYSTICK (zona invisível, esquerda) ============ */
#joystick-zone {
  position: fixed; bottom: 0; left: 0; width: 45%; height: 50%; z-index: 25;
  pointer-events: auto; touch-action: none;
}
#joystick-base {
  position: absolute; width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25);
  display: none; pointer-events: none;
}
#joystick-knob {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  background: #6ee7c8; box-shadow: 0 4px 12px rgba(110,231,200,0.6);
}

/* ============ BARRA DE AÇÃO RÁPIDA (embaixo, central) ============ */
#bottom-bar {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 20;
  pointer-events: none;
}
.quick-btn {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; pointer-events: auto;
}
.quick-btn:active { background: rgba(110,231,200,0.3); }

/* ============ MENU COMPACTO ============ */
#menu-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 30;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 18px; cursor: pointer; pointer-events: auto;
}

/* Menu aberto */
#menu-panel {
  position: fixed; top: 0; right: 0; width: 240px; height: 100%;
  background: rgba(10,15,20,0.95); backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255,255,255,0.15); z-index: 100;
  padding: 60px 16px 20px; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.25s;
}
#menu-panel.open { transform: translateX(0); }
.menu-title { font-size: 14px; color: #ffd166; margin-bottom: 12px; font-weight: 700; }
.menu-btn {
  display: block; width: 100%; padding: 12px 14px; margin-bottom: 6px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  color: #e8eef5; border-radius: 8px; text-align: left; font: 600 13px system-ui;
  cursor: pointer;
}
.menu-btn:active { background: rgba(110,231,200,0.2); }

/* ============ DIALOG NPC (simplificado) ============ */
#npc-dialog {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  width: min(340px, 92vw); z-index: 50;
  background: rgba(0,0,0,0.85); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px; padding: 14px;
  display: none;
}
#npc-name { color: #ffd166; font-size: 15px; font-weight: 700; margin-bottom: 6px; }
#npc-text { color: #c8d0d8; font-size: 13px; line-height: 1.4; margin-bottom: 12px; }
.npc-action { 
  display: block; width: 100%; padding: 10px; margin: 4px 0; 
  background: rgba(110,231,200,0.15); color: #6ee7c8; border: 1px solid rgba(110,231,200,0.4);
  border-radius: 8px; text-align: center; font: 600 13px system-ui; cursor: pointer;
}
.npc-action:active { background: rgba(110,231,200,0.35); }

/* ============ Overlay de morte ============ */
#overlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  flex-direction: column; background: rgba(0,0,0,0.85); z-index: 100;
}
#overlay h1 { color: #ff7a5c; font-size: 28px; margin-bottom: 8px; }
#overlay .sub { color: #9aa4af; font-size: 14px; margin-bottom: 20px; }
#restart-btn { 
  padding: 14px 28px; background: #6ee7c8; color: #000; border: none;
  font: 700 15px system-ui; border-radius: 8px; cursor: pointer;
}

/* ============ Menu inicial ============ */
#menu {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 90;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
}
#menu.hidden { display: none; }
#menu h1 { font-size: 42px; color: #fff; margin-bottom: 8px; }
#menu .sub { color: #9aa4af; font-size: 13px; margin-bottom: 24px; }
#start-btn {
  padding: 16px 32px; background: linear-gradient(135deg, #6ee7c8, #22c55e);
  border: none; color: #000; font-size: 17px; font-weight: 800;
  border-radius: 12px; cursor: pointer;
}
#menu .hint { color: #6b7480; font-size: 11px; margin-top: 20px; }

/* ============ Outros (esconde) ============ */
#enemy-banner, #boss-hp-wrap, #killstreak, #damage-flash,
#joystick-stick, #desktop-hint, #inventory-panel, #shop-panel,
#quest-panel, #build-panel, #inv-panel, #minimap-panel, 
#quest-dialog, #skill-btn { display: none !important; }

#container { width: 100%; height: 100%; }
