/* =============================================================================
   RUNA RUNA CONCEPCIÓN — hoja de estilo
   Menús en papel y tinta; HUD en pantalla mínimo, que no tape la quebrada.
   ========================================================================== */

:root {
  --tinta:          #1c140c;
  --tinta-suave:    #4a3724;
  --tinta-fina:     #785f44;
  --papel:          #f4ebd8;
  --papel-oscuro:   #18120c;
  --papel-borde:    #8e7049;
  --papel-borde-suave: rgba(142, 112, 73, 0.38);
  --papel-tostado:  #c8a876;
  --lacre-rojo:     #8e2622;
  --lacre-vivo:     #ad332d;
  --oro-viejo:      #9c7638;
  --oro-brillo:     #c49a4e;
  --sangre:         #8e2622;
  --sangre-viva:    #b8342c;
  --oro:            #c89c4a;
  --celeste:        #4a7b9d;
  --celeste-brillo: #689cb8;
  --celeste-borde:  #3e6884;
  --azul:           #2a425a;
  --verde:          #4a6e38;
  --sombra:         rgba(0, 0, 0, 0.75);
  --pixel:          'Silkscreen', 'VT323', monospace;
  --serif-antiguo:  'Cinzel', 'IM Fell English', Georgia, serif;
  --serif-texto:    'EB Garamond', 'IM Fell English', Georgia, serif;
  --btn-font:       'Cinzel', 'IM Fell English', Georgia, serif;
  --serif:          'EB Garamond', 'IM Fell English', Georgia, serif;
  --sans:           'EB Garamond', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0d0b08;
  font-family: var(--sans);
  color: var(--papel);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
}

canvas#lienzo {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: none;
  touch-action: none;
}
canvas#lienzo.libre { cursor: default; }

/* ============================== CAPAS ==================================== */

.capa {
  position: fixed; inset: 0;
  display: none;
  z-index: 20;
}
.capa.visible { display: block; }

#hud { z-index: 10; pointer-events: none; }

/* ============================== HUD ====================================== */

/* --- Punto de mira --- */
#mira {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#mira .brazo {
  position: absolute;
  background: rgba(235, 228, 210, 0.82);
  box-shadow: 0 0 2px rgba(0,0,0,0.9);
}
#mira .brazo.h { height: 2px; width: 9px; top: -1px; }
#mira .brazo.v { width: 2px; height: 9px; left: -1px; }
#mira .punto {
  position: absolute; width: 3px; height: 3px;
  left: -1.5px; top: -1.5px; border-radius: 50%;
  background: rgba(235, 228, 210, 0.95);
  box-shadow: 0 0 3px rgba(0,0,0,0.9);
}
#mira.oculta { opacity: 0; }

/* --- Marco de daño --- */
#vineta {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
              rgba(0,0,0,0) 42%, rgba(78, 12, 10, 0.0) 70%, rgba(60, 8, 6, 0.0) 100%);
  transition: background 0.25s ease-out;
}
#sangre-borde {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center,
              rgba(0,0,0,0) 38%, rgba(96, 14, 10, 0.55) 78%, rgba(70, 8, 6, 0.85) 100%);
  transition: opacity 0.35s ease-out;
}
#flash {
  position: absolute; inset: 0; pointer-events: none;
  background: #b83c34; opacity: 0;
}

/* --- Bloque inferior izquierdo: estado del cuerpo --- */
#estado {
  position: absolute; left: 26px; bottom: 24px;
  width: 210px;
}
.barra-rot {
  height: 7px; background: rgba(20, 16, 12, 0.55);
  border: 1px solid rgba(233, 224, 201, 0.28);
  margin-bottom: 7px; position: relative; overflow: hidden;
}
.barra-rot i {
  position: absolute; inset: 0;
  transform-origin: left center;
  display: block;
}
#aliento i { background: linear-gradient(90deg, #4a6b7c, #7fb0c4); }
#aliento.bajo i { background: linear-gradient(90deg, #8e5a2b, #d08a3a); }
/* Sin resuello: no puede volver a correr hasta recuperar margen */
#aliento.agotado { border-color: rgba(184, 60, 52, 0.75); }
#aliento.agotado i { background: linear-gradient(90deg, #7a2420, #b8483c); }

/* --- Marcadores de objetivo proyectados desde el mundo --- */
#marcadores { position: absolute; inset: 0; pointer-events: none; }
.marcador {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 6px;
  background: rgba(14, 11, 8, 0.52);
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 2px;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
  transition: opacity 0.2s;
}
.marcador .mk-punto {
  width: 7px; height: 7px;
  background: var(--oro);
  transform: rotate(45deg);
  flex: none;
}
.marcador .mk-txt {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--papel);
}
.marcador .mk-dist {
  font-size: 10px; text-decoration: none;
  color: rgba(233, 224, 201, 0.6);
  font-variant-numeric: tabular-nums;
}
/* Fuera de cuadro: se pega al borde y se reduce a la marca */
.marcador.fuera { border-color: rgba(201, 162, 39, 0.85); background: rgba(14, 11, 8, 0.72); }
.marcador.fuera .mk-txt { display: none; }
.marcador.cerca .mk-punto { animation: pulsoMarca 1.1s infinite; }
@keyframes pulsoMarca {
  0%, 100% { transform: rotate(45deg) scale(1); opacity: 1; }
  50% { transform: rotate(45deg) scale(1.45); opacity: 0.6; }
}
.etiqueta-barra {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(233, 224, 201, 0.62);
  margin-bottom: 3px;
  text-shadow: 0 1px 3px #000;
}

