/* ==========================================================================
   CSS Variables & Design System
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-gradient: radial-gradient(circle at center, #1b0a2a 0%, #0d0414 100%);
    --accent-pink: hsl(330, 85%, 68%);
    --accent-pink-hover: hsl(330, 95%, 75%);
    --accent-pink-glow: rgba(244, 98, 154, 0.4);
    --accent-purple: hsl(280, 60%, 55%);
    --text-primary: #fdfafc;
    --text-secondary: #e0d5e8;
    --text-muted: #bdaec6;
    
    /* Glassmorphism Configuration */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: rgba(244, 98, 154, 0.05);
    --card-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 20px 0 var(--glass-glow);
    
    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;
    --font-signature: 'Great Vibes', cursive;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-primary);
    overflow-x: hidden;
    scroll-behavior: smooth;
    line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0d0414;
}
::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-pink);
}

/* Canvas Background */
#hearts-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* ==========================================================================
   1. Welcome / Intro Gate Screen
   ========================================================================== */
.intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1b0a2b 10%, #06020a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 1.2s cubic-bezier(0.25, 1, 0.5, 1), visibility 1.2s;
}

.intro-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.intro-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--card-shadow);
    z-index: 101;
    animation: zoomIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.heart-pulse-container {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.heart-pulse {
    animation: heartBeat 1.4s infinite alternate cubic-bezier(0.215, 0.610, 0.355, 1);
}

.intro-card h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-card p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.volume-hint {
    font-size: 0.9rem;
    color: var(--accent-pink);
    margin-top: 1.25rem;
    opacity: 0.9;
    font-weight: 500;
    animation: pulseGlow 1.8s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% {
        opacity: 0.7;
        transform: translateY(0) scale(0.98);
        text-shadow: 0 0 4px rgba(244, 98, 154, 0);
    }
    100% {
        opacity: 1;
        transform: translateY(-2px) scale(1.02);
        text-shadow: 0 0 8px rgba(244, 98, 154, 0.4);
    }
}

.enter-btn {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 6px 20px var(--accent-pink-glow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.enter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.6s;
}

.enter-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 25px var(--accent-pink-glow), 0 0 15px var(--accent-pink);
}

.enter-btn:hover::before {
    left: 100%;
}

.enter-btn:active {
    transform: translateY(1px);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.enter-btn:hover .btn-icon {
    transform: rotate(20deg) scale(1.2);
}

/* ==========================================================================
   2. Main Layout (Reveal Screen)
   ========================================================================== */
.main-content {
    opacity: 1;
    transition: opacity 1.5s ease-in-out;
    position: relative;
    z-index: 2;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Letter Wrapper */
.letter-container {
    max-width: 680px;
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 32px;
    padding: 4rem 3rem;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

/* Inner Decorative Corners */
.letter-container::before {
    content: '✿';
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--glass-border);
    font-size: 1.5rem;
}

.letter-container::after {
    content: '✿';
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: var(--glass-border);
    font-size: 1.5rem;
}

/* Header Styles */
.letter-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.letter-badge {
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-pink);
    font-weight: 600;
    background: rgba(244, 98, 154, 0.1);
    padding: 0.35rem 1rem;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.recipient-name {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 30%, var(--accent-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.divider {
    color: var(--accent-pink);
    opacity: 0.6;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.divider::before, .divider::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-pink), transparent);
}

/* ==========================================================================
   3. Content Cards & Message
   ========================================================================== */
.letter-body {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.letter-card {
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--accent-purple);
    border-radius: 0 16px 16px 0;
    padding: 1.75rem 2rem;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.letter-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: var(--accent-pink);
    transform: translateX(4px);
}

.letter-card p {
    font-size: 1.4rem;
    color: var(--text-secondary);
    text-align: justify;
    text-justify: inter-word;
    line-height: 1.7;
}

/* Highlight Otaku */
.highlight-otaku {
    font-weight: 600;
    color: var(--accent-pink);
    background: rgba(244, 98, 154, 0.12);
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    border: 1px dashed rgba(244, 98, 154, 0.3);
    white-space: nowrap;
    display: inline-block;
    transform: rotate(-1deg);
}

/* Media Cards for Videos */
.media-card {
    border-left: none;
    border-top: 3px solid var(--accent-purple);
    border-radius: 16px;
    padding: 2rem;
}

.media-card:hover {
    border-top-color: var(--accent-pink);
    transform: translateY(-4px);
}

.media-intro {
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem !important;
    text-align: left !important;
    line-height: 1.7;
}

.accent-text {
    color: var(--accent-pink);
    font-style: italic;
    font-weight: 500;
}

/* Premium Video Aspect Ratio Wrapper */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    background: #000;
    border: 1px solid var(--glass-border);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Secret Reveal Card */
.secret-card {
    background: linear-gradient(135deg, rgba(244, 98, 154, 0.05) 0%, rgba(138, 75, 175, 0.05) 100%);
    border: 1px dashed var(--accent-pink);
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.5s ease;
}

.secret-card:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(244, 98, 154, 0.15);
    background: linear-gradient(135deg, rgba(244, 98, 154, 0.08) 0%, rgba(138, 75, 175, 0.08) 100%);
}

.secret-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.5s ease;
}

.secret-icon {
    font-size: 2.2rem;
    animation: heartBeat 1.8s infinite alternate;
}

.secret-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 600;
}

