/* ============================================================
   handmade birthday experience — styles
   ============================================================ */

:root {
    --bg: #fff9f2;
    --primary: #ffd166;
    --accent: #ff8c69;
    --text: #2e2e2e;
    --card: #ffffff;
    --soft: rgba(46, 46, 46, 0.55);
    --shadow-sm: 0 6px 20px rgba(255, 140, 105, 0.12), 0 2px 8px rgba(46, 46, 46, 0.06);
    --shadow-md: 0 18px 40px rgba(255, 140, 105, 0.18), 0 6px 16px rgba(46, 46, 46, 0.08);
    --radius-sm: 14px;
    --radius-md: 22px;
    --radius-lg: 32px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Poppins", system-ui, sans-serif;
    font-weight: 400;
    overflow-x: hidden;
    overscroll-behavior: none;
}

body {
    min-height: 100dvh;
    line-height: 1.55;
    letter-spacing: 0.01em;
}

::selection {
    background: var(--primary);
    color: var(--text);
}

/* ---------- typography ---------- */
h1,
h2,
h3 {
    font-family: "Fredoka", "Poppins", sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0.4em 0;
    line-height: 1.15;
}

h1 {
    font-size: clamp(2.4rem, 7vw, 4rem);
}

.big {
    font-size: clamp(2.6rem, 9vw, 5rem);
    color: var(--accent);
}

.handwave {
    font-size: clamp(3.2rem, 12vw, 6rem);
    color: var(--text);
}

p {
    margin: 0.5em 0;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
}

.soft {
    color: var(--soft);
    font-size: 1rem;
}

.light {
    color: rgba(255, 249, 242, 0.85);
}

em {
    font-style: italic;
    color: var(--accent);
}

/* ---------- layout ---------- */
#stage {
    position: relative;
    width: 100vw;
    min-height: 100dvh;
    display: block;
}

.scene {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.scene.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.wrap {
    width: 100%;
    max-width: 720px;
    text-align: center;
    padding: 36px 28px;
    animation: floatIn 500ms ease both;
}

.wrap.tight {
    max-width: 520px;
}

.wrap.narrow {
    max-width: 560px;
    text-align: left;
}

.z1 {
    position: relative;
    z-index: 1;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    font-family: "Fredoka", sans-serif;
    font-weight: 500;
    font-size: 1.05rem;
    padding: 14px 26px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 250ms ease, background-color 250ms ease;
    text-decoration: none;
    user-select: none;
}

.btn:hover {
    transform: translateY(-3px) rotate(-0.6deg);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0) scale(0.97);
}

.btn.primary {
    background: var(--primary);
    color: var(--text);
}

.btn.primary:hover {
    background: #ffd97a;
}

.btn.ghost {
    background: rgba(255, 255, 255, 0.75);
    border: 1.5px solid rgba(46, 46, 46, 0.08);
}

.btn.ghost.light {
    background: rgba(255, 255, 255, 0.08);
    color: #fff9f2;
    border: 1.5px solid rgba(255, 249, 242, 0.2);
    box-shadow: none;
}

.btn.ghost.light:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn.small {
    font-size: 0.9rem;
    padding: 10px 20px;
}

.btn-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    animation: floatIn 500ms ease both;
}

/* ---------- particles + confetti canvases ---------- */
#particles,
#confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

#confetti {
    z-index: 30;
}

/* ---------- sound hint ---------- */
#sound-hint {
    position: fixed;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--soft);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease;
}

#sound-hint.show {
    opacity: 1;
}

/* ---------- wave ---------- */
.wave {
    font-size: 3rem;
    display: inline-block;
    transform-origin: 70% 70%;
    animation: wave 2.4s ease-in-out infinite;
    margin: 0;
}

