/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: #5a3e3e;
    overflow-x: hidden;
    min-height: 100vh;
}

img,
video {
    max-width: 100%;
    height: auto;
}

h1,
h2 {
    font-family: 'Dancing Script', cursive;
    color: #d6336c;
}

.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s ease-in-out;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none;
    /* For logic hiding, not animation */
}

/* Hero Section */
#hero {
    text-align: center;
}

.header-text {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.typewriter {
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 30px;
    min-height: 120px;
    white-space: pre-wrap;
    background: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.scroll-indicator {
    margin-top: 50px;
    font-size: 1rem;
    animation: bounce 2s infinite;
    opacity: 0.7;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Video Section */
.video-container {
    background: white;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 90%;
    width: 600px;
    text-align: center;
}

.romantic-video {
    width: 100%;
    border-radius: 10px;
}

.caption {
    margin-top: 15px;
    font-style: italic;
    color: #777;
}

/* Envelope Section */
.envelope-wrapper {
    background: #f7f7f7;
    height: 300px;
    width: 400px;
    position: relative;
    border-radius: 10px;
    /* Envelope shape base */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s;
    margin: 40px auto;
    /* Centered with vertical spacing */
}

.envelope-wrapper:hover {
    transform: scale(1.05);
}

/* Simple CSS envelope representation */
.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    background: #ff6b6b;
    border-radius: 0 0 10px 10px;
}

.envelope::before {
    /* Flap */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 100px solid #ff8787;
    transform-origin: top;
    transition: transform 0.5s 0.2s;
    /* Open delay */
    z-index: 5;
}

.envelope.open::before {
    transform: rotateX(180deg);
    z-index: 1;
}

.card {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: white;
    padding: 20px;
    text-align: center;
    transition: transform 0.5s 0.5s, z-index 0.5s 0.5s;
    transform: translateY(0);
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.envelope.open .card {
    transform: translateY(-120px);
    z-index: 6;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.instruction {
    margin-top: 50px;
    font-size: 1.2rem;
    color: #d6336c;
}

/* Questions Section */
.question-box {
    display: none;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 90%;
    width: 450px;
    animation: fadeIn 0.5s;
}

.question-box.active {
    display: block;
}

/* Reward Display */
.reward-container {
    text-align: center;
    margin-bottom: 20px;
    display: none;
    /* Hidden by default */
}

.reward-container.show {
    display: block;
    animation: popIn 0.5s;
}

.reward-media {
    width: 300px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid #fff;
    margin-bottom: 10px;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.btn {
    padding: 10px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s;
}

.yes-btn {
    background-color: #ff6b6b;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: heartbeat 2s infinite;
}

.yes-btn:hover {
    background-color: #ff4757;
    transform: scale(1.1);
    animation: none;
    /* Stop pulsing on hover */
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.no-btn {
    background-color: #e0e0e0;
    color: #555;
    position: relative;
}

.plea-message {
    color: #e63946;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 15px;
    display: none;
    /* Hidden by default until JS toggles shows it */
}

.plea-message.show {
    display: block;
    animation: fadeIn 0.5s;
}

/* Lyrics Section */
.lyrics-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: opacity 0.5s;
}

#lyrics-display {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    display: none;
    /* Hidden initially */
}

#lyrics-display.show {
    display: flex;
}

.penguin-container {
    position: relative;
    height: 60px;
    width: 100%;
    margin-bottom: 10px;
    overflow: hidden;
}

.penguin {
    font-size: 50px;
    position: absolute;
    right: 100%;
    /* Start off-screen left */
    transition: right 2s ease-out;
}

.penguin.walk {
    right: 48%;
    /* Walk to center */
}

.lyrics-envelope {
    /* Reuse basic envelope styles or override */
    background: #f7f7f7;
    height: 400px;
    /* Taller for lyrics */
    width: 500px;
    /* Wider */
    position: relative;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
    /* Penguin opens it */
    margin-top: 20px;
}

.lyrics-envelope .envelope {
    width: 400px;
    height: 280px;
}

.lyrics-envelope .envelope::before {
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-top: 140px solid #ff8787;
}

.lyrics-card {
    padding: 15px;
    overflow-y: auto;
    /* Scrollable */
    text-align: left;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    line-height: 1.4;
}

/* Custom scrollbar for lyrics */
.lyrics-card::-webkit-scrollbar {
    width: 5px;
}

.lyrics-card::-webkit-scrollbar-thumb {
    background: #ffb199;
    border-radius: 5px;
}

.lyrics-envelope.open .card {
    transform: translateY(-180px);
    /* Move up more */
    z-index: 6;
    height: 450px;
    /* Expand card height significantly for lyrics */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

/* Final Section */
.final-content {
    text-align: center;
}

.final-photo {
    width: 300px;
    height: 300px;
    /* Square crop if not square */
    object-fit: cover;
    border-radius: 20px;
    border: 5px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    animation: float 6s ease-in-out infinite;
}

.final-quote {
    font-size: 1.5rem;
    font-weight: 600;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Falling Petals */
.petal {
    position: fixed;
    top: -10vh;
    font-size: 20px;
    animation: fall linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(720deg);
    }
}

/* Tablet Responsiveness */
@media (min-width: 601px) and (max-width: 900px) {
    .header-text {
        font-size: 3rem;
    }

    .envelope-wrapper {
        width: 350px;
        height: 250px;
    }

    .envelope {
        width: 250px;
        height: 180px;
    }

    .envelope::before {
        border-left-width: 125px;
        border-right-width: 125px;
        border-top-width: 80px;
    }

    .lyrics-envelope {
        width: 400px;
        height: 350px;
        margin: 0 auto;
    }

    .lyrics-envelope .envelope {
        width: 320px;
        height: 220px;
    }

    .lyrics-envelope .envelope::before {
        border-left-width: 160px;
        border-right-width: 160px;
        border-top-width: 110px;
    }

    .lyrics-envelope.open .card {
        transform: translateY(-130px);
        height: 350px;
    }

    .video-container {
        width: 450px;
    }

    .question-box {
        width: 400px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .header-text {
        font-size: 2rem;
        word-wrap: break-word;
    }

    .section {
        padding: 10px;
    }

    /* Fluid Envelope */
    .envelope-wrapper {
        width: 280px;
        /* Base size */
        height: 180px;
        max-width: 90%;
    }

    .envelope {
        width: 100%;
        height: 100%;
    }

    .envelope::before {
        border-left-width: 140px;
        /* Half of 280 roughly */
        border-right-width: 140px;
        border-top-width: 90px;
    }

    .envelope.open .card {
        transform: translateY(-80px);
    }

    .card {
        padding: 10px;
        font-size: 0.8rem;
    }

    .final-photo {
        width: 80%;
        max-width: 250px;
        height: auto;
        aspect-ratio: 1/1;
    }

    /* Fluid Lyrics */
    .lyrics-envelope {
        width: 95%;
        max-width: 320px;
        height: 250px;
    }

    .lyrics-envelope .envelope {
        width: 100%;
        height: 180px;
    }

    .lyrics-envelope .envelope::before {
        border-left-width: 50vw;
        /* Responsive flap */
        border-right-width: 50vw;
        border-top-width: 100px;
        max-width: 160px;
        /* Cap flap size */
    }

    /* Fix flap for lyrics specifically to match width? 
       Actually, borders are tricky with %. Let's stick to safe fixed small pixels that fit 320px screens.
    */
    .lyrics-envelope .envelope::before {
        border-left-width: 140px;
        border-right-width: 140px;
        border-top-width: 100px;
        left: 50%;
        transform: translateX(-50%);
        max-width: none;
    }

    .lyrics-envelope.open .card {
        transform: translateY(-100px);
        height: 300px;
        width: 90%;
        left: 5%;
        /* Center it */
    }

    .penguin {
        font-size: 30px;
    }

    .penguin.walk {
        right: 40%;
    }

    .typewriter {
        font-size: 0.9rem;
        padding: 15px;
        width: 90%;
    }

    .video-container {
        width: 95%;
    }

    .question-box {
        width: 90%;
    }

    .reward-media {
        width: 100%;
        height: auto;
    }
}

/* Cursor Heart Trail */
.cursor-heart {
    position: absolute;
    font-size: 20px;
    pointer-events: none;
    animation: fadeUp 1s ease-out forwards;
    z-index: 1000;
}

@keyframes fadeUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.5);
    }
}