@font-face {
    font-family: "Press Start 2P";
    src: url("fonts/PressStart2P-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "NeoDunggeunmo";
    src: url("fonts/GalmuriMono9.ttf?v=20261027-ui") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "NeoDunggeunmoPixel";
    src: url("fonts/GalmuriMono9.ttf?v=20261030") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "GalmuriMono9";
    src: url("fonts/GalmuriMono9.ttf?v=20261027") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#gameContainer button {
    font-family: "GalmuriMono9", monospace !important;
    font-weight: 700 !important;
}

#gameContainer .menu button:not(.devTools button) {
    font-family: "GalmuriMono9", monospace !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 1px !important;
    font-synthesis: weight;
    text-shadow: none;
}

#gameContainer .menu button:not(.devTools button):not(:disabled) {
    color: var(--ui-text-main) !important;
}

#gameContainer #missionClearMenu #clearReplayButton,
#gameContainer #missionClearMenu #clearMenuButton {
    font-size: 16px !important;
}

:root {
    --arcade-black: #02040a;
    --arcade-navy: #071329;
    --arcade-blue: #087ee8;
    --arcade-cyan: #25e7ff;
    --arcade-red: #e63b44;
    --arcade-orange: #ff9d28;
    --arcade-white: #eafcff;
    --ui-text-main: #4e3c95;
    --ui-text-secondary: #856cad;
    --ui-text-light: #fff7df;
    --ui-button-outline: #1f043f;
    --ui-button-edge: #5340b8;
}

body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #000;
    color: #ffffff;
    font-family: "NeoDunggeunmo", monospace;
    font-weight: 400;
    image-rendering: pixelated;
}

body.cursorIdle,
body.cursorIdle * {
    cursor: none !important;
}

#gameContainer {
    position: relative;
    flex: 0 0 auto;
    width: 360px;
    height: 640px;
    -webkit-user-select: none;
    user-select: none;
    container-type: inline-size;
    background: var(--arcade-black);
    border: 0;
    outline: 0;
}

#gameContainer input {
    -webkit-user-select: text;
    user-select: text;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.catalogSaveButton {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 130;
    min-width: 72px;
    height: 28px;
    padding: 0 9px;
    border: 2px solid #4b2169;
    border-radius: 5px;
    background: #fff4d9;
    color: #4b2169;
    font: 11px "NeoDunggeunmo", monospace;
    box-shadow: 0 2px 0 #d99ac2;
    cursor: pointer;
}

.catalogSaveButton:active {
    bottom: 7px;
    box-shadow: 0 1px 0 #d99ac2;
}

.menu {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 14px;
    overflow: visible;
    color: var(--arcade-white);
    text-align: center;
    background: rgba(1, 4, 12, 0.42);
    border: 0;
    outline: 0;
}

.menu::before,
.menu::after {
    display: none;
}

.hidden {
    display: none;
}

h1,
h2 {
    color: var(--arcade-white);
    line-height: 1.15;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #4e3c95;
}

.systemText {
    color: #ffffff;
    font-family: "Press Start 2P", monospace;
    font-weight: 400;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #4e3c95;
}

span.systemText {
    font-size: inherit;
    letter-spacing: 1px;
}

h1 {
    max-width: 340px;
    margin-bottom: 56px;
    font-size: 44px;
    letter-spacing: 1px;
}

.titleImage {
    display: block;
    width: 96cqw;
    max-width: none;
    height: auto;
    margin-bottom: 11.111cqw;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#mainMenu {
    justify-content: flex-start;
    gap: 5px;
    padding: 418px 14px 18px;
    background: transparent;
}

.menuCat {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 360px;
    height: 640px;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#mainMenu > button:not(.devToggleButton) {
    z-index: 2;
    width: 226px;
    min-height: 49px;
    height: 49px;
    margin: 0;
    padding: 0 42px;
    border: 0;
    border-radius: 0;
    clip-path: none;
    background: var(--menu-button-image) center / 226px 49px no-repeat;
    box-shadow: none;
    color: var(--ui-text-main);
    font: 400 19px/1.2 "NeoDunggeunmo", monospace;
    font-weight: 700 !important;
    letter-spacing: 1px;
    text-shadow: none;
    filter: none;
    transition: transform 80ms steps(2, end), filter 100ms steps(2, end);
}

#playButton {
    --menu-button-image: url("images/Main Menu/button_start.png?v=20261010-014031");
}

#gameContainer #mainMenu > #playButton,
#gameContainer #mainMenu > #guideButton,
#gameContainer #mainMenu > #rankingButton {
    font-weight: 700 !important;
}

#guideButton {
    --menu-button-image: url("images/Main Menu/button_start.png?v=20261010-014031");
}

#rankingButton {
    --menu-button-image: url("images/Main Menu/button_start.png?v=20261010-014031");
}

#mainMenu > button:not(.devToggleButton)::before {
    content: none;
}

#mainMenu > button:not(.devToggleButton)::after {
    content: none;
}

#mainMenu > button:not(.devToggleButton):hover,
#mainMenu > button:not(.devToggleButton):focus-visible,
#mainMenu > button.keyboardSelected {
    background: var(--menu-button-image) center / 226px 49px no-repeat;
    color: var(--ui-text-main);
    box-shadow: none;
    filter: none;
    transform: translateY(-1px);
}

#mainMenu > button:not(.devToggleButton):hover::after,
#mainMenu > button:not(.devToggleButton):focus-visible::after,
#mainMenu > button.keyboardSelected::after,
#mainMenu > button:not(.devToggleButton):hover::before,
#mainMenu > button:not(.devToggleButton):focus-visible::before,
#mainMenu > button.keyboardSelected::before {
    filter: brightness(1.12);
}

#mainMenu > button:not(.devToggleButton):active {
    transform: translateY(1px);
    box-shadow: none;
}

h2 {
    margin-bottom: 34px;
    font-size: 32px;
    letter-spacing: 2px;
}

button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55.25%;
    min-height: 54.4px;
    margin: 5.95px;
    padding: 8.5px 15.3px;
    border: 2px solid #1766a0;
    border-radius: 0;
    outline: 0;
    background: rgba(3, 12, 28, 0.9);
    box-shadow: none;
    color: #ffffff;
    font: 400 19.4px/1.2 "NeoDunggeunmo", monospace;
    letter-spacing: 1.7px;
    text-align: center;
    cursor: pointer;
}

button:hover,
button:focus-visible {
    border-color: var(--arcade-cyan);
    background: #061a2e;
    color: #ffffff;
    box-shadow: none;
}

button::before {
    content: "";
    position: absolute;
    left: 10px;
    color: var(--arcade-cyan);
}

button:hover::before,
button:focus-visible::before {
    content: ">";
}

.devTools {
    position: absolute;
    z-index: 20;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.devTestMenu {
    position: absolute;
    z-index: 21;
    right: 0;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.devTools.hidden,
.devTestMenu.hidden {
    display: none;
}

#gameContainer .devTools button {
    width: auto;
    min-width: 64px;
    min-height: 24px;
    margin: 2px 0;
    padding: 4px 7px;
    border-width: 1px;
    color: #9aa8b8;
    font-family: "Press Start 2P", monospace !important;
    font-size: 9px;
    font-weight: 400 !important;
    line-height: 1.2;
    letter-spacing: 0;
}

#gameContainer .devTools .devTestMenu button {
    box-sizing: border-box;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    margin: 2px 0;
    padding: 0 7px;
}

.devTools button::before {
    left: 3px;
}

