:root {
  --ink: #120F1C;
  --violet: #2B2440;
  --red: #E4002B;
  --cyan: #41B6E6;
  --amber: #F2B134;
  --cream: #F4EDE1;
  --brick: #C3532F;

  --hud: 0.55;
  --stick: clamp(200px, 51vh, 300px);
  --btn: clamp(84px, 22vh, 128px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--cream);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
}

body { position: fixed; inset: 0; }

#app, #stage { position: absolute; inset: 0; }

#stage {
  overflow: hidden;
  background: var(--ink);
  touch-action: none;
}

#stage canvas { display: block; }

#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 18;
  background-image: radial-gradient(rgba(18, 15, 28, 0.55) 0.9px, transparent 1.15px);
  background-size: 4px 4px;
  opacity: 0.16;
  mix-blend-mode: multiply;
}

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  left: 0;
  top: 0;
  width: 1536px;
  height: 150px;
  transform: scale(var(--hud));
  transform-origin: top left;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
body.playing #hud, body.paused #hud, body.bossfight #hud { opacity: 1; }

.hud-hero {
  position: absolute;
  left: 18px;
  top: 6px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.portrait {
  width: 98px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(3px 4px 0 rgba(18, 15, 28, 0.85));
}
.hero-plates { width: 424px; }

.plate { position: relative; display: block; line-height: 0; }
.plate img { display: block; width: 100%; height: auto; }
.health-plate { width: 424px; }
.power-plate { width: 278px; height: 58px; margin-top: 5px; margin-left: 14px; }

.drain {
  position: absolute;
  background: rgba(18, 15, 28, 0.9);
  pointer-events: none;
  transition: width 0.14s linear;
}
.health-plate .drain {
  left: 12.1%;
  right: 7.9%;
  top: 25%;
  height: 55%;
  width: 0;
  box-shadow: inset 3px 0 0 rgba(244, 237, 225, 0.35);
}
.power-plate .drain {
  left: 8.2%;
  top: 28%;
  height: 53%;
  width: 0;
  box-shadow: inset 3px 0 0 rgba(244, 237, 225, 0.35);
}
body.health-low .health-plate { animation: lowpulse 0.7s ease-in-out infinite alternate; }
@keyframes lowpulse {
  from { filter: none; }
  to { filter: drop-shadow(0 0 10px rgba(228, 0, 43, 0.95)); }
}
.power-plate.lowflash { animation: lowflash 0.14s steps(2) 2; }
@keyframes lowflash {
  from { filter: brightness(1); }
  to { filter: brightness(1.8) drop-shadow(0 0 8px rgba(228, 0, 43, 0.9)); }
}

.hud-boss {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 430px;
  display: none;
}
.hud-boss.show { display: block; }
.boss-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: "Bungee", Impact, sans-serif;
  font-size: 25px;
  letter-spacing: 0.04em;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink);
  margin-bottom: -4px;
}
.boss-flag {
  background: var(--red);
  color: var(--cream);
  font-size: 17px;
  padding: 2px 9px 3px;
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 2px var(--cream);
  transform: rotate(-2deg);
}
.boss-plate { width: 430px; }
.boss-plate .drain {
  left: 8%;
  top: 27.7%;
  height: 54.5%;
  width: 0;
  box-shadow: inset 3px 0 0 rgba(244, 237, 225, 0.35);
}

.hud-right {
  position: absolute;
  right: 14px;
  top: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.counter {
  position: relative;
  width: 322px;
  height: 84px;
}
.counter > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.counter-fill {
  position: absolute;
  left: 30.4%;
  top: 37%;
  width: 60.1%;
  height: 26%;
  overflow: hidden;
  border-radius: 40px;
  background: rgba(18, 15, 28, 0.82);
  box-shadow: inset 0 0 0 2px rgba(244, 237, 225, 0.35);
}
.counter-fill i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cyan);
  border-right: 3px solid var(--cream);
  transition: width 0.18s ease-out;
}
#itemText {
  position: absolute;
  right: 3.2%;
  top: 33%;
  font-family: "Azeret Mono", monospace;
  font-weight: 100;
  font-size: 25px;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}

