
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Poppins:wght@300;400;500;600&family=Caveat:wght@500;600&display=swap');

:root {
    --pink: #e98fae;
    --dark-pink: #c65f87;
    --light-pink: #fff0f5;
    --lavender: #f2eafa;
    --text: #624956;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #fff1f5, #f5edff, #ffeaf1);
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: auto;
    padding: 35px 20px 70px;
    position: relative;
    z-index: 2;
}

.page {
    display: none;
    animation: fadeIn 0.8s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.intro, .surprise-heading {
    text-align: center;
    margin: 15px 0 35px;
}

.small-heart {
    color: var(--dark-pink);
    font-size: 36px;
}

.intro h1, .surprise-heading h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(35px, 7vw, 54px);
    color: #a94f77;
    margin: 8px 0;
}

.intro p, .surprise-heading p {
    font-size: 14px;
    color: #997c8b;
}

.decorative-line {
    display: block;
    color: var(--pink);
    margin-top: 20px;
}

.form-card {
    max-width: 570px;
    margin: auto;
    background: rgba(255,255,255,0.88);
    padding: 35px;
    border-radius: 24px;
    box-shadow: 0 15px 45px rgba(176, 105, 140, 0.12);
    border: 1px solid rgba(255,255,255,0.9);
}

.form-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 27px;
    text-align: center;
    color: #a94f77;
}

.form-subtitle {
    text-align: center;
    font-size: 13px;
    margin: 8px 0 25px;
    color: #a58a98;
}

form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin: 17px 0 8px;
}

input, textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid #f0d5e1;
    border-radius: 12px;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: var(--text);
    background: #fffafd;
}

input:focus, textarea:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(233,143,174,0.12);
}

textarea {
    resize: vertical;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.image-preview img {
    width: 85px;
    height: 85px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid white;
    box-shadow: 0 3px 10px #e9c8d8;
}

.primary-btn, .secondary-btn {
    display: block;
    width: 100%;
    max-width: 340px;
    margin: 25px auto 0;
    padding: 14px 20px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #e99ab7, #c96d96);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 7px 18px rgba(201,109,150,0.22);
}

.primary-btn:hover, .secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(201,109,150,0.3);
}

.secondary-btn {
    background: white;
    color: #b15e82;
    border: 1px solid #eccbd9;
}

.envelope-area {
    text-align: center;
    padding: 35px 10px 15px;
}

.envelope {
    width: 230px;
    height: 155px;
    margin: auto;
    position: relative;
    cursor: pointer;
    perspective: 700px;
    filter: drop-shadow(0 12px 12px rgba(170,90,125,0.18));
    transition: transform 0.3s;
}

.envelope:hover {
    transform: translateY(-6px);
}

.envelope-back {
    position: absolute;
    inset: 0;
    background: #e8a0b9;
    border-radius: 5px;
}

.envelope-front {
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 115px solid #f4c1d1;
    border-right: 115px solid #e9a9bf;
    border-top: 78px solid transparent;
    z-index: 3;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 115px solid transparent;
    border-right: 115px solid transparent;
    border-top: 90px solid #d982a2;
    transform-origin: top;
    transition: transform 0.8s ease;
    z-index: 4;
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.letter-paper {
    position: absolute;
    width: 195px;
    height: 125px;
    left: 17px;
    top: 12px;
    background: #fffafc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Caveat', cursive;
    font-size: 23px;
    color: #b45c82;
    transition: transform 1s ease;
    z-index: 2;
}

.envelope.open .letter-paper {
    transform: translateY(-105px);
}

.envelope-heart {
    position: absolute;
    top: 56px;
    left: 98px;
    z-index: 5;
    color: white;
    font-size: 30px;
    pointer-events: none;
}

.click-hint {
    margin-top: 28px;
    font-size: 13px;
    color: #a77c91;
}

.letter-content {
    max-width: 650px;
    margin: 35px auto;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 1s ease, opacity 0.8s ease;
}

.letter-content.show {
    max-height: 700px;
    opacity: 1;
}

.letter-inner {
    background: #fffafc;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #f0d8e3;
    box-shadow: 0 12px 30px rgba(174,103,137,0.12);
    background-image: repeating-linear-gradient(
        transparent,
        transparent 34px,
        #f6e6ed 35px
    );
}

.letter-decoration {
    display: block;
    text-align: center;
    font-size: 35px;
    color: var(--pink);
}

.letter-inner h2 {
    font-family: 'Playfair Display', serif;
    color: #a94f77;
    margin: 15px 0;
}

#displayMessage {
    white-space: pre-wrap;
    line-height: 2;
    font-size: 14px;
}