.debugStats {
    position: absolute;
    left: 6px;
    bottom: 68px;
    z-index: 110;
    width: calc(100% - 12px);
    box-sizing: border-box;
    margin: 0;
    padding: 7px 8px;
    border: 1px solid #1766a0;
    background: rgba(2, 8, 20, 0.88);
    color: #eafcff;
    font: 400 10px/1.35 "NeoDunggeunmo", monospace;
    text-align: left;
    white-space: pre-wrap;
    pointer-events: none;
}

.debugStats.hidden {
    display: none;
}

button:active {
    transform: none;
    background: #0a3155;
}

button:disabled {
    cursor: default;
    opacity: 0.55;
}

#guideMenu,
#rankingMenu {
    background: rgba(42, 31, 78, 0.58);
}

#pauseMenu {
    background: rgba(1, 4, 12, 0.32);
}

.pausePanel {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ui-text-light);
    transform: translateY(-16px);
}

.pausePanel h2,
#gameContainer #gameOverMenu > h2,
#gameContainer #missionClearMenu .clearHeader h2 {
    font-family: "Press Start 2P", monospace;
    font-weight: 400;
    color: var(--ui-text-light);
    font-size: 32px;
    letter-spacing: 2px;
    text-shadow:
        -1px -1px 0 #4e3c95, 1px -1px 0 #4e3c95,
        -1px 1px 0 #4e3c95, 1px 1px 0 #4e3c95,
        -2px -2px 0 #4e3c95, 0 -2px 0 #4e3c95, 2px -2px 0 #4e3c95,
        -2px 0 0 #4e3c95, 2px 0 0 #4e3c95,
        -2px 2px 0 #4e3c95, 0 2px 0 #4e3c95, 2px 2px 0 #4e3c95,
        0 4px 0 #4e3c95;
}

.pausePanel h2 {
    margin: 0 0 16px;
    color: var(--ui-text-light);
    font-size: 32px;
    text-shadow:
        -1px -1px 0 #4e3c95, 1px -1px 0 #4e3c95,
        -1px 1px 0 #4e3c95, 1px 1px 0 #4e3c95,
        -2px -2px 0 #4e3c95, 0 -2px 0 #4e3c95, 2px -2px 0 #4e3c95,
        -2px 0 0 #4e3c95, 2px 0 0 #4e3c95,
        -2px 2px 0 #4e3c95, 0 2px 0 #4e3c95, 2px 2px 0 #4e3c95,
        0 4px 0 #4e3c95;
}

.guideText {
    width: 88%;
    max-width: 316px;
    margin-bottom: 15px;
    padding: 20px 18px 18px;
    border: 2px solid #68558f;
    border-radius: 4px;
    clip-path: none;
    background: rgba(250, 246, 255, 0.96);
    box-shadow: none;
    color: var(--ui-text-main);
    font-size: 14px;
    font-weight: 400;
    font-synthesis: none;
    line-height: 1.75;
    text-align: left;
}

.guideText h2 {
    margin-bottom: 6px;
    color: var(--ui-text-main);
    font-family: "NeoDunggeunmo", monospace;
    font-weight: 400;
    font-size: 28px;
    text-align: center;
    text-shadow: none;
}

.guideText h3 {
    margin: 12px 0 0;
    color: var(--ui-text-secondary);
    font-family: "NeoDunggeunmo", monospace;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.45;
    text-align: center;
}

.guideText p {
    font-family: "NeoDunggeunmo", monospace;
    font-weight: 600;
    font-synthesis: weight;
}

.guideText p::before {
    content: none;
    display: none;
}

.guideText .guideDamageNote {
    margin-top: 5px;
    color: var(--ui-text-secondary);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}
.guideText .guideDamageNote::before { display: none; }
.guideText .guideFraction { font-family: Arial, sans-serif; }

#backButton,
#rankingBackButton,
#resumeButton,
#menuButton {
    width: 226px;
    min-height: 49px;
    height: 49px;
    margin: 5px 0;
    padding: 0 42px;
    border: 0;
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 226px 49px no-repeat;
    box-shadow: none;
    color: var(--ui-text-main);
    font: 400 19px/1.2 "NeoDunggeunmo", monospace;
    letter-spacing: 1px;
}

/* Align each back button with the main-menu button that opened its screen. */
#backButton {
    position: absolute;
    top: 472px;
    left: 67px;
    margin: 0;
}

#rankingBackButton {
    position: absolute;
    top: 526px;
    left: 67px;
    margin: 0;
}

#resumeButton,
#menuButton {
    filter: none;
}

#backButton::before,
#rankingBackButton::before,
#resumeButton::before,
#menuButton::before {
    content: none;
}

#backButton:hover,
#backButton:focus-visible,
#rankingBackButton:hover,
#rankingBackButton:focus-visible,
#resumeButton:hover,
#resumeButton:focus-visible,
#resumeButton.keyboardSelected,
#menuButton:hover,
#menuButton:focus-visible,
#menuButton.keyboardSelected {
    border: 0;
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 226px 49px no-repeat;
    color: var(--ui-text-main);
    filter: none;
    transform: translateY(-1px);
}

#mainMenu > button.keyboardSelected,
#backButton.keyboardSelected,
#rankingBackButton.keyboardSelected,
#resumeButton.keyboardSelected,
#menuButton.keyboardSelected,
#gameOverMenu button.keyboardSelected,
#missionClearMenu button.keyboardSelected {
    filter: brightness(1.1) saturate(1.03);
}

#mainMenu > button.keyboardSelected::before,
#mainMenu > button.keyboardSelected::after,
#backButton.keyboardSelected::before,
#backButton.keyboardSelected::after,
#rankingBackButton.keyboardSelected::before,
#rankingBackButton.keyboardSelected::after,
#resumeButton.keyboardSelected::before,
#resumeButton.keyboardSelected::after,
#menuButton.keyboardSelected::before,
#menuButton.keyboardSelected::after,
#gameOverMenu button.keyboardSelected::before,
#gameOverMenu button.keyboardSelected::after,
#missionClearMenu button.keyboardSelected::before,
#missionClearMenu button.keyboardSelected::after {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: block;
    width: 16px;
    height: 18px;
    background: none;
    color: var(--ui-text-main);
    font: 400 18px/18px "NeoDunggeunmo", monospace;
    text-shadow: none;
    image-rendering: auto;
    pointer-events: none;
    animation: keyboardArrowCursor 650ms steps(2, end) infinite alternate;
}

#mainMenu > button.keyboardSelected::before,
#backButton.keyboardSelected::before,
#rankingBackButton.keyboardSelected::before,
#resumeButton.keyboardSelected::before,
#menuButton.keyboardSelected::before,
#gameOverMenu button.keyboardSelected::before,
#missionClearMenu button.keyboardSelected::before {
    content: ">";
    position: absolute;
    left: 17px;
    transform: translateY(-50%);
}

#mainMenu > button.keyboardSelected::after,
#backButton.keyboardSelected::after,
#rankingBackButton.keyboardSelected::after,
#resumeButton.keyboardSelected::after,
#menuButton.keyboardSelected::after,
#gameOverMenu button.keyboardSelected::after,
#missionClearMenu button.keyboardSelected::after {
    content: "<";
    right: 17px;
    transform: translateY(-50%);
}

#mainMenu > button.keyboardPressed,
#resumeButton.keyboardPressed,
#menuButton.keyboardPressed,
#gameOverMenu button.keyboardPressed,
#missionClearMenu button.keyboardPressed {
    transform: translateY(1px);
    filter: brightness(0.98);
}