.hud-right-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -3px;
}
.life { display: flex; align-items: center; gap: 3px; }
.life img { width: 66px; height: 65px; object-fit: contain; filter: drop-shadow(2px 3px 0 rgba(18, 15, 28, 0.85)); }
.life span {
  font-family: "Bungee", Impact, sans-serif;
  font-size: 39px;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.level-badge { position: relative; width: 86px; height: 60px; }
.level-badge img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(2px 3px 0 rgba(18, 15, 28, 0.85)); }
.level-badge span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  font-family: "Bungee", Impact, sans-serif;
  font-size: 22px;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.score {
  margin-top: 2px;
  font-family: "Azeret Mono", monospace;
  font-weight: 100;
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink);
}

.combo {
  position: absolute;
  left: 50%;
  top: 154px;
  transform: translateX(-50%) scale(0.7);
  font-family: "Bungee", Impact, sans-serif;
  font-size: 44px;
  letter-spacing: 0.04em;
  color: var(--amber);
  text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
}
.combo.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- banners ---------- */

#banner {
  position: absolute;
  left: 50%;
  top: 27%;
  transform: translate(-50%, -50%) scale(0.9) rotate(-1deg);
  z-index: 26;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
}
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
#banner h2 {
  margin: 0;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(26px, 6.4vh, 66px);
  line-height: 1;
  color: var(--cream);
  letter-spacing: 0.03em;
  text-shadow: 5px 5px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
#banner p {
  margin: 6px 0 0;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 800;
  font-size: clamp(11px, 1.8vh, 18px);
  letter-spacing: 0.24em;
  color: var(--amber);
  text-shadow: 2px 2px 0 var(--ink);
}

#flash {
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(228, 0, 43, 0);
  transition: box-shadow 0.1s ease-out;
}
#flash.hit { box-shadow: inset 0 0 0 22px rgba(228, 0, 43, 0.55); transition: none; }

#hint {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  z-index: 27;
  padding: 9px 18px;
  background: var(--ink);
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 3px var(--ink);
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 1.65vh, 15px);
  letter-spacing: 0.12em;
  color: var(--cream);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#hint.show { opacity: 1; }

/* ---------- touch controls, deliberately large ---------- */

#touch {
  position: fixed;
  inset: 0;
  z-index: 32;
  pointer-events: none;
  display: none;
}
body.playing #touch, body.paused #touch { display: block; }
body.paused #touch { opacity: 0.3; }
body.cutscene #touch { opacity: 0; pointer-events: none; }
body.cutscene #hud { opacity: 0.2; }
#touch button, #touch .stick-zone { pointer-events: auto; }

.stick-zone {
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: var(--stick);
  height: calc(var(--stick) * 381 / 323);
  touch-action: none;
  cursor: grab;
}
.stick-zone:active { cursor: grabbing; }
.stick-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 9px 0 rgba(18, 15, 28, 0.8));
  transform-origin: 50% 72%;
  will-change: transform;
}
.ctrl-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(11px, calc(var(--stick) * 0.075), 19px);
  letter-spacing: 0.1em;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  pointer-events: none;
}
.move-label { top: -10px; z-index: 2; }

.action-cluster {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: calc(var(--btn) * 0.1);
}

