:root {
  --bg: #0d0806;
  --panel: rgba(19, 13, 10, .92);
  --line: rgba(255, 161, 65, .34);
  --orange: #ff8a1d;
  --yellow: #ffd25c;
  --text: #fff7ea;
  --muted: #cdbbab;
  --lava: #ff521f;
}
* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #070504;
}
body {
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
button { font: inherit; }
#app, .screen { width: 100%; height: 100%; }
.screen { display: none; position: absolute; inset: 0; }
.screen.active { display: flex; }
.hidden { display: none !important; }

.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 4, 3, .96);
  padding: 24px;
}
.overlay-card {
  width: min(460px, 100%);
  text-align: center;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(145deg, rgba(31,18,12,.94), rgba(9,7,6,.94));
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.overlay-icon { font-size: 60px; margin-bottom: 10px; }
.overlay-card h2 { margin: 0 0 10px; font-size: 28px; }
.overlay-card p { margin: 0; color: #d8c9bc; line-height: 1.6; }

#homeScreen {
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 81, 17, .18), transparent 28%),
    radial-gradient(circle at 18% 15%, rgba(255, 183, 81, .06), transparent 22%),
    linear-gradient(rgba(8,5,4,.18), rgba(8,5,4,.88)),
    repeating-linear-gradient(115deg, #180f0a 0 3px, #0f0907 3px 10px);
}
#homeScreen::before,
#homeScreen::after {
  content: "";
  position: fixed;
  left: -10%;
  right: -10%;
  bottom: -7vh;
  height: 36vh;
  background: #0b0806;
  clip-path: polygon(0 72%, 10% 56%, 18% 67%, 27% 42%, 35% 61%, 43% 55%, 51% 21%, 58% 57%, 66% 44%, 76% 69%, 88% 48%, 100% 67%, 100% 100%, 0 100%);
  opacity: .95;
  pointer-events: none;
}
#homeScreen::after {
  bottom: -16vh;
  background: #2c170d;
  opacity: .42;
  transform: scaleX(-1);
}
.home-grid {
  position: relative;
  z-index: 2;
  width: min(1200px, 100%);
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 28px;
}
.hero-card, .difficulty-card, .result-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(35, 18, 11, .94), rgba(10, 8, 7, .94));
  box-shadow: 0 24px 80px rgba(0,0,0,.45), inset 0 0 60px rgba(255, 91, 31, .04);
  backdrop-filter: blur(8px);
}
.hero-card { padding: clamp(24px, 4.5vw, 54px); }
.difficulty-card { padding: 26px; align-self: center; }
.eyebrow { color: var(--orange); letter-spacing: .16em; font-weight: 900; font-size: 12px; }
h1 {
  margin: 18px 0 0;
  font-size: clamp(52px, 7vw, 104px);
  line-height: .78;
  letter-spacing: -.075em;
  text-shadow: 0 0 25px rgba(255, 83, 16, .25);
}
h1 span { color: var(--orange); }
.hero-card h2 { margin: 14px 0 22px; font-size: clamp(22px, 2.6vw, 38px); color: var(--yellow); }
.briefing { max-width: 720px; line-height: 1.72; color: #eadccc; font-size: clamp(14px, 1.25vw, 18px); }
.mission-line {
  margin-top: 24px;
  padding: 14px 16px;
  border-left: 4px solid var(--lava);
  background: rgba(255, 82, 31, .1);
  color: #ffd9ca;
  font-weight: 900;
  letter-spacing: .04em;
}
.campaign-box, .tips-box {
  margin-top: 22px;
  padding: 18px 18px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
}
.campaign-box h3, .tips-box h4, .difficulty-card h3 {
  margin: 0 0 12px;
  letter-spacing: .12em;
  font-size: 15px;
  color: #f1d7c1;
}
.campaign-box ul {
  margin: 0;
  padding-left: 18px;
  color: #e7d8c8;
  line-height: 1.65;
}
.tips-box p {
  margin: 0 0 10px;
  color: #d8c9bb;
  line-height: 1.6;
  font-size: 13px;
}
.tips-box p:last-child { margin-bottom: 0; }
.difficulty {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  margin: 10px 0;
  color: var(--text);
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  cursor: pointer;
  transition: .18s ease;
}
.difficulty:hover { transform: translateX(4px); border-color: rgba(255, 161, 70, .5); }
.difficulty.selected { border-color: var(--orange); background: rgba(255, 138, 29, .13); box-shadow: 0 0 25px rgba(255, 91, 24, .12); }
.difficulty.infernal strong { color: #ff6c47; }
.difficulty strong { font-size: 18px; }
.difficulty span { color: var(--muted); font-size: 13px; }
.start-btn, .secondary-btn {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 17px 18px;
  font-weight: 1000;
  letter-spacing: .08em;
  cursor: pointer;
}
.start-btn {
  margin-top: 14px;
  color: #160a04;
  background: linear-gradient(90deg, #ff7b1b, #ffd562);
  box-shadow: 0 8px 28px rgba(255, 93, 22, .24);
}
.secondary-btn {
  margin-top: 10px;
  background: rgba(255,255,255,.07);
  color: white;
  border: 1px solid rgba(255,255,255,.12);
}
.compact-btn { padding: 13px 15px; }
footer {
  position: absolute;
  z-index: 3;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255,255,255,.34);
  font-size: 11px;
}

#gameScreen { background: #000; align-items: stretch; justify-content: stretch; }
#gameCanvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
  flex-wrap: wrap;
  justify-content: center;
}
.hud-box {
  min-width: 84px;
  height: 48px;
  padding: 7px 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(10, 8, 6, .78);
  border: 1px solid rgba(255, 137, 44, .38);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.hud-box span { font-size: 9px; letter-spacing: .13em; color: #cdb8a8; font-weight: 900; }
.hud-box b { font-size: 20px; line-height: 1; color: #fff4d8; }
.health-box { width: 150px; }
.health-track {
  width: 100%;
  height: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.6);
  margin-top: 4px;
}
.health-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5b3a, #ffd66e); }
#messageBar {
  position: absolute;
  left: 50%;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 18px));
  transform: translateX(-50%) translateY(14px);
  min-width: min(84vw, 820px);
  max-width: 88vw;
  z-index: 18;
  opacity: 0;
  padding: 12px 18px;
  background: rgba(10, 8, 6, .82);
  border: 1px solid rgba(255, 170, 81, .38);
  text-align: center;
  letter-spacing: .06em;
  font-weight: 900;
  transition: opacity .2s ease, transform .2s ease;
}
#messageBar.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#statusStrip {
  position: absolute;
  top: max(74px, calc(env(safe-area-inset-top) + 64px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  min-width: 360px;
  max-width: 88vw;
  text-align: center;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(6,6,6,.45);
  color: #f3dfbd;
  font-size: 12px;
  letter-spacing: .06em;
}
#damageFlash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255,96,50,.06), rgba(255,0,0,.34));
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 9;
}
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
}
#crosshair i {
  position: absolute;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 8px rgba(255,255,255,.3);
}
#crosshair i:first-child { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
#crosshair i:last-child { top: 50%; left: 0; width: 100%; height: 2px; transform: translateY(-50%); }
#desktopHint {
  position: absolute;
  left: 14px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 9;
  font-size: 11px;
  color: rgba(255,255,255,.47);
  background: rgba(0,0,0,.25);
  padding: 7px 10px;
}
.corner-btn {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: auto;
  z-index: 16;
  min-width: 96px;
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(11, 9, 7, .76);
  color: white;
  padding: 9px 11px;
  cursor: pointer;
  text-align: center;
  backdrop-filter: blur(4px);
}
.corner-btn.exit { top: max(54px, calc(env(safe-area-inset-top) + 40px)); }
.corner-btn.music-right { left: 14px; right: auto; top: max(94px, calc(env(safe-area-inset-top) + 80px)); min-width: 96px; }
#mobileControls {
  position: absolute;
  inset: auto 0 max(72px, calc(env(safe-area-inset-bottom) + 54px)) 0;
  display: none;
  justify-content: space-between;
  align-items: end;
  padding: 0 18px;
  z-index: 15;
}
.pad {
  --pad-size: 58px;
  display: grid;
  grid-template-columns: repeat(3, var(--pad-size));
  grid-template-rows: repeat(3, var(--pad-size));
  grid-template-areas:
    ". up ."
    "left center right"
    ". down .";
  gap: 7px;
  align-items: center;
  justify-items: center;
}
.pad-up { grid-area: up; }
.pad-left { grid-area: left; }
.pad-right { grid-area: right; }
.pad-down { grid-area: down; }
.pad-center {
  grid-area: center;
  width: calc(var(--pad-size) * .72);
  height: calc(var(--pad-size) * .72);
  border-radius: 50%;
  border: 1px solid rgba(255, 147, 55, .22);
  background:
    radial-gradient(circle, rgba(255, 122, 28, .24) 0 18%, transparent 20%),
    rgba(9, 7, 6, .58);
  box-shadow: inset 0 0 15px rgba(255, 97, 22, .08);
  pointer-events: none;
}
.pad button, #fireBtn {
  width: var(--pad-size);
  height: var(--pad-size);
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.15);
  background: linear-gradient(145deg, rgba(29,20,15,.88), rgba(8,7,6,.82));
  color: white;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(0,0,0,.28), inset 0 0 12px rgba(255,123,31,.04);
  backdrop-filter: blur(4px);
}
#fireBtn {
  width: 96px;
  height: 76px;
  font-size: 16px;
  font-weight: 1000;
  letter-spacing: .07em;
  border-color: rgba(255, 132, 41, .34);
}
.pad button.active {
  transform: scale(.94);
  background: linear-gradient(145deg, rgba(255, 129, 37, .55), rgba(85, 30, 9, .78));
  border-color: rgba(255, 178, 90, .7);
}

