:root {
  --bg: #07060c;
  --gold: #e8c36a;
  --gold-dim: #a8873d;
  --blood: #d4453a;
  --blood-hi: #ff6b5a;
  --mana: #3d7cff;
  --mana-hi: #7eb0ff;
  --stone: #2a261f;
  --ink: #f4ead2;
  --muted: #b9a98a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --hud-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; overflow: hidden; background: var(--bg); color: var(--ink); font-family: Outfit, system-ui, sans-serif; touch-action: none; user-select: none; overscroll-behavior: none; }
#app { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; overflow: hidden; background: #05040a; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: #05040a; }

#vignette {
  pointer-events: none;
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 46%, transparent 78%, rgba(0,0,0,.1) 100%);
  z-index: 2;
}
#flash { pointer-events: none; position: absolute; inset: 0; z-index: 3; opacity: 0; background: #fff; mix-blend-mode: overlay; }

/* ——— HUD stile Metal Slug ——— */
#hud {
  position: absolute; z-index: 10;
  top: calc(var(--safe-t) + 8px);
  left: calc(12px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.ms-tools { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.ms-tools .ms-score { margin: 0; }
.ms-mini {
  font-family: "Press Start 2P", monospace; font-size: 8px; color: #ffe9a0;
  background: #14110c; border: 2px solid #6a5630; padding: 7px 8px; cursor: pointer;
}
.ms-mini.on { color: #14110c; background: #e8c36a; }
.ms-off { display: none !important; }
.ms-left { pointer-events: none; max-width: 46vw; }
.ms-score, #ms-time, #ms-foot, .ms-slot, .ms-up, .ms-rune {
  font-family: "Press Start 2P", monospace;
  color: #ffe14a;
  text-shadow: 3px 3px 0 #1a1204, -1px 0 0 #000, 1px 0 0 #000, 0 1px 0 #000;
}
.ms-score { font-size: clamp(13px, 2.1vw, 20px); letter-spacing: 1px; margin-bottom: 8px; }
.ms-row { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 6px; }
.ms-slot {
  background: none; border: 0; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  pointer-events: auto;
}
.ms-slot em { font-style: normal; font-size: 8px; color: #fff6c8; letter-spacing: 0; }
#weapon-pill.weapon-now { flex-direction: row; align-items: center; gap: 6px; }
#weapon-ico { width: 36px; height: 36px; image-rendering: pixelated; background: transparent; }
.ms-slot b { font-weight: 400; font-size: clamp(12px, 1.8vw, 16px); color: #fff; }
.ms-life {
  width: min(40vw, 220px); height: 16px; margin-top: 2px;
  background: #071433;
  border: 3px solid #d7f2ff;
  box-shadow: 0 0 0 2px #102448, inset 0 0 0 1px #061028;
}
.ms-life i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(#e9f8ff, #7ec8ff 18%, #2f7fe0 55%, #1a4ea8);
}
.ms-up { margin-top: 6px; font-size: 9px; color: #fff; }
.ms-rune { margin-top: 4px; font-size: 8px; color: #9ee7ff; }
#ms-time {
  position: absolute; z-index: 11;
  left: 50%; top: calc(var(--safe-t) + 8px);
  transform: translateX(-50%);
  font-size: clamp(12px, 2vw, 18px);
  line-height: 1.45; text-align: center; white-space: pre-line;
  pointer-events: none;
  color: #ffe14a;
}
#ms-foot {
  position: absolute; z-index: 11;
  left: 50%; bottom: calc(64px + var(--safe-b));
  transform: translateX(-50%);
  display: flex; gap: 28px; align-items: baseline;
  pointer-events: none;
  font-size: clamp(10px, 1.6vw, 14px);
}
#boss-bar {
  position: absolute; z-index: 9; left: 50%; top: calc(var(--safe-t) + 62px);
  transform: translateX(-50%);
  width: min(52vw, 360px); pointer-events: none; text-align: center;
}
#boss-bar b {
  font-family: "Press Start 2P", monospace; font-size: 8px; font-weight: 400; color: #ffe9a0;
  text-shadow: 2px 2px 0 #140804; letter-spacing: 0;
}
.boss-track {
  margin-top: 6px; height: 10px; border-radius: 6px; overflow: hidden;
  background: #1a100c; border: 1px solid #6a3a2a;
}
#boss-fill { display: block; height: 100%; width: 0%; background: linear-gradient(#ff8a78, #d4453a 40%, #8a2018); }

#combo {
  position: absolute; z-index: 12; left: 50%; top: 16%;
  transform: translateX(-50%);
  pointer-events: none; text-align: center;
  text-shadow: 0 3px 0 #2a1808, 0 8px 18px #000;
}
#combo span {
  display: block; font-family: "Press Start 2P", monospace; letter-spacing: 0;
  font-size: 8px; color: #ffe9a0; text-shadow: 2px 2px 0 #140804;
}
#combo b {
  display: block; font-family: "Press Start 2P", monospace; font-weight: 400;
  font-size: clamp(14px, 3vw, 22px); line-height: 1.4; color: #fff6d2;
  text-shadow: 3px 3px 0 #140804;
}