.keyboardMenuHint {
    position: absolute;
    bottom: 13px;
    left: 50%;
    z-index: 3;
    display: grid;
    grid-template-columns: 52px 34px;
    gap: 3px 10px;
    width: 96px;
    color: #ffffff;
    font: 400 11px/1.15 "NeoDunggeunmo", monospace;
    letter-spacing: 0.2px;
    text-shadow: none;
    transform: translateX(-50%);
}

.keyboardMenuHint span:nth-child(odd) {
    text-align: right;
}

.keyboardMenuHint span {
    text-shadow:
        -1px 0 0 #4e3c95,
        1px 0 0 #4e3c95,
        0 -1px 0 #4e3c95,
        0 1px 0 #4e3c95,
        0 0 4px rgba(78, 60, 149, 0.65);
}

.keyboardMenuHint span:nth-child(even) {
    text-align: left;
}

.keyboardMenuHint span:first-child {
    color: #ffffff;
    -webkit-text-stroke: 0.4px #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 12px;
}

.pauseKeyboardHint {
    position: static;
    margin-top: 13px;
    transform: none;
}

@keyframes keyboardArrowCursor {
    from { margin-left: 0; margin-right: 0; }
    to { margin-left: 2px; margin-right: 2px; }
}

#backButton:active,
#rankingBackButton:active,
#resumeButton:active,
#menuButton:active {
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 226px 49px no-repeat;
    transform: translateY(1px);
}

#countdown {
    background: rgba(1, 4, 12, 0.32);
}

#countdown.openingMode {
    background: rgba(16, 20, 66, 0.08);
}

.openingScene {
    position: absolute;
    inset: 0;
    width: 360px;
    height: 640px;
    font-family: "NeoDunggeunmoPixel", monospace;
}

.openingCat {
    position: absolute;
    top: 210px;
    left: 88px;
    width: 184px;
    height: 200px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    animation: openingCatFloat 2.4s steps(4, end) infinite;
}

.openingDialogueBox {
    position: absolute;
    left: 19px;
    bottom: 56px;
    box-sizing: border-box;
    width: 322px;
    height: 92px;
    padding: 0;
    border: 0;
    background: none;
    border-image: url("images/ui/opening_dialogue_box.png") 12 12 18 12 fill / 12px 12px 18px 12px / 0 stretch;
    color: var(--ui-text-main);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.openingSpeakerNameplate {
    position: absolute;
    left: 5px;
    top: -15px;
    width: 84px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: url("images/ui/opening_cat_name.png") 0 0 no-repeat;
    color: #ffffff;
    font: 400 12px/1 "NeoDunggeunmoPixel", monospace;
    -webkit-text-stroke: 0;
    text-shadow: none;
    image-rendering: pixelated;
    pointer-events: none;
}

.openingSpeakerNameplate > span {
    position: absolute;
    top: 0;
    right: 2px;
    bottom: 1px;
    left: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-4px, 2px);
    white-space: nowrap;
}

#openingScene .openingSpeakerNameplate > span,
#endingCatDialogue .openingSpeakerNameplate > span {
    transform: translate(-4px, 0);
}

.openingDialogueText {
    position: absolute;
    top: 22px;
    right: 23px;
    left: 23px;
    display: block;
    height: auto;
    min-height: 0;
    margin: 0;
    font: 400 15px/1.45 "NeoDunggeunmoPixel", monospace;
    -webkit-text-stroke: 0;
    text-align: left;
    word-break: keep-all;
}

#openingScene .openingDialogueHint,
#endingCatDialogue .openingDialogueHint {
    bottom: 13px;
}

#openingScene .openingDialogueHint kbd,
#endingCatDialogue .openingDialogueHint kbd,
.controlsIntroHint kbd {
    display: inline-block;
    padding: 0 3px;
    border-radius: 3px;
    background: #ead9f9;
    color: inherit;
    font: inherit;
}

.openingDialogueHint {
    position: absolute;
    right: 14px;
    bottom: 11px;
    left: auto;
    margin: 0;
    color: var(--ui-text-secondary);
    font: 400 10px/1.2 "NeoDunggeunmoPixel", "NeoDunggeunmo", monospace;
    text-align: right;
    white-space: nowrap;
}

@keyframes openingCatFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.stageIntroCopy {
    position: absolute;
    top: calc(50% - 18px);
    left: 14px;
    right: 14px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#countText {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    color: #ffffff;
    font-size: 42px;
    letter-spacing: 0;
    text-align: center;
    text-shadow: none;
}

#countText.startText {
    font-size: 35px;
}

#countText.stageText {
    font-size: 32px;
    line-height: 40px;
    color: var(--ui-text-light);
    word-spacing: -14px;
}

.controlsIntroPanel {
    position: absolute;
    inset: 0;
    width: 360px;
    max-width: none;
    height: 640px;
    padding: 0;
    border: 0;
    background: url("images/ui/controls_panel.png?v=20261103-esc") 0 0 / 360px 640px no-repeat;
    color: var(--ui-text-main);
    font-family: "NeoDunggeunmo", monospace;
    text-align: left;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.controlsIntroPanel h2 {
    position: absolute;
    top: 185px;
    left: 0;
    width: 360px;
    margin: 0;
    color: var(--ui-text-main);
    font: 400 20px/1.2 "NeoDunggeunmo", monospace;
    letter-spacing: 0;
    word-spacing: -4px;
    text-align: center;
    text-shadow: none;
}

.controlsIntroRows {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
}

.controlsIntroRows p {
    position: absolute;
    left: 172px;
    width: 150px;
    margin: 0;
    font: 400 14px/1 "NeoDunggeunmo", monospace;
    text-align: left;
}

.controlsIntroRows p:nth-child(1) {
    top: 250px;
}

.controlsIntroRows p:nth-child(2) {
    top: 309px;
}

.controlsIntroRows p:nth-child(3) {
    top: 362px;
}

.controlsIntroRows span,
.controlsIntroRows small {
    display: block;
}

.controlsIntroRows span {
    color: var(--ui-text-main);
}

.controlsIntroRows small {
    margin-top: 6px;
    color: var(--ui-text-secondary);
    font: 400 11px/1.3 "NeoDunggeunmo", monospace;
}

.controlsIntroHint,
#countdown > .introSkipHint {
    position: absolute;
    top: 403px;
    left: 0;
    width: 360px;
    margin: 0;
    color: var(--ui-text-secondary);
    font: 600 10px/1.2 "NeoDunggeunmo", monospace;
    letter-spacing: 0;
    text-align: center;
}

.controlsIntroPanel h2,
.controlsIntroRows p,
.controlsIntroRows small,
.controlsIntroHint {
    font-weight: 600;
}

.controlsIntroHint {
    top: 404px;
}

.stageStoryText {
    width: 92%;
    min-height: 24px;
    margin: 14px 0 0;
    color: #ffffff;
    font: 400 16px/1.5 "NeoDunggeunmo", monospace;
    letter-spacing: 0;
    text-align: center;
    white-space: pre-line;
}

.stageStoryText.stage2Story {
    color: #ffffff;
}

.stageStoryText:empty {
    display: none;
}

.introSkipHint {
    width: 100%;
    margin: 22px 0 0;
    color: #fff7df;
    font: 400 12px/1.2 "NeoDunggeunmo", monospace;
    text-shadow: 1px 1px 0 #4e3c95;
    letter-spacing: 0;
    text-align: center;
}

