:root {
  --gold: #F5B325;
  --gold-hi: #FFE08A;
  --red: #E23A2E;
  --red-hot: #FF5140;
  --ink: #0B0A10;
  --ink-2: #141018;
  --violet: #3A2A4D;
  --cream: #F0E6D2;
  --hud-gap: clamp(4px, 0.7vw, 10px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07050a;
  color: var(--cream);
  font-family: 'Archivo', system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; overflow: hidden; }

.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(130% 55% at 50% 34%, rgba(255, 150, 70, 0.22) 0%, rgba(226, 90, 50, 0.08) 46%, rgba(0,0,0,0) 72%),
    linear-gradient(180deg,
      #241a3b 0%,
      #2b2048 10%,
      #3c2750 17%,
      #5c3052 22%,
      #8c3d4b 26%,
      #cc5c3a 30%,
      #f09048 33%,
      #a34a43 36%,
      #4a2438 42%,
      #241425 50%,
      #140d19 100%);
}

#stage { position: absolute; inset: 0; z-index: 1; }
#stage canvas { display: block; width: 100% !important; height: 100% !important; }

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.16) 0px, rgba(0,0,0,0.16) 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 3px);
  opacity: 0.30;
  mix-blend-mode: multiply;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(115% 95% at 50% 52%, rgba(0,0,0,0) 48%, rgba(0,0,0,0.34) 78%, rgba(0,0,0,0.72) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.34) 0%, rgba(0,0,0,0) 12%, rgba(0,0,0,0) 84%, rgba(0,0,0,0.42) 100%);
}

.is-hidden { display: none !important; }

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

.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 20;
  padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: var(--hud-gap);
}

.hud-row {
  display: flex;
  align-items: center;
  gap: var(--hud-gap);
  width: 100%;
}

.hud-row-top {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.hud-row-bottom { justify-content: flex-start; }

.plate {
  position: relative;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.65)) drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  flex: 0 0 auto;
}

.plate-score {
  width: clamp(108px, min(21vw, 26vh), 212px);
  aspect-ratio: 504 / 148;
  background-image: url('../assets/hud_kit_01_score_plate.webp');
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 6% 1% 8%;
}

.plate-label {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(7px, min(0.95vw, 1.35vh), 12px);
  letter-spacing: 0.14em;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 1px 0 #000;
}

.plate-digits {
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(13px, min(2.1vw, 3.1vh), 27px);
  line-height: 1;
  color: var(--gold-hi);
  text-shadow: 0 2px 0 #16100a, 0 0 8px rgba(245,179,37,0.25);
  letter-spacing: 0.02em;
}

.plate-note {
  width: clamp(62px, min(13vw, 16.5vh), 122px);
  aspect-ratio: 323 / 148;
  background-image: url('../assets/hud_kit_02_note_counter_plate.webp');
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12% 3% 0;
}

.plate-cd {
  width: clamp(66px, min(14vw, 17.5vh), 130px);
  aspect-ratio: 343 / 149;
  background-image: url('../assets/hud_kit_03_cd_counter_plate.webp');
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12% 3% 0;
}

.portrait {
  width: clamp(42px, min(7.5vw, 9.5vh), 68px);
  aspect-ratio: 206 / 190;
  background-image: url('../assets/hud_kit_06_life_icon_frame.webp');
  background-size: 100% 100%;
  position: relative;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.65)) drop-shadow(0 0 14px rgba(245,179,37,0.22));
  flex: 0 0 auto;
}
.portrait-crop {
  position: absolute;
  inset: 12% 11%;
  overflow: hidden;
  border-radius: 30%;
  background: #120d16;
}
.portrait-crop img, .life-crop img {
  position: absolute;
  left: 50%;
  top: -3%;
  height: 214%;
  width: auto;
  transform: translateX(-50%);
  image-rendering: auto;
}

.lives {
  display: flex;
  align-items: center;
  gap: clamp(2px, 0.45vw, 6px);
  flex: 0 0 auto;
}
.life {
  width: clamp(19px, min(3.1vw, 4vh), 30px);
  aspect-ratio: 206 / 190;
  background-image: url('../assets/hud_kit_06_life_icon_frame.webp');
  background-size: 100% 100%;
  position: relative;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.6));
}
.life-crop {
  position: absolute;
  inset: 12% 11%;
  overflow: hidden;
  border-radius: 30%;
  background: #120d16;
}
.life.spent { filter: grayscale(1) brightness(0.34); opacity: 0.85; }

