@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --cream: #fffaf5;
    --soft-pink: #ffe4ec;
    --pink: #f4a6bc;
    --deep-pink: #c85b83;
    --dark-rose: #80445e;
    --text: #735260;
    --white: #ffffff;
    --shadow: rgba(196, 104, 139, 0.15);
}

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

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;

    background:
        radial-gradient(ellipse at 15% 20%, #ffe0e9 0%, transparent 40%),
        radial-gradient(ellipse at 85% 75%, #fce8dc 0%, transparent 42%),
        linear-gradient(135deg, #fffaf5, #fff0f4, #fff8ef);

    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

button {
    font: inherit;
}

button:focus-visible {
    outline: 3px solid var(--deep-pink);
    outline-offset: 5px;
}

button:disabled {
    cursor: wait;
    opacity: 0.8;
}

/* =====================================
   پس زمینه و نورهای صورتی
===================================== */

.background-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(3px);
    pointer-events: none;
    z-index: -1;
    animation: glow 7s ease-in-out infinite alternate;
}

.glow-one {
    width: 300px;
    height: 300px;
    top: 10%;
    right: -100px;
    background: rgba(255, 145, 190, 0.3);
}

.glow-two {
    width: 360px;
    height: 360px;
    bottom: -150px;
    left: -100px;
    background: rgba(255, 193, 168, 0.35);
    animation-delay: 2s;
}

/* نورهای اضافه پس زمینه */

.ambient-light {
    position: fixed;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    filter: blur(65px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.55;
    animation: ambientDrift 12s ease-in-out infinite alternate;
}

.ambient-light-one {
    top: 35%;
    left: 15%;
    background: rgba(255, 121, 177, 0.3);
}

.ambient-light-two {
    top: 55%;
    right: 10%;
    background: rgba(255, 189, 209, 0.4);
    animation-delay: -5s;
}

/* =====================================
   ساختار کلی صفحه
===================================== */

.main-container {
    min-height: 100vh;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 7%;
    position: relative;
    z-index: 2;

    display: flex;
    flex-direction: column;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--dark-rose);
    font-size: 17px;
    font-weight: 700;
}

.brand-heart {
    color: #dc7296;
    font-size: 27px;
    animation: heartbeat 1.8s infinite;

    text-shadow: 0 0 20px rgba(230, 110, 155, 0.4);
}

/* =====================================
   دکمه موسیقی
===================================== */

.music-button {
    position: relative;
    overflow: hidden;

    border: 1px solid rgba(200, 91, 131, 0.22);
    background: rgba(255, 255, 255, 0.76);
    color: var(--dark-rose);

    border-radius: 30px;
    padding: 10px 17px;

    display: flex;
    align-items: center;
    gap: 9px;

    cursor: pointer;

    transition:
        background 0.3s,
        transform 0.3s,
        box-shadow 0.3s;

    box-shadow: 0 5px 20px rgba(196, 104, 139, 0.08);

    backdrop-filter: blur(12px);
}

.music-button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(196, 104, 139, 0.18);
}

#musicIcon {
    font-size: 19px;
}

.music-button.is-playing #musicIcon {
    animation: musicPulse 1s ease-in-out infinite;
}

/* =====================================
   بخش خوشامدگویی
===================================== */

.welcome-section {
    flex: 1;
    min-height: 600px;

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

    text-align: center;
    padding: 55px 15px 35px;

    position: relative;
}

.small-label {
    color: #b77b91;
    font-size: 14px;

    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 12px;

    animation: fadeInUp 1s both;
}

.label-star {
    color: #d99bb0;
    font-size: 22px;
    animation: sparkle 2s infinite;
}

/* =====================================
   قلب مرکزی سه بعدی
===================================== */

.main-heart {
    width: 175px;
    height: 175px;

    position: relative;

    display: grid;
    place-items: center;

    margin: 5px 0 15px;

    perspective: 700px;

    animation: heartFloat 4s ease-in-out infinite;
}