#app.boss-cine::before, #app.boss-cine::after {
  content: "";
  position: absolute; left: 0; right: 0; height: 6.5vh; z-index: 6;
  background: #000; pointer-events: none;
}
#app.boss-cine::before { top: 0; }
#app.boss-cine::after { bottom: 0; }
#app.lowhp .ms-life i { background: linear-gradient(#fff, #ff6a55 40%, #9a1810); }
#app.lowhp #vignette {
  background:
    radial-gradient(ellipse at 50% 48%, transparent 28%, rgba(120, 0, 0, .55) 100%),
    linear-gradient(to bottom, rgba(0,0,0,.35) 0, transparent 14%, transparent 78%, rgba(0,0,0,.55) 100%);
  animation: hpPulse .55s ease-in-out infinite;
}
@keyframes hpPulse { 50% { opacity: .72; } }

#pad button.crouch { width: 56px; height: 56px; }

/* ——— caption / skills / dock ——— */
#caption {
  position: absolute; z-index: 8; left: 50%; bottom: calc(48px + var(--safe-b));
  transform: translateX(-50%);
  font-family: "Press Start 2P", monospace; font-size: 8px; letter-spacing: 0; line-height: 1.7;
  text-align: center; color: #fff4dc; text-shadow: 2px 2px 0 #140804;
  width: min(92vw, 640px); pointer-events: none;
}
@keyframes cap { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

#pad {
  position: absolute; z-index: 11;
  left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r));
  bottom: calc(72px + var(--safe-b));
  display: flex; justify-content: space-between; align-items: flex-end;
  pointer-events: none; touch-action: none;
}
#stick {
  width: 132px; height: 132px; border-radius: 50%;
  border: 3px solid rgba(255, 228, 160, 0.72);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 244, 210, 0.16), rgba(18, 12, 8, 0.42) 68%);
  box-shadow:
    inset 0 0 0 10px rgba(0, 0, 0, 0.22),
    inset 0 8px 14px rgba(255, 255, 255, 0.08),
    0 5px 0 rgba(0, 0, 0, 0.32);
  position: relative; touch-action: none; pointer-events: auto;
}
#stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #fff8dc 0, #f0c56a 42%, #a86a22 78%, #5c3810 100%);
  box-shadow:
    inset 0 -4px 0 rgba(80, 40, 8, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.pad-move, .pad-act {
  display: flex; gap: 10px; align-items: flex-end;
  pointer-events: auto;
}
#pad button {
  width: 68px; height: 68px; border-radius: 50%;
  border: 3px solid rgba(255, 232, 176, 0.78);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.38), transparent 42%),
    rgba(36, 24, 16, 0.5);
  color: #fff6dc;
  box-shadow:
    inset 0 -7px 0 rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    0 4px 0 rgba(0, 0, 0, 0.38);
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  touch-action: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 4px 2px;
}
#pad button span {
  display: block;
  font-size: 6px;
  line-height: 1.2;
  color: #fff6dc;
  margin-top: 0;
  text-shadow: 1px 1px 0 #1a1008;
}
#pad button i { font-style: normal; display: block; line-height: 1; }
#pad button i.px, .ms-mini i.px {
  display: block; margin: 0 auto;
  width: 28px; height: 28px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(1px 1px 0 rgba(20, 8, 4, 0.65));
}
#pad button.mini i.px { width: 20px; height: 20px; }
.ms-mini i.px { width: 16px; height: 16px; filter: none; }
#pad button.mini {
  width: 56px; height: 56px;
  border-color: rgba(214, 206, 188, 0.7);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.28), transparent 44%),
    rgba(48, 44, 40, 0.5);
}
#pad button.bomb {
  width: 72px; height: 72px;
  border-color: rgba(186, 236, 255, 0.9);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.42), transparent 44%),
    rgba(18, 92, 148, 0.55);
}
#pad button.jump {
  width: 86px; height: 86px;
  border-color: #ffe7a4;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.5), transparent 46%),
    rgba(184, 116, 22, 0.58);
}
#pad button.jump i.px { width: 34px; height: 34px; }
#pad button.fire {
  width: 96px; height: 96px;
  border-color: #ffc2b4;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.42), transparent 46%),
    rgba(168, 36, 28, 0.6);
}
#pad button.fire i.px { width: 36px; height: 36px; }
#pad button.on {
  transform: translateY(3px);
  box-shadow:
    inset 0 5px 0 rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(0, 0, 0, 0.35);
  filter: brightness(1.12);
}
#keys-hint {
  position: absolute; z-index: 11; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--safe-b));
  font-family: "Press Start 2P", monospace;
  font-size: 8px; color: #f3e0bc; letter-spacing: 0;
  text-shadow: 2px 2px 0 #140804;
  pointer-events: none; white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  #pad { display: none; }
  #keys-hint:not(.hidden) { display: block !important; }
}
@media (max-width: 420px) {
  #stick { width: 112px; height: 112px; }
  #stick-knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  #pad button.mini { width: 48px; height: 48px; }
  #pad button.bomb { width: 60px; height: 60px; }
  #pad button.jump { width: 74px; height: 74px; }
  #pad button.fire { width: 82px; height: 82px; }
}
body.input-touch #pad:not(.hidden) { display: flex !important; }
body.input-key #pad, body.input-pad #pad { display: none !important; }
@media (pointer: coarse) {
  body.input-pad #pad:not(.hidden) { display: flex !important; }
}
body.input-touch #keys-hint { display: none !important; }
body.input-key #keys-hint:not(.hidden),
body.input-pad #keys-hint:not(.hidden) { display: block !important; }