.health {
  position: relative;
  width: clamp(150px, min(27vw, 34vh), 320px);
  aspect-ratio: 502 / 109;
  background-image: url('../assets/hud_kit_04_segmented_health_bar.webp');
  background-size: 100% 100%;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.6)) drop-shadow(0 0 12px rgba(226,58,46,0.18));
  flex: 0 0 auto;
}
.health-empty {
  position: absolute;
  top: 9%;
  bottom: 10%;
  right: 6.5%;
  width: 0%;
  background: #0C0910;
  border-radius: 2px;
  transition: width 120ms steps(10, end);
}
.health-tag {
  position: absolute;
  left: 7%;
  bottom: 12%;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(6px, 0.8vh, 10px);
  color: rgba(255,224,138,0.75);
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 #000;
  pointer-events: none;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.6vw, 8px);
  margin-left: auto;
  pointer-events: auto;
}
.power-badge {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(8px, min(1.3vw, 1.7vh), 13px);
  letter-spacing: 0.08em;
  color: #16100a;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border: 2px solid #0b0a10;
  border-radius: 999px;
  padding: 3px 10px 2px;
  box-shadow: 0 2px 0 #000, 0 0 16px rgba(245,179,37,0.55);
  flex: 0 0 auto;
  white-space: nowrap;
}
.power-badge.hot { background: linear-gradient(180deg, #ffd9d2, #ff5140); color: #3a0b09; box-shadow: 0 2px 0 #000, 0 0 18px rgba(255,81,64,0.6); }
.round-btn {
  width: clamp(30px, min(4.6vw, 6.4vh), 46px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 34% 30%, #241b1d 0%, #0b0810 70%);
  color: var(--gold-hi);
  font-family: 'Bungee', sans-serif;
  font-size: clamp(13px, min(1.8vw, 2.4vh), 22px);
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #8f1c18, 0 2px 0 #000, 0 0 14px rgba(0,0,0,0.5);
  padding: 0;
}
.round-btn { position: relative; }
.round-btn:active { transform: translateY(1px); }
.round-btn.muted { color: #8a8070; border-color: #6b5a33; }
.round-btn.muted::after {
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  top: 50%;
  height: 2px;
  background: #ff5a48;
  transform: rotate(-42deg);
  box-shadow: 0 1px 0 #000;
  pointer-events: none;
}
.title-sound {
  width: clamp(36px, min(6vw, 6.4vh), 48px);
  flex: 0 0 auto;
}
.pause-img-btn {
  width: clamp(34px, min(5.4vw, 7.4vh), 54px);
  aspect-ratio: 286 / 253;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.65));
}
.pause-img-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pause-img-btn:active img { transform: scale(0.95); }

.bossbar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: clamp(240px, min(58vw, 74vh), 620px);
  margin-top: clamp(2px, 0.5vh, 6px);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}
.boss-tag {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(8px, min(1.15vw, 1.7vh), 14px);
  color: var(--gold-hi);
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(226,58,46,0.6);
  padding-left: 3%;
}
.boss-track {
  position: relative;
  width: 100%;
  aspect-ratio: 669 / 125;
  background-image: url('../assets/hud_kit_05_boss_health_bar.webp');
  background-size: 100% 100%;
}
.boss-empty {
  position: absolute;
  top: 12%;
  bottom: 13%;
  right: 5.5%;
  width: 0%;
  background: #0C0910;
  border-radius: 2px;
  transition: width 160ms steps(12, end);
}

/* ---------------- touch controls ---------------- */

.touch {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
}
.touch-pad {
  position: absolute;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 1vw, 10px);
  pointer-events: none;
}
.touch-left { left: max(6px, env(safe-area-inset-left)); }
.touch-right { right: max(6px, env(safe-area-inset-right)); }
.touch-btn {
  pointer-events: auto;
  width: clamp(52px, min(15vw, 14vh), 88px);
  aspect-ratio: 292 / 224;
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0.92;
  filter: drop-shadow(0 4px 7px rgba(0,0,0,0.6));
  transition: transform 60ms ease-out, opacity 60ms ease-out;
}
.touch-btn:active img,
.touch-btn.held img {
  transform: scale(0.92) translateY(2px);
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(245,179,37,0.55)) drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.btn-punch, .btn-kick { aspect-ratio: 313 / 216; }
.btn-jump { transform: translateY(-8%); }
.btn-block {
  pointer-events: auto;
  width: clamp(52px, min(13vw, 12vh), 76px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle at 34% 28%, rgba(255,224,138,0.22), rgba(11,10,16,0.92) 62%);
  color: var(--gold-hi);
  font-family: 'Bungee', sans-serif;
  font-size: clamp(9px, min(1.6vw, 2vh), 14px);
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 rgba(0,0,0,0.65), 0 0 14px rgba(245,179,37,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-block span { display: block; transform: translateY(-1px); }
.btn-block:active,
.btn-block.held {
  background: radial-gradient(circle at 34% 28%, rgba(255,224,138,0.45), rgba(58,11,9,0.95) 65%);
  box-shadow: 0 0 20px rgba(245,179,37,0.7), 0 2px 0 rgba(0,0,0,0.6);
  transform: translateY(2px) scale(0.96);
}

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

.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
}

.title-screen {
  background:
    radial-gradient(120% 85% at 50% 26%, rgba(12,8,18,0.10) 0%, rgba(9,6,14,0.58) 58%, rgba(5,4,9,0.88) 100%);
}

.title-inner {
  width: 100%;
  max-width: 940px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(6px, 1.5vh, 18px);
  padding-top: clamp(10px, 4.5vh, 56px);
  text-align: center;
}
.title-lockup { width: 100%; display: flex; justify-content: center; }
.title-logo {
  width: min(92vw, 100vh, 860px);
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 0 rgba(0,0,0,0.55)) drop-shadow(0 18px 34px rgba(0,0,0,0.75)) drop-shadow(0 0 26px rgba(226,58,46,0.20));
}
.world-tag {
  margin: clamp(6px, 1.6vh, 18px) 0 0;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(10px, min(1.9vw, 2.4vh), 19px);
  letter-spacing: 0.14em;
  color: var(--gold-hi);
  text-shadow: 0 2px 0 #1a1208, 0 0 16px rgba(245,179,37,0.28);
}
.world-tag span {
  display: inline-block;
  margin-left: 0.35em;
  color: #ff6a58;
  text-shadow: 0 2px 0 #3a0b09, 0 0 14px rgba(226,58,46,0.5);
}
.title-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 26px);
  flex-wrap: wrap;
  margin-top: clamp(2px, 1vh, 10px);
}
.start-img-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.6));
  transition: transform 90ms ease-out, filter 90ms ease-out;
}
.start-img-btn img {
  width: clamp(90px, min(26vw, 22vh), 164px);
  height: auto;
  display: block;
}
.start-img-btn:hover { transform: translateY(-2px) scale(1.02); filter: drop-shadow(0 10px 18px rgba(0,0,0,0.7)) drop-shadow(0 0 20px rgba(245,179,37,0.28)); }
.start-img-btn:active { transform: translateY(1px) scale(0.99); }