.heart-shape {
    position: relative;

    display: inline-block;

    font-family: Arial, sans-serif;
    font-size: 125px;
    line-height: 1;

    color: #e98cac;

    transform-style: preserve-3d;
    transform-origin: center;

    text-shadow:
        1px 1px 0 #e17c9f,
        2px 2px 0 #d96e94,
        3px 3px 0 #d26089,
        4px 4px 0 #c95681,
        5px 5px 0 #bc4c76,
        8px 12px 15px rgba(153, 47, 94, 0.25),
        0 0 30px rgba(244, 166, 188, 0.7),
        0 0 65px rgba(244, 166, 188, 0.35);

    animation:
        heartbeat 2.1s ease-in-out infinite,
        heartRotate 7s ease-in-out infinite;
}

.heart-sparkle {
    position: absolute;
    color: #d58aa6;
    pointer-events: none;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
}

.sparkle-one {
    top: 20px;
    right: 0;
    font-size: 28px;
    animation: sparkle 2s infinite;
}

.sparkle-two {
    bottom: 22px;
    left: 0;
    font-size: 23px;
    animation: sparkle 2.8s infinite 0.4s;
}

.sparkle-three {
    top: 0;
    left: 22px;
    font-size: 20px;
    animation: sparkle 2.3s infinite 0.7s;
}

/* =====================================
   عنوان و نوشته ها
===================================== */

h1 {
    color: #89536b;

    font-size: clamp(36px, 5vw, 60px);
    font-weight: 700;
    line-height: 1.5;

    margin-bottom: 10px;

    animation: fadeInUp 1s 0.2s both;
}

.name-highlight {
    display: inline-block;

    color: #d56f96;

    text-shadow:
        0 0 12px rgba(213, 111, 150, 0.22),
        0 0 35px rgba(213, 111, 150, 0.12);

    animation: nameGlow 3s ease-in-out infinite alternate;
}

.title-heart {
    color: #e68eac;
    display: inline-block;
    font-size: 28px;
    vertical-align: middle;

    animation: heartbeat 1.8s infinite;
}

.welcome-description {
    font-size: clamp(16px, 2vw, 19px);
    font-weight: 400;
    line-height: 2.2;

    color: #967183;
    margin-top: 6px;

    animation: fadeInUp 1s 0.35s both;
}

.decorative-divider {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 13px;
    width: min(250px, 80%);

    margin: 25px 0;
}

.decorative-divider > span:not(.divider-heart) {
    height: 1px;
    flex: 1;

    background: linear-gradient(90deg, transparent, #e4a4ba);
}

.decorative-divider > span:first-child {
    background: linear-gradient(90deg, #e4a4ba, transparent);
}

.divider-heart {
    color: #d781a0;
    font-size: 15px;

    animation: heartbeat 2s infinite;
}

.invitation-text {
    font-size: 15px;
    color: #a17c8d;

    margin-bottom: 23px;

    animation: fadeInUp 1s 0.5s both;
}

/* =====================================
   دکمه شروع سورپرایز
===================================== */

.start-button {
    position: relative;
    overflow: hidden;
    isolation: isolate;

    border: 1px solid rgba(255, 255, 255, 0.55);

    background: linear-gradient(
        135deg,
        #f3b5ca,
        #e98cac,
        #d9769b
    );

    color: white;

    min-width: 215px;
    padding: 16px 28px;

    border-radius: 50px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    cursor: pointer;

    box-shadow:
        0 10px 28px rgba(204, 105, 145, 0.25),
        0 0 25px rgba(236, 151, 183, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);

    transition:
        transform 0.3s,
        box-shadow 0.3s;

    animation: buttonGlow 3s ease-in-out infinite;
}

.start-button::before {
    content: "";
    position: absolute;

    top: -50%;
    left: -100%;

    width: 60%;
    height: 200%;

    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.45),
        transparent
    );

    transform: rotate(25deg);

    transition: left 0.7s;

    z-index: -1;
}