#dock {
  display: none !important;
}
#dock button {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--muted);
  font-family: Outfit, sans-serif; font-size: 9px; letter-spacing: .02em;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; cursor: pointer; border-radius: 12px;
}
#dock button i { font-style: normal; font-size: 16px; color: var(--gold); }
#dock button.on, #dock button.auto.on { background: rgba(232,195,106,.12); color: var(--ink); }
#btn-auto.on i { color: #7dffb0; }

/* ——— panels ——— */
#panel {
  position: absolute; z-index: 20;
  left: 50%; bottom: 0;
  width: min(560px, 100%);
  max-height: 62%;
  transform: translateX(-50%);
  background: linear-gradient(#1a1610f2, #0c0a08f6);
  border-top: 1px solid #6a5630;
  border-radius: 22px 22px 0 0;
  padding: 14px 16px calc(86px + var(--safe-b));
  box-shadow: 0 -20px 50px rgba(0,0,0,.6);
  overflow: auto;
  touch-action: pan-y;
  animation: up .28s ease;
}
@keyframes up { from { transform: translateX(-50%) translateY(24px); opacity: 0; } }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-head h2 { font-family: Cinzel, serif; font-size: 18px; color: var(--gold); }
#panel-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #5a4a2e; background: #16130e; color: var(--ink); cursor: pointer;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-bottom: 1px solid #2a2418;
}
.row button.buy {
  margin-left: auto; border: 1px solid var(--gold-dim);
  background: linear-gradient(#3a3018, #1e180c);
  color: var(--gold); font-weight: 600; font-family: Outfit, sans-serif;
  border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 12px;
}
.row button.buy:disabled { opacity: .4; cursor: default; }
.row .meta { font-size: 12px; color: var(--muted); }
.row b { display: block; font-size: 14px; }
.chip { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #2a2418; color: var(--gold); }
.chip.rare { color: #6af; background: #123; }
.chip.epic { color: #c8f; background: #213; }
.chip.legendary { color: #fc3; background: #321; }

/* ——— title / boot ——— */
#title-screen, #boot {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: #05040a;
}
#title-screen {
  background: #071018 url("../assets/bg-menu.jpg") center / cover no-repeat;
  align-items: flex-end;
  image-rendering: pixelated;
}
#title-screen .kicker,
#title-screen h1,
#title-screen .tag,
#title-screen .hint { display: none; }
#title-screen .title-inner {
  padding: 18px 16px max(22px, env(safe-area-inset-bottom));
  background: none;
}
#title-screen .cta {
  width: max-content;
  max-width: calc(100% - 8px);
  margin: 0 auto 14px;
  padding: 14px 16px 12px;
  border: 0;
  border-radius: 0;
  background: #9a1a16;
  color: #fff4dc;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(8px, 2.15vw, 12px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.55;
  text-shadow: 2px 2px 0 #1a0806;
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#title-screen .cta.ghost {
  background: #161c28;
  color: #f3e0bc;
  box-shadow:
    inset 0 4px 0 #3a4458,
    inset 0 -4px 0 #0c1018,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#title-screen #btn-start {
  animation: nn-blink 0.85s steps(2, end) infinite;
}
#title-screen .cta:active {
  transform: translate(4px, 4px);
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    2px 2px 0 #140804;
}
@keyframes nn-blink {
  50% { background: #d24a32; }
}
.title-inner { text-align: center; padding: 24px 18px; width: 100%; overflow: visible; }
.kicker { color: var(--gold); letter-spacing: .18em; font-size: 10px; text-transform: uppercase; margin-bottom: 8px; }
h1 {
  font-family: Cinzel, serif; font-weight: 900;
  font-size: clamp(28px, 9vw, 84px);
  letter-spacing: 0.06em;
  padding-right: 0.08em;
  color: #f3e6c0;
  text-shadow: 0 0 24px rgba(232,195,106,.4), 0 6px 0 #2a1e08, 0 14px 32px #000;
}
.tag { color: var(--muted); margin: 10px auto 28px; max-width: 320px; font-size: 14px; }
.cta {
  display: block; width: min(80vw, 280px); margin: 0 auto 10px;
  padding: 14px 18px; border-radius: 999px; cursor: pointer;
  font-family: Cinzel, serif; font-weight: 700; letter-spacing: .12em;
  border: 1px solid var(--gold);
  background: linear-gradient(#c9a44a, #7a5a18);
  color: #1a1408; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 1px 0 #ffe9a8;
}
.cta.ghost { background: transparent; color: var(--gold); box-shadow: none; }
.hint { margin-top: 18px; font-size: 11px; color: #7a6e58; }

#boot {
  flex-direction: column; gap: 16px; z-index: 50;
  background: #071018 url("../assets/bg-menu.jpg") center / cover no-repeat;
}
.boot-mark {
  width: 72px; height: 72px; border-radius: 0;
  display: grid; place-items: center;
  font-family: "Press Start 2P", monospace; font-size: 22px; font-weight: 400; color: #fff4dc;
  background: #9a1a16; border: 0;
  text-shadow: 2px 2px 0 #1a0806;
  box-shadow: 0 0 0 4px #140804, 6px 6px 0 #140804;
}
#boot p { color: #fff4dc; font-family: "Press Start 2P", monospace; font-size: 10px; letter-spacing: 0; text-shadow: 2px 2px 0 #140804; }
.boot-bar { width: 180px; height: 4px; background: #1a1610; border-radius: 4px; overflow: hidden; }
#boot-fill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }

#toast {
  position: absolute; z-index: 90; left: 50%; top: 22%;
  transform: translateX(-50%);
  pointer-events: none; text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px; line-height: 1.6;
  color: #fff4dc;
  text-shadow: 2px 2px 0 #140804; opacity: 0; transition: opacity .3s;
  width: min(90vw, 560px);
}
#btn-install-mini {
  position: absolute; z-index: 15; top: calc(var(--safe-t) + 12px); right: 12px;
  border: 1px solid var(--gold-dim); background: #16130ecc; color: var(--gold);
  border-radius: 999px; padding: 6px 10px; font-size: 11px; cursor: pointer;
}

.hidden { display: none !important; }

.game-ad {
  width: min(340px, 94%);
  margin: 12px auto 0;
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  border: 1px solid rgba(255, 228, 160, 0.28);
  background: rgba(8, 6, 12, 0.62);
  box-shadow: 0 0 0 3px #140804;
}
.game-ad-label {
  margin-bottom: 6px;
  color: #d7c7a2;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.game-ad-slot { max-width: 100%; overflow: hidden; }
.game-ad-slot iframe { display: block; max-width: 100%; border: 0; }
#title-screen .game-ad { margin-top: 8px; }
#hero-select { flex-direction: column; }
#hero-select .game-ad { flex: 0 0 auto; margin-top: 8px; }
#stage-recap, #boss-gate { overflow: auto; align-items: safe center; }
#stage-recap .game-ad, #boss-gate .game-ad, #life-lost .game-ad, #game-over .game-ad { margin: 8px auto 12px; background: rgba(8, 6, 12, 0.35); }

#hero-select {
  position: absolute; inset: 0; z-index: 41;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(8px, var(--safe-t))
    max(14px, var(--safe-r))
    max(8px, var(--safe-b))
    max(14px, var(--safe-l));
  background:
    linear-gradient(rgba(4,8,22,.22), rgba(4,8,22,.22)),
    url("../assets/bg-select.png") center / cover no-repeat;
  image-rendering: pixelated;
}
.select-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vw, 28px);
  width: 100%;
  max-width: 980px;
  max-height: 100%;
  margin: 0;
}
#hero-select .kicker {
  margin: 0 0 8px;
  color: #f3e0bc;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #140804;
}
#hero-select h2 {
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  color: #fff4dc;
  font-size: clamp(14px, 3vw, 22px);
  letter-spacing: 0;
  margin: 0 0 8px;
  text-shadow: 3px 3px 0 #140804;
}
#hero-grid {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: auto;
  margin: 0;
}
.hero-card {
  width: min(28dvh, 13vw, 112px);
  cursor: pointer;
  border: 0;
  border-radius: 0;
  background: #120e0c;
  padding: 6px;
  color: #fff4dc;
  text-align: center;
  box-shadow: 0 0 0 3px #140804, 4px 4px 0 #140804;
}
.hero-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  display: block;
  background: #1a1410;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 3px #140804;
}
.hero-card.on {
  background: #3a140e;
  box-shadow: 0 0 0 3px #e24a32, 4px 4px 0 #140804;
}
.select-detail {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 480px;
  text-align: left;
}
#pick-title {
  color: #f3e0bc;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 8px;
  text-shadow: 2px 2px 0 #140804;
}
#pick-tag {
  font-family: Outfit, sans-serif;
  font-size: clamp(13px, 2.2vw, 16px);
  line-height: 1.35;
  margin: 0 0 6px;
  color: #fff4dc;
}
#pick-stats {
  margin: 0 0 12px;
  color: #f3e0bc;
  font-family: Outfit, sans-serif;
  font-size: clamp(12px, 2vw, 15px);
  line-height: 1.35;
}
.select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
#hero-select .cta {
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 12px 14px 10px;
  white-space: nowrap;
  border: 0;
  border-radius: 0;
  background: #9a1a16;
  color: #fff4dc;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(8px, 1.8vw, 11px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.55;
  text-shadow: 2px 2px 0 #1a0806;
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#hero-select .cta.ghost {
  background: #161c28;
  color: #f3e0bc;
  box-shadow:
    inset 0 4px 0 #3a4458,
    inset 0 -4px 0 #0c1018,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#hero-select .cta:active {
  transform: translate(4px, 4px);
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    2px 2px 0 #140804;
}
@media (orientation: portrait) and (pointer: coarse) {
  #app {
    position: fixed;
    width: 100vh;
    width: 100dvh;
    height: 100vw;
    height: 100dvw;
    top: 0;
    left: 100%;
    transform: rotate(90deg);
    transform-origin: top left;
    overflow: hidden;
  }
}

