:root {
    --primary-color: #ff4d6d;
    --bg-color: #ffe5ec;
    --text-color: #590d22;
    --heart-color: #ff0f4c;
    --glow: rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* ensure no scrolling anywhere */
}

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    width: 100%;
    overflow: hidden; /* single-page, no scrolling */
    /* Smooth, covering background that adapts to all viewports */
    background: radial-gradient(circle at top, #ffd6e0 0%, #ffa6c1 35%, #ff6b9f 70%, #ff4d6d 100%);
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-color);
    position: relative;
}

body::before,
body::after {
    content: '';
    position: absolute;
    /* keep decorative layers slightly outside the viewport so edges don't show seams */
    inset: -8%;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.5) 0 6px, transparent 6px),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.4) 0 8px, transparent 8px),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.35) 0 5px, transparent 5px),
        radial-gradient(circle at 60% 30%, rgba(255, 255, 255, 0.45) 0 4px, transparent 4px);
    /* make the decorative pattern scale with the viewport so it doesn't tile visibly */
    background-size: 45vmin 45vmin;
    background-repeat: no-repeat;
    animation: drift 35s linear infinite;
    z-index: 0;
    opacity: 0.7;
    pointer-events: none;
}

body::after {
    animation-duration: 50s;
    opacity: 0.45;
}

#main-container {
    position: relative;
    width: 100%;
    height: 100vh; /* force single-page, viewport-sized stage */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.98);
    transition: opacity 0.9s ease, transform 0.9s ease, visibility 0.9s;
}

/* Make sure the finale stage never exceeds viewport */
#stage-finale {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#stage-finale.active {
    z-index: 1000 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.stage.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 10;
}

/* Stage 1 */
.heart-container {
    width: clamp(140px, 18vw, 220px);
    height: clamp(140px, 18vw, 220px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 65%);
    border-radius: 50%;
    animation: heartbeat 2.4s ease-in-out infinite;
    position: relative;
}

.heart-container::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: pulseGlow 3s ease-in-out infinite;
}

.heart-container.zooming {
    animation: introZoom 1.3s forwards ease-in;
}

.heart-svg {
    width: 80%;
    height: 80%;
    fill: var(--heart-color);
    filter: drop-shadow(0 0 16px rgba(255, 15, 76, 0.5));
}

.fade-in-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2rem, 5vw, 3.8rem);
    margin-top: 24px;
    opacity: 0;
    animation: fadeIn 2.5s forwards 0.4s;
    color: white;
    text-shadow: 0 6px 18px rgba(255, 0, 76, 0.45);
}

/* Stage 2 */
.reveal-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: clamp(2rem, 6vw, 3.5rem);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: popIn 1.2s ease forwards;
    box-shadow: 0 25px 60px rgba(89, 13, 34, 0.25);
}

.emoji {
    font-size: clamp(4rem, 12vw, 8rem);
    margin-bottom: 1rem;
}

#stage-reveal h2 {
    font-size: clamp(3rem, 8vw, 4.5rem);
    color: white;
    letter-spacing: 4px;
    text-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* Stage 3 */
#stage-question {
    gap: 2.5rem;
}

#wait-message h2 {
    font-size: clamp(2rem, 6vw, 3rem);
    color: white;
    animation: pulse 1.2s ease-in-out infinite;
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#question-box {
    width: min(480px, 90vw);
    padding: clamp(2rem, 6vw, 3.5rem);
    border-radius: 35px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 35px 70px rgba(89, 13, 34, 0.3);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

#question-box.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#question-box h2 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 2rem;
    color: #800f2f;
    text-shadow: 0 10px 20px rgba(255, 255, 255, 0.6);
}

.buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    position: relative;
    min-height: 150px;
    overflow: hidden;
}

button {
    padding: 14px 48px;
    font-size: 1.3rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    letter-spacing: 1px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#yes-btn {
    background: linear-gradient(135deg, #ffc3d4, #ff4d6d);
    color: white;
    box-shadow: 0 18px 35px rgba(255, 77, 109, 0.45);
}

#yes-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 25px 45px rgba(255, 77, 109, 0.6);
}

#no-btn {
    background: rgba(255, 255, 255, 0.85);
    color: #ff0f4c;
    position: relative;
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.15);
    transition: left 0.25s ease, top 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

/* Stage 4 */
#stage-finale {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 5vw, 48px);
}

.finale-heart {
    width: clamp(180px, 28vw, 360px);
    aspect-ratio: 1 / 1;
    display: none;
    align-items: center;
    justify-content: center;
    --beat-speed: 1.8s;
    animation: finaleBeat var(--beat-speed) cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    filter: drop-shadow(0 0 25px rgba(255, 77, 109, 0.7));
    position: relative;
    z-index: 5;
    transform-origin: center;
    will-change: transform;
}

.finale-heart svg {
    width: 90%;
    height: 90%;
    fill: var(--heart-color);
    display: block;
}

.finale-heart.pulse-glow {
    filter: drop-shadow(0 0 30px rgba(255, 77, 109, 0.9)) drop-shadow(0 0 60px rgba(255, 77, 109, 0.6));
}

.finale-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2.5rem, 7vw, 4.8rem);
    color: white;
    text-shadow: 0 0 20px rgba(255, 77, 109, 0.85), 0 0 45px rgba(255, 77, 109, 0.6);
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
    margin-top: clamp(24px, 4vw, 36px);
    text-align: center;
    pointer-events: none;
}

.finale-text.show {
    opacity: 1;
    transform: translateY(0);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.1);
    }

    60% {
        transform: scale(0.98);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.2;
    }

    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

@keyframes introZoom {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(12);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    70% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(0, -8%, 0) rotate(6deg);
    }
}

@keyframes finaleBeat {
    0% {
        transform: scale(1);
    }

    8% {
        transform: scale(1.12);
    }

    18% {
        transform: scale(0.96);
    }

    28% {
        transform: scale(1.08);
    }

    40% {
        transform: scale(0.98);
    }

    55% {
        transform: scale(1.04);
    }

    70% {
        transform: scale(0.99);
    }

    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    #main-container {
        padding: 1.5rem 0.75rem;
        height: 100vh;
    }

    .stage {
        padding: 1.5rem;
    }

    .fade-in-text {
        font-size: 1.9rem;
        text-align: center;
        padding: 0 1rem;
    }

    .heart-container {
        width: 150px;
        height: 150px;
    }

    #question-box {
        width: 100%;
        max-width: 360px;
        padding: 1.75rem 1.5rem;
    }

    .buttons {
        flex-direction: column;
        align-items: stretch;
        min-height: 200px;
    }

    button {
        width: 100%;
        padding: 14px 0;
        font-size: 1.1rem;
    }

    .finale-text {
        padding: 0 1.5rem;
        text-align: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #main-container {
        padding: 1.5rem 1rem;
    }

    .stage {
        padding: 2rem;
    }

    #question-box {
        max-width: 420px;
    }

    .buttons {
        gap: 2rem;
    }
}