.start-button:hover::before {
    left: 140%;
}

.start-button:hover {
    transform: translateY(-4px) scale(1.035);

    box-shadow:
        0 15px 35px rgba(204, 105, 145, 0.35),
        0 0 40px rgba(236, 151, 183, 0.35);
}

.start-button:active {
    transform: scale(0.96);
}

.button-heart {
    font-size: 22px;
    animation: heartbeat 1.8s infinite;
}

/* =====================================
   نوشته پایین صفحه
===================================== */

.bottom-note {
    font-size: 12px;
    color: #b38a9b;

    margin-top: 25px;
}

.bottom-note span {
    color: #d87c9d;
    font-size: 18px;
    margin-right: 4px;

    animation: heartbeat 2s infinite;
}

.page-footer {
    display: flex;
    justify-content: center;
    align-items: center;

    flex-wrap: wrap;
    gap: 13px;

    color: #b18b9b;
    font-size: 12px;

    padding: 20px 0 5px;
}

.footer-separator {
    color: #d98aa7;
    font-size: 11px;

    animation: heartbeat 2s infinite;
}

/* =====================================
   قلب های تزئینی
===================================== */

.decorative-heart {
    position: absolute;

    color: rgba(212, 125, 158, 0.55);
    font-size: 42px;

    text-shadow: 0 0 22px rgba(236, 151, 183, 0.4);

    animation: heartFloat 5s ease-in-out infinite;
}

.heart-top {
    top: 15%;
    left: 17%;
}

/* =====================================
   لایه قلب های شناور
===================================== */

.floating-hearts {
    position: fixed;
    inset: 0;

    overflow: hidden;
    pointer-events: none;

    z-index: 3;
}

.floating-heart {
    position: absolute;
    bottom: -70px;

    color: rgba(215, 119, 154, 0.7);

    font-family: Arial, sans-serif;
    line-height: 1;

    user-select: none;
    will-change: transform, opacity;

    filter: drop-shadow(0 0 8px rgba(226, 117, 161, 0.25));

    animation: floatUp linear forwards;
}

/* قلب های سه بعدی در حال پرواز */

.floating-heart.three-dimensional-heart {
    transform-style: preserve-3d;

    text-shadow:
        1px 1px 0 #e17c9f,
        2px 2px 0 #d96e94,
        3px 3px 0 #c95681,
        5px 7px 9px rgba(153, 47, 94, 0.25),
        0 0 20px rgba(244, 166, 188, 0.55);

    animation:
        floatUp3D linear forwards,
        heartPulse 2s ease-in-out infinite;
}

/* =====================================
   بادکنک های قلبی
===================================== */

.balloon-layer {
    position: fixed;
    inset: 0;

    overflow: hidden;
    pointer-events: none;

    z-index: 4;

    perspective: 900px;
}

.heart-balloon {
    position: absolute;
    bottom: -150px;

    width: var(--balloon-size, 72px);
    height: calc(var(--balloon-size, 72px) * 1.18);

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

    transform-style: preserve-3d;
    transform-origin: center;

    animation: balloonRise var(--rise-duration, 9s) linear forwards;

    will-change: transform, opacity;
}

