@font-face {
  font-family: "Press Start 2P";
  src: url("../assets/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Galmuri11";
  src: url("../assets/fonts/Galmuri11.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.scene-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
}

/* Title scene */
.title-scene {
  background: #0b0908 url("../assets/images/IntroSchool.png") center / cover no-repeat;
  color: #fff;
}

.title-scene__fade {
  position: absolute;
  z-index: 20;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 550ms ease;
}

.title-scene.is-starting .title-scene__fade {
  opacity: 1;
}

.title-scene__title {
  position: absolute;
  top: clamp(18px, 4vh, 58px);
  left: clamp(18px, 2.5vw, 52px);
  width: clamp(280px, 35vw, 900px);
  margin: 0;
}

.title-scene__logo {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.title-scene__menu {
  position: absolute;
  bottom: max(clamp(22px, 4.5vh, 70px), env(safe-area-inset-bottom));
  left: max(clamp(22px, 2.5vw, 54px), env(safe-area-inset-left));
  display: grid;
  gap: clamp(14px, 3.8vh, 54px);
  list-style: none;
  padding: 0;
  margin: 0;
}

.title-scene__menu-button {
  position: relative;
  background: none;
  border: none;
  padding: 4px 10px 4px 0;
  font-family: "Galmuri11", monospace;
  font-size: clamp(28px, 3.2vw, 72px);
  font-weight: 700;
  -webkit-text-stroke: 1px #fff;
  line-height: 1.2;
  letter-spacing: 0;
  color: #fff;
  text-align: left;
  text-shadow:
    3px 0 #1b100c,
    -3px 0 #1b100c,
    0 3px #1b100c,
    0 -3px #1b100c;
  cursor: pointer;
}

.title-scene__menu-button:hover,
.title-scene__menu-button:focus-visible {
  color: #ffcc4d;
  -webkit-text-stroke: 1px #ffcc4d;
  outline: none;
  transform: translateX(8px);
}

.title-scene__menu-button:hover::before,
.title-scene__menu-button:focus-visible::before {
  content: ">";
  position: absolute;
  right: 100%;
  margin-right: 8px;
}

.title-scene__credit {
  position: absolute;
  right: max(clamp(16px, 2vw, 40px), env(safe-area-inset-right));
  bottom: max(clamp(14px, 2vh, 28px), env(safe-area-inset-bottom));
  max-width: min(62vw, 760px);
  margin: 0;
  font-family: "Galmuri11", monospace;
  font-size: clamp(11px, 1.15vw, 22px);
  line-height: 1.4;
  color: rgb(255 255 255 / 78%);
  text-align: right;
  text-shadow: 2px 2px #160b08;
}

/* Story scene */
.story-scene {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgb(68 5 10 / 28%), transparent 34%),
    #020203;
  color: #fff;
  isolation: isolate;
}

.story-scene::before,
.story-scene::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
}

.story-scene::before {
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 255 255 / 3%) 3px 4px);
  opacity: 0.6;
}

.story-scene::after {
  background:
    linear-gradient(90deg, transparent 0 13%, rgb(255 24 32 / 7%) 13% 13.4%, transparent 13.4% 72%, rgb(255 24 32 / 5%) 72% 72.5%, transparent 72.5%),
    radial-gradient(ellipse at center, transparent 35%, rgb(0 0 0 / 75%) 100%);
  animation: story-glitch 2.8s steps(1, end) infinite;
}