/* Heridas */
#heridas { display: flex; gap: 6px; margin-top: 10px; }
.herida {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid rgba(233, 224, 201, 0.25);
  background: rgba(20, 16, 12, 0.5);
  color: rgba(233, 224, 201, 0.45);
  text-shadow: 0 1px 2px #000;
}
.herida.activa {
  color: #f0d6cd; border-color: var(--sangre-viva);
  background: rgba(120, 26, 20, 0.55);
}
#sangrado {
  margin-top: 8px; font-size: 11px; color: var(--sangre-viva);
  letter-spacing: 0.06em; text-shadow: 0 1px 3px #000;
  display: none;
}
#sangrado.visible { display: block; animation: latido 1.1s infinite; }
@keyframes latido { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* --- Bloque inferior derecho: arma --- */
#arma-info {
  position: absolute; right: 26px; bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(14, 11, 8, 0.82);
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 6px;
  padding: 8px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75), inset 0 0 12px rgba(0,0,0,0.5);
  pointer-events: none;
  backdrop-filter: blur(4px);
}
#arma-icono-contenedor {
  width: 58px; height: 58px;
  flex: none;
  border-radius: 6px;
  border: 2px solid #5a5d66;
  background: #121316;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.8), 0 0 6px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#arma-icono {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}
#arma-detalles {
  display: flex;
  flex-direction: column;
  text-align: right;
}
#arma-nombre {
  font-family: var(--serif);
  font-size: 19px; letter-spacing: 0.05em;
  color: var(--papel);
  text-shadow: 0 2px 6px #000;
}
#arma-estado {
  font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase;
  margin-top: 2px;
  text-shadow: 0 1px 4px #000;
}
#arma-estado.cargado { color: #9fc48a; }
#arma-estado.vacio { color: var(--sangre-viva); }
#municion {
  font-family: var(--serif);
  font-size: 26px; margin-top: 2px; letter-spacing: 0.04em;
  text-shadow: 0 2px 8px #000;
}
#municion small { font-size: 13px; opacity: 0.6; }

/* --- Los cinco tiempos de carga --- */
#carga {
  position: absolute; left: 50%; bottom: 132px;
  transform: translateX(-50%);
  width: 330px; display: none;
}
#carga.visible { display: block; }
#carga-pasos { display: flex; gap: 4px; margin-bottom: 8px; }
.paso-carga {
  flex: 1; height: 4px; background: rgba(20, 16, 12, 0.6);
  border: 1px solid rgba(233, 224, 201, 0.2);
  position: relative; overflow: hidden;
}
.paso-carga i {
  position: absolute; inset: 0; background: var(--oro);
  transform: scaleX(0); transform-origin: left;
}
.paso-carga.hecho i { transform: scaleX(1); }
#carga-texto {
  text-align: center; font-size: 12px;
  letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--oro);
  text-shadow: 0 1px 5px #000;
}
#carga-num {
  text-align: center; font-size: 10px; opacity: 0.55;
  letter-spacing: 0.14em; margin-top: 2px;
}

/* --- Aviso de descarga enemiga --- */
#orden {
  position: absolute; left: 50%; top: 17%;
  transform: translate(-50%, 0) scale(0.9);
  font-family: var(--serif);
  font-size: 46px; letter-spacing: 0.10em;
  color: #f2e4d4;
  text-shadow: 0 0 22px rgba(180, 40, 30, 0.85), 0 3px 12px #000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.14s, transform 0.22s;
}
#orden.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
#orden.peligro { color: #ffc9b4; text-shadow: 0 0 30px rgba(220, 60, 40, 1), 0 3px 12px #000; }

/* --- Objetivo y tiempo ganado --- */
#panel-sup {
  position: absolute; left: 50%; top: 20px;
  transform: translateX(-50%);
  text-align: center; max-width: 620px;
}
#objetivo {
  font-size: 13px; letter-spacing: 0.10em;
  color: rgba(240, 232, 214, 0.92);
  text-shadow: 0 2px 8px #000;
  padding: 5px 16px;
  background: rgba(16, 13, 9, 0.42);
  border-left: 2px solid var(--oro);
  border-right: 2px solid var(--oro);
  display: inline-block;
}
#tiempo-ganado {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 15px; color: var(--oro);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px #000;
}
#tiempo-ganado small {
  display: block; font-size: 9px; letter-spacing: 0.20em;
  text-transform: uppercase; opacity: 0.62; color: var(--papel);
  font-family: var(--sans);
}

/* --- Aviso contextual (F) --- */
#interaccion {
  position: absolute; left: 50%; top: 56%;
  transform: translateX(-50%);
  text-align: center; display: none;
}
#interaccion.visible { display: block; }
#interaccion .tecla {
  display: inline-block; min-width: 26px;
  padding: 3px 8px; margin-right: 8px;
  border: 1px solid var(--papel-borde);
  background: rgba(16, 13, 9, 0.7);
  font-size: 13px; font-weight: 600;
}
#interaccion .txt { font-size: 14px; letter-spacing: 0.06em; text-shadow: 0 2px 6px #000; }
#interaccion .sub { font-size: 11px; opacity: 0.65; margin-top: 3px; }

/* Barra de progreso de acción */
#progreso-accion {
  position: absolute; left: 50%; top: 62%;
  transform: translateX(-50%);
  width: 250px; height: 6px;
  background: rgba(16, 13, 9, 0.72);
  border: 1px solid rgba(233, 224, 201, 0.3);
  display: none;
}
#progreso-accion.visible { display: block; }
#progreso-accion i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--sangre), var(--oro));
  transform-origin: left; transform: scaleX(0);
}
#hachazos {
  position: absolute; left: 50%; top: 66%;
  transform: translateX(-50%);
  display: none; gap: 5px;
}
#hachazos.visible { display: flex; }
.marca-hachazo {
  width: 15px; height: 3px;
  background: rgba(233, 224, 201, 0.25);
}
.marca-hachazo.dado { background: var(--oro); }

/* --- Avisos flotantes --- */
#avisos {
  position: absolute; left: 26px; top: 140px;
  width: 300px;
}
.aviso {
  font-size: 12.5px; letter-spacing: 0.03em;
  padding: 6px 12px; margin-bottom: 5px;
  background: rgba(16, 13, 9, 0.62);
  border-left: 2px solid var(--sangre-viva);
  text-shadow: 0 1px 3px #000;
  animation: entra 0.22s ease-out;
}
@keyframes entra { from { opacity: 0; transform: translateX(-14px); } }

/* --- Brújula --- */
#brujula {
  position: absolute; left: 50%; top: 106px;
  transform: translateX(-50%);
  width: 260px; height: 18px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  opacity: 0.55;
}
#brujula-cinta { position: absolute; top: 0; height: 100%; white-space: nowrap; }
#brujula-cinta span {
  position: absolute; font-size: 10px; letter-spacing: 0.1em;
  transform: translateX(-50%);
  text-shadow: 0 1px 3px #000;
}