.balloon-heart {
    position: relative;

    display: block;

    font-family: Arial, sans-serif;
    font-size: var(--balloon-size, 72px);
    line-height: 1;

    color: var(--balloon-color, #ef8fb2);

    transform-style: preserve-3d;
    transform-origin: center;

    text-shadow:
        1px 1px 0 var(--balloon-side, #d76b95),
        2px 2px 0 var(--balloon-side, #d76b95),
        3px 3px 0 var(--balloon-side, #d76b95),
        4px 4px 0 var(--balloon-side, #d76b95),
        6px 7px 0 rgba(164, 60, 100, 0.18),
        10px 13px 15px rgba(133, 48, 83, 0.23),
        inset 0 0 15px rgba(255, 255, 255, 0.25);

    filter: drop-shadow(0 0 13px rgba(235, 121, 163, 0.3));

    animation: balloonWobble 2.5s ease-in-out infinite;
}

.balloon-heart::after {
    content: "";

    position: absolute;

    width: 23%;
    height: 14%;

    top: 18%;
    left: 23%;

    background: rgba(255, 255, 255, 0.65);

    border-radius: 50%;

    filter: blur(3px);

    transform: rotate(-35deg);

    pointer-events: none;
}

.balloon-string {
    position: absolute;

    top: 68%;
    left: 50%;

    width: 1px;
    height: calc(var(--balloon-size, 72px) * 0.72);

    background: linear-gradient(
        180deg,
        rgba(210, 118, 155, 0.7),
        rgba(210, 118, 155, 0.05)
    );

    transform: translateX(-50%);
    transform-origin: top;
}

.balloon-knot {
    position: absolute;

    top: 66%;
    left: 50%;

    width: 8px;
    height: 8px;

    background: var(--balloon-side, #d76b95);

    transform: translateX(-50%) rotate(45deg);

    border-radius: 2px;
}

/* بادکنک در لحظه ترکیدن */

.heart-balloon.popping {
    animation: balloonPop 0.22s ease-out forwards;
}

.heart-balloon.popping .balloon-string,
.heart-balloon.popping .balloon-knot {
    opacity: 0;
}

/* =====================================
   انفجار قلب ها و ذرات نور
===================================== */

.burst-layer {
    position: fixed;
    inset: 0;

    overflow: hidden;
    pointer-events: none;

    z-index: 8;
}

.burst-particle {
    position: absolute;

    left: var(--start-x);
    top: var(--start-y);

    color: var(--particle-color, #ef8fb2);

    font-family: Arial, sans-serif;
    font-size: var(--particle-size, 20px);
    line-height: 1;

    opacity: 0;

    transform: translate(-50%, -50%) scale(0.2);

    text-shadow:
        0 0 9px rgba(255, 255, 255, 0.9),
        0 0 20px rgba(232, 114, 161, 0.5);

    animation: particleBurst var(--particle-duration, 1.5s) ease-out forwards;

    will-change: transform, opacity;
}

.light-particle {
    position: absolute;

    left: var(--start-x);
    top: var(--start-y);

    width: var(--particle-size, 7px);
    height: var(--particle-size, 7px);

    border-radius: 50%;

    background: radial-gradient(
        circle,
        #ffffff 0%,
        #ffd6e5 35%,
        #ed8eb4 100%
    );

    box-shadow:
        0 0 8px #ffffff,
        0 0 17px #ed8eb4,
        0 0 28px rgba(237, 142, 180, 0.7);

    animation: lightBurst var(--particle-duration, 1.2s) ease-out forwards;
}

/* موج نوری انفجار */

.burst-wave {
    position: absolute;

    left: var(--start-x);
    top: var(--start-y);

    width: 20px;
    height: 20px;

    border: 2px solid rgba(244, 145, 181, 0.8);
    border-radius: 50%;

    transform: translate(-50%, -50%) scale(0.1);

    animation: waveExpand 0.8s ease-out forwards;
}

/* =====================================
   اعلان پایین صفحه
===================================== */

.toast-message {
    position: fixed;

    bottom: 25px;
    left: 50%;

    transform: translate(-50%, 20px);

    width: max-content;
    max-width: calc(100% - 32px);

    padding: 12px 20px;

    border-radius: 15px;

    background: rgba(128, 68, 94, 0.95);
    color: white;

    font-size: 13px;
    text-align: center;

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.3s,
        transform 0.3s,
        visibility 0.3s;

    z-index: 20;

    backdrop-filter: blur(10px);
}

.toast-message.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* =====================================
   انیمیشن ها
===================================== */

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.1);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.07);
    }

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

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

    50% {
        transform: translateY(-15px);
    }
}

@keyframes heartRotate {
    0%, 100% {
        transform: rotateY(-12deg) rotateX(4deg);
    }

    50% {
        transform: rotateY(12deg) rotateX(-4deg);
    }
}

@keyframes heartPulse {
    0%, 100% {
        scale: 1;
    }

    50% {
        scale: 1.06;
    }
}

@keyframes balloonWobble {
    0%, 100% {
        transform: rotate(-7deg) rotateY(-12deg);
    }

    50% {
        transform: rotate(7deg) rotateY(12deg);
    }
}

@keyframes balloonRise {
    0% {
        transform:
            translate3d(0, 0, 0)
            rotate(-8deg)
            scale(0.72);

        opacity: 0;
    }

    8% {
        opacity: 1;
    }

    25% {
        transform:
            translate3d(22px, -25vh, 30px)
            rotate(8deg)
            scale(0.95);
    }

    50% {
        transform:
            translate3d(-20px, -50vh, -20px)
            rotate(-6deg)
            scale(1.08);
    }

    75% {
        transform:
            translate3d(18px, -75vh, 20px)
            rotate(7deg)
            scale(1.02);
    }

    100% {
        transform:
            translate3d(-10px, -125vh, 0)
            rotate(-8deg)
            scale(0.95);

        opacity: 0.9;
    }
}

@keyframes balloonPop {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }

    35% {
        transform: scale(1.35);
        opacity: 1;
        filter: brightness(1.5);
    }

    100% {
        transform: scale(0.05);
        opacity: 0;
        filter: brightness(2);
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    85% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-110vh) rotate(35deg);
        opacity: 0;
    }
}

@keyframes floatUp3D {
    0% {
        transform:
            translate3d(0, 0, 0)
            rotateY(0deg)
            rotateZ(0deg)
            scale(0.6);

        opacity: 0;
    }

    12% {
        opacity: 1;
    }

    50% {
        transform:
            translate3d(35px, -55vh, 25px)
            rotateY(180deg)
            rotateZ(18deg)
            scale(1);
    }

    100% {
        transform:
            translate3d(-20px, -115vh, -15px)
            rotateY(360deg)
            rotateZ(-25deg)
            scale(0.75);

        opacity: 0;
    }
}

@keyframes particleBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    }

    12% {
        opacity: 1;
    }

    65% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform:
            translate(
                calc(-50% + var(--move-x)),
                calc(-50% + var(--move-y))
            )
            scale(var(--end-scale, 0.5))
            rotate(var(--rotation, 180deg));
    }
}