#countdown #countText.stageText,
#countdown #countText.startText,
#countdown .stageStoryText,
#countdown .introSkipHint {
    text-shadow: 1px 1px 0 #4e3c95;
}

#countdown .stageStoryText {
    text-shadow: 2px 2px 0 #4e3c95;
}

.introSkipHint kbd {
    display: inline-block;
    padding: 0 3px;
    border-radius: 3px;
    background: #ead9f9;
    color: var(--ui-text-main);
    font: inherit;
    text-shadow: none;
}

.stageClearBanner {
    position: absolute;
    inset: 0;
    z-index: 105;
    padding: 0;
    background: rgba(1, 4, 12, 0.32);
    transition: background-color 1s ease-in;
    text-align: center;
    pointer-events: none;
}
.stageClearBanner:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}
.stageClearBanner h2 {
    margin: 0;
    color: var(--ui-text-light);
    font-size: 32px;
    line-height: 40px;
    word-spacing: normal;
    text-shadow: 2px 2px 0 #4e3c95;
    transition: opacity 0.3s ease;
}

.stageClearBanner.clearToIntro { background: transparent; }
.stageClearBanner.clearToIntro h2 { opacity: 0; }
.stageClearBanner.endingFade { background-color: #000; }
.stageClearBanner.endingFade h2 { opacity: 0; transition-duration: 0.5s; }
#countdown.stageIntroReveal .stageIntroCopy {
    animation: stageIntroReveal 0.3s ease both;
}
@keyframes stageIntroReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.endingScreen {
    position: absolute;
    inset: 0;
    z-index: 120;
    overflow: hidden;
    background: #000;
    color: var(--arcade-white);
    font-family: "NeoDunggeunmo", monospace;
    transition: background-color 0.38s ease-out;
}

.endingScreen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(22, 17, 69, 0.08) 0%, rgba(22, 17, 69, 0.02) 58%, rgba(22, 17, 69, 0.12) 100%);
}

.endingScreen.clearTitleMode {
    background-color: #020812;
}

.endingScreen.dreamDialogueMode::before {
    background: #000;
    opacity: 1;
    transition: opacity 1.2s ease;
}

.endingCat {
    position: absolute;
    top: 210px;
    left: 88px;
    z-index: 1;
    width: 184px;
    height: 200px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    opacity: 1;
    transition: opacity 0.75s ease-out;
}
.endingScreen.endingIntro .endingCat,
.endingScreen.endingIntro .endingCatDialogue { opacity: 0; }

.endingCatDialogue {
    z-index: 2;
    transition: opacity 0.75s ease-out;
}
.endingScreen.isFading .endingCat,
.endingScreen.isFading .endingCatDialogue { opacity: 0; }

.endingScreen.isFading .endingClearTitle,
.endingScreen.isFading .endingText,
.endingScreen.isFading .endingPrototypeImage,
.endingScreen.isFading .endingThankYou {
    opacity: 0;
}

.endingScreen.thankYouFade .endingThankYou {
    transition-duration: 1.2s;
    transition-timing-function: ease-out;
}

.endingScreen::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
}

.endingScreen.thankYouFade::after { opacity: 1; }

.endingClearTitle {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 152px;
    opacity: 1;
    transition: opacity 0.38s steps(6, end);
}

.endingClearTitle p {
    margin: 0;
    color: #fff0b7;
    font-size: 28px;
    line-height: 1.5;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 3px 0 #4e3c95, 2px 0 0 #4e3c95, -2px 0 0 #4e3c95;
}

.endingNote {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 120px 30px 82px;
    opacity: 1;
    transition: opacity 0.38s steps(6, end);
}

.endingText {
    width: 100%;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.38s steps(6, end);
    color: #ffffff;
    font: 400 16px/1.7 "NeoDunggeunmo", monospace;
    text-align: left;
    white-space: pre-wrap;
    word-break: keep-all;
}

.endingPrototypeImage {
    display: block;
    align-self: center;
    width: auto;
    height: 220px;
    max-width: 100%;
    margin: 24px auto;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.38s steps(6, end);
}
.endingPrototypeImage.hidden { display: none; }
.endingPrototypeImage { opacity: 0; transition: opacity 0.35s ease; }
.endingPrototypeImage.prototypeVisible { opacity: 1; }
.endingNote.prototypePage { padding-top: 70px; }
.endingNote.prototypePage .endingPrototypeImage { height: 160px; }

.endingNote.reflective {
    padding-right: 36px;
    padding-left: 36px;
}

.endingNote.reflective .endingText {
    font-size: 16px;
    line-height: 1.7;
}

.endingQuestion {
    display: block;
    width: 208px;
    margin: 1.7em auto 0;
    color: #ffffff;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

.endingQuestionBody {
    display: block;
    margin-top: 1.7em;
    color: #ffffff;
    font-weight: 400;
    text-align: left;
    white-space: pre-wrap;
}

.endingControls {
    position: absolute;
    right: 18px;
    bottom: 18px;
    left: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font: 400 12px/1.2 "NeoDunggeunmoPixel", "NeoDunggeunmo", monospace;
    letter-spacing: 0;
}

.endingNextHint {
    color: #ffffff;
    animation: none;
}

/* Reserve the next hint's space while typing so Skip never shifts sideways. */
.endingControls .endingNextHint.hidden {
    display: inline;
    visibility: hidden;
}

@keyframes endingHintBlink {
    50% { opacity: 0.35; }
}

.endingThankYou {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 1;
    transition: opacity 0.75s ease-in;
}

.endingThankYou p {
    margin: 0;
    padding: 0;
    background: none;
    color: var(--ui-text-light);
    font: 400 20px/1.6 "Press Start 2P", monospace;
    letter-spacing: 0;
    text-shadow: 0 2px 0 #1f043f;
}

.endingChoice {
    position: absolute;
    top: 270px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 248px;
}
.endingChoice.hidden { display: none; }
.resultsTransitionCurtain {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: #000;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: auto;
}
.endingScreen.authorNotesMode {
    background: #000;
    background-image: none !important;
}
.endingScreen.authorNotesMode::before {
    background: none;
}
#endingScreen .endingChoice button {
    width: 248px;
    height: 49px;
    min-height: 49px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-image: none;
    background: none;
    color: #ffffff;
    font: 400 16px/20px "NeoDunggeunmo", monospace;
    font-weight: 400 !important;
    letter-spacing: 0;
    box-shadow: none;
    image-rendering: pixelated;
}
#endingScreen .endingChoice button:hover,
#endingScreen .endingChoice button:focus {
    background: none;
    color: #ffffff;
    filter: none;
    outline: none;
    box-shadow: none;
    transform: none;
}
#endingScreen .endingChoice button::before { content: none; }
#endingScreen .endingChoice button::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 50%;
    width: 12px;
    height: 12px;
    transform: translateY(-50%);
    background: #ffffff;
    clip-path: polygon(0 0, 29% 0, 29% 14%, 57% 14%, 57% 29%, 86% 29%, 86% 43%, 100% 43%, 100% 57%, 86% 57%, 86% 71%, 57% 71%, 57% 86%, 29% 86%, 29% 100%, 0 100%);
    opacity: 0;
    pointer-events: none;
}
#endingScreen .endingChoice button:focus::after { opacity: 1; }

.endingClearTitle.hidden,
.endingNote.hidden,
.endingThankYou.hidden {
    display: none;
}

#gameOverMenu > h2,
#gameOverMenu > .continueHint,
#gameOverMenu > button {
    translate: 0 -30px;
}

