/* =========================================================
   TOKENS
   ========================================================= */

:root {
    --deep: #1b1330;
    --deep-2: #281c47;
    --gold: #f4b942;
    --gold-soft: #ffd98a;
    --pink: #ff7089;
    --lilac: #c9a7eb;
    --cream: #fff8ec;
    --line: rgba(255, 248, 236, 0.14);
    --shadow: 0 30px 60px rgba(10, 6, 25, 0.45);

    --font-display: "Fredoka", system-ui, sans-serif;
    --font-body: "Nunito", system-ui, sans-serif;
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100vh;

    background: radial-gradient(
            ellipse at 20% -10%,
            #3a2560 0%,
            transparent 55%
    ),
    radial-gradient(
            ellipse at 90% 110%,
            #4a1f52 0%,
            transparent 50%
    ),
    var(--deep);

    color: var(--cream);
    font-family: var(--font-body);

    overflow-x: hidden;
}

h1,
h2 {
    font-family: var(--font-display);
    margin: 0;
}


/* =========================================================
   AMBIENT FLOATING LIGHTS
   ========================================================= */

.ambient {
    position: fixed;
    inset: 0;

    pointer-events: none;
    z-index: 0;

    overflow: hidden;
}

.ambient::before,
.ambient::after {
    content: "";
    position: absolute;

    border-radius: 50%;

    filter: blur(1px);

    background: var(--gold-soft);

    opacity: 0.55;

    box-shadow: 0 0 14px 3px var(--gold-soft);

    animation: drift 14s ease-in-out infinite;
}

.ambient::before {
    width: 6px;
    height: 6px;

    top: 20%;
    left: 10%;

    animation-duration: 16s;
}

.ambient::after {
    width: 5px;
    height: 5px;

    top: 65%;
    left: 85%;

    animation-duration: 12s;
    animation-delay: 2s;

    background: var(--lilac);

    box-shadow: 0 0 14px 3px var(--lilac);
}

@keyframes drift {
    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-40px) translateX(30px);
    }
}


/* Generated sparkle dots via JS */

.spark {
    position: fixed;

    border-radius: 50%;

    pointer-events: none;
    z-index: 0;

    animation: drift ease-in-out infinite;
}


/* =========================================================
   SCREENS
   ========================================================= */

.screen {
    position: relative;
    z-index: 1;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 32px 20px;

    transition: opacity 0.6s ease;
}

.hidden {
    display: none;
}


/* =========================================================
   LOGIN CARD
   ========================================================= */

.lock-card {
    position: relative;

    width: 100%;
    max-width: 420px;

    background: linear-gradient(
            180deg,
            var(--deep-2),
            #201436
    );

    border: 1px solid var(--line);

    border-radius: 28px;

    padding: 44px 34px 38px;

    text-align: center;

    box-shadow: var(--shadow);
}


/* Small cake on login */

.lock-cake {
    position: relative;

    width: 74px;
    height: 56px;

    margin: 0 auto 22px;
}

.lock-flame {
    position: absolute;

    left: 50%;
    top: -16px;

    translate: -50% 0;

    width: 8px;
    height: 14px;

    border-radius: 50% 50% 50% 50%
        /
        60% 60% 40% 40%;

    background: radial-gradient(
            circle at 50% 30%,
            #fff6d8,
            var(--gold) 60%,
            var(--pink) 100%
    );

    animation: flicker 2.4s ease-in-out infinite;
}

.lock-cake__tier {
    position: absolute;

    left: 50%;

    translate: -50% 0;

    border-radius: 8px;

    background: linear-gradient(
            180deg,
            var(--gold-soft),
            var(--gold)
    );
}

.lock-cake__tier--top {
    width: 34px;
    height: 20px;

    bottom: 36px;
}

.lock-cake__tier--bottom {
    width: 74px;
    height: 36px;

    bottom: 0;

    background: linear-gradient(
            180deg,
            var(--pink),
            #e4536a
    );
}


/* Login text */

.lock-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;

    color: var(--cream);
}

.lock-title .dot {
    color: var(--gold);
}

.lock-sub {
    margin: 14px 0 26px;

    color: rgba(255, 248, 236, 0.72);

    font-size: 0.98rem;
    line-height: 1.5;
}


/* Login form */

.lock-form {
    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 18px;
}

.date-fields {
    display: flex;
    align-items: flex-end;

    gap: 8px;
}

.name-field {
    align-items: center;
}

.name-field label {
    text-align: center;
}