/* --- Diálogo --- */
#dialogo {
  position: absolute; left: 50%; bottom: 96px;
  transform: translateX(-50%);
  width: min(720px, 86vw);
  background: radial-gradient(ellipse at 50% 30%, rgba(246, 238, 220, 0.90) 0%, rgba(228, 214, 184, 0.93) 100%);
  border: 1.5px solid #8e7049;
  border-left: 5px solid #8e2622;
  border-radius: 4px;
  padding: 14px 20px;
  display: none;
  pointer-events: auto;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.75), inset 0 0 25px rgba(110, 75, 30, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#dialogo.visible {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 18px;
}
#dialogo-avatar {
  width: 74px;
  height: 84px;
  flex-shrink: 0;
  background-image: url('../img/npc_paisano.png');
  background-repeat: no-repeat;
  background-size: 380px auto;
  background-position: -11px -20px;
  border: 1.5px solid #8e7049;
  background-color: rgba(220, 204, 175, 0.65);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#dialogo-avatar.enemigo {
  background-image: url('../img/npc_enemigo.png');
  background-repeat: no-repeat;
  background-size: 420px auto;
  background-position: -22px -52px;
  border: 1.5px solid #8e2622;
  background-color: rgba(215, 190, 180, 0.85);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(142, 38, 34, 0.35);
}
#dialogo-cuerpo {
  flex: 1;
}
#dialogo-quien {
  font-family: var(--serif-antiguo); font-size: 13.5px; font-weight: 700;
  color: #8e2622; letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 4px;
}
#dialogo-texto {
  font-family: var(--serif-texto);
  font-size: 16.5px;
  line-height: 1.5;
  color: #1c140c;
}
#dialogo-pista {
  font-family: var(--serif-texto);
  margin-top: 8px; font-size: 11px; opacity: 0.85;
  font-style: italic;
  letter-spacing: 0.08em;
  color: #5c442c;
}

/* ============================== MENÚS ==================================== */

/* --- Fondo rotativo con transiciones suaves --- */
#fondo-rotativo {
  position: fixed; inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1s ease;
  background: #0a0806;
}
#fondo-rotativo.activo {
  opacity: 1;
}

.fondo-capa {
  position: absolute;
  inset: -30px;
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.06);
  filter: brightness(1.15) contrast(1.04) saturate(1.08);
  transition: opacity 2s ease-in-out, transform 9s ease-out;
  will-change: opacity, transform;
}
.fondo-capa.visible {
  opacity: 1;
  transform: scale(1);
}

.fondo-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 50%, rgba(12, 9, 6, 0.16) 100%),
    linear-gradient(to bottom, rgba(15, 12, 8, 0.05) 0%, transparent 35%, rgba(12, 9, 6, 0.12) 100%);
  pointer-events: none;
}

.pantalla {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(15, 12, 8, 0.08), rgba(10, 7, 5, 0.25));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow-y: auto;
}
.hoja {
  width: min(860px, 92vw);
  margin: 40px auto;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(247, 239, 222, 0.86) 0%, rgba(235, 220, 192, 0.88) 65%, rgba(210, 188, 150, 0.92) 100%);
  color: var(--tinta);
  padding: 42px 50px;
  border: 2px solid #8e7049;
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.78), inset 0 0 50px rgba(118, 86, 44, 0.22), 0 0 0 1px rgba(70, 48, 22, 0.28);
  position: relative;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hoja::after {
  content: ""; position: absolute; inset: 7px;
  border: 1px solid rgba(142, 112, 73, 0.38);
  border-radius: 2px;
  pointer-events: none;
}