#gameOverMenu > .continueHint,
#gameOverMenu > button {
    translate: 0 -20px;
}

#gameOverMenu h2 {
    position: relative;
    top: 43px;
    color: var(--ui-text-light);
}

#gameOverMenu .continueHint {
    position: relative;
    top: 0;
    margin: 12px 0 10px;
    color: #ffffff;
    font: 400 12px/1.5 "NeoDunggeunmoPixel", monospace;
    text-shadow: 1px 1px 0 #1f043f;
    word-break: keep-all;
}

#gameOverMenu button,
#missionClearMenu button {
    width: 226px;
    min-width: 226px;
    min-height: 49px;
    height: 49px;
    margin: 5px 0;
    padding: 0 42px;
    border: 0;
    border-radius: 0;
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 226px 49px no-repeat;
    box-shadow: none;
    color: var(--ui-text-main);
    font: 400 17px/1.2 "NeoDunggeunmo", monospace;
    letter-spacing: 1px;
    filter: none;
}

#gameOverMenu button:hover,
#gameOverMenu button:focus-visible,
#missionClearMenu button:hover,
#missionClearMenu button:focus-visible {
    border: 0;
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 226px 49px no-repeat;
    color: var(--ui-text-main);
}

#gameOverMenu button::before,
#missionClearMenu button::before {
    content: none;
}

#missionClearMenu h2 {
    margin: 0;
    color: var(--ui-text-light);
    font-size: 27px;
    line-height: 1.45;
    letter-spacing: 1px;
    text-shadow: 3px 3px 0 #4e3c95;
}

#missionClearMenu {
    justify-content: flex-start;
    padding: 96px 10px 16px;
    background: rgba(42, 31, 78, 0.22);
}

.clearHeader {
    margin-bottom: 28px;
    text-align: center;
}

.clearCard {
    position: relative;
    width: 300px;
    padding: 18px 16px 16px;
    border: 2px solid #6650ad;
    border-radius: 13px;
    background: rgba(255, 248, 233, 0.98);
    box-shadow: 0 5px 0 #9f89cf, inset 0 0 0 2px #eadff7;
}

.clearCard::before,
.clearCard::after {
    position: absolute;
    top: -13px;
    color: #fff0a8;
    font: 400 25px/1 "NeoDunggeunmo", monospace;
    text-shadow: 2px 2px 0 #4e3c95;
    content: "★";
}

.clearCard::before {
    left: -9px;
}

.clearCard::after {
    right: -9px;
}

.clearScore {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 88px;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 2px dashed #d8cbea;
}

.clearScore span {
    margin-bottom: 8px;
    color: var(--ui-text-main);
    font-size: 12px;
    letter-spacing: 1px;
    text-shadow: none;
}

.clearScore strong {
    color: #fff0a8;
    font: 400 32px/1 "Press Start 2P", monospace;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 #4e3c95;
}

#rankingMenu h2 {
    margin-bottom: 16px;
    color: var(--ui-text-light);
    font-size: 24px;
    text-shadow: 2px 2px 0 #4e3c95;
    transform: translateY(-25px);
}

.rankingPanel {
    position: relative;
    width: 88%;
    height: 420px;
    margin-bottom: 12px;
    border: 2px solid #68558f;
    border-radius: 4px;
    clip-path: none;
    background: rgba(250, 246, 255, 0.96);
    box-shadow: none;
    color: var(--ui-text-main);
    font-family: "NeoDunggeunmo", monospace;
    overflow: hidden;
    transform: translateY(-25px);
}

.rankingHeader,
.rankingRow {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 68px 50px;
    align-items: center;
    min-height: 30px;
    padding: 0 4px;
    column-gap: 7px;
}

.rankingHeader {
    border-bottom: 2px solid #b9a4d6;
    background: #e8ddf5;
    color: #554176;
    font-size: 13px;
}

.rankingList {
    height: 366px;
    overflow-y: auto;
    scrollbar-color: #8e75b5 #eee6f7;
    scrollbar-width: thin;
}

.rankingRow {
    border-bottom: 1px solid #d8cbea;
    font-size: 14px;
}

.rankingRow:nth-child(even) {
    background: rgba(232, 221, 245, 0.5);
}

.rankingRow span:first-child,
.rankingHeader span:first-child {
    padding-left: 0;
    text-align: center;
}

.rankingRow span:nth-child(2) {
    padding-left: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.rankingHeader span:nth-child(2) {
    padding-left: 15px;
    text-align: left;
}

.rankingRow span:nth-child(3),
.rankingHeader span:nth-child(3) {
    text-align: right;
}

.rankingRow span:nth-child(4),
.rankingHeader span:nth-child(4) {
    text-align: center;
}

.rankingStatus {
    min-height: 18px;
    margin: 5px 8px 0;
    color: #68558f;
    font: 400 13px/1.3 "NeoDunggeunmo", monospace;
    text-align: center;
}

#rankingLoadStatus.empty {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    margin: 0;
    transform: translateY(-50%);
}

.rankingRegister {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.rankingRegister::before,
.rankingRegister::after {
    position: absolute;
    top: -1px;
    color: #f19ac2;
    font: 400 13px/1 "NeoDunggeunmo", monospace;
    content: "✦";
}

.rankingRegister::before {
    left: 20px;
}

.rankingRegister::after {
    right: 20px;
}

.rankingRegister label {
    display: block;
    margin-bottom: 10px;
    color: var(--ui-text-main);
    font: 400 16px/1 "NeoDunggeunmo", monospace;
    text-align: center;
}

.rankingRegister input {
    width: 100%;
    height: 43px;
    padding: 7px 9px;
    border: 1px solid #8e75b5;
    border-radius: 4px;
    outline: 0;
    background: #f2eaff;
    color: var(--ui-text-main);
    font: 400 16px/1 "NeoDunggeunmo", monospace;
    text-align: center;
}

.rankingRegister input:focus {
    border-color: #f19ac2;
}

.rankingRegister input.keyboardSelected {
    border-color: #f19ac2;
    box-shadow: 0 0 0 2px #d8cbea;
}

.rankingRegister input::placeholder {
    color: var(--ui-text-secondary);
    opacity: 1;
}

.rankingRegister button {
    width: 190px;
    min-width: 190px;
    min-height: 41px;
    height: 41px;
    margin: 9px auto 0;
    padding: 0 34px;
    background-size: 190px 41px;
    font-size: 15px;
}

.rankingRegister button.registered:disabled {
    border: 0;
    background: url("images/Main Menu/button_start.png?v=20261010-014031") center / 190px 41px no-repeat;
    color: var(--ui-text-main);
    filter: brightness(0.76) saturate(0.75);
    opacity: 1;
}

.rankingRegister .rankingStatus {
    margin: 4px 0 0;
}

.rankingRegister .rankingStatus:empty {
    min-height: 0;
    margin: 0;
}

.clearActions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 22px;
    gap: 8px;
}

.clearActions button {
    width: 138px;
    min-width: 138px;
    min-height: 44px;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    background-size: 138px 44px;
    font-size: 15px;
}

#clearMenuButton {
    word-spacing: -4px;
}