.result-screen { align-items: center; justify-content: center; padding: 20px; }
.result-card { width: min(560px, 100%); padding: 34px 30px; text-align: center; }
.result-icon { font-size: 64px; margin-bottom: 12px; color: var(--yellow); }
.result-card h2 { margin: 0 0 12px; font-size: 34px; }
.result-card p { margin: 0; color: #dacbbb; line-height: 1.6; }
.result-stats {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.result-stats div {
  padding: 14px 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.result-stats span { display: block; font-size: 11px; color: #baaa9b; letter-spacing: .12em; }
.result-stats b { display: block; margin-top: 5px; font-size: 26px; }

@media (max-width: 960px) {
  .home-grid { grid-template-columns: 1fr; }
}
@media (hover: none), (pointer: coarse) {
  #mobileControls { display: flex; }
  #desktopHint { display: none; }
}
@media (max-width: 760px) {
  #hud { max-width: 95vw; }
  .hud-box { min-width: 70px; }
  .health-box { width: 130px; }
  .pad { --pad-size: 52px; gap: 5px; }
  #fireBtn { width: 84px; height: 66px; }
  #statusStrip { top: max(110px, calc(env(safe-area-inset-top) + 100px)); min-width: 260px; font-size: 11px; }
}

/* v0.3: portada fija, sin desplazamiento ni zoom */
#homeScreen {
  overflow: hidden;
  padding: clamp(12px, 2.2vh, 22px) clamp(14px, 2vw, 24px) clamp(24px, 4vh, 38px);
}
.home-grid {
  height: min(650px, calc(100dvh - 62px));
  min-height: 0;
  grid-template-columns: 1.08fr .92fr;
  align-items: stretch;
  gap: clamp(16px, 2vw, 28px);
}
.hero-card,
.difficulty-card {
  min-height: 0;
  overflow: hidden;
}
.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(22px, 4vw, 52px);
}
.difficulty-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(18px, 2.6vw, 30px);
}
#homeScreen h1 {
  font-size: clamp(50px, 7.2vw, 102px);
  margin-top: 14px;
}
#homeScreen .hero-card h2 {
  margin: 13px 0 18px;
}
#homeScreen .briefing {
  margin: 0;
  max-width: 650px;
  font-size: clamp(14px, 1.22vw, 18px);
  line-height: 1.62;
}
#homeScreen .mission-line {
  margin-top: clamp(16px, 2.6vh, 24px);
  padding: 12px 15px;
  font-size: clamp(12px, 1vw, 15px);
}
#homeScreen .difficulty {
  flex: 0 0 auto;
  padding: clamp(11px, 1.65vh, 15px) 18px;
  margin: 7px 0;
}
#homeScreen .start-btn {
  margin-top: 10px;
  padding: 15px 18px;
}
#homeScreen .secondary-btn {
  margin-top: 8px;
  padding: 11px 15px;
}
.controls-mini {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
  color: #d5c5b7;
  font-size: 12px;
  line-height: 1.5;
}
#homeScreen footer {
  bottom: max(6px, env(safe-area-inset-bottom));
}