.titulo-juego {
  font-family: var(--serif-antiguo);
  font-size: clamp(24px, 3.8vw, 36px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  color: #1e140a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}
.subtitulo-juego {
  font-family: var(--serif-texto);
  font-size: 15px;
  font-style: italic;
  color: #624b33;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(142, 112, 73, 0.35);
}
.hoja h2 {
  font-family: var(--serif-antiguo);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  color: #1e140a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}
.hoja h3 {
  font-family: var(--serif-antiguo);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #721915;
  margin: 24px 0 10px;
  border-bottom: 1px solid rgba(142, 112, 73, 0.30);
  padding-bottom: 5px;
}
.hoja p {
  font-family: var(--serif-texto);
  font-size: 16.5px;
  line-height: 1.65;
  color: #241910;
  margin: 0 0 12px;
}
.hoja p strong {
  color: #721915;
  font-weight: 700;
}
.hoja .lugar {
  font-family: var(--serif-texto);
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.08em;
  color: #6a4f32;
  margin-bottom: 16px;
}

.nota-historica {
  background: rgba(188, 160, 122, 0.20);
  border: 1px solid rgba(142, 112, 73, 0.40);
  border-left: 4px solid #8e2622;
  border-radius: 3px;
  padding: 14px 18px;
  font-family: var(--serif-texto);
  font-size: 15px;
  line-height: 1.65;
  color: #2b1d11;
  font-style: italic;
  margin: 18px 0;
  box-shadow: inset 0 1px 4px rgba(60, 40, 15, 0.06);
}
.nota-historica strong {
  font-style: normal;
  color: #721915;
  font-family: var(--serif-antiguo);
  font-size: 13.5px;
  letter-spacing: 0.04em;
}

/* Botones */
.botones { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* Botones en el menú principal: cuadrícula simétrica 3x2 para que los textos nunca se desborden */
#menu .botones {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 26px;
}
#menu .botones .boton {
  width: 100%;
  min-width: 0;
  padding: 12px 10px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
#menu .botones .boton.oro {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
}
#menu .botones .boton.boton-leyendas {
  background: linear-gradient(135deg, rgba(250, 242, 225, 0.9) 0%, rgba(212, 175, 55, 0.28) 50%, rgba(240, 226, 198, 0.95) 100%);
  border: 1.5px solid #a67c38;
  color: #3d230a;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 10px rgba(180, 140, 60, 0.25);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  position: relative;
  letter-spacing: 0.12em;
}
#menu .botones .boton.boton-leyendas::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px dashed rgba(166, 124, 56, 0.45);
  border-radius: 2px;
  pointer-events: none;
}
#menu .botones .boton.boton-leyendas:hover {
  background: linear-gradient(135deg, rgba(255, 248, 235, 1) 0%, rgba(230, 190, 70, 0.5) 50%, rgba(255, 240, 210, 1) 100%);
  border-color: #634313;
  color: #261404;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45), inset 0 0 14px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.boton {
  font-family: var(--serif-antiguo);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 20px;
  background: rgba(246, 237, 218, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #2a1e12;
  border: 1.5px solid #8e7049;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), inset 0 0 10px rgba(160, 125, 75, 0.14);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.16s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.boton:hover,
.boton:focus-visible {
  border-color: #523b20;
  color: #0f0a05;
  background: rgba(255, 249, 238, 0.88);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.26), inset 0 0 12px rgba(180, 140, 80, 0.22);
  transform: translateY(-1px);
}
.boton:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
.boton.sec {
  background: rgba(242, 232, 212, 0.46);
  border: 1.5px solid rgba(142, 112, 73, 0.65);
  color: #38281a;
}
.boton.sec:hover {
  background: rgba(252, 245, 230, 0.85);
  border-color: #684c2a;
  color: #140d07;
}
.boton.oro {
  border: 2px solid #8e2622;
  background: rgba(248, 238, 218, 0.76);
  color: #721915;
  box-shadow: 0 3px 8px rgba(114, 25, 21, 0.22), inset 0 0 10px rgba(142, 38, 34, 0.12);
}
.boton.oro:hover {
  background: #8e2622;
  border-color: #631411;
  color: #f7eed8;
  box-shadow: 0 5px 16px rgba(114, 25, 21, 0.40);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.boton:disabled {
  opacity: 0.40;
  cursor: not-allowed;
  box-shadow: none;
  border-color: rgba(142, 112, 73, 0.35);
}
.boton:disabled:hover {
  transform: none;
  background: rgba(246, 237, 218, 0.58);
  color: #2a1e12;
}

/* Selector de misión */
.lista-misiones { display: grid; gap: 12px; margin-top: 10px; }
.mision-fila {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: rgba(246, 237, 218, 0.50);
  border: 1.5px solid rgba(142, 112, 73, 0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.16s ease-in-out;
}
.mision-fila:hover {
  background: rgba(255, 248, 234, 0.85);
  border-color: #6b4d29;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transform: translateX(4px);
}
.mision-fila.bloqueada {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(142, 112, 73, 0.25);
}
.mision-fila.bloqueada:hover {
  background: rgba(246, 237, 218, 0.50);
  transform: none;
  box-shadow: none;
  border-color: rgba(142, 112, 73, 0.25);
}
.mision-num {
  font-family: var(--serif-antiguo);
  font-size: 22px;
  font-weight: 700;
  color: #721915;
  min-width: 34px;
}
.mision-datos { flex: 1; }
.mision-nom {
  font-family: var(--serif-antiguo);
  font-weight: 700;
  font-size: 16px;
  color: #1e140a;
}
.mision-res {
  font-family: var(--serif-texto);
  font-size: 14px;
  color: #553e28;
  margin-top: 2px;
}
.mision-marca {
  font-family: var(--serif-antiguo);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 10px; border: 1.5px solid;
  border-radius: 3px;
}
.marca-oro { color: #721915; border-color: #8e2622; background: rgba(142, 38, 34, 0.12); }
.marca-plata { color: #423224; border-color: #8e7049; background: rgba(142, 112, 73, 0.14); }
.marca-bronce { color: #6e4620; border-color: #9c6838; background: rgba(156, 104, 56, 0.14); }

/* Resultado */
.rango-grande {
  font-family: var(--serif-antiguo);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 6px 0 2px;
  color: #721915;
}
.rango-grande.oro { color: #8e2622; }
.rango-grande.plata { color: #4a3724; }
.rango-grande.bronce { color: #7a4820; }
.rango-grande.gris { color: #8c7258; }

.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 20px 0; }
.cifra {
  padding: 12px 14px;
  background: rgba(244, 235, 214, 0.60);
  border: 1px solid rgba(142, 112, 73, 0.35);
  border-left: 3px solid #8e2622;
  border-radius: 3px;
}
.cifra .v {
  font-family: var(--serif-antiguo);
  font-size: 22px;
  font-weight: 700;
  color: #1e140a;
}
.cifra .k {
  font-family: var(--serif-antiguo);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #721915;
  margin-top: 4px;
}
.cifra.destacada {
  border-left-color: #721915;
  background: rgba(248, 238, 218, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.cifra.destacada .v {
  color: #721915;
}

/* Controles */
.tabla-controles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 26px; }
.ctrl { display: flex; align-items: baseline; gap: 12px; font-size: 14px; font-family: var(--serif-texto); }
.ctrl kbd {
  font-family: var(--serif-antiguo);
  font-size: 11.5px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
  padding: 4px 8px;
  background: rgba(246, 237, 218, 0.85);
  color: #1e140a;
  border: 1.5px solid #8e7049;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.ctrl span { color: #2e2014; }

/* Ajustes */
.ajuste { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 14.5px; font-family: var(--serif-texto); }
.ajuste label { min-width: 160px; color: #2e2014; }
.ajuste input[type=range] { flex: 1; max-width: 240px; accent-color: #8e2622; }
.ajuste .val { min-width: 46px; font-family: var(--serif-antiguo); font-weight: 700; font-size: 14px; color: #721915; }

/* Cargando */
#cargando {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px;
  background: #120e0a;
}
#cargando .marca {
  font-family: var(--serif-antiguo); font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 800;
  letter-spacing: 0.16em; color: #f4ebd8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  text-align: center;
}
#cargando .est { font-family: var(--serif-texto); font-style: italic; font-size: 13px; letter-spacing: 0.15em; text-transform: uppercase; color: #c8a876; }

/* Fundido entre escenas */
#fundido {
  position: fixed; inset: 0; z-index: 50;
  background: #0d0a08;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
#fundido.negro { opacity: 1; }

/* Pausa - Estilo pergamino decreto colonial */
#pausa .pantalla {
  background: radial-gradient(ellipse at center, rgba(16, 12, 8, 0.15) 0%, rgba(8, 6, 4, 0.35) 100%);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
#pausa .hoja.pausa-caja {
  background: radial-gradient(ellipse at 50% 30%, rgba(247, 239, 222, 0.90) 0%, rgba(230, 215, 186, 0.93) 100%) !important;
  border: 2px solid #8e7049 !important;
  border-radius: 4px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.85), inset 0 0 35px rgba(118, 86, 44, 0.24) !important;
  padding: 34px 40px !important;
  margin: auto !important;
  width: min(460px, 92vw) !important;
  text-align: center;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  position: relative;
}
#pausa .hoja.pausa-caja::after {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(142, 112, 73, 0.38);
  border-radius: 2px;
  pointer-events: none;
  display: block !important;
}
#pausa h2 {
  font-family: var(--serif-antiguo);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.10em;
  color: #1e140a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
  margin: 0 0 8px;
  text-transform: uppercase;
}
#pausa p#pausa-objetivo {
  font-family: var(--serif-texto);
  font-size: 15px;
  font-style: italic;
  color: #523c26;
  margin: 0 0 24px;
  line-height: 1.5;
}
#pausa .botones {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: 320px !important;
  margin: 18px auto 0 !important;
}
#pausa .botones .boton {
  width: 100% !important;
  height: 44px !important;
  padding: 0 20px !important;
  font-size: 13px !important;
  letter-spacing: 0.14em !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

@media (max-width: 700px) {
  .hoja { padding: 28px 24px; }
  .titulo-juego { font-size: clamp(20px, 4.4vw, 28px); }
  #estado { width: 150px; left: 14px; bottom: 14px; }
  #arma-info { right: 14px; bottom: 14px; }
}

@media (max-width: 650px) {
  #menu .botones {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #menu .botones .boton {
    font-size: 11px;
    padding: 11px 8px;
  }
  #menu .botones .boton.oro {
    grid-column: span 2;
  }
}

@media (max-width: 440px) {
  #menu .botones {
    grid-template-columns: 1fr;
  }
  #menu .botones .boton.oro {
    grid-column: span 1;
  }
}

/* =============================================================================
   PANTALLA DE LEYENDAS Y PANEL DE LORE ROTATIVO
   ========================================================================== */

.hoja.hoja-leyendas {
  width: min(980px, 95vw);
  padding: 38px 44px;
}

.leyendas-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 34px;
  align-items: stretch;
}