.cab-button {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(11px, min(1.6vw, 2vh), 16px);
  letter-spacing: 0.06em;
  color: #ff5a48;
  background: linear-gradient(180deg, #1c1520 0%, #0c0810 100%);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 0.72em 1.2em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #8f1c18, 0 3px 0 #050407, 0 6px 18px rgba(0,0,0,0.5);
  text-shadow: 0 1px 0 #000;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, color 80ms ease-out;
}
.cab-button:hover { color: #ffd24a; box-shadow: inset 0 0 0 1px #c22a22, 0 3px 0 #050407, 0 0 20px rgba(245,179,37,0.26); }
.cab-button:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px #8f1c18, 0 1px 0 #050407; }
.cab-button.wide { min-width: min(78%, 280px); }
.cab-button.ghost { color: #f3ddae; border-color: #8a6a2a; }
.cab-button:disabled { opacity: 0.55; cursor: default; }

.title-hint {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(8px, min(1.2vw, 1.5vh), 12px);
  letter-spacing: 0.1em;
  color: rgba(255, 224, 138, 0.72);
}
.title-best {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(10px, min(1.6vw, 2vh), 15px);
  letter-spacing: 0.08em;
  color: var(--gold-hi);
  text-shadow: 0 2px 0 #000;
}
.title-loading {
  margin: auto 0 2vh;
  font-family: 'Archivo', sans-serif;
  font-size: clamp(9px, 1.1vw, 13px);
  letter-spacing: 0.18em;
  color: rgba(240, 230, 210, 0.42);
}

.panel-screen {
  background: radial-gradient(120% 90% at 50% 40%, rgba(8,6,12,0.72) 0%, rgba(5,4,8,0.9) 100%);
  backdrop-filter: blur(2px);
}
.panel {
  width: min(92vw, 460px);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, #17111c 0%, #0a070d 100%);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: clamp(16px, 3vh, 30px) clamp(16px, 4vw, 30px);
  text-align: center;
  box-shadow: inset 0 0 0 1px #7d1b17, inset 0 0 40px rgba(0,0,0,0.7), 0 24px 70px rgba(0,0,0,0.8);
}
.panel-title {
  margin: 0 0 0.2em;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(24px, 5.2vh, 44px);
  line-height: 1;
  color: var(--gold-hi);
  text-shadow: 0 3px 0 #7d1b17, 0 5px 0 #000, 0 0 26px rgba(226,58,46,0.4);
  letter-spacing: 0.02em;
}
.panel-title.red { color: #ff5a48; text-shadow: 0 3px 0 #4a0d0b, 0 5px 0 #000, 0 0 26px rgba(226,58,46,0.4); }
.panel-title.gold { color: #ffdf8a; }
.panel-sub {
  margin: 0 0 1.1em;
  font-family: 'Archivo', sans-serif;
  font-size: clamp(11px, 1.4vh, 14px);
  letter-spacing: 0.06em;
  color: rgba(240, 230, 210, 0.66);
}
.panel-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 4px;
}
.stats.big { grid-template-columns: repeat(2, 1fr); }
.stats div {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(245,179,37,0.34);
  border-radius: 8px;
  padding: 7px 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stats span {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(7px, 1.1vh, 10px);
  letter-spacing: 0.12em;
  color: rgba(255, 224, 138, 0.7);
}
.stats b {
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(14px, 2.4vh, 22px);
  color: var(--gold-hi);
  text-shadow: 0 2px 0 #000;
}
.rank-line {
  margin: 0.55em 0 0;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(12px, 1.8vh, 17px);
  letter-spacing: 0.12em;
  color: rgba(240,230,210,0.72);
}
.rank-line b {
  display: inline-block;
  margin-left: 0.35em;
  font-size: 1.8em;
  color: #ffd24a;
  text-shadow: 0 3px 0 #7d1b17, 0 0 18px rgba(245,179,37,0.5);
}
.clear-kicker {
  margin: 0 0 0.5em;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(8px, 1.3vh, 11px);
  letter-spacing: 0.2em;
  color: #ff5a48;
}
.next-line {
  margin: 14px 0 0;
  font-family: 'Archivo', sans-serif;
  font-size: clamp(8px, 1.2vh, 11px);
  letter-spacing: 0.14em;
  color: rgba(240, 230, 210, 0.44);
}

.panel-help { width: min(94vw, 520px); }
.help-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 14px;
  text-align: left;
}
.help-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Archivo', sans-serif;
  font-size: clamp(10px, 1.5vh, 13px);
  color: rgba(240, 230, 210, 0.82);
  border-bottom: 1px solid rgba(245,179,37,0.12);
  padding-bottom: 7px;
}
.help-row .keys { flex: 0 0 auto; min-width: 108px; color: var(--gold-hi); }
kbd {
  display: inline-block;
  font-family: 'Silkscreen', monospace;
  font-size: 0.86em;
  padding: 2px 5px;
  margin: 0 1px;
  border: 1px solid rgba(245,179,37,0.55);
  border-radius: 4px;
  background: #0d0912;
  color: var(--gold-hi);
  box-shadow: 0 2px 0 #000;
}
.help-note {
  margin: 0 0 16px;
  text-align: left;
  font-family: 'Archivo', sans-serif;
  font-size: clamp(9px, 1.35vh, 12px);
  line-height: 1.5;
  color: rgba(240, 230, 210, 0.6);
}

/* boss intro */
.boss-intro {
  position: absolute;
  inset: 0;
  z-index: 38;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.letterbox {
  height: 13%;
  background: #050308;
  box-shadow: 0 0 40px rgba(0,0,0,0.9);
  animation: lb-in 260ms ease-out both;
}
.letterbox.bottom { animation-name: lb-in-b; }
@keyframes lb-in { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes lb-in-b { from { transform: translateY(100%); } to { transform: translateY(0); } }
.boss-card {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2vh 5vw;
  background: linear-gradient(180deg, rgba(10,6,14,0.86) 0%, rgba(10,6,14,0.5) 100%);
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  animation: boss-pop 420ms cubic-bezier(.18,.9,.24,1) both;
}
@keyframes boss-pop { from { transform: scaleX(0.6); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.boss-kicker {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(8px, 1.4vh, 12px);
  letter-spacing: 0.28em;
  color: #ff5a48;
}
.boss-name {
  font-family: 'Bungee', sans-serif;
  font-size: clamp(30px, 8vh, 74px);
  line-height: 0.95;
  color: #ffe08a;
  text-shadow: 0 4px 0 #8f1b18, 0 7px 0 #000, 0 0 30px rgba(226,58,46,0.6);
  letter-spacing: 0.01em;
}
.boss-title {
  font-family: 'Archivo', sans-serif;
  font-size: clamp(9px, 1.5vh, 13px);
  letter-spacing: 0.22em;
  color: rgba(255,224,138,0.7);
  text-transform: uppercase;
}

/* toast */
.toast {
  position: absolute;
  left: 50%;
  top: 21%;
  transform: translate(-50%, -8px);
  z-index: 30;
  pointer-events: none;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(13px, min(2.4vw, 3vh), 23px);
  letter-spacing: 0.08em;
  color: #ffe08a;
  text-shadow: 0 3px 0 #7d1b17, 0 5px 0 #000;
  padding: 0.5em 1.1em;
  background: rgba(8,5,12,0.72);
  border: 2px solid rgba(245,179,37,0.75);
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(226,58,46,0.6);
  opacity: 0;
  transition: opacity 160ms ease-out, transform 160ms ease-out;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* pickup fly */
.fx { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.fly-item {
  position: absolute;
  width: clamp(26px, 4.6vh, 42px);
  height: auto;
  left: 0;
  top: 0;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 10px rgba(245,179,37,0.6));
}
.pulse { animation: counter-pulse 220ms ease-out; }
@keyframes counter-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.24); } 100% { transform: scale(1); } }
.hurt-flash {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(110% 90% at 50% 50%, rgba(255,30,20,0) 45%, rgba(255,30,20,0.46) 100%);
  opacity: 0;
  transition: opacity 90ms ease-out;
}
.hurt-flash.on { opacity: 1; transition: opacity 40ms ease-in; }

@media (min-width: 760px) {
  .hud {
    flex-direction: row;
    align-items: center;
    column-gap: clamp(10px, 1.2vw, 20px);
    row-gap: 6px;
    flex-wrap: wrap;
  }
  .hud-row { width: auto; flex-wrap: nowrap; }
  .hud-row-bottom { margin-left: auto; }
  .hud-actions { margin-left: 0; }
  .bossbar {
    position: absolute;
    top: 104%;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(280px, 46vw, 620px);
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .hud { padding-top: max(4px, env(safe-area-inset-top)); gap: 3px; }
  .hud-row { gap: 3px; }
  .title-inner { gap: 5px; padding-top: 3.5vh; }
  .panel { padding: 16px 14px; }
  .help-row .keys { min-width: 96px; }
}
@media (max-height: 520px) {
  .hud { gap: 3px; }
  .title-inner { padding-top: 2vh; gap: 4px; }
  .title-hint { display: none; }
  .title-loading { margin-bottom: 1vh; }
  .panel { padding: 12px 16px; }
  .panel-title { font-size: clamp(20px, 6vh, 34px); }
  .panel-actions { margin-top: 10px; gap: 7px; }
  .help-grid { gap: 4px; margin: 8px 0 10px; }
  .help-row { padding-bottom: 4px; }
  .help-note { margin-bottom: 10px; }
}
