:root {
  --rojo: #c4161c;
  --verde: #6fdc6a;
  --oro: #ffcf4a;
  --uv: #9d5cff;
  --texto: #f1ece4;
  --panel: rgba(12, 10, 10, 0.88);
  --borde: rgba(255, 255, 255, 0.12);
  --fuente: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --display: Impact, "Arial Black", "Segoe UI Black", sans-serif;
  --terror: "Creepster", Impact, "Arial Black", sans-serif;
  /* linterna: las actualiza el juego en cada cuadro */
  --lx: 50%; --ly: 50%; --r1: 0px; --r2: 1px; --amb: 0.09;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #030303; color: var(--texto);
  font-family: var(--fuente);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

/* ---------- Panorama: oscuridad + linterna ---------- */
#pano { position: absolute; inset: 0; }
#pano canvas {
  filter: saturate(0.45) contrast(1.18) brightness(0.75) sepia(0.18);
}
body.oscuro #pano canvas {
  -webkit-mask-image: radial-gradient(circle at var(--lx) var(--ly),
    #000 0, #000 calc(var(--r1) * 0.62), rgba(0,0,0,0.55) var(--r1), rgba(0,0,0,var(--amb)) var(--r2));
  mask-image: radial-gradient(circle at var(--lx) var(--ly),
    #000 0, #000 calc(var(--r1) * 0.62), rgba(0,0,0,0.55) var(--r1), rgba(0,0,0,var(--amb)) var(--r2));
}
body.desktop.state-playing #pano { cursor: none; }

#haz {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.15s;
  background: radial-gradient(circle at var(--lx) var(--ly),
    rgba(140, 70, 255, 0.42) 0, rgba(120, 60, 255, 0.25) calc(var(--r1) * 0.8), rgba(90, 40, 200, 0) var(--r1));
  mix-blend-mode: screen;
}
body.uv #haz { opacity: 1; }

#vineta {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 160px 40px rgba(0,0,0,0.85);
}
#dano {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(140,0,0,0) 35%, rgba(170,0,0,0.75) 100%);
  transition: opacity 0.5s;
}
#dano.golpe { transition: none; opacity: 1; }
body.vida-baja #dano { animation: latido 1s infinite; }
@keyframes latido { 0%,100% { opacity: 0.15; } 50% { opacity: 0.5; } }

body.sacudon #pano, body.sacudon #fx { animation: sacudon 0.3s; }
@keyframes sacudon {
  0% { transform: translate(0,0); } 20% { transform: translate(-12px, 6px); }
  40% { transform: translate(10px, -8px); } 60% { transform: translate(-6px, 4px); }
  80% { transform: translate(4px, -2px); } 100% { transform: translate(0,0); }
}