.leyendas-col-izq {
  display: flex;
  flex-direction: column;
}

.lista-leyendas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.item-leyenda {
  background: rgba(235, 220, 192, 0.45);
  border: 1.5px solid rgba(142, 112, 73, 0.45);
  border-radius: 4px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.22s ease-in-out;
  position: relative;
  outline: none;
}

.item-leyenda:hover,
.item-leyenda:focus-visible {
  border-color: #8e2622;
  background: rgba(248, 239, 222, 0.88);
  box-shadow: 0 4px 14px rgba(60, 40, 20, 0.18);
  transform: translateX(4px);
}

.item-leyenda.destacado {
  border-color: #a67c38;
  background: linear-gradient(90deg, rgba(238, 222, 194, 0.8) 0%, rgba(248, 240, 225, 0.6) 100%);
  box-shadow: 0 3px 10px rgba(166, 124, 56, 0.15);
}

.item-leyenda.destacado:hover,
.item-leyenda.destacado:focus-visible {
  border-color: #721915;
  background: linear-gradient(90deg, rgba(255, 248, 235, 0.95) 0%, rgba(245, 230, 205, 0.9) 100%);
  box-shadow: 0 5px 16px rgba(142, 38, 34, 0.22);
}

.item-leyenda-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.item-leyenda-titulo {
  font-family: var(--serif-antiguo);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1e140a;
}

.item-leyenda.destacado .item-leyenda-titulo {
  color: #721915;
}

.badge-andino {
  background: #8e2622;
  color: #f4ebd8;
  font-family: var(--serif-antiguo);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.item-leyenda-resumen {
  font-family: var(--serif-texto);
  font-size: 13.5px;
  line-height: 1.5;
  color: #3d2b1a;
}

.item-leyenda-pista-hover {
  font-family: var(--serif-texto);
  font-size: 11.5px;
  font-style: italic;
  color: #8e2622;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* Panel de visualización de Lore rotativo (Pergamino envejecido) */
.leyendas-col-der {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 400px;
}

.leyendas-placeholder-vacio {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  border: 1.5px dashed rgba(142, 112, 73, 0.4);
  border-radius: 4px;
  background: rgba(235, 220, 192, 0.22);
  color: #5c4424;
  pointer-events: none;
  box-sizing: border-box;
}

.placeholder-icono-cruz {
  font-size: 34px;
  color: #8e2622;
  margin-bottom: 12px;
  opacity: 0.85;
}

.placeholder-texto {
  font-family: var(--serif-antiguo);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3b2814;
  margin-bottom: 8px;
}

.placeholder-subtexto {
  font-family: var(--serif-texto);
  font-size: 13px;
  color: #6e5232;
  max-width: 280px;
  line-height: 1.45;
}

.placeholder-subtexto em {
  color: #8e2622;
  font-style: normal;
  font-weight: 700;
}

.panel-lore-pergamino {
  width: 100%;
  height: 100%;
  min-height: 390px;
  box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 20%, #fef8eb 0%, #f4e3c4 65%, #d8bd8c 100%);
  border: 2px solid #8e7049;
  border-radius: 4px;
  padding: 30px 32px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), inset 0 0 35px rgba(110, 75, 30, 0.26), 0 0 0 1px rgba(70, 48, 22, 0.25);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transform: translateX(14px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.panel-lore-pergamino.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.panel-lore-pergamino::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(142, 112, 73, 0.45);
  border-radius: 2px;
  pointer-events: none;
}

.lore-encabezado {
  text-align: center;
  position: relative;
  z-index: 2;
}

.lore-etiqueta {
  font-family: var(--serif-antiguo);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8e2622;
}

.lore-nombre {
  font-family: var(--serif-antiguo);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1e140a;
  margin: 4px 0 10px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.lore-linea-div {
  width: 55px;
  height: 1.5px;
  background: #8e7049;
  margin: 0 auto;
  opacity: 0.7;
}

.lore-cuerpo {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  min-height: 180px;
  position: relative;
  z-index: 2;
}

.lore-fragmento {
  font-family: var(--serif-texto);
  font-size: 16px;
  line-height: 1.7;
  color: #26190d;
  text-align: justify;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.42s ease-in-out, transform 0.42s ease-in-out;
  margin: 0;
}

.lore-fragmento.activo {
  opacity: 1;
  transform: translateY(0);
}

.lore-fragmento.destacado {
  font-family: var(--serif-antiguo);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #8e2622;
  text-align: center;
  text-shadow: 0 0 16px rgba(142, 38, 34, 0.35);
  font-style: italic;
  padding: 16px 0;
}

.lore-pie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(142, 112, 73, 0.3);
  padding-top: 12px;
  position: relative;
  z-index: 2;
}

.lore-ciclo-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.dot-ciclo {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(142, 112, 73, 0.35);
  transition: all 0.3s ease;
}

.dot-ciclo.activo {
  background: #8e2622;
  transform: scale(1.35);
  box-shadow: 0 0 6px rgba(142, 38, 34, 0.55);
}

.lore-pista-pie {
  font-family: var(--serif-texto);
  font-size: 11px;
  font-style: italic;
  color: #634b32;
  letter-spacing: 0.04em;
}

/* =============================================================================
   HUD INFERIOR: BARRA DE SALUD 85% Y BARRA DE INVENTARIO
   ========================================================================== */

#hud-inferior-andino {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 15;
  pointer-events: none;
}

/* Barra de Vida: SALUD 85% */
#hud-salud-bloque {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.salud-cabecera {
  display: flex;
  justify-content: space-between;
  width: 280px;
  margin-bottom: 4px;
}