@keyframes wave {
    0%, 60%, 100% {
        transform: rotate(0);
    }
    10% {
        transform: rotate(14deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    30% {
        transform: rotate(14deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
}

.fade-in-delay {
    animation: floatIn 600ms 400ms ease both;
}

/* ---------- terminal scene ---------- */
.terminal-scene {
    background: #0a0a0a;
}

.terminal {
    width: 100%;
    max-width: 620px;
    background: #111111;
    border-radius: var(--radius-md);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    font-family: "JetBrains Mono", monospace;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.term-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.term-title {
    margin-left: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.term-body {
    padding: 24px 22px;
    margin: 0;
    min-height: 260px;
    color: #d0f3d0;
    font-size: 0.95rem;
    line-height: 1.75;
    font-family: "JetBrains Mono", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.term-body .prompt {
    color: #ffd166;
}

.term-body .ok {
    color: #7ee787;
}

.term-body .cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: #d0f3d0;
    vertical-align: text-bottom;
    animation: blink 1s steps(2) infinite;
    margin-left: 2px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ---------- story lines ---------- */
.story {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 180px;
    text-align: center;
}

.story.ending {
    text-align: left;
    gap: 18px;
    line-height: 1.8;
}

.story p {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 500ms ease, transform 500ms ease;
    font-size: clamp(1.05rem, 3vw, 1.25rem);
    line-height: 1.5;
    margin: 0;
}

.story p.show {
    opacity: 1;
    transform: translateY(0);
}

.story p.emphasis {
    font-family: "Fredoka", sans-serif;
    font-size: clamp(1.25rem, 4vw, 1.6rem);
    color: var(--accent);
    font-weight: 500;
}

.story.light p {
    color: rgba(255, 249, 242, 0.9);
}

/* ---------- cake ---------- */
.cake-drop {
    display: flex;
    justify-content: center;
    margin: 20px 0 24px;
    opacity: 0;
    transform: translateY(-160px);
}

.cake-drop.drop {
    animation: cakeDrop 900ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 1;
}

.cake-drop.bounce {
    animation: cakeBounce 2.2s ease-in-out infinite;
    opacity: 1;
    transform: translateY(0);
}

@keyframes cakeDrop {
    0% {
        opacity: 0;
        transform: translateY(-260px) rotate(-8deg);
    }
    60% {
        opacity: 1;
        transform: translateY(20px) rotate(2deg);
    }
    80% {
        transform: translateY(-8px) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

@keyframes cakeBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.cake {
    position: relative;
    width: 180px;
    height: 200px;
}

.cake .layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px 12px 6px 6px;
    box-shadow: 0 8px 20px rgba(255, 140, 105, 0.25);
}

.cake .layer.top {
    width: 100px;
    height: 40px;
    background: linear-gradient(180deg, #fff2df 0%, #ffe0b2 100%);
    top: 40px;
    z-index: 3;
}

.cake .layer.mid {
    width: 140px;
    height: 44px;
    background: linear-gradient(180deg, #ffb8a0 0%, #ff8c69 100%);
    top: 78px;
    z-index: 2;
}

.cake .layer.bot {
    width: 170px;
    height: 46px;
    background: linear-gradient(180deg, #ffe0b2 0%, #ffc98a 100%);
    top: 120px;
    z-index: 1;
}

.cake .plate {
    position: absolute;
    left: 50%;
    top: 164px;
    transform: translateX(-50%);
    width: 190px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(46, 46, 46, 0.12);
}

.cake .candle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 32px;
    top: 12px;
    background: linear-gradient(180deg, #ff8c69, #ffd166);
    border-radius: 3px;
    z-index: 4;
}

.cake .flame {
    position: absolute;
    left: 50%;
    top: -14px;
    transform: translateX(-50%);
    width: 12px;
    height: 18px;
    background: radial-gradient(circle at 50% 70%, #fff2ac, #ff8c69 70%, transparent 71%);
    border-radius: 50% 50% 40% 40%;
    animation: flicker 0.8s ease-in-out infinite alternate;
    filter: blur(0.4px);
}

@keyframes flicker {
    from {
        transform: translateX(-50%) scale(1) rotate(-1deg);
        opacity: 0.9;
    }
    to {
        transform: translateX(-50%) scale(1.08) rotate(2deg);
        opacity: 1;
    }
}

/* ---------- dark scenes ---------- */
.dark-scene {
    background: #101318;
    color: #fff9f2;
}

.dark-scene .story p {
    color: rgba(255, 249, 242, 0.92);
}

/* ---------- stadium ---------- */
.stadium-scene {
    background: radial-gradient(ellipse at center top, #1a2b1e 0%, #0a1610 60%, #050a08 100%);
    color: #fff9f2;
    overflow: hidden;
}

.stadium-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 249, 242, 0.08), transparent 30%),
        radial-gradient(circle at 70% 15%, rgba(255, 249, 242, 0.07), transparent 30%);
}

.stadium-lights {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 0%, rgba(255, 209, 102, 0.14), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(255, 209, 102, 0.14), transparent 35%);
    animation: lightsPulse 3s ease-in-out infinite;
}

@keyframes lightsPulse {
    50% {
        opacity: 0.7;
    }
}

.trophy {
    font-size: clamp(4rem, 12vw, 7rem);
    animation: trophyFloat 2.4s ease-in-out infinite;
}

@keyframes trophyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.stadium-title {
    font-family: "Fredoka", sans-serif;
    font-size: clamp(2.4rem, 7vw, 4rem);
    color: #ffd166;
    margin: 12px 0 4px;
    letter-spacing: 0.02em;
}

.stadium-sub {
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 249, 242, 0.7);
    margin-bottom: 20px;
}

.countdown {
    font-family: "Fredoka", sans-serif;
    font-size: clamp(4rem, 15vw, 8rem);
    line-height: 1;
    color: #ffd166;
    margin-top: 12px;
    min-height: 1.2em;
}

.countdown span {
    display: inline-block;
    animation: countPop 900ms ease both;
}

@keyframes countPop {
    0% {
        opacity: 0;
        transform: scale(2.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.7);
    }
}

/* ---------- penalty game ---------- */
.game-scene {
    background: linear-gradient(180deg, #0f1f14 0%, #14351f 100%);
    color: #fff9f2;
    flex-direction: column;
    padding: 12px;
    justify-content: flex-start;
    padding-top: max(20px, env(safe-area-inset-top));
}

.scoreboard {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 249, 242, 0.1);
    padding: 10px 20px;
    border-radius: 999px;
    margin-top: 8px;
    font-family: "Fredoka", sans-serif;
}

.score-box {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: #fff9f2;
    font-size: 1rem;
}

.score-box .label {
    font-size: 0.75rem;
    color: rgba(255, 249, 242, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.score-box .value {
    font-size: 1.4rem;
    color: #ffd166;
    font-weight: 600;
}

.score-box.big-score .value {
    font-size: 2rem;
}

.score-box .of {
    color: rgba(255, 249, 242, 0.4);
}

.pitch {
    position: relative;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 4 / 5;
    margin: 20px auto 12px;
    background: linear-gradient(180deg, #14351f 0%, #1e4a2e 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.crowd {
    position: absolute;
    inset: 0 0 auto 0;
    height: 12%;
    background:
        repeating-linear-gradient(
            90deg,
            #2a2a2a 0 4px,
            #444 4px 8px,
            #666 8px 12px,
            #333 12px 16px
        );
    opacity: 0.6;
    animation: crowdMove 0.6s steps(2) infinite;
}

@keyframes crowdMove {
    50% { transform: translateX(2px); }
}

.goal {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 12%;
    height: 30%;
    background: rgba(255, 249, 242, 0.06);
    border: 4px solid #fff9f2;
    border-top-width: 4px;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.net {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
    background-size: 14px 14px;
    opacity: 0.55;
}

.keeper {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(2.4rem, 8vw, 3.2rem);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: left 320ms cubic-bezier(0.68, -0.55, 0.27, 1.55),
        bottom 320ms cubic-bezier(0.68, -0.55, 0.27, 1.55),
        transform 320ms ease;
    z-index: 3;
}

.keeper.dive-left {
    left: 15%;
    bottom: 10%;
    transform: translateX(-50%) rotate(-45deg);
}

.keeper.dive-right {
    left: 85%;
    bottom: 10%;
    transform: translateX(-50%) rotate(45deg);
}

.keeper.dive-center {
    bottom: 6%;
    transform: translateX(-50%) scale(1.1);
}

.grass {
    position: absolute;
    inset: 42% 0 0 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
        repeating-linear-gradient(
            180deg,
            #1e4a2e 0 24px,
            #235536 24px 48px
        );
}

.ball {
    position: absolute;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(2rem, 6vw, 2.6rem);
    z-index: 4;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
    transition: left 600ms cubic-bezier(0.22, 0.9, 0.36, 1),
        bottom 600ms cubic-bezier(0.22, 0.9, 0.36, 1),
        transform 600ms cubic-bezier(0.22, 0.9, 0.36, 1),
        opacity 300ms ease;
}

.ball.shooting {
    animation: ballSpin 600ms linear;
}

@keyframes ballSpin {
    from { transform: translateX(-50%) rotate(0); }
    to { transform: translateX(-50%) rotate(720deg); }
}

.flash {
    position: absolute;
    inset: 0;
    background: #fff9f2;
    opacity: 0;
    pointer-events: none;
}

.flash.on {
    animation: flashOn 500ms ease;
}

@keyframes flashOn {
    0%, 100% { opacity: 0; }
    30% { opacity: 0.5; }
}

.result-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Fredoka", sans-serif;
    font-size: clamp(2rem, 7vw, 3.4rem);
    color: #ffd166;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

.result-text.show {
    animation: resultPop 900ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-text.saved {
    color: #ff8c69;
}

@keyframes resultPop {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }
    30% {
        opacity: 1;
        transform: scale(1.15);
    }
    70% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

.aim-controls {
    width: 100%;
    max-width: 520px;
    text-align: center;
    margin-top: 4px;
}

.aim-title {
    font-family: "Fredoka", sans-serif;
    font-size: 1.1rem;
    color: rgba(255, 249, 242, 0.85);
    margin: 6px 0;
}

.aim-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.aim-btn {
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255, 249, 242, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #fff9f2;
    font-family: "Fredoka", sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
        background 200ms ease, border-color 200ms ease;
}

.aim-btn:hover {
    background: rgba(255, 209, 102, 0.15);
    border-color: #ffd166;
    transform: translateY(-2px);
}

.aim-btn:active {
    transform: translateY(0) scale(0.96);
}

.aim-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.game-end {
    text-align: center;
    animation: floatIn 500ms ease both;
    margin-top: 10px;
}

.game-end-text {
    font-family: "Fredoka", sans-serif;
    font-size: 1.4rem;
    color: #ffd166;
    margin-bottom: 12px;
}

/* ---------- reward ---------- */
.progress-bar {
    width: 100%;
    max-width: 360px;
    height: 10px;
    background: rgba(255, 249, 242, 0.12);
    border-radius: 999px;
    overflow: hidden;
    margin: 22px auto;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffd166, #ff8c69);
    border-radius: 999px;
    transition: width 400ms ease;
}

.kidding {
    font-family: "Fredoka", sans-serif;
    font-size: clamp(1.6rem, 5vw, 2.4rem) !important;
    color: #ffd166 !important;
    animation: kidPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kidPop {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.duck-big {
    font-size: clamp(5rem, 18vw, 9rem);
    display: inline-block;
    animation: duckWiggle 1.4s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(255, 209, 102, 0.4));
}

@keyframes duckWiggle {
    0%, 100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg); }
}

.you-got {
    font-family: "Fredoka", sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.24em;
    color: #ffd166 !important;
    margin: 6px 0 !important;
}

.duckie {
    font-family: "Fredoka", sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    color: #ff8c69 !important;
    letter-spacing: 0.04em;
    margin: 0 0 18px !important;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.quack-log {
    margin: 16px auto !important;
    color: rgba(255, 249, 242, 0.75);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.95rem;
    min-height: 1.4em;
    line-height: 1.8;
}

/* ---------- playlist ---------- */
.walking-duck {
    position: relative;
    font-size: 4rem;
    margin: 20px auto;
    display: inline-block;
    transform: translateX(-40vw);
    opacity: 0;
    animation: duckWalkIn 2.6s cubic-bezier(0.22, 0.9, 0.36, 1) forwards;
    filter: drop-shadow(0 6px 12px rgba(255, 140, 105, 0.3));
}

@keyframes duckWalkIn {
    0% {
        transform: translateX(-40vw) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    20% { transform: translateX(-30vw) rotate(-6deg); }
    40% { transform: translateX(-15vw) rotate(6deg); }
    60% { transform: translateX(0) rotate(-6deg); }
    80% { transform: translateX(4vw) rotate(6deg); }
    100% {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

.dropped-icon {
    display: inline-block;
    margin: 8px auto 20px;
    animation: iconDrop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes iconDrop {
    from {
        opacity: 0;
        transform: translateY(-30px) rotate(-12deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

/* ---------- ending ---------- */
.ending-scene {
    background: var(--bg);
}

.ending-scene .wrap {
    animation: floatIn 700ms ease both;
}

.story.ending p {
    font-size: clamp(1rem, 2.6vw, 1.15rem);
    color: var(--text);
    line-height: 1.7;
}

.story.ending p.emphasis {
    color: var(--accent);
    text-align: center;
    font-family: "Fredoka", sans-serif;
}

.ending-scene #endingContinue {
    display: block;
    margin: 32px auto 0;
}

/* ---------- final ---------- */
.final-scene {
    background: radial-gradient(ellipse at center, #fff5e2 0%, #fff9f2 70%);
}

.tag {
    font-family: "Fredoka", sans-serif;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--soft);
    margin-bottom: 16px !important;
}

.percent {
    font-family: "Fredoka", sans-serif;
    font-size: clamp(4rem, 15vw, 7rem);
    color: var(--accent);
    line-height: 1;
    margin: 8px 0 20px;
}

.foot {
    margin-top: 32px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    color: var(--soft);
    font-size: 0.9rem;
    font-family: "Fredoka", sans-serif;
}

.foot-icons {
    letter-spacing: 0.2em;
}

/* ---------- responsive tweaks ---------- */
@media (max-width: 480px) {
    .wrap {
        padding: 24px 18px;
    }
    .terminal {
        border-radius: 16px;
    }
    .term-body {
        padding: 18px 16px;
        font-size: 0.86rem;
    }
    .cake {
        width: 150px;
        transform: scale(0.9);
    }
    .aim-buttons {
        gap: 8px;
    }
    .aim-btn {
        padding: 14px 8px;
        font-size: 0.9rem;
    }
    .scoreboard {
        gap: 8px;
        padding: 8px 14px;
    }
    .score-box .value {
        font-size: 1.2rem;
    }
    .score-box.big-score .value {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    .wave, .duck-big, .flame, .trophy, .stadium-lights, .crowd {
        animation: none !important;
    }
}

/* ---------- locked scene ---------- */
.locked-wrap {
    animation: floatIn 700ms ease both;
}
.lock-emoji {
    font-size: clamp(3.5rem, 12vw, 5.5rem);
    animation: peek 2.6s ease-in-out infinite;
    display: inline-block;
    margin-bottom: 8px;
}
@keyframes peek {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-6px) rotate(4deg); }
}
.locked-title {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    color: var(--accent);
    margin: 12px 0 8px;
}
.soft.tiny {
    font-size: 0.85rem;
    margin-top: 24px !important;
}

/* ---------- stats scene ---------- */
.stats-wrap {
    text-align: left;
    animation: floatIn 500ms ease both;
}
.stats-title {
    font-size: clamp(2rem, 5vw, 2.8rem);
    color: var(--accent);
    margin: 8px 0 24px;
}
.stats-body {
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px 24px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stats-card {
    background: #fff5e2;
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
.stats-card .num {
    font-family: "Fredoka", sans-serif;
    font-size: 2rem;
    color: var(--accent);
    line-height: 1.1;
}
.stats-card .lbl {
    font-size: 0.8rem;
    color: var(--soft);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
}
.stats-section-title {
    font-family: "Fredoka", sans-serif;
    font-size: 1rem;
    color: var(--text);
    margin: 16px 0 8px;
    letter-spacing: 0.02em;
}
.stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 340px;
    overflow-y: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
}
.stats-list li {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(46, 46, 46, 0.06);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text);
}
.stats-list li:last-child {
    border-bottom: none;
}
.stats-list .visitor-tag {
    color: var(--accent);
    font-weight: 600;
}
.stats-empty {
    text-align: center;
    color: var(--soft);
    padding: 20px 0;
}

/* ---------- utilities ---------- */
[hidden] {
    display: none !important;
}