#fx, #indicadores { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- Fantasmas ---------- */
.z { position: absolute; width: 0; height: 0; }
.zwrap {
  position: absolute; left: 0; top: 0;
  width: 120px; height: 300px;
  transform-origin: 50% 50%;
  will-change: transform;
}
.zanim {
  width: 100%; height: 100%;
  transform-origin: 50% 40%;
  animation: flotar 2.4s ease-in-out infinite, titilar 3.7s infinite;
  filter: drop-shadow(0 0 14px rgba(170, 215, 255, 0.75)) drop-shadow(0 0 3px rgba(255,255,255,0.5));
}
.zanim svg {
  width: 100%; height: 100%; display: block; overflow: visible;
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, rgba(0,0,0,0.35) 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 45%, rgba(0,0,0,0.35) 78%, transparent 100%);
}
.z.rapido .zanim { animation-duration: 1.2s, 1.3s; filter: drop-shadow(0 0 14px rgba(255, 60, 60, 0.6)); }
.z.gordo .zanim {
  animation-name: flotar-gordo, titilar; animation-duration: 3.2s, 4.5s;
  filter: drop-shadow(0 0 18px rgba(120, 90, 200, 0.8));
}
.z.sombra .zanim { filter: drop-shadow(0 0 16px rgba(157, 92, 255, 0.95)); }
.z.sombra { transition: opacity 0.2s; }
.z.jefe .zanim {
  animation-duration: 3s, 5s;
  filter: drop-shadow(0 0 26px rgba(255, 40, 80, 0.85)) drop-shadow(0 0 6px #fff);
}
.z.congelado .zanim {
  animation-play-state: paused;
  filter: drop-shadow(0 0 20px var(--uv)) hue-rotate(220deg) saturate(3) brightness(1.2);
}
@keyframes flotar {
  0%, 100% { transform: translateY(0) rotate(-2deg) skewX(0); }
  50% { transform: translateY(-10px) rotate(2deg) skewX(-3deg); }
}
@keyframes flotar-gordo {
  0%, 100% { transform: scale(1.35, 1.15) translateY(0); }
  50% { transform: scale(1.38, 1.17) translateY(-8px); }
}
@keyframes titilar {
  0%, 100% { opacity: 0.88; } 40% { opacity: 0.7; } 42% { opacity: 0.25; } 44% { opacity: 0.85; } 70% { opacity: 0.75; }
}
.z .sabana { animation: ondear 1.8s ease-in-out infinite alternate; transform-origin: 50% 0; transform-box: fill-box; }
@keyframes ondear { from { transform: skewX(-4deg); } to { transform: skewX(4deg); } }
.z .brazo {
  transform-box: fill-box; transform-origin: 100% 0;
  animation: brazos 1.6s ease-in-out infinite alternate;
}
.z .brazo.der { animation-delay: -0.8s; }
@keyframes brazos { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }

.z.ataca .zanim { animation: atraviesa 0.5s ease-in-out infinite alternate; }
.z.ataca .boca { transform: scaleY(1.6); transform-box: fill-box; transform-origin: 50% 0; }
@keyframes atraviesa {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.12) translateY(8px); opacity: 0.6; }
}
.z.gordo.ataca .zanim { animation-name: atraviesa-gordo; }
@keyframes atraviesa-gordo {
  from { transform: scale(1.35, 1.15); }
  to { transform: scale(1.5, 1.25) translateY(8px); }
}
.z.herido .zanim { filter: brightness(3) drop-shadow(0 0 20px #fff); }
.z.salta .zanim { opacity: 0 !important; transition: opacity 0.2s; }
.z.muere .zanim { animation: desvanecer 0.9s ease-out forwards; }
.z.jefe.muere .zanim { animation-duration: 2s; }
@keyframes desvanecer {
  0% { transform: scale(1); opacity: 1; filter: brightness(2) blur(0); }
  100% { transform: scale(1.6, 2) translateY(-60px); opacity: 0; filter: brightness(3) blur(8px); }
}
.z.aparece .zanim { animation: aparece 1.3s ease-out; }
@keyframes aparece {
  0% { opacity: 0; filter: blur(10px); transform: scale(0.9); }
  60% { opacity: 0.5; }
  100% { opacity: 0.88; filter: blur(0); transform: scale(1); }
}
.z.decorado .hit { pointer-events: none; }

.hit { position: absolute; pointer-events: auto; cursor: none; }
.hit-cabeza { left: 26%; width: 48%; top: 0; height: 23%; }
.hit-cuerpo { left: 18%; width: 64%; top: 22%; height: 75%; }
.z.gordo .hit-cuerpo { left: 4%; width: 92%; }
.z.muere .hit { pointer-events: none; }

.vidaz {
  position: absolute; left: 25%; width: 50%; top: -14px; height: 5px;
  background: rgba(0,0,0,0.6); border-radius: 3px; overflow: hidden;
  opacity: 0; transition: opacity 0.2s;
}
.vidaz i { display: block; height: 100%; width: 100%; background: var(--rojo); }
.z.tocado .vidaz { opacity: 1; }
.z.jefe .vidaz { display: none; }

/* Orbes que tira Aurora */
.orbe { position: absolute; width: 0; height: 0; }
.orbe-in {
  position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #ff9ad0 25%, rgba(255, 40, 120, 0.7) 50%, rgba(255, 0, 80, 0) 72%);
  box-shadow: 0 0 30px rgba(255, 60, 140, 0.8);
  animation: girar 0.6s linear infinite; will-change: transform;
}
.orbe-in .hit { inset: -10px; border-radius: 50%; }
@keyframes girar { from { filter: hue-rotate(0); } to { filter: hue-rotate(60deg); } }

/* ---------- Escrituras en las paredes ---------- */
.escrito {
  font-family: var(--terror); font-size: 120px; line-height: 1; white-space: nowrap;
  color: #8c0a0a; letter-spacing: 0.04em;
  text-shadow: 0 0 2px #4a0000, 0 6px 0 rgba(90, 0, 0, 0.55), 0 14px 6px rgba(70, 0, 0, 0.4);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -50%);
}
.escrito.uv-tinta { color: #d6b8ff; text-shadow: 0 0 18px var(--uv), 0 0 40px var(--uv); }

/* ---------- Puertas ---------- */
.puerta { position: absolute; width: 0; height: 0; }
.puerta-in {
  position: absolute; left: -44px; top: -44px; width: 88px;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: auto; cursor: pointer;
}
.puerta-flecha {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 30, 25, 0.5);
  border: 2px solid rgba(200, 255, 196, 0.45);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.puerta-flecha svg { width: 30px; height: 30px; opacity: 0.75; }
.puerta-nombre {
  margin-top: 6px; padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  background: rgba(0,0,0,0.7); white-space: nowrap;
}
.puerta-tecla {
  display: none; margin-top: 4px; font-family: var(--display); font-size: 12px;
  padding: 1px 7px; border-radius: 4px; background: var(--verde); color: #0b1a0a;
}
.puerta.adelante .puerta-flecha {
  border-color: var(--verde);
  box-shadow: 0 0 22px rgba(111, 220, 106, 0.7); animation: pulso 1.4s infinite;
}
.puerta.adelante .puerta-tecla { display: block; }
body.mobile .puerta-tecla { display: none !important; }
@keyframes pulso { 0%,100% { transform: scale(1.12); } 50% { transform: scale(1.24); } }
.puerta.salida .puerta-flecha { border-color: var(--oro); box-shadow: 0 0 22px rgba(255, 207, 74, 0.8); }
body.apagon .puerta { opacity: 0.15; }

/* ---------- Objetos ---------- */
.objeto { position: absolute; width: 0; height: 0; }
.objeto-in {
  position: absolute; left: -40px; top: -40px; width: 80px; height: 80px;
  display: grid; place-items: center; pointer-events: auto; cursor: pointer;
  border-radius: 50%;
  animation: flota 1.4s ease-in-out infinite;
}
.objeto-in svg { width: 58px; height: 58px; filter: drop-shadow(0 0 10px var(--brillo)); }
.objeto { --brillo: rgba(255, 255, 255, 0.85); }
.objeto.llaves { --brillo: rgba(255, 207, 74, 0.95); }
.objeto.pilas { --brillo: rgba(160, 255, 120, 0.9); }
.objeto.cartuchos { --brillo: rgba(255, 120, 80, 0.9); }
.objeto.sal { --brillo: rgba(220, 240, 255, 0.9); }
.objeto.escopeta { --brillo: rgba(255, 180, 90, 0.95); }
.objeto.pagina { --brillo: rgba(255, 236, 190, 0.95); }
.objeto.escopeta .objeto-in svg { width: 90px; height: 90px; }
@keyframes flota { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Indicadores fuera de pantalla ---------- */
.ind {
  position: absolute; top: 50%; width: 0; height: 0;
  border-top: 22px solid transparent; border-bottom: 22px solid transparent;
  margin-top: -22px; opacity: 0; transition: opacity 0.15s;
  filter: drop-shadow(0 0 6px rgba(255,0,0,0.9));
}
.ind.izq { left: 10px; border-right: 26px solid var(--rojo); }
.ind.der { right: 10px; border-left: 26px solid var(--rojo); }
.ind.oro.izq { border-right-color: var(--oro); filter: drop-shadow(0 0 6px rgba(255,207,74,0.9)); }
.ind.oro.der { border-left-color: var(--oro); filter: drop-shadow(0 0 6px rgba(255,207,74,0.9)); }

/* ---------- Efectos ---------- */
.ecto {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0, #bfe6ff 45%, rgba(150, 210, 255, 0) 70%);
  pointer-events: none;
  animation: salpica 0.7s ease-out forwards;
}
.grano-sal {
  position: absolute; width: 5px; height: 5px; border-radius: 1px; background: #f4f8ff;
  box-shadow: 0 0 6px #fff; animation: salpica 0.8s ease-out forwards;
}
@keyframes salpica {
  from { transform: translate(0,0) scale(1.4); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}
#destello {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 70%, rgba(255, 200, 120, 0.3), rgba(255, 160, 60, 0) 65%);
}
#destello.ver { animation: destello 0.12s ease-out; }
@keyframes destello { from { opacity: 1; } to { opacity: 0; } }
.impacto {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c0 0, #ffb347 40%, rgba(255,120,0,0) 70%);
  animation: chispa 0.25s ease-out forwards;
}
@keyframes chispa { from { transform: scale(0.5); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.flotante {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--display); font-size: 22px; letter-spacing: 0.05em;
  color: var(--oro); text-shadow: 0 2px 0 #000, 0 0 10px rgba(0,0,0,0.8);
  animation: sube 0.9s ease-out forwards; white-space: nowrap;
}
.flotante.rojo { color: #ff4a4a; }
@keyframes sube { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -50px; } }

/* ---------- Susto ---------- */
#susto {
  position: fixed; inset: 0; z-index: 40; display: none; place-items: center;
  background: radial-gradient(circle, rgba(0,0,0,0.2), #000 75%);
  pointer-events: none;
}
#susto svg { height: 115vh; filter: drop-shadow(0 0 40px rgba(255,255,255,0.4)); }
#susto.ver { display: grid; animation: susto 0.75s ease-out forwards; }
@keyframes susto {
  0% { opacity: 1; transform: scale(0.3); }
  12% { transform: scale(1.15) translate(-6px, 4px); }
  20% { transform: scale(1.05) translate(8px, -6px); }
  30% { transform: scale(1.12) translate(-4px, 2px); }
  70% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.3); }
}

/* ---------- Mira y armas ---------- */
#mira {
  position: fixed; left: 50%; top: 50%; width: 34px; height: 34px;
  margin: -17px 0 0 -17px; pointer-events: none; display: none; z-index: 30;
  border: 2px solid rgba(255,255,255,0.85); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(0,0,0,0.6);
}
#mira::before {
  content: ""; position: absolute; background: #ff3b3b;
  left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%;
}
#mira.sobre { border-color: #ff3b3b; transform: scale(0.8); }
body.escopeta-activa #mira { width: 70px; height: 70px; margin: -35px 0 0 -35px; border-style: dashed; }
body.desktop.state-playing #mira { display: block; }

#pistola {
  position: fixed; left: 50%; bottom: -3vh; height: 44vh; aspect-ratio: 1 / 1;
  pointer-events: none; display: none;
  transform: translateX(-50%);
  transition: transform 0.12s ease-out;
}
#pistolaIn {
  position: relative; width: 100%; height: 100%; transform-origin: 50% 90%;
  animation: respirar 3.2s ease-in-out infinite;
}
.arma-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: drop-shadow(0 -6px 24px rgba(0,0,0,0.85)) brightness(0.82); }
.arma-escopeta { display: none; }
body.escopeta-activa .arma-escopeta { display: block; }
body.escopeta-activa .arma-pistola { display: none; }
body.oscuro .arma-svg { filter: drop-shadow(0 -6px 24px rgba(0,0,0,0.85)) brightness(0.78); }
@keyframes respirar { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
#pistola.caminando #pistolaIn { animation: paso 0.28s ease-in-out infinite alternate; }
@keyframes paso { from { transform: translate(-8px, 4px) rotate(-1.5deg); } to { transform: translate(8px, 14px) rotate(1.5deg); } }
#pistolaIn.tiro { animation: retroceso 0.16s ease-out; }
body.escopeta-activa #pistolaIn.tiro { animation: retroceso-fuerte 0.35s ease-out; }
@keyframes retroceso {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(22px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes retroceso-fuerte {
  0% { transform: translateY(0) scale(1); }
  20% { transform: translateY(50px) scale(1.07) rotate(-3deg); }
  100% { transform: translateY(0) scale(1); }
}
#pistolaIn.recargando { animation: recarga 1.3s ease-in-out; }
@keyframes recarga {
  0%, 100% { transform: translateY(0) rotate(0); }
  25%, 70% { transform: translateY(45%) rotate(-28deg); }
}
#pistolaIn.cambio { animation: cambio 0.5s ease-in-out; }
@keyframes cambio { 0%, 100% { transform: translateY(0); } 45%, 55% { transform: translateY(80%); } }
#fogonazo {
  position: absolute; left: 50%; top: 7%; width: 34%; aspect-ratio: 1 / 1;
  transform: translate(-50%, -62%);
  background: radial-gradient(circle, #fffbe8 0, #ffe08a 18%, rgba(255,150,40,0.75) 38%, rgba(255,90,0,0) 68%);
  border-radius: 50%; opacity: 0;
}
body.escopeta-activa #fogonazo { width: 55%; }
#pistolaIn.tiro #fogonazo { animation: fogonazo 0.09s; }
@keyframes fogonazo { from { opacity: 1; } to { opacity: 0; } }
body.state-playing #pistola, body.state-paused #pistola { display: block; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; display: none; z-index: 20; }
body.state-playing #hud, body.state-paused #hud { display: block; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  gap: 12px;
}
.hud-box {
  background: rgba(0,0,0,0.55); border: 1px solid var(--borde);
  border-radius: 10px; padding: 8px 12px; max-width: 40vw;
}
.hud-box.derecha { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hud-derecha { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#minimapa {
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: 1px solid var(--borde);
  pointer-events: auto; cursor: pointer;
}
.hud-medio { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.reloj {
  font-family: var(--display); font-size: 18px; letter-spacing: 0.12em;
  color: #ff5a5a; text-shadow: 0 0 8px rgba(255,0,0,0.7);
  background: rgba(0,0,0,0.6); padding: 3px 10px; border-radius: 6px;
}
.reloj.hora { animation: titila 0.5s infinite; }
.jefe-barra { display: none; width: min(420px, 100%); text-align: center; }
.jefe-barra span { font-family: var(--terror); font-size: 26px; color: #ff4a7a; text-shadow: 0 0 12px #ff0050; letter-spacing: 0.1em; }
.jefe-barra div { height: 12px; border-radius: 6px; background: rgba(0,0,0,0.7); border: 1px solid #ff4a7a; overflow: hidden; }
.jefe-barra i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #6a0030, #ff2a6a); transition: width 0.2s; }
body.con-jefe .jefe-barra { display: block; }
.lugar { font-family: var(--display); font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; }
.objetivo { font-size: 13px; color: var(--oro); margin-top: 2px; }
.pista { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.puntos { font-family: var(--display); font-size: 26px; letter-spacing: 0.05em; }
.sub { font-size: 12px; opacity: 0.8; }

.hud-centro {
  position: absolute; top: 24%; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
.aviso {
  font-family: var(--display); font-size: clamp(22px, 5vw, 40px); letter-spacing: 0.06em;
  text-align: center; text-shadow: 0 3px 0 #000, 0 0 20px rgba(0,0,0,0.9);
  opacity: 0; transition: opacity 0.3s;
}
.aviso.ver { opacity: 1; }
.aviso.rojo { color: #ff4a4a; }
.aviso.oro { color: var(--oro); }
.aviso.terror { font-family: var(--terror); font-size: clamp(34px, 8vw, 70px); color: #d10f1f; letter-spacing: 0.08em; }
.estado-sala {
  font-size: 14px; padding: 4px 12px; border-radius: 20px;
  background: rgba(0,0,0,0.6); border: 1px solid var(--borde);
}
.estado-sala:empty { display: none; }

.hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 16px max(14px, env(safe-area-inset-bottom));
  gap: 12px;
}
.izquierda { width: min(280px, 38vw); }
.barra-label { font-family: var(--display); font-size: 12px; letter-spacing: 0.1em; margin: 6px 0 3px; }
#uvLabel { color: var(--uv); }
.vida-barra, .bateria-barra {
  height: 14px; border-radius: 7px; background: rgba(0,0,0,0.65);
  border: 1px solid var(--borde); overflow: hidden;
}
.bateria-barra { height: 8px; }
.vida-barra i, .bateria-barra i { display: block; height: 100%; width: 100%; transition: width 0.25s; }
.vida-barra i { background: linear-gradient(90deg, #7a0d0d, var(--rojo)); }
.bateria-barra i { background: linear-gradient(90deg, #8a7a20, #f2e46a); }
body.uv .bateria-barra i { background: linear-gradient(90deg, #4a2390, var(--uv)); }
.bateria-barra.baja i { animation: titila 0.6s infinite; }

.arma { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; }
.arma-nombre { font-family: var(--display); font-size: 14px; letter-spacing: 0.12em; }
.balas { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 46vw; }
.balas i {
  width: 8px; height: 24px; border-radius: 4px 4px 1px 1px;
  background: linear-gradient(#ffd98a 0 30%, #b8862e 30%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}
.balas i.cartucho { width: 12px; height: 26px; border-radius: 3px; background: linear-gradient(#c9a24a 0 22%, #b3261e 22%); }
.balas i.vacia { background: rgba(255,255,255,0.12); }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acciones .ui-btn { padding: 8px 10px; font-size: 13px; }
#btnUV { color: #d9c2ff; border-color: rgba(157, 92, 255, 0.6); }
body.uv #btnUV { background: var(--uv); color: #fff; }
.mover { display: none; gap: 8px; pointer-events: auto; margin-bottom: 6px; }
body.mobile .mover { display: flex; }
#btnCaminar.apagado { opacity: 0.4; }
body.desktop .acciones { display: none; }
#btnArma.oculto { display: none; }

.ui-btn {
  pointer-events: auto; cursor: pointer;
  font-family: var(--display); letter-spacing: 0.08em; font-size: 15px;
  color: var(--texto); background: rgba(30, 6, 6, 0.85);
  border: 1px solid rgba(255, 80, 80, 0.45); border-radius: 10px;
  padding: 10px 16px;
}
.ui-btn:hover { background: rgba(80, 10, 10, 0.95); }
.ui-btn.grande { font-size: 22px; padding: 14px 40px; background: var(--rojo); border-color: #ff6b6b; }
.ui-btn.grande:hover { background: #e0242b; }
.ui-btn.mini { font-size: 12px; padding: 6px 10px; }
.ui-btn.redondo { width: 46px; padding: 10px 0; font-size: 18px; }

/* ---------- Pantallas ---------- */
.pantalla {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(40,0,0,0.55), rgba(0,0,0,0.92));
  padding: 16px; z-index: 50; overflow-y: auto;
}
.pantalla.oculta { display: none; }
.panel {
  width: min(540px, 100%); text-align: center;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 16px;
  padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
}
.panel.chico { width: min(420px, 100%); }
.titulo {
  font-family: var(--terror); font-size: clamp(56px, 15vw, 96px); line-height: 0.9;
  letter-spacing: 0.04em; color: var(--rojo);
  text-shadow: 0 4px 0 #2a0000, 0 0 30px rgba(196,22,28,0.6);
  animation: titila 4s infinite;
}
.titulo.chico { font-size: clamp(40px, 11vw, 60px); }
@keyframes titila { 0%, 94%, 100% { opacity: 1; } 95% { opacity: 0.4; } 97% { opacity: 1; } 98% { opacity: 0.6; } }
.bajada { margin: 0; font-size: 16px; line-height: 1.4; opacity: 0.92; }
#nombre {
  width: min(320px, 100%); font: inherit; font-size: 15px; text-align: center;
  color: var(--texto); background: rgba(255,255,255,0.06);
  border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px;
  user-select: text; -webkit-user-select: text;
}
.dificultad { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dificultad button {
  font: inherit; font-size: 14px; color: var(--texto); cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--borde);
  border-radius: 20px; padding: 7px 14px;
}
.dificultad button.activa { background: rgba(196,22,28,0.35); border-color: #ff6b6b; }
.consejo { font-size: 13px; color: var(--oro); }
.controles { font-size: 13px; line-height: 1.6; opacity: 0.8; }
body.mobile .solo-pc, body.desktop .solo-cel { display: none; }
.stats { font-size: 15px; line-height: 1.7; }
.stats b { color: var(--oro); }
.ranking { width: 100%; font-size: 13px; }
.ranking:empty { display: none; }
.ranking h4 { margin: 4px 0 6px; font-family: var(--display); letter-spacing: 0.1em; font-weight: normal; color: var(--oro); }
.ranking ol { margin: 0; padding: 0; list-style: none; }
.ranking li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 6px; }
.ranking li:nth-child(odd) { background: rgba(255,255,255,0.04); }
.ranking li.yo { background: rgba(196,22,28,0.3); }
.ranking .n { opacity: 0.6; width: 22px; text-align: left; }
.ranking .nom { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mapa-panel { width: min(820px, 100%); }
#mapaGrande { width: 100%; height: min(60vh, 520px); background: rgba(0,0,0,0.45); border-radius: 12px; }

.papel {
  width: min(460px, 100%); padding: 34px 30px 24px; border-radius: 4px;
  background: linear-gradient(170deg, #e8dcc0, #d2c29e 60%, #bba67c);
  color: #2b1d12; box-shadow: 0 20px 80px rgba(0,0,0,0.9), inset 0 0 60px rgba(90, 60, 20, 0.45);
  transform: rotate(-1.5deg); display: flex; flex-direction: column; gap: 14px;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  animation: papel 0.4s ease-out;
}
@keyframes papel { from { transform: rotate(-8deg) scale(0.8); opacity: 0; } }
.papel-fecha { font-size: 14px; opacity: 0.7; }
.papel-texto { font-size: 18px; line-height: 1.55; white-space: pre-line; }
.papel-num { font-size: 13px; opacity: 0.6; text-align: right; }
.papel .ui-btn { align-self: center; }

@media (max-width: 640px) {
  #pistola { height: 30vh; }
  .lugar { font-size: 16px; }
  .hud-box { padding: 6px 8px; max-width: 46vw; }
  .puntos { font-size: 18px; }
  #minimapa { width: 92px; height: 92px; }
  .reloj { font-size: 14px; }
  .escrito { font-size: 90px; }
}