.salud-label {
  font-family: var(--serif-antiguo);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #f4ebd8;
  text-shadow: 0 1px 4px #000, 0 0 8px rgba(0, 0, 0, 0.9);
}

.salud-porcentaje {
  font-family: var(--serif-antiguo);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.65), 0 1px 4px #000;
}

.barra-salud-marco {
  width: 280px;
  height: 12px;
  background: rgba(16, 11, 8, 0.88);
  border: 1.5px solid #8e7049;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.8), inset 0 0 8px rgba(0, 0, 0, 0.9);
}

.barra-salud-relleno {
  height: 100%;
  background: linear-gradient(90deg, #701612 0%, #a8241e 55%, #df382b 100%);
  transition: width 0.35s ease-out;
  box-shadow: 0 0 10px rgba(223, 56, 43, 0.75);
}

.barra-salud-brillo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, transparent 60%);
  pointer-events: none;
}

/* Barra de Inventario (Teclas 1, 2, 3) */
#barra-inventario {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.slot-inv {
  width: 86px;
  height: 86px;
  background: radial-gradient(circle at 50% 25%, rgba(42, 30, 20, 0.92) 0%, rgba(18, 12, 8, 0.96) 100%);
  border: 1.5px solid rgba(142, 112, 73, 0.55);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), inset 0 0 10px rgba(0, 0, 0, 0.6);
  user-select: none;
  outline: none;
}

.slot-inv:hover {
  border-color: rgba(212, 175, 55, 0.85);
  transform: translateY(-2px);
}

/* Cuadro seleccionado: resalte con contorno brillante */
.slot-inv.activo {
  border-color: #ffd700 !important;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.85), inset 0 0 14px rgba(255, 215, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.85) !important;
  transform: translateY(-4px) scale(1.05) !important;
  background: radial-gradient(circle at 50% 25%, rgba(68, 48, 28, 0.95) 0%, rgba(28, 18, 10, 0.98) 100%) !important;
}

.slot-num {
  position: absolute;
  top: 3px;
  left: 6px;
  font-family: var(--serif-antiguo);
  font-size: 11px;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 0 1px 2px #000;
}

.slot-icono {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.slot-icono .svg-icono {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.slot-datos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 2px;
}

.slot-nombre {
  font-family: var(--serif-antiguo);
  font-size: 10.5px;
  font-weight: 700;
  color: #f4ebd8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px #000;
  text-align: center;
}

.slot-cant {
  font-family: var(--serif-antiguo);
  font-size: 10.5px;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

/* =============================================================================
   EFECTO VISUAL DEL GRITO DEL JARJACHA ("JAR, JAR, JAR!")
   ========================================================================== */

#capa-grito-jarjacha {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 48;
  opacity: 0;
  transition: opacity 0.12s ease-out;
  background: radial-gradient(ellipse at center, rgba(160, 20, 20, 0.15) 0%, rgba(120, 10, 10, 0.45) 75%, rgba(60, 0, 0, 0.78) 100%);
}

#capa-grito-jarjacha.activo {
  opacity: 1;
}

#texto-grito-jarjacha {
  font-family: var(--serif-antiguo);
  font-size: clamp(48px, 9vw, 96px);
  font-weight: 900;
  color: #ff1e1e;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 25px #ff0000, 0 0 50px #8b0000, 0 4px 10px #000;
  animation: temblorHorror 0.08s infinite alternate;
  text-align: center;
}

#subtexto-grito-jarjacha {
  font-family: var(--serif-antiguo);
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 700;
  color: #f4ebd8;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 14px;
  text-shadow: 0 2px 6px #000;
}

@keyframes temblorHorror {
  0% { transform: translate(-3px, -2px) rotate(-1deg) scale(1); }
  50% { transform: translate(3px, 2px) rotate(1deg) scale(1.03); }
  100% { transform: translate(-2px, 3px) rotate(0deg) scale(0.98); }
}

@media (max-width: 850px) {
  .leyendas-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .panel-lore-pergamino {
    min-height: 280px;
  }
}

/* =============================================================================
   BARRA DE VIDA DEL JEFE: JARJACHA (BOSS HEALTH BAR)
   ========================================================================== */