.level-intro {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0,0,0,.64);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.level-intro.show {
  opacity: 1;
  visibility: visible;
}
.level-intro-card {
  min-width: min(580px, 82vw);
  padding: clamp(24px, 5vh, 48px) clamp(30px, 6vw, 72px);
  text-align: center;
  border-top: 3px solid #ff8a1d;
  border-bottom: 3px solid #ff8a1d;
  background: linear-gradient(90deg, rgba(8,6,5,.2), rgba(27,14,8,.96), rgba(8,6,5,.2));
  box-shadow: 0 0 80px rgba(255,90,20,.15);
}
.level-intro-card span {
  display: block;
  color: #ffb04c;
  font-size: clamp(13px, 1.6vw, 20px);
  font-weight: 1000;
  letter-spacing: .26em;
}
.level-intro-card h2 {
  margin: 8px 0 6px;
  color: #fff5e6;
  font-size: clamp(34px, 6vw, 78px);
  line-height: .95;
  letter-spacing: -.035em;
}
.level-intro-card p {
  margin: 0;
  color: #e2c8ae;
  font-size: clamp(12px, 1.25vw, 17px);
  font-weight: 800;
  letter-spacing: .13em;
}


.death-banner {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(70,0,0,.38), rgba(0,0,0,.82));
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.death-banner.show {
  opacity: 1;
  visibility: visible;
}
.death-banner-card {
  width: min(720px, 88vw);
  padding: clamp(24px, 5vh, 48px) clamp(24px, 5vw, 64px);
  text-align: center;
  border-top: 3px solid #d91f1f;
  border-bottom: 3px solid #d91f1f;
  background: linear-gradient(90deg, rgba(15,0,0,.18), rgba(42,4,4,.97), rgba(15,0,0,.18));
  box-shadow: 0 0 90px rgba(220,0,0,.22);
}
.death-banner-card span {
  display: block;
  color: #ff8a75;
  font-size: clamp(12px, 1.5vw, 19px);
  font-weight: 1000;
  letter-spacing: .22em;
}
.death-banner-card h2 {
  margin: 8px 0 8px;
  color: #fff4ef;
  font-size: clamp(38px, 7vw, 88px);
  line-height: .92;
  letter-spacing: -.04em;
  text-shadow: 0 0 26px rgba(255,0,0,.32);
}
.death-banner-card p {
  margin: 0 0 13px;
  color: #ffd7ce;
  font-size: clamp(14px, 1.5vw, 21px);
  font-weight: 900;
  letter-spacing: .1em;
}
.death-banner-card strong {
  display: block;
  color: #ffbc57;
  font-size: clamp(11px, 1.15vw, 16px);
  letter-spacing: .08em;
  line-height: 1.45;
}