@keyframes lightBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform:
            translate(
                calc(-50% + var(--move-x)),
                calc(-50% + var(--move-y))
            )
            scale(0.1);
    }
}

@keyframes waveExpand {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(13);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.75) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.25) rotate(20deg);
    }
}

@keyframes glow {
    from {
        transform: scale(0.9);
        opacity: 0.65;
    }

    to {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes ambientDrift {
    0% {
        transform: translate3d(-15px, 10px, 0) scale(0.9);
    }

    100% {
        transform: translate3d(30px, -25px, 0) scale(1.2);
    }
}

@keyframes nameGlow {
    0% {
        text-shadow:
            0 0 8px rgba(213, 111, 150, 0.15),
            0 0 20px rgba(213, 111, 150, 0.1);
    }

    100% {
        text-shadow:
            0 0 12px rgba(213, 111, 150, 0.4),
            0 0 35px rgba(213, 111, 150, 0.22);
    }
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow:
            0 10px 28px rgba(204, 105, 145, 0.23),
            0 0 15px rgba(236, 151, 183, 0.12);
    }

    50% {
        box-shadow:
            0 12px 32px rgba(204, 105, 145, 0.3),
            0 0 30px rgba(236, 151, 183, 0.3);
    }
}

@keyframes musicPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* =====================================
   طراحی موبایل
===================================== */

@media (max-width: 600px) {
    .main-container {
        padding: 20px 5%;
    }

    .brand {
        font-size: 14px;
    }

    .music-button {
        padding: 9px 12px;
        gap: 6px;
        font-size: 12px;
    }

    .welcome-section {
        min-height: 570px;
        padding-top: 35px;
    }

    .main-heart {
        width: 135px;
        height: 135px;
    }

    .heart-shape {
        font-size: 100px;
    }

    .heart-top {
        left: 5%;
        top: 10%;
    }

    .welcome-description {
        font-size: 15px;
    }

    .invitation-text {
        font-size: 13px;
    }

    .page-footer {
        gap: 8px;
        font-size: 10px;
    }

    .heart-balloon {
        transform-origin: center;
    }

    .ambient-light {
        width: 150px;
        height: 150px;
        filter: blur(45px);
    }
}

/* =====================================
   کاهش انیمیشن برای کاربران حساس
===================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* =====================================
   بخش نامه عاشقانه
===================================== */

.letter-section {
    width: 100%;
    min-height: 650px;
    padding: 65px 15px 50px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;

    animation: letterSectionAppear 0.8s ease both;
}

.letter-section[hidden],
.letter-paper[hidden],
.close-letter-button[hidden] {
    display: none !important;
}

.letter-intro {
    margin-bottom: 20px;
}

.letter-eyebrow {
    display: inline-block;

    color: #c77896;
    font-size: 14px;

    margin-bottom: 10px;

    animation: fadeInUp 0.8s both;
}

.letter-intro h2 {
    color: #89536b;

    font-size: clamp(26px, 4vw, 39px);
    font-weight: 700;

    margin-bottom: 12px;

    text-shadow: 0 0 25px rgba(232, 140, 172, 0.18);
}

.letter-intro p {
    color: #a17c8d;

    font-size: 14px;
    line-height: 2;
}

/* صحنه پاکت */

.envelope-scene {
    position: relative;

    width: min(360px, 90vw);
    height: 280px;

    display: grid;
    place-items: center;

    perspective: 1200px;

    margin: 15px auto 0;
}

.envelope {
    position: relative;

    width: min(310px, 82vw);
    height: 190px;

    border: 0;
    padding: 0;

    background: transparent;

    cursor: pointer;

    perspective: 1200px;
    transform-style: preserve-3d;

    transition: transform 0.35s ease;

    filter: drop-shadow(0 18px 20px rgba(190, 88, 127, 0.13));
}

.envelope:hover {
    transform: translateY(-7px) scale(1.025);
}

.envelope:active {
    transform: scale(0.98);
}

.envelope-shadow {
    position: absolute;

    width: 88%;
    height: 22px;

    left: 6%;
    bottom: -23px;

    border-radius: 50%;

    background: rgba(175, 91, 125, 0.17);

    filter: blur(12px);

    transition: transform 0.4s ease;
}

.envelope:hover .envelope-shadow {
    transform: scale(0.9);
}

/* برگه ای که از داخل پاکت دیده می شود */

.envelope-letter-preview {
    position: absolute;

    left: 9%;
    top: 8%;

    width: 82%;
    height: 82%;

    padding: 25px 12px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;

    border: 1px solid rgba(225, 161, 183, 0.5);
    border-radius: 5px 5px 2px 2px;

    background: linear-gradient(
        145deg,
        #fffefb,
        #fff0f4
    );

    color: #a65c7b;

    font-size: 15px;
    font-weight: 600;

    box-shadow: 0 0 15px rgba(200, 91, 131, 0.08);

    transition:
        transform 0.8s cubic-bezier(0.2, 0.75, 0.3, 1),
        opacity 0.5s ease;

    z-index: 1;
}

.preview-heart {
    color: #e58bab;
    font-size: 29px;

    animation: heartbeat 1.8s infinite;
}

/* بدنه پاکت */

.envelope-back {
    position: absolute;
    inset: 0;

    border: 1px solid rgba(214, 127, 157, 0.6);
    border-radius: 8px;

    background: linear-gradient(
        145deg,
        #fbd0df,
        #ef9fbc
    );

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 12px 25px rgba(193, 86, 128, 0.12);

    z-index: 2;
}

/* مثلث روی پاکت */

.envelope-flap {
    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: linear-gradient(
        150deg,
        #ffe2ec,
        #f7bad0
    );

    clip-path: polygon(
        0 0,
        100% 0,
        50% 58%
    );

    transform-origin: top center;

    backface-visibility: hidden;

    transition:
        transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
        filter 0.8s ease;

    filter: drop-shadow(0 4px 3px rgba(170, 76, 112, 0.1));

    z-index: 5;
}

/* قسمت جلویی پاکت */

.envelope-front {
    position: absolute;
    inset: 0;

    border-radius: 8px;

    background: linear-gradient(
        160deg,
        #f6b9cf,
        #e98cac
    );

    clip-path: polygon(
        0 0,
        50% 56%,
        100% 0,
        100% 100%,
        0 100%
    );

    border: 1px solid rgba(210, 111, 151, 0.4);

    z-index: 4;
}

/* قلب روی پاکت */

.envelope-heart-seal {
    position: absolute;

    left: 50%;
    top: 55%;

    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    color: #fff8fb;
    font-family: Arial, sans-serif;
    font-size: 32px;

    border-radius: 50%;

    background: linear-gradient(
        145deg,
        #e98cac,
        #c85b83
    );

    border: 2px solid rgba(255, 255, 255, 0.8);

    box-shadow:
        0 4px 12px rgba(170, 65, 109, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.55);

    transform: translate(-50%, -50%);

    transition:
        opacity 0.3s ease,
        transform 0.5s ease;

    z-index: 6;
}

.envelope-sparkle {
    position: absolute;

    color: white;
    font-size: 23px;

    text-shadow: 0 0 12px rgba(255, 255, 255, 0.9);

    animation: sparkle 2.1s infinite;

    pointer-events: none;

    z-index: 7;
}

.envelope-sparkle-one {
    top: -17px;
    right: 15px;
}

.envelope-sparkle-two {
    bottom: 10px;
    left: -17px;

    animation-delay: 0.7s;
}

/* باز شدن پاکت */

.envelope-scene.is-open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope-scene.is-open .envelope-heart-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
}