.barra-jefe-jarjacha {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, 92vw);
  background: radial-gradient(ellipse at 50% 40%, rgba(36, 22, 14, 0.95) 0%, rgba(16, 9, 6, 0.98) 100%);
  border: 1.5px solid #a67c38;
  border-radius: 4px;
  padding: 8px 16px 10px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.88), 0 0 18px rgba(166, 124, 56, 0.3), inset 0 0 16px rgba(0, 0, 0, 0.85);
  z-index: 25;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.barra-jefe-jarjacha.golpeado {
  animation: sacudidaBarraJefe 0.35s ease-in-out;
  border-color: #ff3b30;
  box-shadow: 0 0 25px rgba(255, 59, 48, 0.7);
}

@keyframes sacudidaBarraJefe {
  0%, 100% { transform: translateX(-50%); }
  20% { transform: translateX(calc(-50% - 5px)); }
  40% { transform: translateX(calc(-50% + 5px)); }
  60% { transform: translateX(calc(-50% - 3px)); }
  80% { transform: translateX(calc(-50% + 3px)); }
}

.jefe-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 5px;
}

.jefe-identidad {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jefe-icono {
  font-size: 16px;
  color: #ff3b30;
  text-shadow: 0 0 8px #ff0000;
  animation: pulsoIconoJefe 1.2s infinite alternate ease-in-out;
}

@keyframes pulsoIconoJefe {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #ff0000); }
  100% { transform: scale(1.2); filter: drop-shadow(0 0 8px #ff4444); }
}

.jefe-nombre {
  font-family: var(--serif-antiguo);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #f7eed8;
  text-shadow: 0 1px 4px #000, 0 0 10px rgba(255, 215, 0, 0.45);
}

.jefe-titulo {
  font-family: var(--serif-texto);
  font-size: 11.5px;
  font-style: italic;
  color: #b59265;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.jefe-estado-contenedor {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jefe-badge-estado {
  font-family: var(--serif-antiguo);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(142, 112, 73, 0.35);
  color: #ffd700;
  border: 1px solid rgba(212, 175, 55, 0.5);
  transition: all 0.25s ease;
}

.jefe-badge-estado.estado-grito {
  background: #8e1414;
  color: #fff;
  border-color: #ff3b30;
  box-shadow: 0 0 10px #ff3b30;
  animation: pulsoAlertaEstado 0.25s infinite alternate;
}

.jefe-badge-estado.estado-embestida {
  background: #a33800;
  color: #fff;
  border-color: #ff9500;
  box-shadow: 0 0 10px #ff9500;
  animation: pulsoAlertaEstado 0.25s infinite alternate;
}

.jefe-badge-estado.estado-aturdido {
  background: #1b4d70;
  color: #b3e5fc;
  border-color: #4fc3f7;
  box-shadow: 0 0 8px #4fc3f7;
}

@keyframes pulsoAlertaEstado {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.jefe-hp-numeros {
  font-family: var(--serif-antiguo);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffd700;
  text-shadow: 0 1px 3px #000;
}

.jefe-barra-marco {
  position: relative;
  width: 100%;
  height: 14px;
  background: rgba(12, 6, 4, 0.95);
  border: 1.5px solid #8e7049;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.75);
}

.jefe-barra-fondo {
  position: absolute;
  inset: 0;
  background: #1a0808;
}

.jefe-barra-danio {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #ffd700);
  transition: width 0.55s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.jefe-barra-relleno {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #6b0c09 0%, #aa1913 50%, #f02d24 100%);
  transition: width 0.15s ease-out;
  box-shadow: 0 0 10px rgba(240, 45, 36, 0.85);
}

.jefe-barra-brillo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, transparent 65%);
  pointer-events: none;
}

/* =============================================================================
   BANNER DE ALERTA DE ATAQUE INMINENTE
   ========================================================================== */

.alerta-ataque-jarjacha {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(160, 20, 16, 0.95) 0%, rgba(120, 10, 10, 0.98) 100%);
  border: 1.5px solid #ffd700;
  border-radius: 3px;
  padding: 6px 20px;
  box-shadow: 0 0 25px rgba(220, 30, 20, 0.85), 0 4px 15px rgba(0, 0, 0, 0.8);
  z-index: 26;
  pointer-events: none;
  animation: pulsoBannerAlerta 0.35s infinite alternate ease-in-out;
}

@keyframes pulsoBannerAlerta {
  0% { transform: translateX(-50%) scale(1); box-shadow: 0 0 15px rgba(220, 30, 20, 0.6); }
  100% { transform: translateX(-50%) scale(1.04); box-shadow: 0 0 30px rgba(255, 60, 40, 1); }
}

.alerta-ataque-jarjacha .alerta-icono {
  font-size: 18px;
  color: #ffd700;
  text-shadow: 0 0 8px #ff0;
}

.alerta-ataque-jarjacha .alerta-texto {
  font-family: var(--serif-antiguo);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 4px #000, 0 0 10px rgba(255, 50, 30, 0.8);
}

/* =============================================================================
   OVERLAY VISUAL DE ZARPAZO / IMPACTO DE EMBESTIDA
   ========================================================================== */

.overlay-zarpazo {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 47;
  opacity: 0;
  transition: opacity 0.08s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-zarpazo.activo {
  opacity: 1;
}

.zarpazo-marcas {
  position: relative;
  width: min(500px, 85vw);
  height: min(400px, 70vh);
  transform: rotate(-18deg);
}

.zarpazo-garra {
  position: absolute;
  width: 100%;
  height: 9px;
  background: linear-gradient(90deg, transparent 0%, #ff1c1c 20%, #fff 50%, #ff1c1c 80%, transparent 100%);
  border-radius: 5px;
  box-shadow: 0 0 25px #ff0000, 0 0 50px #8b0000;
  filter: blur(1px);
}

.garra-1 { top: 25%; transform: scaleY(1.2); }
.garra-2 { top: 50%; transform: scaleY(1.5) translateX(-15px); }
.garra-3 { top: 75%; transform: scaleY(1.1) translateX(10px); }

.zarpazo-destello {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 30, 30, 0.45) 0%, rgba(180, 0, 0, 0.25) 50%, transparent 80%);
}

/* =============================================================================
   MÓVILES: AVISO DE ORIENTACIÓN, CONTROLES TÁCTILES Y RESPONSIVIDAD
   ========================================================================== */

/* --- Aviso de Orientación Vertical (Landscape enforcement) --- */
#aviso-orientacion {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #0d0b08;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  touch-action: none;
}
.aviso-orientacion-contenido {
  max-width: 440px;
  background: rgba(26, 18, 12, 0.96);
  border: 2px solid var(--oro);
  border-radius: 14px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.9);
  color: var(--papel);
}
.aviso-orientacion-contenido h2 {
  font-family: var(--serif-antiguo);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--oro-brillo);
  margin: 12px 0 8px 0;
}
.aviso-orientacion-contenido p {
  font-size: 15px;
  line-height: 1.5;
  color: #dfd4c0;
  margin-bottom: 20px;
}
.icono-rotar {
  font-size: 64px;
  display: inline-block;
  animation: animRotarCelular 2.2s infinite ease-in-out;
}
@keyframes animRotarCelular {
  0%   { transform: rotate(0deg); }
  45%  { transform: rotate(-90deg); }
  85%  { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

/* --- Capa de Controles Táctiles --- */
#controles-tactiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  touch-action: none;
}

/* --- Joystick Virtual (Izquierda) --- */
#touch-joystick-zona {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 144px;
  height: 144px;
  pointer-events: auto;
  touch-action: none;
}
#touch-joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(38, 28, 18, 0.65), rgba(14, 10, 6, 0.88));
  border: 2px solid rgba(200, 156, 74, 0.65);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75), inset 0 0 14px rgba(0, 0, 0, 0.6);
}
#touch-joystick-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8c67f, #9b722d 75%, #583d12);
  border: 2px solid #f8e1ab;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7), inset 0 2px 4px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  transition: transform 0.03s linear;
}