.field {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.field label {
    font-size: 0.72rem;

    letter-spacing: 0.08em;

    text-transform: uppercase;

    color: var(--lilac);

    text-align: left;
}

.name-field {
    align-items: center;
}

.name-field label {
    text-align: center;
}

.field input {
    width: 74px;

    padding: 12px 0;

    text-align: center;

    font-family: var(--font-display);

    font-size: 1.4rem;

    color: var(--cream);

    background: rgba(255, 248, 236, 0.06);

    border: 1.5px solid var(--line);

    border-radius: 12px;

    outline: none;

    transition: border-color 0.2s,
    background 0.2s;
}

.name-field input {
    width: 170px;
}


.field input:focus {
    border-color: var(--gold);

    background: rgba(255, 248, 236, 0.1);
}

.sep {
    font-family: var(--font-display);

    font-size: 1.4rem;

    padding-bottom: 12px;

    color: var(--lilac);
}


/* Unlock button */

.unlock-btn {
    margin-top: 4px;

    padding: 14px 28px;

    border: none;
    border-radius: 999px;

    font-family: var(--font-display);

    font-size: 1rem;
    font-weight: 600;

    color: #2a1a10;

    background: linear-gradient(
            180deg,
            var(--gold-soft),
            var(--gold)
    );

    cursor: pointer;

    box-shadow: 0 10px 24px rgba(244, 185, 66, 0.28);

    transition: transform 0.15s ease,
    box-shadow 0.15s ease;
}

.unlock-btn:hover {
    transform: translateY(-2px);

    box-shadow: 0 14px 28px rgba(244, 185, 66, 0.36);
}

.unlock-btn:active {
    transform: translateY(0);
}

.hint-msg {
    min-height: 20px;

    margin: 0;

    font-size: 0.88rem;

    color: var(--pink);

    font-weight: 600;
}


/* Shake animation */

.shake {
    animation: shake 0.45s ease;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(7px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(4px);
    }
}


/* =========================================================
   PARTY SCREEN
   ========================================================= */

#party-screen {
    flex-direction: column;

    text-align: center;

    /*
       Extra space at the top gives the candles room.
    */
    padding-top: 90px;
}


/* Confetti */

#confetti-canvas {
    position: fixed;

    inset: 0;

    z-index: 0;

    pointer-events: none;
}


/* Balloons */

.balloons {
    position: fixed;

    inset: 0;

    z-index: 0;

    pointer-events: none;

    overflow: hidden;
}

.balloon {
    position: absolute;

    bottom: -140px;

    width: 46px;
    height: 58px;

    border-radius: 50% 50% 50% 50%
        /
        55% 55% 45% 45%;

    animation: rise linear forwards;
}

.balloon::after {
    content: "";

    position: absolute;

    left: 50%;
    bottom: -46px;

    translate: -50% 0;

    width: 1px;
    height: 46px;

    background: rgba(255, 248, 236, 0.4);
}

@keyframes rise {
    to {
        transform: translateY(-115vh) translateX(var(--drift, 0px)) rotate(var(--rot, 0deg));
    }
}


/* =========================================================
   PARTY CONTENT
   ========================================================= */

.party-content {
    position: relative;

    z-index: 2;

    width: 100%;
    max-width: 560px;
}

.eyebrow {
    margin: 0 0 10px;

    font-size: 0.78rem;

    letter-spacing: 0.14em;

    text-transform: uppercase;

    color: var(--lilac);

    font-weight: 800;
}


/*
   Fluid heading.

   Instead of jumping from 2.5rem to 1.9rem
   at exactly 480px, the size changes smoothly.
*/

.party-title {
    font-size: clamp(
            2.5rem,
            6vw,
            2.5rem
    );

    font-weight: 700;

    color: var(--cream);

    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

#name-slot {
    color: var(--gold);
}


/* =========================================================
   CAKE SCENE
   ========================================================= */

.cake-scene {
    /*
       Extra top space for the candles.
    */
    margin: 100px auto 34px;

    /*
       Height of the original cake scene.
    */
    height: 340px;

    display: flex;

    align-items: flex-end;

    justify-content: center;

    /*
       Important:
       don't clip the candles.
    */
    overflow: visible;

    width: 100%;
}


/* =========================================================
   CAKE
   ========================================================= */

/*
   The cake itself remains at one fixed
   internal size.

   We scale the COMPLETE cake instead
   of resizing individual tiers.
*/

.cake {
    position: relative;

    width: 320px;

    flex: none;

    /*
       The cake scales from its bottom center.
       This keeps the plate anchored visually.
    */
    transform-origin: bottom center;

    /*
       Default desktop size.
    */
    transform: scale(1);
}


/* =========================================================
   CANDLES
   ========================================================= */

/*
   IMPORTANT:

   The candle container is positioned
   relative to the TOP cake tier.

   This means the candles stay attached
   to the cake when the cake is scaled.
*/

.cake__tier--top {
    position: relative;

    width: 174px;
    height: 76px;

    background: linear-gradient(
            180deg,
            #fff2d0,
            var(--gold-soft)
    );

    z-index: 3;
}

.candles {
    position: absolute;

    left: 50%;

    /*
       Place the bottom of the candles
       exactly at the top of the cake tier.
    */
    bottom: 100%;

    transform: translateX(-50%);

    display: flex;

    gap: 26px;

    z-index: 5;

    /*
       Prevent the candle group from
       affecting the cake dimensions.
    */
    width: max-content;
}


/* Individual candle */

