:root {
    color-scheme: dark;
    --ink: #f7efe6;
    --muted: #d9c9b3;
    --night: #132029;
    --deep: #0d151b;
    --rose: #ff6f91;
    --mint: #8be8cf;
    --gold: #ffd166;
    --line: rgba(255, 255, 255, .16);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    align-items: center;
    background:
        radial-gradient(circle at 22% 18%, rgba(255, 209, 102, .18), transparent 26%),
        linear-gradient(145deg, #0d151b 0%, #132029 48%, #233a3a 100%);
    color: var(--ink);
    display: flex;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    justify-content: center;
    min-height: 100%;
    overflow: hidden;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

button {
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    background: var(--ink);
    border: 0;
    border-radius: 8px;
    color: var(--deep);
    cursor: pointer;
    font: 800 1rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
    min-height: 48px;
    padding: 0 28px;
    transition: transform .18s ease, background .18s ease;
}

button:active {
    transform: translateY(2px) scale(.98);
}

.game-shell {
    display: grid;
    gap: 12px;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: min(100%, 900px);
    max-width: 520px;
    width: min(100%, 520px);
}

.topbar {
    align-items: end;
    display: flex;
    justify-content: space-between;
    min-height: 68px;
}

.eyebrow {
    color: var(--mint);
    display: block;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(1.55rem, 8vw, 2.35rem);
    line-height: .98;
}

.stats {
    display: flex;
    gap: 8px;
}

.stats span {
    align-items: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    min-width: 58px;
    padding: 0 10px;
}

.stats strong {
    color: var(--gold);
    font-size: 1.05rem;
}

.stage-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
    min-height: 0;
    overflow: hidden;
    position: relative;
    touch-action: none;
}

canvas {
    background: #101923;
    display: block;
    height: 100%;
    width: 100%;
}

.overlay {
    align-items: center;
    background:
        linear-gradient(rgba(13, 21, 27, .48), rgba(13, 21, 27, .84)),
        rgba(13, 21, 27, .76);
    display: none;
    flex-direction: column;
    gap: 14px;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: absolute;
    text-align: center;
}

.overlay.is-visible {
    display: flex;
}

.overlay h2 {
    font-size: clamp(1.85rem, 9vw, 3.25rem);
    line-height: .95;
    max-width: 9ch;
}

.overlay p {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.45;
    max-width: 31ch;
}

.moon-mark {
    height: 92px;
    width: 92px;
}

.start-photo {
    aspect-ratio: 2 / 3;
    border: 2px solid rgba(255, 255, 255, .62);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
    display: block;
    max-height: min(44vh, 330px);
    max-width: min(58vw, 220px);
    object-fit: cover;
    object-position: center;
    width: 100%;
}

.note-ribbon {
    align-items: center;
    background: rgba(255, 111, 145, .16);
    border: 1px solid rgba(255, 111, 145, .32);
    border-radius: 8px;
    color: var(--ink);
    display: flex;
    font-size: 1rem;
    font-weight: 750;
    justify-content: center;
    line-height: 1.35;
    min-height: 58px;
    padding: 10px 14px;
    text-align: center;
    text-shadow: 0 1px 16px rgba(255, 111, 145, .36);
}

@media (max-width: 420px) {
    body {
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    .game-shell {
        gap: 10px;
    }

    .topbar {
        min-height: 58px;
    }

    .stats span {
        height: 34px;
        min-width: 50px;
    }

    .overlay {
        gap: 11px;
        padding: 14px;
    }

    .start-photo {
        max-height: min(38vh, 280px);
        max-width: min(54vw, 190px);
    }
}
