/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0c1445 0%, #1a237e 50%, #283593 100%);
    font-family: 'Montserrat', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Контейнер */
.container {
    text-align: center;
    z-index: 10;
    padding: 20px;
}

/* Заголовок */
.title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.3);
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

.subtitle {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.3);
    }
    to {
        text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.5);
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Обёртка конверта */
.envelope-wrapper {
    perspective: 1000px;
    display: flex;
    justify-content: center;
}

/* Конверт */
.envelope {
    position: relative;
    width: clamp(280px, 80vw, 350px);
    height: clamp(200px, 50vw, 250px);
    cursor: pointer;
    transition: transform 0.3s ease;
}

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

/* Задняя часть конверта */
.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #c41e3a 0%, #8b0000 100%);
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* Передняя часть конверта */
.envelope-front {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 65%;
    background: linear-gradient(180deg, #dc143c 0%, #b22222 100%);
    border-radius: 0 0 10px 10px;
    z-index: 1;
}

.envelope-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 calc(clamp(280px, 80vw, 350px) / 2) calc(clamp(200px, 50vw, 250px) * 0.35) calc(clamp(280px, 80vw, 350px) / 2);
    border-color: transparent transparent #cd5c5c transparent;
}

/* Декоративные полоски на конверте */
.envelope-front::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    border-radius: 2px;
    box-shadow: 0 -15px 0 #ffd700, 0 -30px 0 #ffd700;
    opacity: 0.6;
}

/* Клапан конверта */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #c41e3a 0%, #dc143c 100%);
    transform-origin: top center;
    transition: transform 0.6s ease;
    z-index: 4;
    border-radius: 10px 10px 0 0;
    clip-path: polygon(0 0, 50% 100%, 100% 0);
}

/* Печать на клапане */
.envelope-flap::after {
    content: '❄';
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* Открытый конверт */
.envelope.open .envelope-flap {
    transform: rotateX(180deg) translateY(-6px);
    z-index: 1;
}

/* Письмо */
.letter {
    position: absolute;
    width: 90%;
    left: 5%;
    bottom: 10%;
    background: linear-gradient(180deg, #fffef0 0%, #faf8e8 100%);
    border-radius: 8px;
    padding: 25px 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 2;
    transform: translateY(0);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    min-height: 320px;
}

.envelope.open .letter {
    transform: translateY(-50px);
    opacity: 1;
}

/* Содержимое письма */
.letter-content {
    text-align: center;
    color: #333;
}

.letter-content h2 {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: #c41e3a;
    margin-bottom: 15px;
}

.letter-content .greeting {
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 500;
    color: #1a237e;
    margin-bottom: 15px;
}

.letter-content p {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    line-height: 1.6;
    margin-bottom: 12px;
    color: #444;
}

.letter-content .signature {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #c41e3a;
    margin-top: 20px;
}

.letter-content .heart {
    display: inline-block;
    animation: heartbeat 1s ease-in-out infinite;
}

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

/* Снежинки */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -50px;
    color: white;
    font-size: 1.5rem;
    opacity: 0.8;
    animation: fall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.snowflake:nth-child(1) { left: 5%; animation-duration: 10s; animation-delay: 0s; font-size: 1.2rem; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 12s; animation-delay: 1s; font-size: 1.8rem; }
.snowflake:nth-child(3) { left: 25%; animation-duration: 8s; animation-delay: 2s; font-size: 1rem; }
.snowflake:nth-child(4) { left: 35%; animation-duration: 14s; animation-delay: 0.5s; font-size: 1.5rem; }
.snowflake:nth-child(5) { left: 45%; animation-duration: 9s; animation-delay: 3s; font-size: 2rem; }
.snowflake:nth-child(6) { left: 55%; animation-duration: 11s; animation-delay: 1.5s; font-size: 1.3rem; }
.snowflake:nth-child(7) { left: 65%; animation-duration: 13s; animation-delay: 2.5s; font-size: 1.7rem; }
.snowflake:nth-child(8) { left: 75%; animation-duration: 10s; animation-delay: 0.8s; font-size: 1.1rem; }
.snowflake:nth-child(9) { left: 85%; animation-duration: 15s; animation-delay: 4s; font-size: 1.9rem; }
.snowflake:nth-child(10) { left: 92%; animation-duration: 7s; animation-delay: 1.2s; font-size: 1.4rem; }
.snowflake:nth-child(11) { left: 10%; animation-duration: 11s; animation-delay: 3.5s; font-size: 1.6rem; }
.snowflake:nth-child(12) { left: 50%; animation-duration: 9s; animation-delay: 2.2s; font-size: 1.2rem; }

@keyframes fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* Мерцающие звёзды */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.star:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.star:nth-child(2) { top: 20%; left: 80%; animation-delay: 0.3s; }
.star:nth-child(3) { top: 30%; left: 40%; animation-delay: 0.6s; }
.star:nth-child(4) { top: 15%; left: 60%; animation-delay: 0.9s; }
.star:nth-child(5) { top: 50%; left: 10%; animation-delay: 1.2s; }
.star:nth-child(6) { top: 60%; left: 90%; animation-delay: 1.5s; }
.star:nth-child(7) { top: 80%; left: 30%; animation-delay: 1.8s; }
.star:nth-child(8) { top: 70%; left: 70%; animation-delay: 2.1s; }

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* Плавающие сердечки */
.hearts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.floating-heart {
    position: absolute;
    font-size: 1.5rem;
    animation: floatUp 4s ease-out forwards;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1.5) rotate(45deg);
    }
}

/* Скрытие подсказки после открытия */
.envelope.open ~ .subtitle,
.subtitle.hidden {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Адаптивность */
@media (max-width: 480px) {
    .letter {
        padding: 20px 15px;
    }

    .letter-content p {
        margin-bottom: 10px;
    }

}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 1s ease-out;
}