@media (max-height: 660px) and (orientation: landscape) {
  #homeScreen {
    padding: 9px 12px 25px;
  }
  .home-grid {
    height: calc(100dvh - 38px);
    gap: 12px;
  }
  .hero-card { padding: 18px 24px; }
  .difficulty-card { padding: 14px 18px; }
  #homeScreen .eyebrow { font-size: 9px; }
  #homeScreen h1 { font-size: clamp(42px, 8.1vh, 70px); margin-top: 8px; }
  #homeScreen .hero-card h2 { font-size: clamp(17px, 3.6vh, 26px); margin: 8px 0 10px; }
  #homeScreen .briefing { font-size: clamp(11px, 2.05vh, 14px); line-height: 1.45; }
  #homeScreen .mission-line { margin-top: 11px; padding: 9px 11px; font-size: 10px; }
  #homeScreen .difficulty-card h3 { margin-bottom: 5px; font-size: 11px; }
  #homeScreen .difficulty { padding: 8px 12px; margin: 4px 0; gap: 1px; }
  #homeScreen .difficulty strong { font-size: 14px; }
  #homeScreen .difficulty span { font-size: 10px; }
  #homeScreen .start-btn { margin-top: 6px; padding: 10px 12px; font-size: 12px; }
  #homeScreen .secondary-btn { margin-top: 5px; padding: 8px 12px; font-size: 11px; }
  .controls-mini { margin-top: 7px; padding: 7px 9px; font-size: 9px; line-height: 1.35; }
  #homeScreen footer { font-size: 9px; }
}

@media (max-width: 760px) and (orientation: landscape) {
  .home-grid { grid-template-columns: 1.04fr .96fr; }
  #homeScreen h1 { letter-spacing: -.06em; }
}


/* v0.4: los controles de sonido y salida quedan fuera del minimapa */
@media (max-width: 760px) and (orientation: landscape) {
  .corner-btn {
    left: max(8px, env(safe-area-inset-left));
    min-width: 78px;
    padding: 7px 8px;
    font-size: 10px;
  }
  .corner-btn.exit { top: max(46px, calc(env(safe-area-inset-top) + 34px)); }
  .corner-btn.music-right { left: max(8px, env(safe-area-inset-left)); right: auto; top: max(84px, calc(env(safe-area-inset-top) + 72px)); min-width: 78px; }
}

