@font-face {
    font-family: "DIN Pro";
    src: url("../assets/fonts/DINPro-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Carter One";
    src: url("../assets/fonts/CarterOne-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
:root {
    --night: #141225;
    --parchment: #f3e9d2;
    --ink: #1b1830;
    --enh: #ff7a6b;
    --env: #4fd1c5;
    --uti: #f6c860;
    --eff: #b79cff;
    --ult: #c77dff;
    --score_font: "Carter One", "DIN Pro", "Avenir Next", sans-serif;
    --viewport_width: 100vw;
    --viewport_height: 100vh;
    --safe_viewport_width: calc(var(--viewport_width) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    --safe_viewport_height: calc(var(--viewport_height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
@supports (height: 100dvh) {
    :root {
        --viewport_width: 100dvw;
        --viewport_height: 100dvh;
    }
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
}
html {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
input,
textarea {
    user-select: text;
    -webkit-user-select: text;
}
body {
    background: #0a0812;
    height: var(--viewport_height);
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px)
        env(safe-area-inset-left, 0px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "DIN Pro", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    color: var(--parchment);
    overflow: hidden;
    overscroll-behavior: none;
}
#stage {
    position: relative;
    width: min(var(--safe_viewport_width), calc(var(--safe_viewport_height) * 420 / 680));
    height: min(var(--safe_viewport_height), calc(var(--safe_viewport_width) * 680 / 420));
    user-select: none;
    -webkit-user-select: none;
}
canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
    cursor: pointer;
}
#game {
    touch-action: none;
}

.overlay,
#pause_panel,
#pause_btn,
#fanfare,
#debug_invincibility_button {
    zoom: var(--ui_zoom, 1);
}
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-content: safe center;
    background: rgba(15, 12, 32, 0.82);
    backdrop-filter: blur(3px);
    padding: 18px;
    text-align: center;
    animation: fade_in 0.2s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.hidden {
    display: none !important;
}
.coin_icon {
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.12em;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffe9a0, #ffd968 55%, #f0b95a);
    border: 1px solid #c98f2e;
    box-shadow: 0 0 6px rgba(255, 217, 104, 0.45);
}
.coin_icon::after {
    content: "✦";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    font-weight: 800;
    color: #a8781f;
}
@keyframes fade_in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes pop_in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes bounce_in {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }
    60% {
        transform: scale(1.06);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

h1 {
    font-family: var(--score_font);
    font-size: 46px;
    letter-spacing: 1px;
    font-weight: 400;
    background: linear-gradient(180deg, #ffe9b0, #f0a35e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: bounce_in 0.45s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.sub {
    opacity: 0.85;
    margin: 12px 0 8px;
    font-size: 15px;
    line-height: 1.55;
    max-width: 300px;
    animation: pop_in 0.35s 0.08s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.hint {
    opacity: 0.6;
    font-size: 13px;
    margin-bottom: 24px;
    animation: pop_in 0.35s 0.14s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.btn {
    font: inherit;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.5px;
    color: var(--ink);
    background: linear-gradient(180deg, #ffe9b0, #f0b35e);
    border: none;
    border-radius: 999px;
    padding: 13px 38px;
    cursor: pointer;
    box-shadow: 0 4px 0 #9c6b2e;
    transition:
        transform 0.1s cubic-bezier(0.3, 1.4, 0.4, 1),
        box-shadow 0.1s ease;
    animation: pop_in 0.35s 0.18s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.btn:hover {
    transform: translateY(-2px) scale(1.03);
}
.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #9c6b2e;
}
.btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}
