:root {
    --primary: #ff4d6d;
    --secondary: #ff8fa3;
    --dark: #590d22;
    --white: #fff0f3;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a0b1c, #000); /* Чуть темнее фон, чтобы цветы светились */
    font-family: 'Montserrat', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white);
    perspective: 1000px;
}

#bgCanvas {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    filter: blur(1px); /* Легкий блюр для атмосферности */
}

.container {
    text-align: center;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
}

.title {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    margin-bottom: 3rem;
    text-shadow: 0 0 20px var(--primary);
    animation: fadeIn 2s ease forwards;
}

/* --- КОНВЕРТ --- */
.envelope-wrapper {
    height: 200px; width: 300px;
    margin: 0 auto 3rem;
    position: relative;
}

.envelope {
    position: relative; width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.envelope .back {
    position: absolute; width: 100%; height: 100%;
    background: #c9184a;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 1;
}

.envelope .front {
    position: absolute; width: 0; height: 0;
    z-index: 3;
    border-top: 100px solid transparent;
    border-right: 150px solid #ff4d6d;
    border-bottom: 100px solid #ff4d6d;
    border-left: 150px solid #ff758f;
    top: 0;
    border-radius: 10px;
    pointer-events: none; /* Чтобы клики проходили */
}

/* ПИСЬМО (CARD) */
.card {
    position: absolute;
    top: 10px; left: 15px;
    width: 270px; height: 180px;
    background: #fff;
    border-radius: 5px;
    z-index: 2;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Текст внутри письма - изначально скрыт */
.card .text {
    font-family: 'Dancing Script', cursive;
    color: var(--dark);
    font-size: 1.5rem;
    text-align: center;
    opacity: 0; /* НЕВИДИМ */
    transform: scale(0.9);
    transition: opacity 1s ease 0.5s, transform 1s ease 0.5s; /* Задержка появления */
}

/* АНИМАЦИЯ ОТКРЫТИЯ */
.envelope.open .card {
    transform: translateY(-130px); /* Выезжает выше */
    z-index: 4;
}

.envelope.open .card .text {
    opacity: 1; /* Текст проявляется */
    transform: scale(1);
}

/* --- КНОПКИ --- */
.buttons {
    display: flex; justify-content: center; gap: 30px;
    margin-top: 50px;
    position: relative;
    height: 60px; /* Фиксируем высоту, чтобы кнопка НЕТ не прыгала */
}

.btn {
    padding: 12px 40px;
    font-size: 1.2rem;
    border: none; border-radius: 50px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    z-index: 100;
}

.btn-yes {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary);
}
.btn-yes:hover {
    background: #ff0a54;
    transform: scale(1.1);
    box-shadow: 0 0 30px #ff0a54;
}

.btn-no {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(5px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Очень плавная анимация движения */
}
.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95); /* Темный фон */
    z-index: 2000; /* Очень высокий приоритет, чтобы быть поверх всего */
    display: none; /* Изначально скрыта */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

/* Этот класс мы будем добавлять через JS */
.gallery-overlay.active {
    display: flex !important;
    animation: fadeIn 0.5s forwards;
}

.photo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    max-width: 1000px;
}

.gallery-title {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem; color: var(--primary);
    margin-bottom: 30px;
}
.photo-grid {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 30px; max-width: 1200px;
}

.polaroid {
    background: white; padding: 15px 15px 40px 15px;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: rotate(var(--rotation));
    transition: transform 0.4s ease, z-index 0.4s;
    width: 250px;
    animation: floatIn 0.8s ease-out backwards;
    animation-delay: var(--delay);
}
.polaroid:hover {
    transform: scale(1.1) rotate(0deg) !important;
    z-index: 10;
    box-shadow: 0 20px 50px rgba(255, 77, 109, 0.4);
}
.polaroid img { width: 100%; height: auto; border-radius: 2px; }

.hidden { display: none; }
.music-control { position: fixed; bottom: 20px; right: 20px; z-index: 300; }
.music-control button { font-size: 2rem; background: none; border: none; cursor: pointer; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; } }

@media (max-width: 600px) {
    .envelope-wrapper { transform: scale(0.8); }
    .title { font-size: 2rem; }
}   