/* ===== Versión 0.6: integración de assets ===== */
#homeScreen {
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(5,4,4,.90) 0%, rgba(5,4,4,.70) 48%, rgba(5,4,4,.82) 100%),
    url('assets/img/bg_home_lanzarote.jpg') center/cover no-repeat;
}
#homeScreen::before,
#homeScreen::after { display: none; }
.home-grid { max-height: calc(100vh - 42px); align-items: center; }
.hero-card, .difficulty-card {
  background: linear-gradient(145deg, rgba(18,13,11,.88), rgba(7,7,7,.82));
  border-color: rgba(255,128,32,.42);
}
.hero-card { padding: clamp(18px, 3vw, 38px); }
.game-logo {
  display: block;
  width: min(100%, 680px);
  max-height: 34vh;
  object-fit: contain;
  object-position: left center;
  margin: 6px 0 -2px;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.7));
}
.hero-card h2 { margin: 0 0 12px; }
.briefing { margin: 0; line-height: 1.45; }
.mission-line { margin-top: 14px; padding: 10px 13px; font-size: 13px; }
.difficulty-card { padding: 20px; }
.difficulty { padding: 11px 14px; margin: 7px 0; }
.start-btn { padding: 14px 16px; }
.secondary-btn { padding: 11px 14px; }
.controls-mini { font-size: 11px; line-height: 1.45; margin-top: 10px; color: #d8c7b8; }

#hud {
  width: min(760px, 78vw);
  min-height: 70px;
  padding: 11px 30px 14px;
  background: url('assets/img/hud_panel.png') center/100% 100% no-repeat;
  gap: 5px;
  flex-wrap: nowrap;
}
.hud-box {
  min-width: 70px;
  height: 43px;
  background: rgba(4,4,4,.50);
  border-color: rgba(255,134,37,.22);
  box-shadow: none;
}
.hud-box span { font-size: 8px; }
.hud-box b { font-size: 18px; }
.health-box {
  width: 132px;
  margin-left: clamp(42px, 5.5vw, 75px);
}
.health-box .health-track {
  width: min(100%, 118px);
  margin-left: auto;
  margin-right: auto;
}
#statusStrip { top: max(88px, calc(env(safe-area-inset-top) + 78px)); }

#crosshair {
  width: clamp(44px, 5.3vw, 74px);
  height: clamp(44px, 5.3vw, 74px);
  background: url('assets/img/crosshair.png') center/contain no-repeat;
}
#crosshair i { display: none; }
#bloodOverlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  background: url('assets/img/blood_fx.png') center/70vmin 70vmin no-repeat;
  mix-blend-mode: screen;
  transition: opacity .13s ease;
}
#bloodOverlay.show { opacity: .72; }
.result-screen {
  background:
    linear-gradient(rgba(5,4,4,.78), rgba(5,4,4,.92)),
    url('assets/img/bg_home_lanzarote.jpg') center/cover no-repeat;
}