.envelope-scene.is-open .envelope-letter-preview {
    transform: translateY(-120px);
    opacity: 0;
}

.envelope-scene.is-open .envelope {
    cursor: default;
}

/* راهنمای زیر پاکت */

.envelope-hint {
    color: #b77b91;

    font-size: 14px;
    line-height: 2;

    margin: 5px 0 28px;

    animation: hintPulse 2.8s ease-in-out infinite;
}

/* =====================================
   برگه نامه
===================================== */

.letter-paper {
    position: relative;

    width: min(650px, 100%);
    margin: 10px auto 25px;
    padding: clamp(25px, 5vw, 52px);

    overflow: hidden;

    border: 1px solid rgba(220, 157, 179, 0.55);
    border-radius: 8px 8px 13px 13px;

    background:
        radial-gradient(
            ellipse at 10% 0%,
            rgba(255, 223, 234, 0.75),
            transparent 35%
        ),
        linear-gradient(
            155deg,
            #fffefa,
            #fff8f5 50%,
            #fff0f4
        );

    box-shadow:
        0 20px 65px rgba(176, 91, 125, 0.15),
        0 3px 10px rgba(176, 91, 125, 0.06),
        inset 0 0 35px rgba(255, 231, 238, 0.55);

    color: #795467;

    text-align: right;

    transform-origin: top center;

    animation: letterPaperOpen 0.9s cubic-bezier(0.2, 0.7, 0.25, 1) both;
}

