/* ==========================================================================
   Romantic Twilight Theme & Glassmorphism Design System for Chutuu ❤️
   ========================================================================== */

:root {
    --primary: #ff477e;
    --primary-glow: rgba(255, 71, 126, 0.45);
    --secondary: #ff70a6;
    --accent: #ffd166;
    --accent-glow: rgba(255, 209, 102, 0.4);
    --bg-dark: #0e0517;
    --card-bg: rgba(26, 12, 38, 0.72);
    --card-border: rgba(255, 180, 210, 0.28);
    --text-main: #fff0f5;
    --text-muted: #e2b4c8;
    --font-ui: 'Outfit', sans-serif;
    --font-love: 'Dancing Script', cursive;
    --font-letter: 'Caveat', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-ui);
    background: radial-gradient(circle at 50% 35%, #2a0845 0%, #170428 50%, #080112 100%);
    color: var(--text-main);
}

/* 3D Canvas Viewport */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    cursor: grab;
}

#canvas-container:active {
    cursor: grabbing;
}

/* Background Twinkle Dust Overlay */
.star-dust-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 80% 20%, rgba(255, 220, 240, 0.08) 0%, transparent 60%);
}

/* ==========================================================================
   Screen 1: The Romantic Opening Envelope
   ========================================================================== */
#envelope-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(15, 4, 25, 0.65);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 1.2s;
}

#envelope-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.envelope-card {
    position: relative;
    width: 90%;
    max-width: 440px;
    padding: 38px 28px;
    background: linear-gradient(135deg, rgba(45, 18, 62, 0.85) 0%, rgba(25, 8, 38, 0.92) 100%);
    border: 1.5px solid var(--card-border);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 40px var(--primary-glow);
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: floatCard 4s ease-in-out infinite;
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(0.4deg); }
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 30px;
    background: rgba(255, 71, 126, 0.2);
    border: 1px solid rgba(255, 112, 166, 0.35);
    font-size: 0.82rem;
    font-weight: 500;
    color: #ffccd5;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.wax-seal-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wax-seal {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ff4d6d 0%, #c9184a 70%, #800f2f 100%);
    box-shadow: 0 10px 25px rgba(201, 24, 74, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4), inset 0 -4px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid #ff758f;
    animation: pulseHeartbeat 1.8s infinite;
}

.wax-heart-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: heartbeat 1.8s infinite;
}

@keyframes pulseHeartbeat {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 25px rgba(201, 24, 74, 0.6), 0 0 20px var(--primary-glow);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 12px 35px rgba(255, 71, 126, 0.85), 0 0 35px var(--primary-glow);
    }
}

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

.envelope-title {
    font-family: var(--font-love);
    font-size: 2.4rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 18px rgba(255, 112, 166, 0.8);
    margin-bottom: 8px;
    line-height: 1.2;
}

.envelope-subtitle {
    font-size: 0.98rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.btn-open-love {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #ff477e 0%, #ff70a6 50%, #ff85a1 100%);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 71, 126, 0.5), 0 0 20px rgba(255, 71, 126, 0.3);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-open-love:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 71, 126, 0.7), 0 0 30px rgba(255, 71, 126, 0.5);
}

.btn-open-love:active {
    transform: translateY(1px) scale(0.98);
}

.sound-hint {
    margin-top: 16px;
    font-size: 0.82rem;
    color: rgba(255, 209, 102, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ==========================================================================
   In-World Speech Bubbles (Separation Phase)
   ========================================================================== */
.speech-bubble-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: #1a0826;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0.7) translateY(10px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

.bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.95) transparent;
}

.bubble.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#bubble-dinidu {
    left: 22%;
    top: 38%;
}

#bubble-chutuu {
    right: 22%;
    top: 38%;
}

/* ==========================================================================
   Romantic Banner (Reveals after the hug)
   ========================================================================== */
#romance-banner {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    z-index: 20;
    text-align: center;
    width: 90%;
    max-width: 620px;
    padding: 20px 26px;
    background: rgba(26, 8, 40, 0.72);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px var(--primary-glow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

#romance-banner.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.banner-title {
    font-family: var(--font-love);
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 15px #ff477e;
    margin-bottom: 6px;
    line-height: 1.2;
}

