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

body {
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
    background: #1a1a2e;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    overflow-x: hidden;
}

/* ==================== OPENING OVERLAY ==================== */
.opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 25%, #6bcf7f 50%, #4d9de0 75%, #a29bfe 100%);
    background-size: 400% 400%;
    animation: gentleGradient 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
    transition: opacity 0.8s ease;
    overflow: hidden;
}

.opening-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes gentleGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.opening-content {
    text-align: center;
    animation: floatIn 1.5s ease-out;
    position: relative;
    z-index: 2;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.opening-title {
    font-size: 3.5rem;
    color: white;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    animation: glow 2s ease-in-out infinite;
    line-height: 1.2;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3),
                     0 0 40px rgba(255, 255, 255, 0.4);
    }
    50% {
        text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3),
                     0 0 60px rgba(255, 255, 255, 0.6),
                     0 0 80px rgba(255, 255, 255, 0.4);
    }
}

.opening-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    animation: pulse 2s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.opening-overlay:hover .opening-title {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.opening-overlay:hover .opening-subtitle {
    color: white;
    transition: color 0.3s ease;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.9;
    }
    50% { 
        transform: scale(1.05);
        opacity: 1;
    }
}

/* Opening Sparkles */
.sparkles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkleFloat 4s ease-in-out infinite;
    opacity: 0;
}

@keyframes sparkleFloat {
    0% {
        transform: translateY(0) rotate(0deg) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
        transform: translateY(-30px) rotate(180deg) scale(1);
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) rotate(360deg) scale(0);
        opacity: 0;
    }
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.main-content.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animated Gradient Background */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf7f, #4d9de0);
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
    z-index: -1;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==================== FLOATING HEARTS ==================== */
.hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.heart {
    position: absolute;
    font-size: 2rem;
    opacity: 0.7;
    animation: floatUp 8s linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ==================== BALLOONS ==================== */
.balloons-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.balloon {
    position: absolute;
    font-size: 3rem;
    animation: floatBalloon 12s ease-in-out infinite;
}

@keyframes floatBalloon {
    0%, 100% {
        transform: translateY(100vh) translateX(0);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-100px) translateX(30px);
        opacity: 0.8;
    }
    100% {
        opacity: 0;
    }
}

/* ==================== CONFETTI ==================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    top: -10px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==================== TITLE ANIMATION ==================== */
.title-container {
    position: relative;
    z-index: 3;
    margin-bottom: 30px;
    opacity: 0;
    animation: fadeInBounce 1s ease forwards;
    animation-delay: 0.5s;
}

.main-title {
    font-size: 3.5rem;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-weight: 700;
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes fadeInBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes titleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ==================== LETTER CARD ==================== */
.card-container {
    position: relative;
    z-index: 4;
    max-width: 700px;
    width: 100%;
    opacity: 0;
    animation: cardFadeIn 1s ease forwards;
    animation-delay: 2.5s;
}

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

.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
}

.card-inner {
    padding: 50px 40px;
}

.letter-text {
    font-family: 'Caveat', cursive;
    font-size: 1.6rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 25px;
}

.letter-text.signature {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff6b6b;
    margin-top: 30px;
}

/* ==================== FINAL MESSAGE ==================== */
.final-message {
    position: relative;
    z-index: 4;
    margin-top: 40px;
    opacity: 0;
    animation: finalFadeIn 1.5s ease forwards;
    animation-delay: 4s;
}

@keyframes finalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.glow-text {
    font-size: 2.5rem;
    color: white;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8),
                 0 0 40px rgba(255, 107, 107, 0.6),
                 0 0 60px rgba(255, 107, 107, 0.4);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 107, 107, 0.8),
                     0 0 40px rgba(255, 107, 107, 0.6),
                     0 0 60px rgba(255, 107, 107, 0.4);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 107, 107, 1),
                     0 0 60px rgba(255, 107, 107, 0.8),
                     0 0 90px rgba(255, 107, 107, 0.6);
    }
}

/* ==================== SOUND TOGGLE ==================== */
.sound-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.sound-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.sound-toggle.muted {
    opacity: 0.5;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .opening-title {
        font-size: 2.5rem;
        padding: 0 20px;
    }

    .opening-subtitle {
        font-size: 1.2rem;
        padding: 0 20px;
    }

    .main-title {
        font-size: 2.5rem;
        padding: 0 20px;
        text-align: center;
    }

    .card-container {
        margin: 0 10px;
    }

    .card-inner {
        padding: 35px 28px;
    }

    .letter-text {
        font-size: 1.4rem;
        line-height: 2;
    }

    .letter-text.signature {
        font-size: 1.6rem;
    }

    .glow-text {
        font-size: 1.9rem;
        padding: 0 20px;
        text-align: center;
    }

    .sound-toggle {
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
        bottom: 20px;
        right: 20px;
    }

    /* Optimize animations for mobile */
    .heart, .balloon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .opening-title {
        font-size: 2rem;
        padding: 0 15px;
        margin-bottom: 15px;
    }

    .opening-subtitle {
        font-size: 1.1rem;
        padding: 0 15px;
    }

    .main-title {
        font-size: 2.2rem;
        padding: 0 15px;
    }

    .card-container {
        margin: 0 5px;
    }

    .card-inner {
        padding: 30px 22px;
    }

    .letter-text {
        font-size: 1.3rem;
        line-height: 2.1;
    }

    .letter-text.signature {
        font-size: 1.5rem;
        margin-top: 25px;
    }

    .glow-text {
        font-size: 1.6rem;
        padding: 0 15px;
    }

    .final-message {
        margin-top: 30px;
    }

    .heart, .balloon {
        font-size: 1.8rem;
    }

    .sound-toggle {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }

    /* Reduce confetti on small screens */
    .confetti {
        width: 8px;
        height: 8px;
    }

    /* Better spacing for mobile */
    .main-content {
        padding: 15px 10px;
    }
}