.candle {
    position: relative;

    width: 9px;
    height: 50px;

    border-radius: 4px;

    background: repeating-linear-gradient(
            180deg,
            var(--pink) 0 8px,
            var(--cream) 8px 16px
    );
}


/* Flame */

.flame {
    position: absolute;

    left: 50%;

    bottom: 100%;

    translate: -50% 0;

    margin-bottom: 6px;

    width: 14px;
    height: 24px;

    border-radius: 50% 50% 50% 50%
        /
        65% 65% 35% 35%;

    background: radial-gradient(
            circle at 50% 30%,
            #fff6d8,
            var(--gold) 55%,
            var(--pink) 100%
    );

    box-shadow: 0 0 18px 4px rgba(244, 185, 66, 0.7);

    transform-origin: bottom center;

    animation: flicker 2.2s ease-in-out infinite;
}


/* Individual flame timing */

.candle:nth-child(2) .flame {
    animation-delay: 0.3s;
}

.candle:nth-child(3) .flame {
    animation-delay: 0.6s;
}

.candle:nth-child(4) .flame {
    animation-delay: 0.15s;
}

.candle:nth-child(5) .flame {
    animation-delay: 0.45s;
}


/* Flame animation */

@keyframes flicker {
    0%,
    100% {
        transform: rotate(-3deg) scaleY(1);
    }

    50% {
        transform: rotate(3deg) scaleY(1.08);
    }
}

.flame.out {
    animation: none;

    opacity: 0;

    transition: opacity 0.3s ease;
}


/* =========================================================
   CAKE TIERS
   ========================================================= */

.cake__tier {
    position: relative;

    border-radius: 18px 18px 8px 8px;

    margin: 0 auto;
}


/* Top tier */

.cake__tier--top {
    width: 174px;
    height: 76px;

    background: linear-gradient(
            180deg,
            #fff2d0,
            var(--gold-soft)
    );

    z-index: 3;
}


/* Middle tier */

.cake__tier--mid {
    width: 246px;
    height: 86px;

    margin-top: -10px;

    background: linear-gradient(
            180deg,
            #ffd8de,
            var(--pink)
    );

    z-index: 2;
}


/* Base tier */

.cake__tier--base {
    width: 320px;
    height: 96px;

    margin-top: -10px;

    background: linear-gradient(
            180deg,
            #d9c2f5,
            var(--lilac)
    );

    z-index: 1;
}


/* Plate */

.cake__plate {
    width: 348px;
    height: 18px;

    margin: 3px auto 0;

    background: rgba(255, 248, 236, 0.85);

    border-radius: 50%;
}


/* Drips */

.drip {
    position: absolute;

    top: 100%;

    width: 20px;
    height: 28px;

    background: inherit;

    border-radius: 0 0 10px 10px;
}

.drip:nth-child(1) {
    left: 14px;
}

.drip:nth-child(2) {
    left: 60px;

    height: 36px;
}

.drip:nth-child(3) {
    left: 108px;
}

.drip:nth-child(4) {
    left: 148px;

    height: 22px;
}


/* =========================================================
   PARTY MESSAGE
   ========================================================= */

.party-msg {
    color: rgba(255, 248, 236, 0.85);

    line-height: 1.6;

    font-size: 1.5rem;

    margin: 0 auto 30px;
}


/* =========================================================
   BLOW BUTTON
   ========================================================= */

.blow-btn {
    padding: 14px 30px;

    border: none;

    border-radius: 999px;

    font-family: var(--font-display);

    font-size: 1rem;

    font-weight: 600;

    color: var(--cream);

    background: linear-gradient(
            180deg,
            var(--pink),
            #e14f6a
    );

    cursor: pointer;

    box-shadow: 0 12px 26px rgba(255, 112, 137, 0.32);

    transition: transform 0.15s ease;

    margin-bottom: 60px;
}

.blow-btn:hover {
    transform: translateY(-2px);
}

.blow-btn:active {
    transform: translateY(0);
}


/* =========================================================
   RESPONSIVE CAKE SCALING
   ========================================================= */

/*
   IMPORTANT:

   We do NOT change the dimensions of:

   - cake
   - cake tiers
   - candles
   - flames
   - plate

   Instead we scale the whole cake.

   This keeps all relative positions intact.
*/


/* Tablets / smaller desktop */

@media (max-width: 700px) {

    .cake {
        transform: scale(0.90);
    }

}


/* Normal phone */

@media (max-width: 480px) {

    #party-screen {
        padding-top: 70px;
    }

    .cake-scene {
        margin-top: 95px;
    }

    .cake {
        transform: scale(0.78);
    }

    .candles {
        gap: 22px;
    }

}


/* Small phone */

@media (max-width: 380px) {

    .cake {
        transform: scale(0.68);
    }

    .candles {
        gap: 20px;
    }

}


/* Very small phone */

@media (max-width: 340px) {

    .cake {
        transform: scale(0.62);
    }

    .candles {
        gap: 18px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;

        animation-iteration-count: 1 !important;
    }
}