.banner-subtitle {
    font-size: 1.05rem;
    color: #ffccd5;
    line-height: 1.4;
    font-weight: 400;
}

.banner-heart-decor {
    display: inline-block;
    animation: heartbeat 1.5s infinite;
}

/* Camera Hint Tooltip */
.camera-tip {
    position: absolute;
    top: 145px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: rgba(255, 209, 102, 0.85);
    background: rgba(14, 3, 22, 0.6);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 209, 102, 0.3);
    z-index: 15;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}

.camera-tip.visible {
    opacity: 1;
}

/* ==========================================================================
   Floating Love Dock (Interactive Action Menu)
   ========================================================================== */
#love-dock {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: rgba(25, 7, 38, 0.78);
    border: 1px solid var(--card-border);
    border-radius: 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--primary-glow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#love-dock.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dock-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 14px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.dock-btn .btn-icon {
    font-size: 1.35rem;
    transition: transform 0.25s ease;
}

.dock-btn:hover {
    background: rgba(255, 71, 126, 0.25);
    border-color: rgba(255, 112, 166, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(255, 71, 126, 0.4);
}

.dock-btn:hover .btn-icon {
    transform: scale(1.22);
}

.dock-btn:active {
    transform: translateY(1px) scale(0.96);
}

.dock-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Love Letter Modal (Handwritten Emotional Parchment)
   ========================================================================== */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 150;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 2, 18, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.letter-parchment {
    position: relative;
    width: 92%;
    max-width: 580px;
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #fffdf8 0%, #fff5ea 50%, #fdebd9 100%);
    color: #3b1d28;
    padding: 38px 32px 32px;
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75), 0 0 50px rgba(255, 112, 166, 0.4);
    border: 2px solid #f1cfb8;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .letter-parchment {
    transform: scale(1) translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #edd4c3;
    border: none;
    color: #4a2835;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #e2beab;
    transform: scale(1.1);
}

.letter-header {
    text-align: center;
    margin-bottom: 20px;
}

.letter-seal-decor {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

.letter-title {
    font-family: var(--font-love);
    font-size: 2.4rem;
    color: #a81c44;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.letter-body {
    font-family: var(--font-letter);
    font-size: 1.45rem;
    line-height: 1.75;
    color: #2e141f;
}

.letter-body p {
    margin-bottom: 16px;
}

.letter-body .highlight {
    color: #c9184a;
    font-weight: 700;
}

.letter-signature {
    text-align: right;
    margin-top: 24px;
    font-family: var(--font-love);
    font-size: 1.9rem;
    color: #a81c44;
}

/* ==========================================================================
   "Why I Miss & Love You" Cards Modal
   ========================================================================== */
.reasons-container {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: rgba(28, 10, 42, 0.92);
    border: 1.5px solid var(--card-border);
    border-radius: 28px;
    padding: 32px 24px;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px var(--primary-glow);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .reasons-container {
    transform: scale(1);
}

.reason-card-display {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 112, 166, 0.25);
    margin: 20px 0;
    transition: all 0.3s ease;
}

.reason-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.reason-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffd166;
    margin-bottom: 8px;
}

.reason-desc {
    font-size: 1.02rem;
    line-height: 1.5;
    color: #ffccd5;
}

.reasons-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-arrow-btn {
    background: rgba(255, 71, 126, 0.2);
    border: 1px solid rgba(255, 112, 166, 0.4);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.reason-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 600px) {
    .envelope-title {
        font-size: 2rem;
    }
    .banner-title {
        font-size: 1.8rem;
    }
    .banner-subtitle {
        font-size: 0.9rem;
    }
    #romance-banner {
        top: 14px;
        padding: 14px 18px;
    }
    #love-dock {
        bottom: 16px;
        gap: 6px;
        padding: 8px 12px;
        width: 95%;
        justify-content: space-around;
    }
    .dock-btn {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    .dock-btn .btn-icon {
        font-size: 1.15rem;
    }
    .dock-divider {
        display: none;
    }
    .letter-parchment {
        padding: 28px 20px;
    }
    .letter-body {
        font-size: 1.25rem;
    }
    #bubble-dinidu {
        left: 10%;
        top: 32%;
    }
    #bubble-chutuu {
        right: 10%;
        top: 32%;
    }
}