/* Keep every player-facing menu button on the same arcade interaction rhythm. */
#mainMenu > button:not(.devToggleButton):not(:disabled):hover,
#mainMenu > button:not(.devToggleButton):not(:disabled):focus-visible,
#mainMenu > button:not(.devToggleButton).keyboardSelected,
#backButton:not(:disabled):hover,
#backButton:not(:disabled):focus-visible,
#backButton.keyboardSelected,
#rankingBackButton:not(:disabled):hover,
#rankingBackButton:not(:disabled):focus-visible,
#rankingBackButton.keyboardSelected,
#resumeButton:not(:disabled):hover,
#resumeButton:not(:disabled):focus-visible,
#resumeButton.keyboardSelected,
#menuButton:not(:disabled):hover,
#menuButton:not(:disabled):focus-visible,
#menuButton.keyboardSelected,
#gameOverMenu button:not(:disabled):hover,
#gameOverMenu button:not(:disabled):focus-visible,
#gameOverMenu button.keyboardSelected,
#missionClearMenu button:not(:disabled):hover,
#missionClearMenu button:not(:disabled):focus-visible,
#missionClearMenu button.keyboardSelected {
    color: var(--ui-text-main);
    border-radius: 0;
    outline: none;
    box-shadow: none;
    filter: brightness(1.12);
    transform: translateY(-1px);
    z-index: 3;
    overflow: visible;
}

#mainMenu > button:not(.devToggleButton):not(:disabled):active,
#mainMenu > button:not(.devToggleButton).keyboardPressed,
#backButton:not(:disabled):active,
#backButton.keyboardPressed,
#rankingBackButton:not(:disabled):active,
#rankingBackButton.keyboardPressed,
#resumeButton:not(:disabled):active,
#resumeButton.keyboardPressed,
#menuButton:not(:disabled):active,
#menuButton.keyboardPressed,
#gameOverMenu button:not(:disabled):active,
#gameOverMenu button.keyboardPressed,
#missionClearMenu button:not(:disabled):active,
#missionClearMenu button.keyboardPressed {
    filter: brightness(0.98);
    transform: translateY(1px);
}

/* Final score screen: cream card and lavender arcade controls. */
#missionClearMenu {
    padding: 118px 20px 16px;
    background: rgba(26, 14, 62, 0.08);
    gap: 0;
}
#missionClearMenu .clearHeader { margin: 0 0 25px; }
#missionClearMenu .clearHeader h2 {
    color: var(--ui-text-light);
    font-size: 30px;
    line-height: 1.22;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #4e3c95;
}
#missionClearMenu .clearCard {
    width: 288px;
    padding: 17px 19px 20px;
    border: 2px solid #ab85df;
    border-radius: 0;
    background: #fff7e9;
    box-shadow: 0 0 0 2px #6650ad, 0 5px 0 2px #4e398e, inset 0 0 0 1px #fffdf7;
}
#missionClearMenu .clearCard::before,
#missionClearMenu .clearCard::after,
#missionClearMenu .rankingRegister::before,
#missionClearMenu .rankingRegister::after { content: none; }
#missionClearMenu .clearScore {
    min-height: 0;
    margin: 0 0 14px;
    padding: 0 0 20px;
    border-bottom: 1px solid #b68cde;
}
#missionClearMenu .clearScore span {
    margin: 0 0 10px;
    color: var(--ui-text-main);
    font-size: 12px;
    letter-spacing: 0;
}
#missionClearMenu .clearScore strong {
    max-width: 100%;
    color: var(--ui-text-main);
    font-size: 36px;
    line-height: 1.1;
    letter-spacing: -1px;
    text-shadow: 3px 4px 0 #d3b8ee;
}
#missionClearMenu .rankingRegister label {
    margin: 0 0 9px;
    color: var(--ui-text-main);
    font-size: 17px;
    line-height: 1.2;
}
#missionClearMenu .rankingRegister input {
    height: 36px;
    border: 2px solid #b78bdd;
    border-radius: 0;
    background: #efe3fc;
    color: var(--ui-text-main);
    font-size: 15px;
}
#missionClearMenu .rankingRegister input::placeholder { color: var(--ui-text-secondary); }
#missionClearMenu .rankingRegister input:focus,
#missionClearMenu .rankingRegister input.keyboardSelected {
    border-color: #b78bdd;
    box-shadow: none;
}
#missionClearMenu button {
    border: 1px solid #49309e;
    border-radius: 0;
    background: #ead8ff;
    box-shadow: 0 3px 0 #9d70db, 0 4px 0 #49309e, inset 0 1px 0 #fff9ff;
    color: var(--ui-text-main);
    font: 400 18px/1.1 "NeoDunggeunmo", monospace;
    text-shadow: none;
    clip-path: none;
    transition: transform 80ms steps(2, end), filter 80ms steps(2, end);
}
#missionClearMenu .rankingRegister button {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    margin: 11px 0 0;
    padding: 0 25px;
    background: #ead8ff;
    font-size: 19px;
}
#missionClearMenu .clearActions {
    width: 288px;
    margin-top: 18px;
    gap: 9px;
}
#missionClearMenu .clearActions button {
    flex: 1;
    width: auto;
    min-width: 0;
    height: 41px;
    min-height: 41px;
    padding: 0 17px;
    font-size: 17px;
}
#missionClearMenu button:not(:disabled):hover,
#missionClearMenu button:not(:disabled):focus-visible,
#missionClearMenu button.keyboardSelected {
    border: 1px solid #49309e;
    background: #ead8ff;
    box-shadow: 0 3px 0 #9d70db, 0 4px 0 #49309e, inset 0 1px 0 #fff9ff;
    color: var(--ui-text-main);
    filter: brightness(1.12);
}
#missionClearMenu #rankingSubmitButton:not(:disabled):hover,
#missionClearMenu #rankingSubmitButton.keyboardSelected {
    background: #ead8ff;
}
#missionClearMenu button:not(:disabled):active,
#missionClearMenu button.keyboardPressed {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #9d70db, 0 2px 0 #49309e;
}
#missionClearMenu .rankingRegister button.registered:disabled {
    border: 1px solid #9277b5;
    background: #dfccef;
    box-shadow: 0 2px 0 #b497d2;
    color: var(--ui-text-secondary);
    filter: none;
}
#missionClearMenu .rankingStatus { font-size: 11px; }
#missionClearMenu .clearActions button.keyboardSelected::before { left: 7px; }
#missionClearMenu .clearActions button.keyboardSelected::after { right: 7px; }
/* Pixel UI: exact integer placement within the 360x640 game screen. */
#missionClearMenu { padding: 0; background: rgba(20, 12, 48, 0.3); }
#missionClearMenu .clearHeader { position: absolute; left: 20px; top: 136px; width: 320px; margin: 0; }
#missionClearMenu .clearHeader h2 { line-height: 36px; }
#missionClearMenu .clearCard { position: absolute; left: 36px; top: 225px; width: 288px; height: 226px; padding: 9px 8px 9px; border: 12px solid transparent; border-image: url("images/ui/opening_dialogue_box.png") 12 12 18 12 fill / 12px 12px 18px 12px / 0 stretch; background: none; box-shadow: none; image-rendering: pixelated; }
#missionClearMenu .clearScore { height: 85px; margin: 0 0 7px; padding: 0 0 15px; border-bottom: 2px solid #b68cde; }
#missionClearMenu .clearScore span { line-height: 16px; }
#missionClearMenu .clearScore strong { position: relative; top: -2px; line-height: 44px; }
#missionClearMenu .rankingRegister label { margin: 0 0 10px; font-size: 16px; line-height: 20px; }
#missionClearMenu .rankingRegister input { padding: 7px 8px 5px; font-size: 16px; line-height: 20px; }
#missionClearMenu button { border: 0; border-radius: 0; background: url("images/Main Menu/button_small.png") 0 0 / 140px 44px no-repeat; box-shadow: none; font: 400 15px/20px "NeoDunggeunmo", monospace; image-rendering: pixelated; filter: none; transition: none; }
#missionClearMenu .rankingRegister button { width: 248px; height: 44px; min-height: 44px; margin: 8px 0 0; padding: 1px 25px 3px; background: url("images/Main Menu/button_small.png") 0 0 / 248px 44px no-repeat; font-size: 16px; }
#missionClearMenu .clearActions { position: absolute; left: 36px; top: 461px; width: 288px; height: 44px; margin: 0; gap: 8px; }
#missionClearMenu .clearActions button { flex: none; width: 140px; height: 44px; min-height: 44px; padding: 1px 17px 3px; font-size: 16px; }
#missionClearMenu button:not(:disabled):hover, #missionClearMenu button:not(:disabled):focus-visible, #missionClearMenu button.keyboardSelected { border: 0; border-radius: 0; outline: none; background: url("images/Main Menu/button_small.png") 0 0 / 140px 44px no-repeat; box-shadow: none; filter: brightness(1.12); transform: translateY(-1px); z-index: 3; overflow: visible; }
#missionClearMenu #rankingSubmitButton:not(:disabled):hover, #missionClearMenu #rankingSubmitButton:not(:disabled):focus-visible, #missionClearMenu #rankingSubmitButton.keyboardSelected { background: url("images/Main Menu/button_small.png") 0 0 / 248px 44px no-repeat; }
#missionClearMenu button:not(:disabled):active, #missionClearMenu button.keyboardPressed { transform: translateY(2px); filter: none; box-shadow: none; }
#missionClearMenu .rankingRegister button.registered:disabled {
    border: 0;
    background: url("images/Main Menu/button_small.png") 0 0 / 248px 44px no-repeat;
    box-shadow: none;
    color: var(--ui-text-main);
    font-family: "GalmuriMono9", monospace !important;
    font-weight: 700 !important;
    -webkit-text-fill-color: var(--ui-text-main);
    appearance: none;
    opacity: 1;
    filter: none;
}
#missionClearMenu .rankingStatus { font: 400 10px/12px "NeoDunggeunmo", monospace; }