.letter-ending {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    color: #b35d82;
    text-align: right;
    margin-top: 25px;
}

.gallery-section {
    text-align: center;
    margin: 65px 0 35px;
}

.gallery-section h2 {
    font-family: 'Playfair Display', serif;
    color: #a94f77;
    font-size: 32px;
}

.section-subtitle {
    font-size: 13px;
    color: #a58a98;
    margin: 10px 0 30px;
}

.scrapbook-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
}

.polaroid {
    width: 215px;
    padding: 10px 10px 20px;
    background: white;
    box-shadow: 0 8px 20px rgba(135,85,110,0.15);
    transform: rotate(-3deg);
    transition: transform 0.4s;
    position: relative;
}

.polaroid:nth-child(even) {
    transform: rotate(4deg);
}

.polaroid:hover {
    transform: rotate(0) scale(1.06);
    z-index: 2;
}

.polaroid img {
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.polaroid p {
    font-family: 'Caveat', cursive;
    font-size: 21px;
    text-align: center;
    color: #a75c7d;
    margin-top: 9px;
}

.certificate {
    max-width: 700px;
    margin: 35px auto;
    padding: 12px;
    background: #f9e9ef;
    box-shadow: 0 12px 35px rgba(153,83,115,0.15);
}

.certificate-border {
    border: 2px solid #d7a1b6;
    outline: 1px solid #d7a1b6;
    outline-offset: 5px;
    padding: 45px 20px;
    text-align: center;
    background: #fffafc;
    position: relative;
}

.certificate-top {
    font-size: 11px;
    letter-spacing: 3px;
    color: #b36d8c;
}

.certificate-heart {
    font-size: 60px;
    color: #d984a4;
    margin: 15px 0;
}

.certificate h1 {
    font-family: 'Playfair Display', serif;
    color: #a94f77;
    font-size: clamp(30px, 6vw, 44px);
    margin: 10px 0 25px;
}

.certificate-text {
    font-size: 13px;
    color: #8f7180;
    margin: 12px 0;
}

.certificate h2 {
    font-family: 'Caveat', cursive;
    color: #c46b91;
    font-size: 42px;
    border-bottom: 1px solid #e9c8d7;
    display: inline-block;
    padding: 0 35px 8px;
    margin: 10px 0;
}

.certificate-divider {
    color: #d984a4;
    margin: 25px 0;
    font-size: 22px;
}

.certificate-from {
    font-size: 13px;
    color: #997a89;
}

.certificate h3 {
    font-family: 'Caveat', cursive;
    color: #b15e82;
    font-size: 31px;
    margin-top: 5px;
}

.certificate-date {
    font-size: 12px;
    color: #a88c99;
    margin-top: 25px;
}

.certificate-bottom {
    font-family: 'Caveat', cursive;
    color: #b15e82;
    font-size: 21px;
    margin-top: 30px;
}

.background-hearts {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.floating-heart {
    position: absolute;
    bottom: -30px;
    color: rgba(218, 111, 155, 0.35);
    animation: floatUp linear forwards;
    pointer-events: none;
}

@keyframes floatUp {
    from { transform: translateY(0) rotate(0); opacity: 0; }
    10% { opacity: 1; }
    to { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

@media (max-width: 600px) {
    .container {
        padding: 25px 14px 50px;
    }

    .form-card {
        padding: 24px 18px;
    }

    .letter-inner {
        padding: 25px 20px;
    }

    .polaroid {
        width: 175px;
    }

    .polaroid img {
        height: 150px;
    }

    .certificate-border {
        padding: 35px 12px;
    }
}

@media print {
    body {
        background: white;
    }

    body * {
        visibility: hidden;
    }

    #certificatePage, #certificatePage * {
        visibility: visible;
    }

    #certificatePage {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .print-btn, .secondary-btn {
        display: none !important;
    }

    .certificate {
        box-shadow: none;
        margin: 20px auto;
    }
}
