* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center horizontally */
    justify-content: flex-start; /* Stack content from the top */
    min-height: 100vh; /* Full viewport height */
    margin: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(123, 79, 156, 0.45), transparent 60%),
        linear-gradient(160deg, #1b1330 0%, #2d1b4e 45%, #140f24 100%);
    font-family: 'Poppins', 'Avenir Next', Arial, sans-serif;
    padding: 40px 20px 60px; /* Add padding to create space around content */
    overflow-y: auto; /* Allow the body to scroll */
    overflow-x: hidden;
    position: relative;
}

html {
    background: #140f24; /* Prevents a white flash/edges on mobile browsers */
}

/* Keep the opening screen isolated when mobile browser chrome changes height. */
body.landing-active {
    height: 100dvh;
    overflow: hidden;
}

body.landing-active .reveal-row,
body.landing-active .quiz-gate,
body.landing-active .quiz {
    display: none !important;
}

/* Soft bokeh lights and twinkling sparks drifting behind the content */
.bokeh-field {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.bokeh {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 213, 141, 0.45), rgba(244, 213, 141, 0) 70%);
    filter: blur(2px);
    animation: bokehDrift 10s ease-in-out infinite;
}

@keyframes bokehDrift {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-18px) scale(1.15); opacity: 0.9; }
}

.spark {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #f7f1e8;
    box-shadow: 0 0 6px 1px rgba(247, 241, 232, 0.8);
    animation: sparkTwinkle 3.5s ease-in-out infinite;
}

@keyframes sparkTwinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* Landing hero shown before the gift is revealed */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
    padding: 20px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.landing.hide {
    opacity: 0;
    transform: scale(0.95);
}

.landing-greeting {
    font-family: 'Playfair Display', serif;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(247, 241, 232, 0.85);
    margin: 0 0 8px;
}

.landing-name {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(48px, 11vw, 88px);
    font-weight: 700;
    color: #f7ead2;
    margin: 0 0 36px;
    text-shadow: 0 0 18px rgba(244, 213, 141, 0.55), 0 0 40px rgba(244, 213, 141, 0.25);
}

.landing-button {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f7f1e8;
    background: transparent;
    border: 1px solid rgba(247, 241, 232, 0.55);
    border-radius: 999px;
    padding: 14px 32px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.landing-button:hover {
    background: rgba(247, 241, 232, 0.12);
    box-shadow: 0 0 24px rgba(244, 213, 141, 0.35);
    transform: translateY(-2px);
}

.landing-note {
    margin-top: 22px;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 14px;
    color: rgba(247, 241, 232, 0.55);
    letter-spacing: 0.04em;
}

/* Sparkle burst on opening */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    border-radius: 2px;
    opacity: 0.9;
    animation-name: confettiFall;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation-fill-mode: forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(540deg);
        opacity: 0;
    }
}

.reveal-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    width: 100%;
    max-width: 920px;
    margin-top: 28px;
}

@media (min-width: 760px) {
    .reveal-row {
        flex-direction: row;
        align-items: flex-start;
    }

    .reveal-row .birthday-media {
        max-width: 300px;
        flex: 0 0 auto;
    }

    .reveal-row .message {
        flex: 1 1 auto;
        max-width: 480px;
    }
}

.message {
    display: none; /* Hide initially */
    opacity: 0;
    margin-top: 0;
    font-size: clamp(18px, 1.7vw, 20px);
    color: #f1ebe2; /* Warm off-white for message text */
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-align: left; /* Align the message text to the left */
    line-height: 1.8; /* Increase line height for readability */
    padding: 28px 30px;
    background: rgba(255, 255, 255, 0.06); /* Dark glassmorphism card */
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(247, 241, 232, 0.18);
    border-radius: 26px; /* Rounded corners */
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); /* Soft shadow for 3D effect */
    max-width: 600px; /* Limit width for readability */
    transform: translateY(24px) scale(0.97);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.message.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.message h2 {
    margin: 0 0 24px;
    color: #f4d58d;
    font-family: 'Dancing Script', cursive;
    font-size: clamp(36px, 6vw, 48px);
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 0 18px rgba(244, 213, 141, 0.38);
}

.message p {
    margin: 0 0 20px;
}

