@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;700&display=swap');

:root{
  --neon: #00ffff;
  --neon2:#ff00ff;
  --danger:#ff2a2a;
  --ok:#00ff66;
}

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: 'Rajdhani', sans-serif;
  touch-action: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  pointer-events: auto; /* IMPORTANTE: habilita botones */
}

.hud-left{
  display:flex;
  gap:12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.hud-right{
  display:flex;
  gap:10px;
  align-items: center;
}

.hud-box {
  color: white;
  text-shadow: 0 0 5px var(--neon);
  text-align: left;
  min-width: 170px;
  padding: 10px 12px;
  background: rgba(0,255,255,0.05);
  border: 1px solid rgba(0,255,255,0.18);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.label {
  font-size: 0.75em;
  color: #a9a9a9;
  display: block;
  letter-spacing: 0.08em;
}

#scoreEl, #weaponEl, #levelEl {
  font-size: 1.45em;
  font-weight: 700;
  display: inline-block;
  margin-top: 2px;
}

.sub{
  margin-top: 6px;
  font-size: 0.9em;
  color:#d7d7d7;
}

.bar-bg {
  width: 170px;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

#hpBar {
  width: 100%;
  height: 100%;
  background: var(--ok);
  transition: width 0.15s linear;
}

.bar-xp{ height: 8px; }
#xpBar{
  width: 0%;
  height: 100%;
  background: var(--neon2);
  transition: width 0.15s linear;
}

.hud-btn{
  pointer-events: auto;
  background: rgba(0,0,0,0.45);
  color: var(--neon);
  border: 1px solid rgba(0,255,255,0.35);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0,255,255,0.2);
}
.hud-btn:hover{
  background: rgba(0,255,255,0.12);
}

/* Pantallas */
.screen {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  color: white;
  z-index: 100;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}
.screen.active { display: flex; }

h1 {
  font-size: 3em;
  margin: 0;
  text-shadow: 0 0 20px var(--neon);
}

.tips{
  margin-top: 14px;
  opacity: 0.9;
  max-width: 680px;
  line-height: 1.35;
}

button {
  background: transparent;
  color: var(--neon);
  border: 2px solid var(--neon);
  padding: 15px 40px;
  font-size: 1.4em;
  margin-top: 20px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(0,255,255,0.5);
  transition: 0.2s;
  border-radius: 14px;
}
button:hover { background: var(--neon); color: #000; }

/* Móvil */
#mobileControls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}
@media (max-width: 900px) {
  #mobileControls { display: block; }
  .hud-box{ min-width: 155px; }
  .bar-bg{ width: 155px; }
}

#joystickZone {
  position: absolute;
  bottom: 50px;
  left: 24px;
  width: 130px;
  height: 130px;
  pointer-events: auto;
}

#stickBase {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(0,255,255,0.2);
  position: relative;
  display: none;
}

#stickKnob {
  width: 54px;
  height: 54px;
  background: var(--neon);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px rgba(0,255,255,0.7);
}

#fireBtn {
  position: absolute;
  bottom: 50px;
  right: 24px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255, 0, 0, 0.18);
  border: 2px solid var(--danger);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2em;
  color: white;
  pointer-events: auto;
  box-shadow: 0 0 14px rgba(255,42,42,0.6);
  padding: 0;
  margin: 0;
}
#fireBtn:active { background: rgba(255,42,42,0.7); }