.shoulders {
  display: flex;
  gap: calc(var(--btn) * 0.12);
  margin-right: calc(var(--btn) * 0.06);
}
.shoulder {
  position: relative;
  width: calc(var(--btn) * 1.44);
  height: calc(var(--btn) * 0.64);
  padding: 0;
  border: 0;
  background: none;
  touch-action: none;
  filter: drop-shadow(0 6px 0 rgba(18, 15, 28, 0.8));
  transition: transform 0.06s;
}
.shoulder:active, .shoulder.held { transform: translateY(3px) scale(0.97); }
.shoulder img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.shoulder-name {
  position: absolute;
  left: 12%;
  top: 23%;
  font-family: "Bungee", Impact, sans-serif;
  font-size: calc(var(--btn) * 0.155);
  letter-spacing: 0.03em;
  color: var(--ink);
  pointer-events: none;
}
.shoulder-key {
  position: absolute;
  right: 9%;
  top: 30%;
  font-family: "Azeret Mono", monospace;
  font-size: calc(var(--btn) * 0.145);
  color: rgba(18, 15, 28, 0.8);
  pointer-events: none;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, var(--btn));
  grid-template-rows: repeat(2, var(--btn));
  gap: calc(var(--btn) * 0.11);
}
.action-btn {
  position: relative;
  width: var(--btn);
  height: var(--btn);
  padding: 0;
  border: 0;
  background: none;
  touch-action: none;
  filter: drop-shadow(0 7px 0 rgba(18, 15, 28, 0.85));
  transition: transform 0.06s, filter 0.08s;
}
.action-btn:active, .action-btn.pressed { transform: translateY(4px) scale(0.95); filter: drop-shadow(0 3px 0 rgba(18, 15, 28, 0.85)); }
.btn-face { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.glyph {
  position: absolute;
  filter: drop-shadow(0 2px 0 rgba(18, 15, 28, 0.55));
  transition: width 0.16s, left 0.16s, top 0.16s, right 0.16s, bottom 0.16s;
  pointer-events: none;
}
.glyph.gx { width: 57%; left: 21.5%; top: 13%; }
.glyph.gp { width: 28%; right: 4.5%; bottom: 8%; opacity: 0.94; }
body.pad-ps .glyph.gx { width: 28%; left: auto; right: 4.5%; top: auto; bottom: 8%; }
body.pad-ps .glyph.gp { width: 57%; left: 21.5%; right: auto; top: 13%; bottom: auto; }

.cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2%;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 800;
  font-size: calc(var(--btn) * 0.125);
  letter-spacing: 0.11em;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  pointer-events: none;
}

.special-btn.ready { animation: ready-glow 0.9s ease-in-out infinite alternate; }
.special-btn.ready::after {
  content: "";
  position: absolute;
  inset: -7%;
  border: 4px solid var(--cream);
  border-radius: 50%;
  opacity: 0.75;
  animation: ready-ring 1.1s ease-out infinite;
  pointer-events: none;
}
@keyframes ready-glow {
  from { filter: drop-shadow(0 7px 0 rgba(18, 15, 28, 0.85)); }
  to { filter: drop-shadow(0 0 16px rgba(242, 177, 52, 0.95)) drop-shadow(0 7px 0 rgba(18, 15, 28, 0.85)); }
}
@keyframes ready-ring {
  0% { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.18); opacity: 0; }
}

.touch-tools {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 9px;
  pointer-events: auto;
}
.tool {
  width: 54px;
  height: 48px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--violet);
  box-shadow: 0 0 0 3px var(--cream), 0 5px 0 var(--ink);
  color: var(--cream);
  font-family: "Bungee", Impact, sans-serif;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
}
.tool:active { transform: translateY(3px); }

.portrait-tip { display: none; }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s, visibility 0.18s;
}
.overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
.card-overlay { z-index: 60; background: rgba(18, 15, 28, 0.78); }

#loading { z-index: 80; background: var(--ink); }
.loading-card { text-align: center; }
.boot-word {
  margin: 0;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(52px, 13vh, 120px);
  line-height: 0.9;
  color: var(--cream);
  text-shadow: 6px 6px 0 var(--violet);
}
.boot-sub {
  margin: 10px 0 18px;
  font-family: "Azeret Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--amber);
}
.load-track {
  width: min(420px, 70vw);
  height: 16px;
  margin: 0 auto;
  border: 3px solid var(--cream);
  background: var(--ink);
  padding: 2px;
}
.load-track i { display: block; height: 100%; width: 4%; background: var(--amber); transition: width 0.2s; }

.eyebrow {
  margin: 0 0 6px;
  font-family: "Azeret Mono", monospace;
  font-weight: 100;
  font-size: clamp(9px, 1.5vh, 13px);
  letter-spacing: 0.28em;
  color: var(--amber);
  text-shadow: 2px 2px 0 var(--ink);
}