.paper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    color: #b76b8a;

    font-size: 14px;
    font-weight: 600;

    margin-bottom: 17px;
}

.paper-heart {
    color: #e58bab;
    font-size: 27px;

    animation: heartbeat 2s infinite;
}

.paper-divider {
    display: flex;
    align-items: center;
    gap: 13px;

    color: #d98aa7;

    margin-bottom: 27px;
}

.paper-divider span:not(:nth-child(2)) {
    height: 1px;
    flex: 1;

    background: linear-gradient(
        90deg,
        transparent,
        #e9bdcc
    );
}

.paper-divider span:last-child {
    background: linear-gradient(
        90deg,
        #e9bdcc,
        transparent
    );
}

.letter-content {
    min-height: 160px;

    color: #795467;

    font-size: 16px;
    line-height: 2.5;

    overflow-wrap: anywhere;
    white-space: normal;
}

.letter-paragraph {
    margin: 0 0 18px;

    line-height: 2.5;
}

.letter-loading {
    text-align: center;
    color: #bd7f98;

    padding: 25px 0;
}

.paper-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;

    border-top: 1px solid rgba(218, 161, 182, 0.4);

    padding-top: 20px;
    margin-top: 30px;

    color: #bd8198;
    font-size: 13px;
}

.paper-footer-heart {
    color: #e58bab;
    letter-spacing: 5px;
    font-size: 15px;
}