@media (max-height: 720px) {
  .home-grid { gap: 16px; }
  .hero-card { padding: 16px 22px; }
  .game-logo { max-height: 27vh; }
  .hero-card h2 { font-size: 23px; }
  .briefing { font-size: 13px; }
  .mission-line { font-size: 11px; padding: 8px 10px; }
  .difficulty-card { padding: 14px 16px; }
  .difficulty { padding: 8px 12px; margin: 5px 0; }
  .difficulty strong { font-size: 15px; }
  .difficulty span { font-size: 11px; }
  .start-btn { margin-top: 8px; padding: 11px; }
  .secondary-btn { padding: 8px 10px; }
  .controls-mini { margin-top: 7px; font-size: 9px; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .home-grid { grid-template-columns: 1.05fr .95fr; gap: 12px; }
  .game-logo { max-height: 25vh; }
  .eyebrow { font-size: 8px; }
  .hero-card h2 { font-size: 19px; }
  .briefing { font-size: 11px; }
  .mission-line { font-size: 9px; }
  #hud { width: 74vw; padding-left: 18px; padding-right: 18px; }
  .hud-box { min-width: 55px; height: 38px; padding: 5px; }
  .health-box { width: 105px; }
}


/* PRELOADER */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 103, 23, .18), transparent 34%),
    linear-gradient(145deg, #120a07, #030303 72%);
  transition: opacity .45s ease, visibility .45s ease;
}
.preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-card {
  width: min(650px, 92vw);
  padding: 28px clamp(22px, 5vw, 48px);
  text-align: center;
  background: rgba(10, 8, 7, .9);
  border: 1px solid rgba(255, 137, 40, .42);
  box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 0 55px rgba(255,85,22,.05);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
}
.preloader-logo { width: min(440px, 86%); max-height: 150px; object-fit: contain; }
.preloader h2 { margin: 12px 0 18px; font-size: clamp(18px, 3vw, 28px); letter-spacing: .14em; color: #ffe5c8; }
.preloader-track { height: 16px; padding: 3px; background: #090706; border: 1px solid rgba(255,255,255,.13); overflow: hidden; }
.preloader-track i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #ff5b19, #ffcb56); box-shadow: 0 0 18px rgba(255,100,20,.55); transition: width .18s ease; }
.preloader-row { display: flex; justify-content: space-between; gap: 18px; margin-top: 10px; color: #cbb9a9; font-size: 12px; }
.preloader-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.preloader-row b { color: #ffb04b; }
.preloader-rotate { margin: 18px 0 0; color: #ffe0b5; font-weight: 800; font-size: 13px; }
@media (hover: hover) and (pointer: fine) { .preloader-rotate { opacity: .58; } }


/* ===== Consola secreta de códigos v1.3 ===== */
.cheat-modal {
  position: absolute;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(32, 14, 5, .38), rgba(0, 0, 0, .88));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .16s ease, visibility .16s ease;
}
.cheat-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.cheat-card {
  position: relative;
  width: min(610px, 92vw);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(255, 132, 36, .62);
  border-top: 3px solid #ff7a18;
  border-bottom: 3px solid #ff7a18;
  background: linear-gradient(145deg, rgba(28, 14, 8, .98), rgba(6, 6, 7, .98));
  box-shadow: 0 30px 100px rgba(0, 0, 0, .75), 0 0 55px rgba(255, 93, 19, .12);
  text-align: center;
}
.cheat-eyebrow {
  color: #ff9d49;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .24em;
}
.cheat-card h2 {
  margin: 9px 0 8px;
  color: #fff6ea;
  font-size: clamp(28px, 5vw, 50px);
  line-height: .95;
  letter-spacing: -.04em;
}
.cheat-card p {
  margin: 0 auto 20px;
  max-width: 490px;
  color: #d7c6b7;
  line-height: 1.55;
  font-size: 13px;
}
.cheat-card form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}
.cheat-card input {
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.14);
  outline: none;
  background: rgba(255,255,255,.055);
  color: #fff;
  font: 900 16px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: lowercase;
}
.cheat-card input:focus {
  border-color: #ff861f;
  box-shadow: 0 0 0 3px rgba(255, 126, 27, .12);
}
.cheat-card form button {
  min-width: 112px;
  border: 0;
  padding: 0 17px;
  background: linear-gradient(90deg, #ff7517, #ffc04e);
  color: #160904;
  font-weight: 1000;
  letter-spacing: .07em;
  cursor: pointer;
}
.cheat-close {
  position: absolute;
  top: 9px;
  right: 11px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.cheat-feedback {
  min-height: 22px;
  margin-top: 15px;
  color: #ffca84;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .045em;
}
.cheat-feedback.error { color: #ff7566; }
.cheat-feedback.success { color: #8eff9a; }

@media (max-height: 540px) and (orientation: landscape) {
  .cheat-card { padding: 18px 25px; }
  .cheat-card h2 { font-size: 30px; }
  .cheat-card p { margin-bottom: 12px; }
  .cheat-card input { height: 42px; }
}


/* ===== Ajustes v1.4: HUD y controles móviles ===== */
@media (hover: none), (pointer: coarse) {
  #mobileControls {
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px));
    padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    align-items: end;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  #hud {
    width: min(790px, 80vw);
    padding-left: 16px;
    padding-right: 16px;
  }
  .health-box {
    width: 105px;
    margin-left: clamp(34px, 7vw, 58px);
  }
  .health-box .health-track { width: 92px; }
  .pad { --pad-size: clamp(48px, 8.2vh, 62px); gap: 5px; }
  #fireBtn {
    width: clamp(82px, 13vw, 108px);
    height: clamp(64px, 12vh, 82px);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #mobileControls { bottom: max(8px, env(safe-area-inset-bottom)); }
  .pad { --pad-size: clamp(44px, 8.5vh, 54px); gap: 4px; }
  #fireBtn { width: 82px; height: 62px; font-size: 14px; }
}