.title-screen {
  z-index: 52;
  justify-content: flex-start;
  align-items: center;
  background: rgba(18, 15, 28, 0.35);
  padding: calc(4vh + env(safe-area-inset-top)) calc(5vw + env(safe-area-inset-right)) calc(4vh + env(safe-area-inset-bottom)) calc(5vw + env(safe-area-inset-left));
}
.title-panel {
  width: min(600px, 50vw);
  max-height: 92dvh;
  overflow: auto;
  padding: 2.6vh 2.4vw 2.4vh;
  background: rgba(18, 15, 28, 0.66);
  border-left: 6px solid var(--red);
  box-shadow: 0 0 0 3px rgba(244, 237, 225, 0.22), 12px 12px 0 rgba(18, 15, 28, 0.45);
  scrollbar-width: none;
}
.title-panel::-webkit-scrollbar { display: none; }
.logo {
  margin: 0;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(54px, 15vh, 150px);
  line-height: 0.82;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-shadow: 6px 6px 0 var(--ink), -3px -3px 0 var(--red);
}
.title-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 10px;
}
.title-rule::before, .title-rule::after {
  content: "";
  height: 4px;
  background: var(--cream);
  flex: 1;
  max-width: 74px;
  box-shadow: 0 3px 0 var(--ink);
}
.title-rule span {
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(13px, 2.4vh, 23px);
  letter-spacing: 0.13em;
  color: var(--amber);
  text-shadow: 3px 3px 0 var(--ink);
}
.lede {
  margin: 0 0 18px;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 600;
  font-size: clamp(13px, 2.1vh, 20px);
  letter-spacing: 0.04em;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink);
}
.menu { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 26px;
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 3px var(--cream), 0 7px 0 var(--ink);
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(14px, 2.1vh, 21px);
  letter-spacing: 0.05em;
  color: var(--ink);
  background: var(--cream);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s, filter 0.1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--cream), 0 3px 0 var(--ink); }
.btn:focus-visible { outline: 3px dashed var(--cyan); outline-offset: 6px; }
.btn-red { background: var(--red); color: var(--cream); }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-ghost { background: var(--violet); color: var(--cream); }
.btn.wide { width: 100%; margin-top: 7px; }
.title-panel .btn { min-width: clamp(190px, 22vw, 260px); }

.save-line {
  margin: 16px 0 4px;
  font-family: "Azeret Mono", monospace;
  font-weight: 100;
  font-size: clamp(10px, 1.6vh, 14px);
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-shadow: 2px 2px 0 var(--ink);
}
.tiny {
  margin: 2px 0 0;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 700;
  font-size: clamp(9px, 1.4vh, 12px);
  letter-spacing: 0.18em;
  color: rgba(244, 237, 225, 0.7);
}

.card {
  position: relative;
  width: min(920px, 94vw);
  max-width: 100%;
  max-height: 92dvh;
  overflow: auto;
  padding: clamp(14px, 2.6vh, 28px);
  background: var(--ink);
  border: 4px solid var(--cream);
  box-shadow: 0 0 0 4px var(--ink), 0 16px 0 rgba(0, 0, 0, 0.3);
  color: var(--cream);
  scrollbar-width: thin;
  scrollbar-color: var(--cream) var(--ink);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(244, 237, 225, 0.2) 0.7px, transparent 1px);
  background-size: 5px 5px;
  opacity: 0.35;
}
.card > * { position: relative; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card h2 {
  margin: 0 0 12px;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(28px, 5.4vh, 58px);
  line-height: 0.95;
  color: var(--cream);
  text-shadow: 4px 4px 0 var(--violet);
}
.card h3 {
  margin: 16px 0 5px;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(13px, 2vh, 18px);
  letter-spacing: 0.06em;
  color: var(--amber);
}
.card p {
  margin: 0 0 7px;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-size: clamp(13px, 1.95vh, 17px);
  line-height: 1.3;
  color: var(--cream);
}
.card p b { color: var(--cream); font-weight: 800; letter-spacing: 0.03em; }
.close-x {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 3px solid var(--cream);
  background: var(--red);
  color: var(--cream);
  font-family: "Bungee", Impact, sans-serif;
  font-size: 18px;
  cursor: pointer;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 26px);
}
.pad-status {
  margin-top: 8px !important;
  color: var(--cyan) !important;
  font-family: "Azeret Mono", monospace !important;
  font-size: 11px !important;
  letter-spacing: 0.12em;
}
.pause-card { width: min(480px, 92vw); }
.clear-card { width: min(660px, 92vw); text-align: center; }
.clear-card h2 { color: var(--amber); }
.clear-line { font-size: clamp(14px, 2.2vh, 19px) !important; letter-spacing: 0.04em; margin-bottom: 14px !important; }
.stats {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 44px);
  margin: 10px 0 14px;
  flex-wrap: wrap;
}
.stats div { display: flex; flex-direction: column; gap: 3px; }
.stats span {
  font-family: "Azeret Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--amber);
}
.stats b {
  font-family: "Bungee", Impact, sans-serif;
  font-weight: 400;
  font-size: clamp(20px, 3.2vh, 30px);
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--violet);
}
.row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.clear-card .save-line { margin-top: 4px; }
.gameover-card { width: min(560px, 92vw); text-align: center; }
.gameover-card h2 { color: var(--red); }

