/* =========================================
   VARIABLES & GLOBAL SETTINGS
========================================= */
:root {
    --bg-dark: #070b14;
    --bg-accent: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #ff4d6d;
    --primary-glow: rgba(255, 77, 109, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    line-height: 1.6;
}

/* Background gradient overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(30, 27, 75, 0.5) 0%, transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(88, 28, 135, 0.15) 0%, transparent 50%);
    z-index: -2;
    pointer-events: none;
}

/* =========================================
   TYPOGRAPHY & UTILITIES
========================================= */
h1, h2, h3, .sparkle-text {
    font-family: var(--font-serif);
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Smooth reveal class for sections */
.section-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.mt-4 { margin-top: 1.5rem; }

/* =========================================
   UI COMPONENTS (GLASSMORPHISM)
========================================= */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 30px;
    font-family: var(--font-sans);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.primary-btn {
    background: linear-gradient(135deg, rgba(255, 77, 109, 0.8), rgba(201, 24, 74, 0.8));
    border: 1px solid rgba(255, 77, 109, 0.5);
    font-weight: 600;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.primary-btn:hover {
    background: linear-gradient(135deg, rgba(255, 77, 109, 1), rgba(201, 24, 74, 1));
    box-shadow: 0 6px 20px var(--primary-glow);
}

.floating-music {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    font-size: 0.9rem;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

/* =========================================
   SCREEN 1: COUNTDOWN
========================================= */
.lock-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulseLock 2s infinite;
}

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

#countdown-screen h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

#countdown-screen p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 2rem 0;
}

.time-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    min-width: 80px;
}

.time-box span:first-child {
    font-size: 2.5rem;
    font-weight: 600;
    font-family: var(--font-sans);
    line-height: 1;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    margin-top: 5px;
}

.colon {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 20px;
}

.come-back {
    font-style: italic;
    color: var(--primary-color) !important;
}

/* =========================================
   SCREEN 2: MIDNIGHT REVEAL
========================================= */
#midnight-reveal {
    text-align: center;
}

#countdown-num {
    font-size: 6rem;
    font-weight: 600;
    font-family: var(--font-sans);
    background: linear-gradient(to right, #ff4d6d, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: popIn 1s ease-out forwards;
}

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

.sparkle-text {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ff4d6d, #ffb3c1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 77, 109, 0.4);
}

.name-text {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: white;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* =========================================
   SCREEN 3: CAROUSEL
========================================= */
.content-wrapper {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #ffb3c1;
}

.carousel-container {
    width: 100%;
}

.carousel-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 100%;
}

.image-wrapper {
    width: 100%;
    aspect-ratio: 4/5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.caption {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-main);
    min-height: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.dot.active {
    background: var(--primary-color);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* =========================================
   SCREEN 4: LETTER / ENVELOPE
========================================= */
.envelope-container {
    position: relative;
    width: 300px;
    height: 200px;
    margin: 2rem auto 3rem;
    cursor: pointer;
    perspective: 1000px;
}

.envelope-body {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 2;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.envelope-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom right, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

.envelope-flap {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 50%;
    background: #1e293b;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    z-index: 4;
    transform-origin: top;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.letter {
    position: absolute;
    bottom: 0;
    width: 90%;
    height: 90%;
    background: #fdfbf7;
    border-radius: 8px 8px 0 0;
    padding: 1.5rem;
    z-index: 3;
    transition: transform 0.8s 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100%);
    box-shadow: 0 -5px 15px rgba(0,0,0,0.2);
    overflow-y: auto;
}

#letter-text {
    color: #1e293b;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.8;
    text-align: left;
    white-space: pre-wrap;
}

.envelope-container.open .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope-container.open .letter {
    transform: translateY(-30px);
}

/* =========================================
   SCREEN 5: FINAL SURPRISE
========================================= */
.pulse-btn {
    animation: gentlePulse 2s infinite;
    padding: 15px 40px;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

@keyframes gentlePulse {
    0% { transform: scale(1); box-shadow: 0 0 10px var(--primary-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 25px var(--primary-glow); }
    100% { transform: scale(1); box-shadow: 0 0 10px var(--primary-glow); }
}

.final-wrapper {
    min-height: 50vh;
    justify-content: center;
}

.glowing-heart {
    font-size: 4rem;
    margin-bottom: 2rem;
    animation: heartbeat 1.5s infinite;
    filter: drop-shadow(0 0 20px var(--primary-color));
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.3); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    60% { transform: scale(1); }
}

.typewriter-text {
    font-size: 1.2rem;
    font-family: var(--font-serif);
    line-height: 1.8;
    color: #ffb3c1;
    min-height: 120px; /* Prevent layout jump */
}

.tiny-footer {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    padding: 0 20px;
}

/* =========================================
   PARTICLES & FIREWORKS
========================================= */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: floatUp linear infinite;
    opacity: 0.3;
}

.particle-heart {
    position: absolute;
    color: rgba(255, 77, 109, 0.4);
    font-size: 10px;
    animation: floatUpAndSway linear infinite;
}

@keyframes floatUp {
    0% { transform: translateY(100vh); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { transform: translateY(-10vh); opacity: 0; }
}

@keyframes floatUpAndSway {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    25% { transform: translateY(75vh) translateX(20px); opacity: 0.6; }
    50% { transform: translateY(50vh) translateX(-20px); }
    75% { transform: translateY(25vh) translateX(20px); opacity: 0.6; }
    100% { transform: translateY(-10vh) translateX(0); opacity: 0; }
}

#fireworks {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 99;
}

/* =========================================
   RESPONSIVE DESIGN
========================================= */
@media (max-width: 480px) {
    .glass-card {
        padding: 2rem 1.5rem;
    }
    .sparkle-text {
        font-size: 2.2rem;
    }
    .name-text {
        font-size: 2rem;
    }
    .time-box span:first-child {
        font-size: 2rem;
    }
    .time-box {
        min-width: 65px;
        padding: 10px;
    }
    .image-wrapper {
        aspect-ratio: 3/4;
    }
}