/* One left cursor, visible only for keyboard selection. */
#gameContainer .menu button::before,
#gameContainer .menu button::after {
    content: none !important;
    display: none !important;
    animation: none;
}
body.keyboardNavigation #gameContainer .menu button.keyboardSelected:not(:disabled)::before {
    content: "" !important;
    display: block !important;
    position: absolute;
    left: var(--menu-cursor-left, 16px);
    top: 50%;
    width: var(--menu-cursor-size, 14px);
    height: var(--menu-cursor-size, 14px);
    color: var(--ui-text-main);
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0H2V1H4V2H6V3H7V4H6V5H4V6H2V7H0Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0H2V1H4V2H6V3H7V4H6V5H4V6H2V7H0Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    text-shadow: none;
    transform: translateY(-50%);
    animation: none;
    filter: none;
    pointer-events: none;
}

/* Keep Safari from recompositing and clipping the glow after a filter fade. */
#mainMenu > button:not(.devToggleButton),
#backButton,
#rankingBackButton,
#resumeButton,
#menuButton,
#gameOverMenu button,
#missionClearMenu button {
    transition: transform 80ms steps(2, end);
}

/* A stationary mouse can leave :hover on the old item during keyboard navigation.
   In keyboard mode, only the button carrying keyboardSelected may keep the glow. */
body.keyboardNavigation #gameContainer .menu button:not(.keyboardSelected):not(:disabled) {
    filter: none !important;
    transform: none !important;
    box-shadow: none !important;
    outline: none !important;
    z-index: 2;
}

.menuButtonGlow {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    border: 2px solid rgba(197, 164, 250, 0.55);
    background-color: transparent;
    box-shadow:
        0 0 2px 0 rgba(197, 164, 250, 0.42),
        0 0 4px 1px rgba(197, 164, 250, 0.30);
    filter: none;
    pointer-events: none;
}

#mainMenu > button:not(.devToggleButton):not(:disabled):hover,
#mainMenu > button:not(.devToggleButton):not(:disabled):focus-visible,
#mainMenu > button:not(.devToggleButton).keyboardSelected {
    filter: brightness(1.12);
}

/* Screen titles follow PAUSE; content uses the final-score pixel card. */
#guideMenu > .guideTitle,
#rankingMenu > h2 {
    position: absolute;
    left: 0;
    width: 360px;
    margin: 0;
    color: var(--ui-text-light);
    font-size: 32px;
    line-height: 40px;
    transform: none;
    text-shadow:
        -1px -1px 0 #4e3c95, 1px -1px 0 #4e3c95,
        -1px 1px 0 #4e3c95, 1px 1px 0 #4e3c95,
        -2px -2px 0 #4e3c95, 0 -2px 0 #4e3c95, 2px -2px 0 #4e3c95,
        -2px 0 0 #4e3c95, 2px 0 0 #4e3c95,
        -2px 2px 0 #4e3c95, 0 2px 0 #4e3c95, 2px 2px 0 #4e3c95,
        0 4px 0 #4e3c95;
}

#guideMenu {
    justify-content: center;
    gap: 0;
}

#guideMenu > .guideTitle {
    position: relative;
    top: auto;
    left: auto;
    margin: 0 0 13px;
    font-family: "Press Start 2P", monospace;
    font-size: 32px;
    font-weight: 400;
}

#rankingMenu > h2 { top: 65px; }

#guideMenu .guideText,
#rankingMenu .rankingPanel {
    position: absolute;
    left: 22px;
    width: 316px;
    max-width: none;
    margin: 0;
    border: 12px solid transparent;
    border-image: url("images/ui/opening_dialogue_box.png") 12 12 18 12 fill / 12px 12px 18px 12px / 0 stretch;
    border-radius: 0;
    background: #fffcf7;
    background-clip: padding-box;
    box-shadow: none;
    color: var(--ui-text-main);
    transform: none;
}

#guideMenu .guideText {
    position: relative;
    top: auto;
    left: auto;
    padding: 12px;
}

#guideMenu .guideControls {
    display: grid;
    row-gap: 4px;
}

#guideMenu .guideControls p {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    margin: 0;
    line-height: 24px;
    text-align: left;
}

#guideMenu .guideDamageNote {
    margin: 12px 0 0;
    text-align: center;
}

#guideMenu .guideControls p > span:nth-child(2) {
    position: relative;
    left: -10px;
    font-weight: 600;
}

#guideMenu .guideControls p > span:nth-child(2)::before {
    content: ":";
    position: absolute;
    left: -46px;
}

#guideMenu > #backButton {
    position: relative;
    top: auto;
    left: auto;
    margin: 16px 0 0;
}

#rankingMenu .rankingPanel {
    top: 118px;
    height: 384px;
    padding: 0;
    overflow: visible;
    isolation: isolate;
}

/* Draw the lavender frame above the header and scrollable content. */
#rankingMenu .rankingPanel::after {
    content: "";
    position: absolute;
    inset: -12px;
    z-index: 10;
    border: 12px solid transparent;
    border-image: url("images/ui/opening_dialogue_box2.png") 12 12 18 12 / 12px 12px 18px 12px / 0 stretch;
    pointer-events: none;
}

#rankingMenu,
#rankingMenu .rankingPanel,
#rankingMenu .rankingHeader,
#rankingMenu .rankingRow {
    font-family: "NeoDunggeunmoPixel", monospace;
}