/* ---------- boss intro ---------- */

#bossIntro {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  pointer-events: none;
  overflow: hidden;
}
#bossIntro.show { display: block; }
.intro-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 14vh;
  background: var(--ink);
  border-color: var(--cream);
  border-style: solid;
  border-width: 0;
}
.intro-top { top: 0; border-bottom-width: 4px; animation: barTop 0.35s ease-out both; }
.intro-bottom { bottom: 0; border-top-width: 4px; animation: barBottom 0.35s ease-out both; }
@keyframes barTop { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes barBottom { from { transform: translateY(100%); } to { transform: translateY(0); } }
.intro-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  padding: 12px 18px 16px;
  text-align: center;
  background: rgba(18, 15, 28, 0.92);
  border-top: 3px solid var(--cream);
  border-bottom: 3px solid var(--cream);
  animation: introCard 0.4s ease-out both;
}
@keyframes introCard {
  from { opacity: 0; transform: translateY(-46%) scale(0.96); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}
.intro-card h2 {
  margin: 0;
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(40px, 9vh, 96px);
  line-height: 0.9;
  color: var(--cream);
  letter-spacing: 0.02em;
  text-shadow: 5px 5px 0 var(--red);
}
.intro-card p {
  margin: 5px 0 0;
  font-family: "Barlow Semi Condensed", sans-serif;
  font-weight: 800;
  font-size: clamp(10px, 1.8vh, 17px);
  letter-spacing: 0.3em;
  color: var(--amber);
}

@media (orientation: landscape) {
  #stage {
    inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
}

/* ---------- portrait fallback, never a blocker ---------- */

@media (orientation: portrait) {
  :root {
    --stick: clamp(120px, 36vw, 170px);
    --btn: clamp(58px, 20vw, 90px);
  }
  #stage {
    inset: 9dvh 0 auto 0;
    height: 56.25vw;
  }
  .title-screen { align-items: center; justify-content: center; }
  .title-panel { width: 100%; max-height: 84dvh; padding: 3vh 5vw; }
  .help-grid { grid-template-columns: 1fr; }
  .card { max-height: 82dvh; }
  .shoulder { width: calc(var(--btn) * 1.25); }
  .touch-tools { bottom: calc(var(--btn) * 3.2); }
  #hint { bottom: calc(var(--btn) * 3.8); }
  .portrait-tip {
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--btn) * 4.2);
    width: 88vw;
    text-align: center;
    font-family: "Azeret Mono", monospace;
    font-size: 9px;
    letter-spacing: 0.14em;
    color: var(--cyan);
    text-shadow: 2px 2px 0 var(--ink);
    pointer-events: none;
  }
  .move-label { top: -8px; }
}

@media (max-width: 760px) and (orientation: landscape) {
  .title-panel { width: 58vw; }
  .btn { min-height: 44px; padding: 8px 18px; }
  .shoulder-name { font-size: calc(var(--btn) * 0.145); }
  .touch-tools { bottom: max(14px, env(safe-area-inset-bottom)); }
  .tool { width: 46px; height: 42px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
}