#stage-recap, #boss-gate, #life-lost, #game-over {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(4, 8, 22, 0.72);
}
.recap-card {
  width: min(440px, 100%);
  padding: 22px 18px 18px;
  background: #120e0c;
  color: #fff4dc;
  text-align: center;
  box-shadow: 0 0 0 4px #140804, 8px 8px 0 #140804;
}
#stage-recap .kicker,
#boss-gate .kicker,
#life-lost .kicker,
#game-over .kicker {
  margin: 0 0 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #f3e0bc;
  text-shadow: 2px 2px 0 #140804;
}
#stage-recap h2,
#boss-gate h2,
#life-lost h2,
#game-over h2 {
  margin: 0 0 18px;
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  font-size: clamp(12px, 2.4vw, 16px);
  color: #fff4dc;
  text-shadow: 3px 3px 0 #140804;
}
#stage-recap ul,
#game-over ul {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}
#stage-recap li,
#game-over li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #1c1410;
  box-shadow: inset 0 0 0 3px #140804;
}
#stage-recap li span,
#game-over li span {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #f3e0bc;
  text-align: left;
}
#stage-recap li b,
#game-over li b {
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  font-size: 14px;
  color: #ffe14a;
  text-shadow: 2px 2px 0 #140804;
}
#stage-recap .cta,
#boss-gate .cta,
#life-lost .cta,
#game-over .cta {
  width: max-content;
  max-width: 100%;
  margin: 4px auto 0;
  padding: 14px 18px 12px;
  border: 0;
  border-radius: 0;
  background: #9a1a16;
  color: #fff4dc;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(8px, 1.8vw, 11px);
  font-weight: 400;
  cursor: pointer;
  text-shadow: 2px 2px 0 #1a0806;
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#stage-recap .cta:active,
#boss-gate .cta:active,
#life-lost .cta:active,
#game-over .cta:active {
  transform: translate(4px, 4px);
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    2px 2px 0 #140804;
}
#life-lost,
#game-over {
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 12px 14px;
  background: #07060a;
  overflow: hidden;
}
.fear-art {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  object-position: center 35%;
  image-rendering: pixelated;
  pointer-events: none;
}
.fear-art.shake {
  animation: fear-shake 0.55s linear 3;
}
@keyframes fear-shake {
  0% { transform: translate(0, 0); }
  12% { transform: translate(-16px, 8px); }
  24% { transform: translate(14px, -10px); }
  36% { transform: translate(-12px, -6px); }
  48% { transform: translate(11px, 8px); }
  60% { transform: translate(-8px, 4px); }
  72% { transform: translate(6px, -4px); }
  84% { transform: translate(-3px, 2px); }
  100% { transform: translate(0, 0); }
}
#life-lost .recap-card,
#game-over .recap-card {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  background: rgba(18, 14, 12, 0.9);
}