.paper-decoration {
    position: absolute;

    color: rgba(222, 132, 164, 0.13);
    font-size: 90px;

    pointer-events: none;
}

.paper-decoration-top {
    top: -20px;
    left: 15px;

    transform: rotate(-15deg);
}

.paper-decoration-bottom {
    bottom: -30px;
    right: 10px;

    transform: rotate(15deg);
}

/* =====================================
   دکمه های بخش نامه
===================================== */

.close-letter-button,
.back-home-button {
    border: 1px solid rgba(200, 91, 131, 0.25);

    background: rgba(255, 255, 255, 0.8);
    color: #a45d7a;

    padding: 12px 21px;

    border-radius: 35px;

    font-size: 13px;

    cursor: pointer;

    transition:
        transform 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;

    margin: 7px;
}

.close-letter-button {
    background: linear-gradient(
        135deg,
        #f5c1d3,
        #e98cac
    );

    color: white;

    border-color: rgba(255, 255, 255, 0.65);

    box-shadow: 0 7px 22px rgba(200, 91, 131, 0.16);
}

.close-letter-button:hover,
.back-home-button:hover {
    transform: translateY(-3px);

    box-shadow: 0 10px 25px rgba(200, 91, 131, 0.17);
}

.back-home-button:hover {
    background: white;
}

/* =====================================
   انیمیشن های بخش نامه
===================================== */

@keyframes letterSectionAppear {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

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

@keyframes letterPaperOpen {
    0% {
        opacity: 0;
        transform: translateY(55px) scale(0.92) rotateX(-7deg);
    }

    70% {
        opacity: 1;
        transform: translateY(-5px) scale(1.01) rotateX(1deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

@keyframes hintPulse {
    0%, 100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* =====================================
   واکنش گرایی بخش نامه
===================================== */

@media (max-width: 600px) {
    .letter-section {
        padding: 45px 5px 35px;
    }

    .letter-intro p {
        font-size: 12px;
    }

    .envelope-scene {
        height: 245px;
    }

    .envelope {
        height: 165px;
    }

    .envelope-hint {
        font-size: 12px;
    }

    .letter-paper {
        padding: 24px 20px;
    }

    .paper-header {
        font-size: 12px;
    }

    .letter-content {
        font-size: 14px;
        line-height: 2.4;
    }

    .letter-paragraph {
        line-height: 2.4;
    }

    .paper-footer {
        font-size: 11px;
    }

    .close-letter-button,
    .back-home-button {
        font-size: 12px;
        padding: 11px 16px;
    }
}