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

html {
    overflow-x: hidden;
}

body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.8s ease;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    background: var(--bg-gradient);
}

html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar {
    display: none;
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-flower {
    width: 120px;
    height: 140px;
    animation: splash-bloom 2s ease-in-out infinite;
}

.splash-flower svg {
    width: 100%;
    height: 100%;
}

@keyframes splash-bloom {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.08) rotate(-5deg);
    }
    50% {
        transform: scale(1.15) rotate(0deg);
    }
    75% {
        transform: scale(1.08) rotate(5deg);
    }
}

.splash-petals {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.splash-petal {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0;
    animation: splash-petal-fall 3s ease-in-out infinite;
}

.splash-petal::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: currentColor;
    border-radius: 150% 0 150% 0;
    transform: rotate(-45deg);
    opacity: 0.6;
}

@keyframes splash-petal-fall {
    0% {
        opacity: 0;
        transform: translateY(-20px) rotate(0deg);
    }
    20% {
        opacity: 0.7;
    }
    80% {
        opacity: 0.7;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(360deg);
    }
}

.splash-text {
    margin-top: 30px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    color: var(--title-color);
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: splash-pulse 1.5s ease-in-out infinite;
}

@keyframes splash-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.petals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.petal {
    position: absolute;
    width: 15px;
    height: 15px;
    opacity: 0;
    animation: fall linear infinite;
}

.petal::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: currentColor;
    border-radius: 150% 0 150% 0;
    transform: rotate(-45deg);
    opacity: 0.7;
}

@keyframes fall {
    0% {
        opacity: 0;
        top: -10%;
        transform: translateX(0) rotate(0deg);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        top: 110%;
        transform: translateX(100px) rotate(720deg);
    }
}

.card-wrapper {
    position: relative;
    width: 100%;
    max-width: 650px;
}

.decorations-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.greeting-card {
    width: 100%;
    max-height: calc(100vh - 40px);
    padding: 55px 45px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(25px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), all 0.6s ease;
    z-index: 2;
    transform-style: preserve-3d;
    opacity: 0;
    transform: translateY(30px);
    border-radius: 35px;
}

.greeting-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.bloom-flower {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    animation: bloom-wither 8s ease-out forwards;
}

.bloom-flower svg {
    width: 100%;
    height: 100%;
}

@keyframes bloom-wither {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    15% {
        opacity: 0.9;
        transform: scale(1) rotate(180deg);
    }
    30% {
        opacity: 0.85;
        transform: scale(1.05) rotate(270deg);
    }
    60% {
        opacity: 0.75;
        transform: scale(1) rotate(360deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) rotate(540deg);
    }
}

.decoration {
    position: absolute;
    opacity: 0.08;
    pointer-events: none;
    transition: all 0.6s ease;
    background: var(--decor-color);
}

.decoration-1 {
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
}

.decoration-2 {
    bottom: -25px;
    left: -25px;
    width: 140px;
    height: 140px;
    animation: float 8s ease-in-out infinite;
    border-radius: 40%;
}

.decoration-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    opacity: 0.04;
    border-radius: 50%;
}

.rotating-flower {
    position: absolute;
    top: -30px;
    left: -30px;
    width: 90px;
    height: 90px;
    animation: rotate-flower 25s linear infinite;
    opacity: 0.55;
}

@keyframes rotate-flower {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-25px) scale(1.05);
    }
}

.content {
    position: relative;
    z-index: 3;
}

.greeting-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(36px, 7vw, 52px);
    font-weight: 700;
    margin-bottom: 35px;
    text-align: center;
    transition: color 0.6s ease;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: var(--title-color);
}

.image-container {
    width: 100%;
    max-width: 320px;
    height: 300px;
    margin: 35px auto;
    background: linear-gradient(135deg, #FFF5F7 0%, #FFE8EC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.6s ease;
    position: relative;
    overflow: hidden;
    border-radius: 25px;
    cursor: pointer;
}

.card-image {
    width: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.15);
    transition: transform 0.5s ease;
}

.image-container:hover .card-image {
    transform: scale(1.2);
}

.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.image-overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-image-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    transform: scale(0.85);
    transition: transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-overlay.active .overlay-image-wrapper {
    transform: scale(1);
}

.overlay-image {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    cursor: default;
}

.download-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.image-overlay.active .download-btn {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.download-btn:hover {
    background: #fff;
    transform: scale(1.1) translateY(0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.download-btn svg {
    width: 24px;
    height: 24px;
    color: var(--title-color);
}

.close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.image-overlay.active .close-btn {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

.close-btn:hover {
    background: #fff;
    transform: scale(1.1) translateY(0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.close-btn svg {
    width: 24px;
    height: 24px;
    color: var(--title-color);
}

.greeting-text {
    font-size: clamp(17px, 3.5vw, 22px);
    line-height: 1.9;
    text-align: center;
    margin: 35px 0;
    font-weight: 300;
    transition: color 0.6s ease;
    white-space: pre-line;
    color: var(--text-color);
}

.signature {
    text-align: center;
    margin-top: 45px;
    padding-top: 35px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: clamp(15px, 2.8vw, 20px);
    font-weight: 600;
    font-style: italic;
    transition: color 0.6s ease;
    position: relative;
    color: var(--signature-color);
}

.flower-icon {
    display: inline-block;
    width: 45px;
    height: 45px;
    margin: 0 12px;
    vertical-align: middle;
    opacity: 0.7;
    animation: gentle-pulse 3s ease-in-out infinite;
}

.flower-icon:last-child {
    animation-delay: 1.5s;
}

@keyframes gentle-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

@media (max-width: 600px) {
    .greeting-card {
        padding: 40px 30px;
    }

    .image-container {
        max-width: 280px;
        height: 280px;
    }
    
    .rotating-flower {
        width: 70px;
        height: 70px;
        top: -20px;
        left: -20px;
    }

    .splash-flower {
        width: 90px;
        height: 105px;
    }
    
    .overlay-image-wrapper {
        max-width: 95vw;
    }
    
    .overlay-image {
        max-width: 100%;
        max-height: 80vh;
    }
    
    .download-btn,
    .close-btn {
        width: 44px;
        height: 44px;
        top: 10px;
    }
    
    .download-btn {
        right: 10px;
    }
    
    .close-btn {
        left: 10px;
    }
}

@media (max-width: 400px) {
    .flower-icon {
        margin: 0;
    }
}

@media (max-width: 350px) {
    .image-container {
        max-width: 280px;
        height: 220px;
    }

    .flower-icon {
        margin: 0;
    }
}

@media (max-height: 700px) {
    .greeting-card {
        padding: 35px 28px;
    }
    
    .image-container {
        height: 240px;
    }
    
    .greeting-title {
        margin-bottom: 25px;
    }
    
    .greeting-text {
        margin: 25px 0;
    }
    
    .signature {
        margin-top: 35px;
        padding-top: 25px;
    }
}
