.heart {
    --c: red;
    width: 400px;
    aspect-ratio: 1;
    border-image: radial-gradient(var(--c) 69%, #0000 70%) 84.5% / 50%;
    clip-path: polygon(-42% 0, 50% 91%, 142% 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: beat 2s infinite;
    overflow: visible;
    padding: 40px 60px;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.heart p, .heart h1 {
    margin: 8px 0;
    font-size: 16px;
    color: white;
    transform: translateY(-20px);
    max-width: 280px;
    word-wrap: break-word;
    hyphens: auto;
}

.heart h1 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: white;
}

.container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

.heart-wrapper {
    position: relative;
    padding: 50px; /* Reduced padding since tulips are now positioned better */
    display: flex;
    justify-content: center;
    align-items: center;
}

body, html {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    overflow-x: hidden; /* Prevent horizontal scroll */
}

@keyframes beat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.envelope {
    width: 300px;
    height: 200px;
    background: #f5f5f5;
    border: 3px solid #333;
    position: relative;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 10;
}

.envelope:hover {
    transform: scale(1.05);
}

/* Envelope flap */
.envelope::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 90px solid #e0e0e0;
    z-index: 2;
}

/* Envelope flap border */
.envelope::after {
    content: "";
    position: absolute;
    top: -3px;
    left: -3px;
    width: 0;
    height: 0;
    border-left: 153px solid transparent;
    border-right: 153px solid transparent;
    border-top: 93px solid #333;
    z-index: 1;
}

.envelope p {
    position: relative;
    z-index: 3;
    font-size: 16px;
    padding: 20px;
    margin: 0;
    text-align: center;
    color: #333;
    font-weight: bold;
}

.letter {
    max-width: 90%;
    width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    margin: 20px;
    background: #fffef7;
    border: 2px solid #d4af37;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: #2c2c2c;
    text-align: left;
    border-radius: 10px;
    animation: fadeIn 0.5s ease-in;
    position: relative;
    z-index: 10;
}

.letter h2 {
    color: #8b4513;
    margin-bottom: 15px;
    font-size: 22px;
}

.letter p {
    margin-bottom: 12px;
    font-size: 15px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tulip Styles */
.tulip {
    position: absolute;
    width: 60px;
    height: 120px;
    animation: sway 4s ease-in-out infinite;
}

.tulip-stem {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 80px;
    background: linear-gradient(to bottom, #4a7c59, #2d5016);
    border-radius: 2px;
}

.tulip-flower {
    position: absolute;
    bottom: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 40px;
    background: linear-gradient(45deg, #ff69b4, #ff1493, #dc143c);
    border-radius: 15px 15px 0 0;
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.tulip-flower::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -8px;
    width: 20px;
    height: 35px;
    background: linear-gradient(45deg, #ff1493, #ff69b4);
    border-radius: 10px 10px 0 0;
    transform: rotate(-15deg);
}

.tulip-flower::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -8px;
    width: 20px;
    height: 35px;
    background: linear-gradient(45deg, #ff1493, #ff69b4);
    border-radius: 10px 10px 0 0;
    transform: rotate(15deg);
}

.tulip-leaf {
    position: absolute;
    bottom: 30px;
    width: 8px;
    height: 25px;
    background: linear-gradient(to bottom, #4a7c59, #2d5016);
    border-radius: 0 4px 4px 0;
    transform-origin: bottom;
}

.tulip-leaf.left {
    left: 20px;
    transform: rotate(-30deg);
}

.tulip-leaf.right {
    right: 20px;
    transform: rotate(30deg);
}

/* Heart tulips positioning - positioned relative to heart-wrapper */
.heart-wrapper .tulip.heart-left {
    top: 1%;
    left: 1%;
    animation-delay: 0s;
    z-index: 1;
}

.heart-wrapper .tulip.heart-right {
    top: 1%;
    right: 1%;
    animation-delay: 1s;
    z-index: 1;
}

.heart-wrapper .tulip.heart-left-2 {
    top: 50%;
    left: 5%;
    animation-delay: 0.5s;
    transform: scale(0.8);
    z-index: 1;
}

.heart-wrapper .tulip.heart-right-2 {
    top: 60%;
    right: 5%;
    animation-delay: 1.5s;
    transform: scale(0.9);
    z-index: 1;
}

/* Letter tulips positioning - positioned around the letter */
.letter .tulip.letter-left {
    top: 10%;
    left: -70px;
    animation-delay: 0.3s;
}

.letter .tulip.letter-right {
    top: 15%;
    right: -70px;
    animation-delay: 0.8s;
}

.letter .tulip.letter-left-2 {
    top: 40%;
    left: -80px;
    animation-delay: 1.2s;
    transform: scale(0.85);
}

.letter .tulip.letter-right-2 {
    top: 50%;
    right: -80px;
    animation-delay: 1.7s;
    transform: scale(0.9);
}

.letter .tulip.letter-left-3 {
    bottom: 20%;
    left: -75px;
    animation-delay: 2s;
    transform: scale(0.75);
}

.letter .tulip.letter-right-3 {
    bottom: 15%;
    right: -75px;
    animation-delay: 2.3s;
    transform: scale(0.8);
}

@keyframes sway {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(2deg);
    }
    75% {
        transform: rotate(-2deg);
    }
}

@media (max-width: 768px) {
    .heart-wrapper {
        padding: 30px; /* Smaller padding on mobile */
    }
    
    .heart {
        width: 300px; /* Smaller heart on mobile */
    }
    
    .heart-wrapper .tulip {
        transform: scale(0.6);
    }
    
    .letter .tulip {
        display: none;
    }
}