.story-scene__skip {
  position: absolute;
  z-index: 3;
  top: max(24px, env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  border: 2px solid #fff;
  padding: 12px 16px;
  background: rgb(5 5 7 / 80%);
  color: #fff;
  font-family: "Galmuri11", monospace;
  font-size: clamp(14px, 1.3vw, 20px);
  cursor: pointer;
  box-shadow: 4px 4px 0 #71121b;
}

.story-scene__skip:hover,
.story-scene__skip:focus-visible,
.story-name-form__submit:hover,
.story-name-form__submit:focus-visible {
  border-color: #ff5b62;
  color: #ffdbdd;
  outline: none;
}

.story-name-form {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(560px, calc(100vw - 40px));
  gap: 16px;
  border: 4px solid #fff;
  padding: clamp(26px, 5vw, 54px);
  background: rgb(6 5 7 / 94%);
  box-shadow:
    8px 8px 0 #681019,
    0 0 46px rgb(205 19 34 / 28%);
  color: #fff;
  font-family: "Galmuri11", monospace;
  transform: translate(-50%, -50%);
}

.story-name-form__eyebrow,
.story-name-form__title,
.story-name-form__error {
  margin: 0;
}

.story-name-form__eyebrow {
  color: #ff626a;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(9px, 1vw, 13px);
  letter-spacing: 0.08em;
}

.story-name-form__title {
  margin-bottom: 8px;
  font-size: clamp(27px, 4vw, 46px);
}

.story-name-form__label {
  font-size: clamp(16px, 1.7vw, 22px);
}

.story-name-form__input,
.story-name-form__submit {
  min-height: 58px;
  border: 3px solid #fff;
  border-radius: 0;
  padding: 12px 16px;
  font-family: "Galmuri11", monospace;
  font-size: clamp(17px, 1.8vw, 23px);
}

.story-name-form__input {
  background: #131014;
  color: #fff;
  outline: none;
}

.story-name-form__input:focus {
  border-color: #ff5b62;
  box-shadow: 0 0 0 3px rgb(255 70 80 / 25%);
}

.story-name-form__submit {
  margin-top: 8px;
  background: #211013;
  color: #fff;
  cursor: pointer;
}

.story-name-form__error {
  color: #ff777d;
  font-size: 15px;
}

@keyframes story-glitch {
  0%, 92%, 100% { transform: translateX(0); opacity: 1; }
  93% { transform: translateX(5px); opacity: 0.75; }
  95% { transform: translateX(-3px); opacity: 0.9; }
}

/* Battle scene */
.battle-scene {
  background: #0d0d0d;
}

/* Dialog box (story intro, battle lines) */
.dialog-box {
  position: absolute;
  right: 5vw;
  bottom: 6vh;
  left: 5vw;
  display: flex;
  min-height: clamp(112px, 15vw, 180px);
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding:
    clamp(24px, 3vw, 50px)
    clamp(30px, 4vw, 72px)
    clamp(36px, 4.5vw, 62px);
  background: url("../assets/images/DialogFrame.svg") center / 100% 100% no-repeat;
  color: #2b2117;
  font-family: "Galmuri11", sans-serif;
  font-size: clamp(14px, 1.25vw, 22px);
  line-height: 1.7;
  white-space: pre-line;
  cursor: pointer;
  image-rendering: pixelated;
}

.dialog-box__speaker {
  margin-bottom: 7px;
  color: #801620;
  font-size: 1.05em;
}

.dialog-box__text {
  padding-right: 70px;
}

.dialog-box__progress {
  position: absolute;
  top: clamp(18px, 2vw, 30px);
  right: clamp(30px, 4vw, 72px);
  color: #6f5b48;
  font-size: 0.72em;
}

.dialog-box::after {
  content: "▶ 클릭 · Space · Enter";
  position: absolute;
  right: clamp(30px, 4vw, 72px);
  bottom: clamp(18px, 2vw, 32px);
  font-size: clamp(10px, 0.8vw, 13px);
  opacity: 0.72;
}

@media (max-width: 680px), (max-height: 520px) {
  .story-scene__skip {
    top: max(12px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    padding: 9px 12px;
  }

  .dialog-box {
    right: 3vw;
    bottom: max(3vh, env(safe-area-inset-bottom));
    left: 3vw;
    min-height: 108px;
    padding: 20px 24px 34px;
    font-size: 14px;
    line-height: 1.45;
  }

  .dialog-box__text {
    padding-right: 44px;
  }

  .dialog-box__progress {
    top: 14px;
    right: 22px;
  }

  .dialog-box::after {
    right: 24px;
    bottom: 15px;
    font-size: 9px;
  }

  .story-name-form {
    width: min(520px, calc(100vw - 32px));
    gap: 10px;
    padding: 20px 24px;
  }

  .story-name-form__title {
    font-size: 26px;
  }

  .story-name-form__input,
  .story-name-form__submit {
    min-height: 48px;
    padding: 9px 12px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-scene__fade {
    transition-duration: 1ms;
  }

  .story-scene::after {
    animation: none;
  }
}

/* Choice panel */
.choice-panel {
  position: absolute;
  left: 6vw;
  right: 6vw;
  bottom: 8vh;
  display: grid;
  gap: 10px;
}

.choice-panel__button {
  padding: 14px 18px;
  border: 2px solid var(--control-border);
  border-radius: 8px;
  background: rgb(20 16 10 / 92%);
  color: var(--control-text);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

.choice-panel__button:hover,
.choice-panel__button:focus-visible {
  background: rgb(91 126 28 / 60%);
  outline: none;
}

.choice-panel__button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice-panel__button:disabled:hover {
  background: rgb(20 16 10 / 92%);
}

/* Pickup toast (exploration) */
.pickup-toast {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgb(20 16 10 / 92%);
  border: 2px solid #ffd76a;
  color: #ffd76a;
  font-size: 14px;
  font-weight: 700;
  z-index: 2;
  pointer-events: none;
}

/* Pause overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(34px, 5vh, 72px);
  background: rgb(8 8 8 / 70%);
  backdrop-filter: blur(10px) grayscale(0.7) brightness(0.62);
  /* Above minigame/death/option overlays (z-index: 20) and the HUD (21) so
     ESC can still open it - and see it - over any of those. */
  z-index: 22;
}

.pause-overlay[hidden] {
  display: none;
}

.pause-overlay__title {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.8vw, 28px);
  margin: 0;
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(30px, 4.4vw, 72px);
  line-height: 1;
  text-shadow: 0 8px 18px rgb(0 0 0 / 35%);
}

.pause-overlay__playtime {
  margin: 0;
  color: rgb(255 255 255 / 78%);
  font-family: "Galmuri11", monospace;
  font-size: clamp(14px, 1.6vw, 22px);
  text-shadow: 0 4px 10px rgb(0 0 0 / 35%);
}

.pause-overlay__title-icon {
  display: none;
}

.pause-overlay__title input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pause-overlay__checkbox {
  width: 0.78em;
  height: 0.78em;
  border: 0.12em solid currentColor;
  background: rgb(18 18 18 / 55%);
  box-shadow: 0 5px 0 rgb(0 0 0 / 34%);
}

.pause-overlay__title input:checked + .pause-overlay__checkbox::after {
  content: "✓";
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 0.72em;
  line-height: 1;
}

.pause-overlay__title:focus-within {
  filter: drop-shadow(0 0 12px rgb(255 255 255 / 70%));
}

.pause-overlay__actions {
  display: grid;
  gap: clamp(18px, 2.4vh, 30px);
}

.pause-overlay__action {
  min-width: clamp(290px, 31vw, 520px);
  border: 6px solid #fff;
  padding: clamp(18px, 2.5vh, 30px) clamp(28px, 4vw, 62px);
  background: rgb(31 31 31 / 72%);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(19px, 2.4vw, 38px);
  text-shadow: 0 5px 10px #000;
  box-shadow: 0 9px 0 rgb(0 0 0 / 50%), inset 0 0 18px rgb(255 255 255 / 8%);
  cursor: pointer;
}

.pause-overlay__action:hover,
.pause-overlay__action:focus-visible,
.pause-overlay__option:hover,
.pause-overlay__option:focus-visible {
  filter: drop-shadow(0 0 16px rgb(255 255 255 / 65%));
  outline: none;
}

.pause-overlay__option {
  position: absolute;
  bottom: clamp(28px, 7vh, 96px);
  left: clamp(28px, 4vw, 76px);
  border: 0;
  padding: 0;
  background: none;
  color: #fff;
  font-size: clamp(58px, 6vw, 104px);
  line-height: 1;
  text-shadow: 0 6px 12px #000;
  cursor: pointer;
}

.pause-overlay__sound {
  position: absolute;
  bottom: clamp(28px, 7vh, 96px);
  right: clamp(28px, 4vw, 76px);
  width: clamp(48px, 5.3vw, 104px);
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

.pause-overlay__sound img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.pause-overlay__sound:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 6px;
}

/* Game over overlay */
.death-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 14%) 0 2px, transparent 2px 5px),
    rgb(5 2 3 / 88%);
  backdrop-filter: blur(5px) grayscale(0.8);
}