#rankingMenu .rankingPanel::before {
    content: "";
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    height: 35px;
    border-radius: 8px 8px 0 0;
    background: #eee5fc;
    border-bottom: 2px solid #b68cde;
    pointer-events: none;
}

#rankingMenu .rankingHeader {
    position: relative;
    background: #eee5fc;
    color: var(--ui-text-main);
    font-size: 13px;
    font-weight: 600;
    border-bottom-color: transparent;
}

#rankingMenu .rankingHeader,
#rankingMenu .rankingRow {
    grid-template-columns: 34px minmax(0, 1fr) 68px 42px;
    column-gap: 4px;
    padding: 0 6px;
}

#rankingMenu .rankingHeader,
#rankingMenu .rankingList {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}
#rankingMenu .rankingHeader { height: 27px; min-height: 27px; scrollbar-color: transparent transparent; }
#rankingMenu .rankingHeader > span { transform: translateY(-2px); }
#rankingMenu .rankingList {
    height: 330px;
    width: calc(100% + 5px);
}
/* Keep a matching gutter in the header; use square, beveled pixel scrollbars. */
#rankingMenu .rankingHeader,
#rankingMenu .rankingList {
    scrollbar-width: auto;
    scrollbar-color: auto;
}
#rankingMenu .rankingHeader::-webkit-scrollbar,
#rankingMenu .rankingList::-webkit-scrollbar { width: 12px; }
#rankingMenu .rankingHeader::-webkit-scrollbar-track,
#rankingMenu .rankingHeader::-webkit-scrollbar-thumb { background: transparent; }
#rankingMenu .rankingList::-webkit-scrollbar-track {
    background: #eee5fc;
    border-left: 2px solid #b9a4d6;
}
#rankingMenu .rankingList::-webkit-scrollbar-thumb {
    min-height: 30px;
    border: 2px solid #68558f;
    border-radius: 0;
    background: #b68cde;
    box-shadow: inset 2px 2px 0 #e2cafa, inset -2px -2px 0 #8e65b5;
}
#rankingMenu .rankingList::-webkit-scrollbar-thumb:hover { background: #c6a0ed; }
#rankingMenu .rankingList::-webkit-scrollbar-thumb:active { background: #9d76c7; }
#rankingMenu .rankingRow {
    margin-right: 5px;
    height: 33px;
    min-height: 33px;
    border-bottom: 1px dashed #e5d8ef;
    background: transparent;
    font-size: 13px;
}
#rankingMenu .rankingRow > span {
    align-self: center;
    line-height: 20px;
    position: relative;
    top: 1px;
}
#rankingMenu .rankingRow span:nth-child(2),
#rankingMenu .rankingHeader span:nth-child(2) { padding-left: 3px; text-align: left; }
#rankingMenu .rankingRow span:first-child,
#rankingMenu .rankingHeader span:first-child,
#rankingMenu .rankingRow span:nth-child(4),
#rankingMenu .rankingHeader span:nth-child(4) { text-align: center; }
#rankingMenu .rankingRow span:nth-child(3),
#rankingMenu .rankingHeader span:nth-child(3) { text-align: right; padding-right: 10px; }
#rankingMenu .rankingRow span:first-child { font-size: 13px; color: var(--ui-text-secondary); }
#rankingMenu .rankingRowEmpty,
#rankingMenu .rankingRowEmpty span:first-child { color: #b9a4d6; }
#rankingMenu .rankingRowEmpty span:not(:first-child) {
    font-family: "NeoDunggeunmoPixel", monospace;
    font-size: 13px;
}
#rankingMenu .rankingRowFirst { background: rgba(254, 230, 141, 0.18); }
#rankingMenu .rankingRowFirst span:first-child {
    color: var(--ui-text-secondary);
}
#rankingMenu #rankingLoadStatus:empty { display: none; }

#rankingMenu .rankingHeader > span:nth-child(n) {
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

#rankingMenu .rankingRow span:nth-child(2) {
    font-weight: 600;
}

#rankingMenu .rankingRow span:nth-child(3),
#rankingMenu .rankingRow span:nth-child(4) {
    text-align: left;
    padding-right: 0;
}

#rankingMenu .rankingRow span:first-child { left: -4px; }
#rankingMenu .rankingRow span:nth-child(4) { left: 25px; }

#rankingMenu .rankingRow span:first-child,
#rankingMenu .rankingRow span:nth-child(3),
#rankingMenu .rankingRow span:nth-child(4) {
    font-family: "NeoDunggeunmoPixel", monospace;
    font-weight: 600;
    font-size: 13px;
    top: 1px;
}

/* Shared title outline: purple inner edge, dark outer edge, purple drop shadow. */
#gameContainer #pauseMenu .pausePanel > h2,
#gameContainer #rankingMenu > h2,
#gameContainer #guideMenu > .guideTitle,
#gameContainer #gameOverMenu > h2,
#gameContainer #missionClearMenu .clearHeader > h2 {
    text-shadow:
        -1px -1px 0 #4e3c95, 0 -1px 0 #4e3c95, 1px -1px 0 #4e3c95,
        -1px 0 0 #4e3c95, 1px 0 0 #4e3c95,
        -1px 1px 0 #4e3c95, 0 1px 0 #4e3c95, 1px 1px 0 #4e3c95,
        -2px -2px 0 #1f043f, 0 -2px 0 #1f043f, 2px -2px 0 #1f043f,
        -2px 0 0 #1f043f, 2px 0 0 #1f043f,
        -2px 2px 0 #1f043f, 0 2px 0 #1f043f, 2px 2px 0 #1f043f,
        0 4px 0 #4e3c95;
}

#gameContainer #countdown #countText.stageText {
    text-shadow: 2px 2px 0 #4e3c95;
}

#countdown .stageStoryText {
    text-shadow: 2px 2px 0 #4e3c95;
}

#countdown .introSkipHint {
    color: #ffffff;
    text-shadow: 1px 1px 0 #4e3c95;
}

#countdown > .introSkipHint {
    top: 383px;
}

/* Nine-slice buttons preserve the source corners at every existing button size. */
#gameContainer #mainMenu > button:not(.devToggleButton),
#gameContainer #missionClearMenu button {
    appearance: none;
    -webkit-appearance: none;
    outline: none !important;
    box-shadow: none !important;
    border: 10px solid transparent !important;
    border-image: none !important;
    background: url("images/ui/button_action_frame.svg") center / 100% 100% no-repeat border-box !important;
}

#gameContainer #mainMenu > button:not(.devToggleButton) {
    background-image: url("images/ui/button_menu_frame.svg") !important;
}

#gameContainer #missionClearMenu .clearActions button {
    padding-top: 2px;
    padding-bottom: 2px;
    padding-left: 21px;
    padding-right: 17px;
    justify-content: center;
    text-align: center;
}

#gameContainer #missionClearMenu #rankingSubmitButton {
    padding-top: 2px;
    padding-bottom: 2px;
    border: 0 !important;
    border-image: none !important;
    background: url("images/score-screen/register.png") 0 0 / 248px 44px no-repeat !important;
}

.menuButtonGlow.menuButtonGlowRegister {
    border: 10px solid transparent;
    border-image: url("images/score-screen/register.png") 10 / 10px / 0 stretch;
    border-radius: 0 !important;
    box-shadow: none;
    filter: drop-shadow(0 0 2px rgba(197, 164, 250, 0.65));
}
