@font-face {
  font-family: "Lilita One";
  src: url("../../fuentes/lilita-one.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../../fuentes/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --fondo: #0c0a1d;
  --texto: #f6f4ff;
  --suave: #b9b3de;
  --rosa: #ff3d7f;
  --azul: #46b9ff;
  --naranja: #ff9f1c;
  --titulo: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --cuerpo: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo); color: var(--texto); font-family: var(--cuerpo); font-weight: 700;
  display: flex; flex-direction: column; align-items: center; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.arriba {
  width: 100%; max-width: 1200px; display: flex; align-items: center; gap: 18px;
  padding: 10px 16px; min-height: 52px;
}
.arriba h1 { margin: 0; font-family: var(--titulo); font-weight: 400; font-size: 22px; color: var(--naranja); }
.volver { color: var(--azul); font-weight: 900; text-decoration: none; white-space: nowrap; }
.volver:hover { text-decoration: underline; }

/* el lienzo se agranda sin suavizar: los píxeles quedan nítidos */
.escenario { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
#pantalla {
  display: block; width: 320px; height: 180px; image-rendering: pixelated; image-rendering: crisp-edges;
  border-radius: 10px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6);
  background: #000;
}

.mensaje {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); margin: 0;
  width: max-content; max-width: 88%; padding: 10px 16px; border-radius: 12px; text-align: center;
  background: rgba(12, 10, 29, 0.88); border: 2px solid rgba(255, 159, 28, 0.7);
  font-size: clamp(13px, 2vw, 18px); line-height: 1.3; pointer-events: none;
}
.jefe-barra {
  position: absolute; left: 50%; top: 4%; transform: translateX(-50%); width: 56%;
  display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
}
.jefe-barra span {
  font-family: var(--titulo); font-size: clamp(14px, 2.2vw, 22px); color: #ffb347;
  text-shadow: 0 0 10px rgba(255, 90, 31, 0.9), 0 2px 0 #000;
}
.jefe-vida { width: 100%; height: clamp(8px, 1.4vw, 14px); border-radius: 99px; background: rgba(0, 0, 0, 0.7); border: 2px solid #ffb347; overflow: hidden; }
.jefe-vida i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff3d1f, #ffd23f); transition: width 0.2s ease; }

.capa {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  background: rgba(8, 6, 22, 0.84); border-radius: 10px; overflow: auto;
}
.capa[hidden], .mensaje[hidden], .jefe-barra[hidden], .controles[hidden] { display: none; }
.cartel { max-width: 520px; text-align: center; }
.cartel h2 {
  margin: 0 0 8px; font-family: var(--titulo); font-weight: 400; font-size: clamp(26px, 5vw, 46px); line-height: 1.05;
  color: var(--naranja); text-shadow: 0 0 24px rgba(255, 159, 28, 0.55), 0 3px 0 #000;
}
.cartel p { margin: 0 0 12px; color: var(--suave); font-size: clamp(14px, 2vw, 18px); line-height: 1.35; }
.cartel b { color: #ffb347; }
.cartel .antetitulo { color: var(--rosa); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 900; font-size: 13px; margin-bottom: 4px; }
.ayuda { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: clamp(13px, 1.8vw, 16px); }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 1px; border-radius: 6px;
  background: #221d47; border: 1px solid rgba(255, 255, 255, 0.2); border-bottom-width: 3px;
  font-family: var(--cuerpo); font-weight: 900; font-size: 0.9em;
}
.tactil { display: none; }
.es-tactil .tactil { display: list-item; }
.es-tactil .teclado { display: none; }
.botones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.boton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 26px;
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  font-family: var(--titulo); font-weight: 400; font-size: 22px; color: #1a0f00;
  background: linear-gradient(180deg, #ffd27a, var(--naranja)); box-shadow: 0 8px 24px rgba(255, 159, 28, 0.45);
  transition: transform 0.15s ease;
}
.boton:hover, .boton:focus-visible { transform: translateY(-2px); }
.boton-borde { background: transparent; color: var(--texto); border: 2px solid rgba(255, 255, 255, 0.25); box-shadow: none; font-size: 18px; }

/* palanca y botón de ataque: sólo en pantallas táctiles */
.controles {
  position: fixed; left: 0; right: 0; bottom: 0; pointer-events: none;
  padding: 0 calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
  display: flex; align-items: flex-end; justify-content: space-between;
}
.palanca {
  position: relative; width: 140px; height: 140px; border-radius: 50%; pointer-events: auto; touch-action: none;
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.22);
}
.perilla {
  position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd27a, var(--naranja) 60%, #d9650c); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.atacar {
  width: 96px; height: 96px; border-radius: 50%; pointer-events: auto; touch-action: none; cursor: pointer;
  border: 3px solid rgba(255, 255, 255, 0.35); font-size: 42px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff7aa6, var(--rosa) 60%, #c0185a); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.atacar.apretado { transform: scale(0.92); }

/* celu acostado: el título más chico para que el juego tenga más alto */
@media (orientation: landscape) and (max-height: 500px) {
  .arriba { min-height: 34px; padding: 4px 16px; }
  .arriba h1 { font-size: 16px; }
  .palanca { width: 120px; height: 120px; opacity: 0.85; }
  .atacar { width: 84px; height: 84px; font-size: 36px; opacity: 0.9; }
}

/* ---------- menú principal, jugar, tienda y configuraciones (pedido #12) ---------- */
.monedas-cartel { display: inline-flex; align-items: center; gap: 8px; color: #ffe066 !important; font-weight: 900; }
.moneda {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3a0, #ffd23f 45%, #e0a10b); box-shadow: inset 0 0 0 2px #8a5a00;
}
.menu-botones { display: grid; gap: 10px; width: min(300px, 100%); margin: 4px auto 16px; }
.menu-botones .boton { width: 100%; }
.opciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; text-align: left; }
.opcion { padding: 14px; border-radius: 16px; background: #1d1840; border: 1px solid rgba(255, 255, 255, 0.12); }
.opcion h3 { margin: 0 0 6px; font-family: var(--titulo); font-weight: 400; font-size: 20px; color: var(--texto); }
.opcion p { font-size: 14px !important; }
.opcion .botones { justify-content: flex-start; }
.opcion .boton { font-size: 18px; min-height: 42px; padding: 8px 18px; }
.volver-boton {
  margin-top: 6px; border: 0; background: none; color: var(--azul); font: inherit; font-weight: 900; cursor: pointer;
}
.volver-boton:hover, .volver-boton:focus-visible { text-decoration: underline; }
.skins { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 6px 0 12px; }
.skin {
  width: 150px; padding: 12px 10px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #1d1840; border: 2px solid rgba(255, 255, 255, 0.12);
}
.skin.elegida { border-color: var(--naranja); box-shadow: 0 0 18px rgba(255, 159, 28, 0.35); }
.skin-dibujo { width: 84px; height: 84px; image-rendering: pixelated; image-rendering: crisp-edges; }
.skin b { font-family: var(--titulo); font-weight: 400; font-size: 20px; }
.skin span { font-size: 12px; color: var(--suave); }
.boton-chico { min-height: 38px; padding: 6px 14px; font-size: 16px; }
.boton:disabled { opacity: 0.5; cursor: default; transform: none; }
.tienda-ayuda { font-size: 13px !important; }
.ajustes { display: grid; gap: 10px; margin: 4px auto 16px; width: max-content; max-width: 100%; text-align: left; }
.ajuste { display: flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; }
.ajuste input { width: 22px; height: 22px; accent-color: var(--naranja); }
.pausa {
  position: absolute; top: var(--pausa-y, 18%); right: var(--pausa-x, 1.5%); z-index: 2;
  width: 40px; height: 34px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.3); cursor: pointer;
  background: rgba(12, 10, 29, 0.7); color: #fff; font-weight: 900; font-size: 14px; letter-spacing: -2px;
}
.pausa[hidden] { display: none; }
@media (max-width: 560px) {
  .opciones { grid-template-columns: 1fr; }
}

/* ---------- puesto de pociones (pedido #18) ---------- */
.pociones { display: grid; gap: 8px; margin: 4px auto 10px; max-width: 460px; text-align: left; }
.pocion { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #1d1840; border: 1px solid rgba(255, 255, 255, 0.12); }
.pocion-dibujo { width: 30px; height: 35px; image-rendering: pixelated; image-rendering: crisp-edges; }
.pocion b { display: block; font-size: 15px; }
.pocion span { font-size: 12px; color: var(--suave); }
#pocionComprada { min-height: 1.2em; color: #ffe066 !important; }

/* ---------- mochila (#27) y herrería (#28) ---------- */
.mochila-boton {
  position: absolute; top: calc(var(--pausa-y, 18%) + 40px); right: var(--pausa-x, 1.5%); z-index: 2;
  width: 40px; height: 34px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.3); cursor: pointer;
  background: rgba(12, 10, 29, 0.7); font-size: 18px; line-height: 1;
}
.mochila-boton[hidden] { display: none; }
.item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #1d1840; border: 1px solid rgba(255, 255, 255, 0.12); text-align: left; }
.item-dibujo, .mejora-dibujo { width: 30px; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.item b { display: block; font-size: 15px; }
.item span { font-size: 12px; color: var(--suave); }
#mochilaVacia[hidden] { display: none; }
.herreria {
  width: min(640px, 100%); display: grid; gap: 10px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 170px; grid-template-areas: "info taller" "estante estante" "salir salir";
}
.herreria-info { grid-area: info; text-align: left; }
.herreria-info h2 { margin: 0 0 4px; font-family: var(--titulo); font-weight: 400; font-size: clamp(26px, 4vw, 40px); color: var(--naranja); }
.herreria-info p { margin: 0 0 6px; color: var(--suave); }
.herrero-taller { grid-area: taller; width: 170px; height: 170px; border-radius: 12px; border: 3px solid #5a3a1e; image-rendering: pixelated; image-rendering: crisp-edges; justify-self: end; }
.estante {
  grid-area: estante; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 10px 18px;
  background: linear-gradient(#6a4426, #4e321a); border-radius: 10px; box-shadow: inset 0 -8px 0 #2e1c0c, 0 6px 0 #2e1c0c;
}
.mejora { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); text-align: center; }
.mejora b { font-family: var(--titulo); font-weight: 400; font-size: 18px; }
.mejora span { font-size: 11px; color: #f0d8b8; }
.mejora .mejora-nivel { font-size: 14px; color: #ffd23f; letter-spacing: 2px; }
.herreria-salir { grid-area: salir; }
@media (max-width: 560px) {
  .herreria { grid-template-columns: 1fr; grid-template-areas: "info" "taller" "estante" "salir"; }
  .herrero-taller { justify-self: center; width: 120px; height: 120px; }
  .estante { grid-template-columns: 1fr; }
}