.death-overlay[hidden] {
  display: none;
}

.death-overlay__panel {
  width: min(620px, 92vw);
  border: 5px solid #ff3f3f;
  padding: clamp(28px, 5vw, 64px);
  background: #100708;
  box-shadow:
    0 0 0 7px #31090c,
    0 0 42px rgb(255 34 34 / 52%),
    inset 0 0 42px rgb(125 0 0 / 34%);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  text-align: center;
}

.death-overlay__eyebrow {
  margin-bottom: 18px;
  color: #ff9292;
  font-size: clamp(10px, 1.4vw, 15px);
  letter-spacing: 0.12em;
}

.death-overlay__title {
  color: #ff3939;
  font-size: clamp(38px, 7vw, 82px);
  line-height: 1.1;
  text-shadow: 5px 5px 0 #5b080d;
}

.death-overlay__message {
  margin-top: 22px;
  color: #f6dddd;
  font-family: "Galmuri11", monospace;
  font-size: clamp(16px, 2vw, 24px);
}

.death-overlay__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.death-overlay__button {
  border: 3px solid #fff;
  padding: 16px 12px;
  background: #1d1011;
  color: #fff;
  font-family: "Galmuri11", monospace;
  font-size: clamp(16px, 2vw, 23px);
  cursor: pointer;
}

.death-overlay__button:hover,
.death-overlay__button:focus-visible {
  border-color: #ff4f4f;
  outline: none;
  background: #4a1116;
  box-shadow: 0 0 18px rgb(255 40 40 / 45%);
}

@media (max-width: 560px) {
  .death-overlay__actions {
    grid-template-columns: 1fr;
  }
}

/* HUD */
.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  pointer-events: none;
  /* Above the puzzle-terminal/stair-dodge/death/option overlays (all
     z-index: 20) so HP/cringe stay sharp instead of getting caught in
     their backdrop-filter blur and dark tint. */
  z-index: 21;
  color: var(--message-text);
}

.hud__meters {
  display: grid;
  gap: 4px;
}

.hud__stat {
  --empty-ratio: 0;
  position: relative;
  width: clamp(300px, 42vw, 520px);
  aspect-ratio: 4 / 1;
}

.hud__stat-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hud__bar-empty {
  position: absolute;
  top: 47%;
  right: 7.7%;
  width: calc(69.9% * var(--empty-ratio));
  height: 9.4%;
  border-radius: 0 3px 3px 0;
  background: #25130d;
  transition: width 120ms ease-out;
}

.hud__stat-value {
  position: absolute;
  top: 47%;
  right: 7.7%;
  width: 69.9%;
  height: 9.4%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Galmuri11", monospace;
  font-size: clamp(11px, 1.1vw, 15px);
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  pointer-events: none;
}

.hud__clock {
  padding: 8px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 2.6vw, 28px);
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 #25130d;
}

/* QTE minigame overlay */
.qte-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 16px;
  background: rgb(60 0 0 / 55%);
  z-index: 3;
}