.message p:nth-of-type(3n + 1) {
    color: #f8e5df;
}

.message p:nth-of-type(3n + 2) {
    color: #eadcf5;
}

.message p:nth-of-type(3n) {
    color: #d9eef0;
}

.message p:first-of-type {
    color: #f0a6b4;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95em;
    letter-spacing: 0.03em;
}

.message .word {
    display: inline-block; /* keep characters of a word from wrapping mid-word */
}

.message .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.message .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.message strong {
    color: #ffc0cb; /* Warm blush accent for emphasis */
}

.message em {
    font-family: 'Dancing Script', cursive; /* Match the landing's script signature */
    font-size: 30px;
    font-weight: 700;
    color: #f4d58d; /* Gold accent for the signature */
    font-style: normal;
    text-shadow: 0 0 14px rgba(244, 213, 141, 0.4);
}

.birthday-media {
    display: none; /* Initially hidden */
    opacity: 0;
    margin-top: 0;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 5 / 7;
    padding: 7px;
    border: 1px solid rgba(247, 234, 210, 0.72);
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(247, 241, 232, 0.15);
    transform: translateY(24px) scale(0.96);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
    overflow: hidden;
    background: rgba(17, 10, 32, 0.8);
}

.birthday-media.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.birthday-media:hover {
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), 0 0 0 6px rgba(247, 241, 232, 0.25);
}

.media-stage {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 5 / 7;
    overflow: hidden;
    border-radius: 17px;
    background: #0f0a18;
}

.memory-slide {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transform: scale(1.04);
    transition: opacity 0.45s ease, transform 0.65s ease;
}

.memory-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.memory-slide img,
.memory-slide video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 759px) {
    .landing {
        min-height: calc(100dvh - 100px);
    }

    .birthday-media {
        width: min(88vw, 340px);
        max-width: 100%;
    }
}