.secret-content {
    max-height: 0;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-message {
    font-family: var(--font-heading);
    font-size: 1.8rem !important;
    font-weight: 700;
    color: var(--accent-pink) !important;
    text-align: center !important;
    padding-top: 1.5rem;
    text-shadow: 0 0 10px rgba(244, 98, 154, 0.3);
}

/* Class added when user unlocks the secret content */
.secret-card.unlocked {
    border-style: solid;
    background: linear-gradient(135deg, rgba(244, 98, 154, 0.1) 0%, rgba(138, 75, 175, 0.1) 100%);
}

.secret-card.unlocked .secret-header {
    transform: translateY(-5px);
}

.secret-card.unlocked .secret-icon {
    animation: none;
    transform: scale(1.2);
}

.secret-card.unlocked .secret-content {
    max-height: 120px;
    opacity: 1;
}

/* ==========================================================================
   4. Floating Music Button
   ========================================================================== */
.music-controller {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 90;
}

.music-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.music-toggle-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-pink);
    box-shadow: 0 6px 25px rgba(244, 98, 154, 0.3);
}

.music-icon {
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

/* Sound Wave Equalizer animation */
.sound-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.sound-wave span {
    display: block;
    width: 2px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* Equalizer Active State */
.music-toggle-btn.playing .sound-wave {
    opacity: 1;
}

.music-toggle-btn.playing .sound-wave span {
    background: var(--accent-pink);
    animation: waveBounce 0.8s ease infinite alternate;
}

.music-toggle-btn.playing .sound-wave span:nth-child(1) { animation-delay: 0.1s; }
.music-toggle-btn.playing .sound-wave span:nth-child(2) { animation-delay: 0.3s; height: 100%; }
.music-toggle-btn.playing .sound-wave span:nth-child(3) { animation-delay: 0.2s; height: 70%; }
.music-toggle-btn.playing .sound-wave span:nth-child(4) { animation-delay: 0.4s; }

/* ==========================================================================
   5. Footer & Signature
   ========================================================================== */
.letter-footer {
    text-align: center;
    margin-top: 2rem;
}

.signature-label {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1.5rem;
}

.signature {
    font-family: var(--font-signature);
    font-size: 3.5rem;
    color: var(--accent-pink);
    margin-top: -0.5rem;
    text-shadow: 0 0 10px rgba(244, 98, 154, 0.2);
    letter-spacing: 1px;
}

/* ==========================================================================
   6. Animations & Keyframes
   ========================================================================== */
@keyframes heartBeat {
    0% { transform: scale(0.95); }
    100% { transform: scale(1.1); text-shadow: 0 0 15px var(--accent-pink); }
}

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

@keyframes waveBounce {
    0% { height: 2px; }
    100% { height: 14px; }
}

/* Scroll Reveal Base Class */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* ==========================================================================
   7. Media Queries (Responsive Design)
   ========================================================================== */
@media (max-width: 768px) {
    .letter-container {
        padding: 2.5rem 1.5rem;
        border-radius: 20px;
    }
    
    .recipient-name {
        font-size: 2.2rem;
    }
    
    .letter-card {
        padding: 1.25rem 1.5rem;
    }
    
    .letter-card p {
        font-size: 1.2rem;
        text-align: left;
        line-height: 1.6;
    }
    
    .media-card {
        padding: 1rem;
    }
    
    .signature {
        font-size: 3rem;
    }
    
    .music-controller {
        bottom: 20px;
        right: 20px;
    }
    
    .music-toggle-btn {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .intro-card {
        padding: 2rem 1.25rem;
    }
    
    .intro-card h1 {
        font-size: 1.8rem;
    }
    
    .recipient-name {
        font-size: 1.8rem;
    }
}

/* ==========================================================================
   8. Romantic Photo Card & Animations
   ========================================================================== */
.photo-card {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    margin-top: 1rem;
    overflow: visible;
    perspective: 1000px;
}

.romantic-photo {
    width: 100%;
    max-width: 480px;
    height: auto;
    border-radius: 20px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(244, 98, 154, 0.1);
    opacity: 0;
    transform: scale(2.5) translateY(40px) rotate(-4deg);
    transition: opacity 2.2s cubic-bezier(0.19, 1, 0.22, 1), 
                transform 2.5s cubic-bezier(0.19, 1, 0.22, 1),
                border-color 0.5s ease,
                box-shadow 0.5s ease;
}

.photo-card.visible .romantic-photo {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0deg);
}

.romantic-photo:hover {
    border-color: var(--accent-pink);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), 0 0 35px rgba(244, 98, 154, 0.35);
    transform: translateY(-5px) scale(1.02);
}