.qte-overlay__prompt {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.qte-overlay__bar {
  width: 280px;
  height: 14px;
  border-radius: 8px;
  background: rgb(255 255 255 / 20%);
  overflow: hidden;
}

.qte-overlay__bar-fill {
  height: 100%;
  width: 100%;
  background: #ffcf40;
}

.qte-overlay__count {
  font-size: 18px;
  color: #fff;
}

/* Siren boss fight HUD (in-world music-room fight) */
.siren-boss-hud {
  position: absolute;
  top: clamp(10px, 2.5vh, 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: clamp(6px, 1.2vw, 11px) clamp(14px, 2.4vw, 22px);
  border: 3px solid #4a3018;
  border-radius: 12px;
  background: rgb(20 8 8 / 82%);
  pointer-events: none;
  text-align: center;
}

/* The `hidden` attribute alone loses to the display rule above (same trap as
   .death-overlay), so the scene's hidden toggle needs this to actually hide. */
.siren-boss-hud[hidden] {
  display: none;
}

.siren-boss-hud__round {
  margin: 0;
  color: #ffcf40;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(9px, 1.3vw, 13px);
  text-shadow: 0 0 8px rgb(255 207 64 / 55%);
}

.siren-boss-hud__hp {
  display: flex;
  gap: 6px;
}

.siren-boss-hud__pip {
  width: clamp(14px, 2vw, 20px);
  aspect-ratio: 1;
  border: 2px solid #ff6a6a;
  border-radius: 3px;
  background: #ff2e2e;
  box-shadow: 0 0 10px rgb(255 46 46 / 60%);
  transition: background-color 140ms steps(2, end);
}

.siren-boss-hud__pip.is-broken {
  border-color: #5a3030;
  background: #2a1414;
  box-shadow: none;
}

.siren-boss-prompt {
  position: absolute;
  bottom: clamp(40px, 12vh, 110px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  padding: 8px 18px;
  border-radius: 8px;
  background: rgb(20 8 8 / 78%);
  color: #fff;
  font-family: "Galmuri11", sans-serif;
  font-size: clamp(13px, 1.9vw, 20px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.siren-boss-prompt.is-visible {
  opacity: 1;
  animation: siren-prompt-pulse 620ms ease-in-out infinite;
}

/* Puzzle terminal (computer minigame) */
.puzzle-terminal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(3px);
}

.puzzle-terminal__frame {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: 1;
  padding: clamp(16px, 4vw, 30px);
  border-radius: 28px;
  background: #2c1c10;
  box-shadow:
    0 0 0 6px #4a3018,
    0 0 0 10px #1b110a,
    0 12px 40px rgb(0 0 0 / 65%);
  animation: option-modal-enter 180ms steps(3, end) both;
}

.puzzle-terminal__close {
  position: absolute;
  top: clamp(10px, 3vw, 20px);
  left: clamp(10px, 3vw, 20px);
  z-index: 1;
  width: clamp(30px, 6vw, 44px);
  aspect-ratio: 1;
  border: none;
  background: none;
  color: #fff;
  font: clamp(24px, 5vw, 36px)/1 "Press Start 2P", monospace;
  cursor: pointer;
}

.puzzle-terminal__screen {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(18px, 4vh, 32px);
  padding: clamp(20px, 6%, 40px);
  border-radius: 16px;
  border: 6px solid #c9cdd4;
  background: #050505;
  box-shadow: inset 0 0 24px rgb(0 0 0 / 80%);
}

.puzzle-terminal__screen--hit {
  animation: puzzle-flash-hit 400ms ease-out;
}

.puzzle-terminal__screen--miss {
  animation: puzzle-flash-miss 400ms ease-out;
}

.puzzle-terminal__count {
  margin: 0;
  color: #d7ff2e;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(30px, 8vw, 52px);
  text-shadow: 0 0 10px rgb(215 255 46 / 60%);
}

.puzzle-terminal__track-wrap {
  position: relative;
  width: 100%;
  padding-top: clamp(22px, 5vw, 34px);
}

.puzzle-terminal__arrow {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  color: #d7ff2e;
  font-size: clamp(18px, 4vw, 28px);
  line-height: 1;
}

.puzzle-terminal__track {
  position: relative;
  height: clamp(12px, 2.6vw, 18px);
  border-radius: 999px;
  background: #d7ff2e;
}

.puzzle-terminal__target {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: clamp(22px, 5vw, 32px);
  border: 3px solid #d7ff2e;
  border-radius: 6px;
  background: #050505;
  box-sizing: border-box;
}

.puzzle-terminal__hint {
  margin: 0;
  color: #7d8f3c;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(9px, 1.8vw, 12px);
}

/* Stair-dodge packs more rows into the screen than puzzle-terminal.js
   (count, pips, stage, taunt, hint) - a plain 1:1 frame was too short for
   all of them, pushing the hint text past the screen's bottom edge. Give
   this minigame specifically a taller frame and tighter spacing instead
   of changing the shared square frame every other terminal still uses. */
.stair-dodge .puzzle-terminal__frame {
  aspect-ratio: 3 / 4;
}

.stair-dodge__screen {
  position: relative;
  gap: clamp(10px, 2.2vh, 18px);
}

.stair-dodge .puzzle-terminal__count {
  font-size: clamp(22px, 6vw, 38px);
}

.stair-dodge__pips {
  display: flex;
  gap: 8px;
}

.stair-dodge__pip {
  width: clamp(8px, 1.6vw, 12px);
  aspect-ratio: 1;
  border: 2px solid #7d8f3c;
  border-radius: 2px;
  background: transparent;
}

.stair-dodge__pip--filled {
  background: #d7ff2e;
  border-color: #d7ff2e;
  box-shadow: 0 0 6px rgb(215 255 46 / 70%);
}

.stair-dodge__stage {
  position: relative;
  width: 100%;
  height: clamp(120px, 26vh, 190px);
  overflow: hidden;
}

.stair-dodge__ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  height: 6px;
  background: #7dff5a;
  box-shadow: 0 0 8px rgb(125 255 90 / 60%);
}

.stair-dodge__character {
  position: absolute;
  bottom: calc(18% + 3px);
  left: 24%;
  transform: translateX(-50%);
  width: clamp(36px, 9vw, 56px);
  aspect-ratio: 1;
  /* playerAction/Front.png is a 4-frame walk sheet (256x64) - stretch it
     to 400% width / 100% height so frame 0 alone fills this square box. */
  background-size: 400% 100%;
  background-repeat: no-repeat;
  background-position: 0 0;
  image-rendering: pixelated;
  will-change: left, transform;
}

.stair-dodge__character--jump {
  /* Must match JUMP_DURATION_MS in stair-dodge.js - the airborne window
     (immune to the obstacle) is timed off that constant, not this CSS. */
  animation: stair-dodge-jump 650ms ease-out;
}

.stair-dodge__obstacle {
  position: absolute;
  bottom: calc(18% + 3px);
  width: clamp(46px, 11vw, 66px);
  height: clamp(18px, 4vw, 26px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ff5b47, #c81f16);
  border: 3px solid #6e0f0a;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgb(0 0 0 / 40%);
}

.stair-dodge__taunt {
  margin: 0;
  color: #ff5a7a;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(10px, 2vw, 14px);
  text-align: center;
}

.stair-dodge__banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #050505;
  color: #d7ff2e;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(22px, 6vw, 38px);
  text-align: center;
  line-height: 1.7;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgb(215 255 46 / 60%);
}

.stair-dodge__banner[hidden] {
  display: none;
}

/* Ending scene */
.ending-scene {
  display: grid;
  place-items: center;
  min-height: 100svh;
  overflow: auto;
  padding: 20px;
  background: #080a08;
}

.result-screen {
  width: min(100%, 650px);
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: clamp(28px, 5vw, 48px);
  border: 2px solid #1d251b;
  border-radius: 10px;
  background: #090b09;
  box-shadow: inset 0 0 30px rgb(109 139 62 / 5%);
  text-align: center;
  color: #efffc7;
  font-family: "Galmuri11", monospace;
  animation: result-screen-enter 400ms ease-out both;
}

.result-screen__type {
  margin: 0;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  color: #ff5540;
}

.result-screen--hidden .result-screen__type {
  color: #c77dff;
}

.result-screen--secret .result-screen__type {
  color: #e7c94a;
}

.result-screen__title {
  margin: 0;
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 800;
  line-height: 1.18;
  text-wrap: balance;
}

.result-screen__description {
  max-width: 52ch;
  margin: 0;
  color: #cbd99f;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.6;
  text-wrap: balance;
}

.result-screen__stats {
  width: min(100%, 390px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 4px 0 0;
}

.result-screen__stats dt {
  color: #a5b37d;
  font-size: 13px;
}

.result-screen__stats dd {
  margin: 5px 0 0;
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 700;
  white-space: nowrap;
}

.result-screen__rank-form {
  width: min(100%, 430px);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.result-screen__nickname {
  min-width: 0;
  flex: 1;
  padding: 11px 14px;
  border: 2px solid #9fcb43;
  border-radius: 8px;
  outline: none;
  background: #090b09;
  color: #efffc7;
  font: inherit;
}

.result-screen__nickname:focus {
  border-color: #c6f25f;
  box-shadow: 0 0 0 2px rgb(198 242 95 / 14%);
}

.result-screen__submit,
.result-screen__restart {
  border: 2px solid #9fcb43;
  border-radius: 8px;
  background: #090b09;
  color: #dfffa0;
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.result-screen__submit {
  flex: 0 0 auto;
  padding: 11px 18px;
}

.result-screen__submit:hover,
.result-screen__restart:hover {
  border-color: #c6f25f;
  background: #11150f;
  color: #f2ffcf;
}

.result-screen__rank-status {
  margin: -6px 0 0;
  color: #bfe46d;
  font-size: 13px;
}

.result-screen__rank-status.is-error {
  color: #ff7562;
}

.result-screen__player-rank {
  width: min(100%, 430px);
  display: flex;
  justify-content: center;
  gap: 24px;
  color: #aebc87;
  font-size: 13px;
}

.result-screen__player-rank[hidden] {
  display: none;
}

.result-screen__player-rank strong {
  margin-left: 5px;
  color: #efffc7;
}

.result-screen__ranking {
  width: min(100%, 500px);
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-screen__ranking li {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 6px;
  background: #151715;
  font-size: 14px;
}

.result-screen__rank-index {
  color: #9fab82;
  font-weight: 700;
}

.result-screen__ranking li:nth-child(-n + 3) .result-screen__rank-index {
  color: #ff5540;
}

.result-screen__rank-name {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-screen__rank-time {
  font-weight: 700;
  white-space: nowrap;
}

.result-screen__ranking .result-screen__rank-empty {
  display: flex;
  justify-content: center;
  color: #8f9a76;
}

.result-screen__restart {
  margin-top: 2px;
  padding: 11px 26px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes result-screen-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .ending-scene {
    align-items: start;
    padding: 10px;
  }

  .result-screen {
    gap: 13px;
    padding: 24px 16px;
  }

  .result-screen__rank-form {
    flex-wrap: wrap;
  }

  .result-screen__submit {
    flex: 1 0 auto;
  }

  .result-screen__player-rank {
    gap: 12px;
    flex-wrap: wrap;
  }

  .result-screen__ranking li {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 8px;
    padding-inline: 10px;
  }
}

/* Option modal */
.option-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(3px);
}

.option-modal__panel {
  width: min(100%, 720px);
  position: relative;
  display: grid;
  gap: 24px;
  padding: clamp(26px, 5vw, 52px);
  border: 5px solid #e84313;
  border-radius: 30px 10px 30px 10px;
  background: #160a06;
  box-shadow:
    0 0 0 4px #591808,
    0 0 0 8px #220b05,
    inset 0 0 44px #000,
    0 12px 40px rgb(0 0 0 / 65%);
  color: #fff0c5;
  font-family: "Press Start 2P", monospace;
  image-rendering: pixelated;
  animation: option-modal-enter 180ms steps(3, end) both;
}

.option-modal__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.option-modal__header h2 {
  grid-column: 2;
  margin: 0;
  color: #fff0c5;
  font-size: clamp(30px, 6vw, 62px);
  line-height: 1;
  text-shadow: 0 5px 0 #a4230c;
}

.option-modal__close {
  grid-column: 3;
  justify-self: end;
  width: clamp(46px, 7vw, 68px);
  aspect-ratio: 1;
  border: 4px solid #ff3b12;
  border-radius: 8px;
  background: #9b1009;
  box-shadow: inset 0 -6px 0 #5b0907, 0 0 0 3px #330504;
  color: #fff0c5;
  font: 38px/1 "Press Start 2P", monospace;
  cursor: pointer;
}

.option-modal__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ef4618;
}

.option-modal__divider::before,
.option-modal__divider::after {
  height: 4px;
  flex: 1;
  content: "";
  background: repeating-linear-gradient(90deg, #ef4618 0 8px, #6c1708 8px 12px);
}

.option-modal__divider span {
  font-size: 24px;
}

.option-modal__controls {
  display: grid;
  gap: 24px;
}

.option-volume {
  display: grid;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 4px dotted #92230e;
}

.option-volume__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.option-volume__heading h3,
.option-volume__heading output {
  margin: 0;
  font-size: clamp(14px, 2.4vw, 22px);
}

.option-volume__heading output {
  color: #ff4a1d;
}

.option-volume__control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.option-volume__control button {
  width: clamp(44px, 7vw, 62px);
  aspect-ratio: 1;
  border: 4px solid #ff3b12;
  border-radius: 7px;
  background: #9b1009;
  box-shadow: inset 0 -6px 0 #5b0907;
  color: #fff0c5;
  font: clamp(20px, 3vw, 30px)/1 "Press Start 2P", monospace;
  cursor: pointer;
}

.option-volume input[type="range"] {
  --volume: 100%;
  width: 100%;
  height: 26px;
  appearance: none;
  border: 4px solid #350c07;
  border-radius: 3px;
  outline: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 4px), #350c07 calc(10% - 4px) 10%),
    linear-gradient(90deg, #ff4515 0 var(--volume), #272525 var(--volume) 100%);
}

.option-volume input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 34px;
  appearance: none;
  border: 2px solid #fff0c5;
  background: #ff4515;
}

.option-mute {
  display: grid;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 4px dotted #92230e;
}

.option-mute__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  border: 4px solid #ff3b12;
  border-radius: 7px;
  background: #9b1009;
  box-shadow: inset 0 -6px 0 #5b0907;
  color: #fff0c5;
  font-family: "Galmuri11", sans-serif;
  font-size: clamp(14px, 2.4vw, 22px);
  cursor: pointer;
}

.option-mute__toggle.is-muted {
  border-color: #6d6d6d;
  background: #2c2c2c;
  box-shadow: inset 0 -6px 0 #151515;
  color: #b9b9b9;
}

.option-mute__toggle:hover,
.option-mute__toggle:focus-visible {
  outline: none;
  filter: brightness(1.15);
}

.option-mute__icon {
  width: clamp(24px, 4vw, 36px);
  height: auto;
  image-rendering: pixelated;
}

.option-modal__restart {
  justify-self: center;
  min-width: min(100%, 360px);
  padding: 20px 28px;
  border: 5px solid #ff3b12;
  border-radius: 8px;
  background: #780d0a;
  box-shadow: inset 0 -8px 0 #3e0605, 0 0 0 4px #300504;
  color: #fff0c5;
  font: clamp(20px, 3vw, 30px)/1 "Press Start 2P", monospace;
  cursor: pointer;
}

.option-modal button:hover,
.option-modal button:focus-visible {
  filter: brightness(1.2);
  outline: 3px solid #fff0c5;
  outline-offset: 3px;
}

.option-modal__confirm {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: 30px;
  border-radius: inherit;
  background: rgb(10 3 2 / 96%);
  text-align: center;
  line-height: 1.8;
}

.option-modal__confirm[hidden] {
  display: none;
}

.option-modal__confirm div {
  display: flex;
  gap: 16px;
}

.option-modal__confirm button {
  padding: 13px 20px;
  border: 3px solid #ef4618;
  border-radius: 6px;
  background: #5d0b07;
  color: #fff0c5;
  font: inherit;
}

@keyframes option-modal-enter {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Leaderboard */
.leaderboard-scene {
  overflow: auto;
  padding: clamp(18px, 4vw, 48px);
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 2%) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 0%, #23100a, #080706 58%);
  color: #fff0c5;
  font-family: "Galmuri11", monospace;
}

.leaderboard-shell {
  width: min(100%, 1100px);
  min-height: 100%;
  margin: 0 auto;
}

.leaderboard-shell[hidden] {
  display: none;
}

.leaderboard-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 4px solid #e84313;
}

.leaderboard-header p {
  margin: 0 0 6px;
  color: #ef5a2e;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
}

.leaderboard-header h1 {
  margin: 0;
  font: clamp(28px, 5vw, 52px)/1.1 "Press Start 2P", monospace;
  text-shadow: 0 4px 0 #8c210c;
}

.leaderboard-back {
  padding: 12px 18px;
  border: 3px solid #e84313;
  border-radius: 6px;
  background: #310b06;
  color: #fff0c5;
  font: 14px/1 "Press Start 2P", monospace;
  cursor: pointer;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.leaderboard-card {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 20px;
  border: 3px solid #6b2816;
  border-radius: 10px;
  background: rgb(20 10 7 / 92%);
  color: #fff0c5;
  text-align: left;
  cursor: pointer;
}

/* Centers a trailing odd-one-out card instead of stretching it full width
   (only matches when the last card is also odd-indexed, i.e. the total
   count is odd) so an even card count lays out as a plain 2-column grid. */
.leaderboard-card:nth-child(odd):last-child {
  grid-column: 1 / -1;
  width: calc(50% - 9px);
  justify-self: center;
}

.leaderboard-card:hover,
.leaderboard-card:focus-visible {
  border-color: #f04a1b;
  outline: none;
  transform: translateY(-2px);
}

.leaderboard-card__type,
.leaderboard-detail__type {
  color: #ff5540;
  font-weight: 700;
}

.leaderboard-card--hidden .leaderboard-card__type,
.leaderboard-detail__type[data-ending-type="hidden"] {
  color: #c77dff;
}

.leaderboard-card--secret .leaderboard-card__type,
.leaderboard-detail__type[data-ending-type="secret"] {
  color: #e7c94a;
}

.leaderboard-card__title {
  min-height: 1.4em;
  font-size: clamp(19px, 2.6vw, 28px);
}

.leaderboard-card__ranking,
.leaderboard-detail__ranking {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-card__ranking li,
.leaderboard-detail__ranking li {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #211713;
}

.leaderboard-rank__position {
  color: #ff5a35;
  font-weight: 700;
}

.leaderboard-rank__nickname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-rank__time {
  font-weight: 700;
  white-space: nowrap;
}

.leaderboard-rank__empty {
  display: block !important;
  color: #a69780;
  text-align: center;
}

.leaderboard-detail {
  max-width: 760px;
}

.leaderboard-detail__ranking li {
  padding: 12px 16px;
  font-size: 17px;
}

@media (max-width: 680px) {
  .option-modal__panel {
    gap: 17px;
    padding: 24px 18px;
    border-width: 3px;
  }

  .option-volume__control {
    gap: 10px;
  }

  .leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-card:nth-child(odd):last-child {
    grid-column: auto;
    width: 100%;
  }

  .leaderboard-header {
    align-items: center;
  }

  .leaderboard-header h1 {
    font-size: clamp(22px, 8vw, 36px);
  }

  .leaderboard-back {
    padding: 10px 12px;
    font-size: 11px;
  }
}

/* Mimic battle scene */
.mimic-battle-scene {
  background-color: #3a3a3a;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  font-family: "Galmuri11", sans-serif;
}

.mimic-battle__stage {
  position: absolute;
  inset: 0;
  bottom: clamp(140px, 22vh, 220px);
}

.mimic-battle__sprite {
  position: absolute;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.mimic-battle__sprite--mimic {
  top: 8%;
  right: 10%;
  width: clamp(120px, 16vw, 220px);
  height: clamp(120px, 16vw, 220px);
}

.mimic-battle__sprite--player {
  bottom: 10%;
  left: 10%;
  width: clamp(100px, 13vw, 180px);
  height: clamp(100px, 13vw, 180px);
}

.mimic-battle__panel {
  position: absolute;
  min-width: clamp(220px, 26vw, 340px);
  background: #fff;
  border: 3px solid #1a1a1a;
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 4px 4px 0 rgb(0 0 0 / 35%);
}

.mimic-battle__panel--mimic {
  top: 6%;
  left: 6%;
}

.mimic-battle__panel--player {
  bottom: 6%;
  right: 6%;
}

.mimic-battle__panel-name {
  font-size: clamp(14px, 1.4vw, 20px);
  color: #1a1a1a;
  margin-bottom: 6px;
}

.mimic-battle__hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mimic-battle__heart {
  color: #d33a4b;
  font-size: clamp(18px, 1.8vw, 26px);
  line-height: 1;
}

.mimic-battle__hp-bar {
  flex: 1;
  height: clamp(10px, 1.2vw, 16px);
  background: #1a1a1a;
  border-radius: 999px;
  overflow: hidden;
}

.mimic-battle__hp-fill {
  height: 100%;
  background: #f5f0e8;
  transition: width 200ms ease-out;
}

.mimic-battle__hp-text {
  font-size: clamp(11px, 1.1vw, 15px);
  color: #1a1a1a;
  white-space: nowrap;
}

.mimic-battle__message-box {
  position: absolute;
  left: 4vw;
  right: 4vw;
  bottom: 4vh;
  min-height: clamp(120px, 18vh, 200px);
  background: #fff;
  border: 4px solid #1a1a1a;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #1a1a1a;
  clip-path: polygon(
    16px 0, calc(100% - 16px) 0, 100% 16px,
    100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%,
    0 calc(100% - 16px), 0 16px
  );
  padding: 20px 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.mimic-battle__message-box--menu {
  cursor: default;
  align-items: stretch;
}

.mimic-battle__message-text {
  margin: 0;
  font-size: clamp(15px, 1.6vw, 22px);
  line-height: 1.7;
  color: #1a1a1a;
  white-space: pre-line;
}

.mimic-battle__message-text--choice {
  flex: 1;
}

.mimic-battle__choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  width: clamp(160px, 20vw, 240px);
}

.mimic-battle__choice-button,
.mimic-battle__fight-button {
  font-family: "Galmuri11", sans-serif;
  font-size: clamp(14px, 1.4vw, 19px);
  color: #1a1a1a;
  background: #fff;
  border: 2px solid #1a1a1a;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}

.mimic-battle__choice-button:hover,
.mimic-battle__choice-button:focus-visible,
.mimic-battle__fight-button:hover,
.mimic-battle__fight-button:focus-visible {
  background: #eee;
  outline: none;
}

.mimic-battle__fight-label {
  position: absolute;
  top: 14px;
  left: 28px;
  font-size: clamp(10px, 1vw, 13px);
  color: #1a1a1a;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
  padding: 2px 8px;
  pointer-events: none;
}

.mimic-battle__fight-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  margin-left: clamp(70px, 8vw, 110px);
}

@media (max-width: 720px) {
  .mimic-battle__panel {
    min-width: 60vw;
    padding: 8px 12px;
  }

  .mimic-battle__message-box {
    left: 2vw;
    right: 2vw;
    padding: 16px 18px;
  }

  .mimic-battle__fight-grid {
    margin-left: 0;
  }

  .mimic-battle__fight-label {
    top: 6px;
    left: 12px;
  }
}
.final-boss-scene {
  display: grid;
  place-items: center;
  min-height: 100%;
  background: radial-gradient(circle at 50% 40%, #182129, #030405 72%);
  color: #f8efbf;
}

.final-boss-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-shadow: inset 0 0 0 3px #624050, inset 0 0 45px #9b165c66;
  background: #07090d;
}

.final-boss-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.final-boss-hud {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  width: min(78%, 760px);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 2px 2px #000;
  pointer-events: none;
}

.final-boss-hud > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 7px;
  letter-spacing: .08em;
}

.final-boss-hud__phase { color: #ff6888; font-size: .75rem; }
.final-boss-hud__bar { height: 18px; border: 3px solid #e5dba3; background: #140d12; box-shadow: 0 0 0 2px #000; }
.final-boss-hud__fill { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(90deg, #d31b4f 0 28px, #f64265 28px 31px); transition: width .18s steps(4); }
.final-boss-hud__weakness { margin-top: 8px; color: #b9f7da; font-size: .72rem; }
.final-boss-player-hp, .final-boss-controls { position: absolute; z-index: 3; bottom: 14px; margin: 0; text-shadow: 2px 2px #000; pointer-events: none; }
.final-boss-player-hp { left: 18px; color: #9fffc8; }
.final-boss-controls { right: 18px; color: #d3c6b3; font-size: .66rem; }

.final-boss-dialogue {
  position: absolute;
  z-index: 8;
  left: 6%;
  right: 6%;
  bottom: 6%;
  min-height: 118px;
  padding: 22px 28px;
  border: 4px solid #decf99;
  background: rgba(13, 9, 13, .96);
  box-shadow: 0 0 0 5px #321824, inset 0 0 24px #7e234055;
  cursor: pointer;
}

.final-boss-dialogue strong { display: block; color: #ff5b77; margin-bottom: 10px; }
.final-boss-dialogue p { margin: 0; line-height: 1.65; }
.final-boss-dialogue small { position: absolute; right: 20px; bottom: 10px; color: #b6a985; }

.final-boss-transition,
.final-boss-pause,
.final-boss-retry {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 20px;
  text-align: center;
  background: rgba(0, 0, 0, .94);
}

.final-boss-transition[hidden], .final-boss-pause[hidden], .final-boss-retry[hidden], .final-boss-dialogue[hidden] { display: none; }
.final-boss-transition strong { font-size: clamp(2.8rem, 8vw, 6rem); color: #f7ebbd; text-shadow: 4px 4px #9e173f; animation: final-boss-time-glitch .15s steps(2) infinite; }
.final-boss-transition span { color: #ff7189; font-size: clamp(1rem, 2.5vw, 1.6rem); }
.final-boss-pause h2, .final-boss-retry h2 { color: #ff4568; font-size: 2.5rem; }
.final-boss-pause button, .final-boss-retry button { min-width: 220px; padding: 14px 24px; border: 3px solid #e5dba3; color: #f8efbf; background: #351223; font: inherit; cursor: pointer; }
.final-boss-pause button:hover, .final-boss-retry button:hover { background: #6d1735; }
.final-boss-scene[data-phase="3"] .final-boss-stage { animation: final-boss-glitch-border .35s steps(2) infinite; }
.final-boss-scene.is-boss-defeated .final-boss-stage { animation: screen-shake .11s steps(2) infinite, final-boss-glitch-border .12s steps(2) infinite; }

@keyframes final-boss-time-glitch { 50% { transform: translate(2px, -1px); text-shadow: -4px 2px #37ffe0, 4px -2px #e31b61; } }
@keyframes final-boss-glitch-border { 50% { filter: contrast(1.4) hue-rotate(14deg); box-shadow: -5px 0 #18ffd8, 5px 0 #ff235d; } }

@media (max-width: 700px) {
  .final-boss-hud { top: 7px; width: 70%; }
  .final-boss-hud__weakness, .final-boss-controls { display: none; }
  .final-boss-player-hp { bottom: 7px; font-size: .7rem; }
  .final-boss-dialogue { min-height: 88px; padding: 12px 16px; font-size: .75rem; }
}