/* --- Barra Superior Rápida (Pausa, Pantalla Completa, Armas) --- */
#touch-barra-superior {
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.btn-touch-circular {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 15, 10, 0.85);
  border: 1.5px solid rgba(200, 156, 74, 0.7);
  color: var(--papel);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-select: none;
}
.btn-touch-circular:active {
  background: rgba(142, 38, 34, 0.85);
  transform: scale(0.92);
}
#touch-selector-armas {
  display: flex;
  gap: 8px;
  margin-left: 6px;
}
.btn-touch-slot {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: rgba(20, 15, 10, 0.85);
  border: 1.5px solid rgba(233, 224, 201, 0.35);
  color: var(--papel);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.btn-touch-slot.activo {
  border-color: var(--oro-brillo);
  background: rgba(156, 118, 56, 0.55);
  box-shadow: 0 0 10px rgba(200, 156, 74, 0.7);
}

/* --- Botones de Acción (Derecha) --- */
#touch-botones-accion {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 260px;
  height: 220px;
  pointer-events: auto;
  touch-action: none;
}
.btn-touch-accion {
  position: absolute;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 2px solid rgba(200, 156, 74, 0.65);
  background: rgba(20, 16, 12, 0.85);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-touch-accion:active {
  transform: scale(0.91);
  filter: brightness(1.25);
}
.btn-touch-icono {
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}
.btn-touch-label {
  font-size: 9px;
  font-family: var(--serif);
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-top: 2px;
  pointer-events: none;
  text-shadow: 0 1px 3px #000;
}

/* Botón Fuego: Grande, prominente */
.btn-touch-fuego {
  right: 10px;
  bottom: 10px;
  width: 76px;
  height: 76px;
  border-color: #f06a55;
  background: radial-gradient(circle at 35% 35%, #c83226, #631713);
  box-shadow: 0 0 18px rgba(200, 50, 38, 0.65), inset 0 2px 6px rgba(255, 255, 255, 0.35);
}
.btn-touch-fuego .btn-touch-icono { font-size: 28px; }
.btn-touch-fuego .btn-touch-label { font-size: 10px; }

/* Botón Mira / Bloqueo */
.btn-touch-apuntar {
  right: 100px;
  bottom: 18px;
  width: 60px;
  height: 60px;
  border-color: #689cb8;
  background: radial-gradient(circle at 35% 35%, #3e6884, #1d3342);
}
.btn-touch-apuntar.activo {
  border-color: #8fd4ff;
  background: radial-gradient(circle at 35% 35%, #4a88b0, #264a63);
  box-shadow: 0 0 14px rgba(104, 156, 184, 0.7);
}

/* Botón Usar / F (Interactuar) */
.btn-touch-usar {
  right: 92px;
  bottom: 90px;
  width: 56px;
  height: 56px;
  border-color: var(--oro-brillo);
  background: radial-gradient(circle at 35% 35%, #9c7638, #4f3b19);
}

/* Botón Saltar (Espacio) */
.btn-touch-saltar {
  right: 12px;
  bottom: 100px;
  width: 56px;
  height: 56px;
  border-color: #7fb0c4;
  background: radial-gradient(circle at 35% 35%, #4a6e38, #24381b);
}

/* Botón Recargar (R) */
.btn-touch-recargar {
  right: 172px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-color: #d4af37;
  background: radial-gradient(circle at 35% 35%, #7a5c28, #3b2c12);
}

/* Botón Curar (G) */
.btn-touch-curar {
  right: 162px;
  bottom: 84px;
  width: 50px;
  height: 50px;
  border-color: #b8483c;
  background: radial-gradient(circle at 35% 35%, #6a2420, #36110f);
}

/* --- Reposicionamiento del HUD en modo táctil --- */
body.es-tactil #estado {
  bottom: 178px;
  left: 20px;
  width: 175px;
  transform: scale(0.92);
  transform-origin: bottom left;
}
body.es-tactil #arma-info {
  bottom: 200px;
  right: 20px;
  transform: scale(0.92);
  transform-origin: bottom right;
}
body.es-tactil #carga {
  bottom: 160px;
}
body.es-tactil #interaccion {
  bottom: 180px;
}

/* Evitar retardo de clic de 300ms en botones generales */
button, .boton, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