/* Round challenge button shown after the message finishes typing */
.quiz-gate {
    display: none;
    opacity: 0;
    width: 100%;
    max-width: 920px;
    margin-top: 30px;
    padding-left: clamp(0px, 4vw, 34px);
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.quiz-gate.show {
    opacity: 1;
    transform: translateY(0);
}

.worthy-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 126px;
    height: 126px;
    padding: 18px;
    color: #f9e9df;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.15), transparent 30%),
        linear-gradient(145deg, #b52d55, #6f1237 72%);
    border: 1px solid rgba(255, 221, 226, 0.35);
    border-radius: 50%;
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.38),
        inset 0 1px 1px rgba(255, 255, 255, 0.2),
        0 0 24px rgba(181, 45, 85, 0.24);
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    line-height: 1.15;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.worthy-button::after {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(255, 236, 230, 0.12);
    border-radius: 50%;
    pointer-events: none;
}

.worthy-button:hover {
    filter: brightness(1.08);
    transform: translateY(-4px) scale(1.03);
    box-shadow:
        0 20px 38px rgba(0, 0, 0, 0.44),
        inset 0 1px 1px rgba(255, 255, 255, 0.22),
        0 0 32px rgba(181, 45, 85, 0.36);
}

.worthy-button:focus-visible {
    outline: 3px solid #f4d58d;
    outline-offset: 5px;
}

.quiz-gate.used {
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
}

@media (max-width: 759px) {
    .quiz-gate {
        display: none;
        justify-content: flex-start;
        padding-left: max(8px, 5vw);
    }

    .quiz-gate.show {
        display: flex;
    }

    .worthy-button {
        width: 112px;
        height: 112px;
        font-size: 15px;
    }
}

/* Full-screen quiz experience revealed after the challenge button is clicked */
.quiz {
    display: none;
    opacity: 0;
    position: fixed;
    inset: 0;
    z-index: 10000;
    width: 100vw;
    height: 100dvh;
    padding: 34px 20px;
    overflow-y: auto;
    text-align: center;
    background:
        radial-gradient(circle at 50% 35%, rgba(125, 54, 117, 0.55), transparent 40%),
        linear-gradient(155deg, #160d28 0%, #30143f 50%, #110a20 100%);
    transition: opacity 0.65s ease;
}

.quiz.show {
    opacity: 1;
}

body.quiz-open {
    overflow: hidden;
}

.quiz-content {
    position: relative;
    z-index: 2;
    width: min(100%, 480px);
    margin: max(4vh, 28px) auto;
    animation: quizArrive 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes quizArrive {
    from { opacity: 0; transform: translateY(30px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.quiz-eyebrow {
    margin: 0 0 8px;
    color: #e8b4bc;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.quiz-title {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(20px, 4vw, 26px);
    color: #f7ead2;
    margin: 0 0 20px;
    text-shadow: 0 0 14px rgba(244, 213, 141, 0.3);
}

.quiz-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(247, 241, 232, 0.18);
    border-radius: 26px;
    padding: 28px 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.flying-photos {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.flying-photo {
    position: absolute;
    width: clamp(76px, 10vw, 132px);
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border: 4px solid rgba(255, 245, 238, 0.86);
    border-radius: 16px;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.45);
    opacity: 0.72;
    animation: photoFly 9s ease-in-out infinite alternate;
}

.photo-one { top: 8%; left: 4%; transform: rotate(-12deg); animation-delay: -1s; }
.photo-two { top: 5%; right: 5%; transform: rotate(10deg); animation-delay: -4s; }
.photo-three { top: 43%; left: 2%; transform: rotate(8deg); animation-delay: -6s; }
.photo-four { top: 45%; right: 2%; transform: rotate(-9deg); animation-delay: -2s; }
.photo-five { bottom: 2%; left: 11%; transform: rotate(-6deg); animation-delay: -7s; }
.photo-six { bottom: 3%; right: 10%; transform: rotate(12deg); animation-delay: -3s; }

@keyframes photoFly {
    0% { translate: 0 0; }
    35% { translate: 18px -24px; }
    70% { translate: -14px 18px; }
    100% { translate: 12px -12px; }
}

@media (max-width: 720px) {
    .quiz {
        padding: 24px 15px;
    }

    .quiz-content {
        width: min(100%, 410px);
        margin-top: 7vh;
    }

    .quiz-card {
        padding: 24px 20px;
    }

    .flying-photo {
        width: 74px;
        opacity: 0.4;
        border-width: 3px;
    }

    .photo-one { top: 1%; left: -17px; }
    .photo-two { top: 2%; right: -18px; }
    .photo-three { top: 39%; left: -42px; }
    .photo-four { top: 43%; right: -42px; }
    .photo-five { bottom: -15px; left: -5px; }
    .photo-six { bottom: -15px; right: -5px; }
}

@media (prefers-reduced-motion: reduce) {
    .flying-photo,
    .quiz-content {
        animation: none;
    }
}

.quiz-progress {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(247, 241, 232, 0.55);
    margin: 0 0 12px;
}

.quiz-question {
    font-family: 'Avenir Next', 'Poppins', sans-serif;
    font-size: 19px;
    color: #f1ebe2;
    margin: 0 0 20px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    color: #f7f1e8;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(247, 241, 232, 0.25);
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    text-align: left;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
    background: rgba(247, 241, 232, 0.12);
    border-color: rgba(244, 213, 141, 0.5);
    transform: translateY(-1px);
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-option.correct {
    background: rgba(120, 200, 150, 0.25);
    border-color: rgba(120, 220, 160, 0.7);
    color: #eafff1;
}

.quiz-option.incorrect {
    background: rgba(220, 100, 110, 0.25);
    border-color: rgba(230, 120, 130, 0.7);
    color: #ffeef0;
}

.quiz-score {
    font-family: 'Dancing Script', cursive;
    font-size: 48px;
    font-weight: 700;
    color: #f4d58d;
    margin: 0 0 10px;
    text-shadow: 0 0 18px rgba(244, 213, 141, 0.5);
}

.quiz-verdict {
    font-family: 'Avenir Next', 'Poppins', sans-serif;
    font-size: 16px;
    color: #f1ebe2;
    margin: 0 0 22px;
}

.quiz-retry {
    font-family: 'Playfair Display', serif;
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #f7f1e8;
    background: transparent;
    border: 1px solid rgba(247, 241, 232, 0.55);
    border-radius: 999px;
    padding: 12px 28px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.quiz-retry:hover {
    background: rgba(247, 241, 232, 0.12);
    transform: translateY(-2px);
}