#ios-install {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 16px 16px max(18px, env(safe-area-inset-bottom));
  background: rgba(4, 8, 22, 0.82);
  overflow: auto;
  touch-action: auto;
  user-select: text;
  -webkit-user-select: text;
}
.ios-card {
  width: min(440px, 100%);
  padding: 18px 16px 16px;
  background: #120e0c;
  color: #fff4dc;
  text-align: center;
  box-shadow: 0 0 0 4px #140804, 8px 8px 0 #140804;
}
#ios-install .kicker {
  margin: 0 0 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #f3e0bc;
  text-shadow: 2px 2px 0 #140804;
}
#ios-install h2 {
  margin: 0 0 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: #ffe14a;
  text-shadow: 2px 2px 0 #140804;
}
#ios-steps {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  text-align: left;
}
#ios-steps li {
  margin: 0 0 8px;
  padding: 8px 10px;
  background: #1c1410;
  box-shadow: inset 0 0 0 3px #140804;
  font-family: Outfit, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  color: #fff4dc;
}
#ios-steps b { color: #ffe14a; }
#ios-url {
  width: 100%;
  margin: 0 0 8px;
  padding: 8px;
  border: 0;
  background: #1c1410;
  color: #ffe14a;
  font-family: Outfit, sans-serif;
  font-size: 13px;
  text-align: center;
  box-shadow: inset 0 0 0 3px #140804;
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}
#ios-status {
  min-height: 1.2em;
  margin: 0 0 8px;
  font-family: Outfit, sans-serif;
  font-size: 13px;
  color: #f3e0bc;
}
#ios-install .cta {
  width: max-content;
  max-width: 100%;
  margin: 6px auto 0;
  padding: 14px 18px 12px;
  border: 0;
  border-radius: 0;
  background: #9a1a16;
  color: #fff4dc;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  cursor: pointer;
  text-shadow: 2px 2px 0 #1a0806;
  box-shadow:
    inset 0 4px 0 #e24a32,
    inset 0 -4px 0 #4a0c0a,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#ios-install .cta.ghost {
  background: #2a2118;
  box-shadow:
    inset 0 4px 0 #6a5840,
    inset 0 -4px 0 #120e0a,
    0 0 0 4px #140804,
    6px 6px 0 #140804;
}
#ios-arrow {
  margin: 0;
  font-family: Outfit, sans-serif;
  font-size: 14px;
  color: #fff4dc;
  text-shadow: 2px 2px 0 #140804;
}
#ios-arrow::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 8px auto 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #ffe14a;
}
.share-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0 2px;
  vertical-align: -2px;
  border: 2px solid #ffe14a;
  position: relative;
}
.share-ico::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -7px;
  width: 6px;
  height: 6px;
  border-top: 2px solid #ffe14a;
  border-left: 2px solid #ffe14a;
  transform: rotate(45deg);
}

@media (min-width: 900px) {
  .hp-wrap { width: 320px; }
  .mp-wrap { width: 200px; }
  .portrait-frame { width: 88px; height: 88px; }
  #dock { max-width: 560px; left: 50%; transform: translateX(-50%); }
}
