/* ── Trái Tim Của Em · Premium Romantic Styles ──────────────── */

@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&family=Outfit:wght@200;300;400&display=swap');

:root {
    --bg: #050008;
    --pink-glow: rgba(255, 80, 150, 0.7);
    --gold-glow: rgba(255, 200, 100, 0.5);
    --rose: #ff4d8a;
    --blush: #ffb3d9;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
    background: var(--bg) !important;
}

/* ── Overlay UI ────────────────────────────────────────────── */

.overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.top-section {
    padding-top: clamp(1.5rem, 5vh, 3rem);
    text-align: center;
}

.title {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4rem);
    color: #fff;
    text-shadow:
        0 0 20px var(--pink-glow),
        0 0 50px var(--pink-glow),
        0 0 100px rgba(255, 50, 120, 0.3);
    opacity: 0;
    animation: titleReveal 2.5s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
    letter-spacing: 0.02em;
}

.subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(0.75rem, 2vw, 1rem);
    color: var(--blush);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    margin-top: 8px;
    opacity: 0;
    animation: fadeSlideUp 2s ease 1.2s forwards;
    text-shadow: 0 0 20px rgba(255, 179, 217, 0.4);
}

.bottom-section {
    padding-bottom: clamp(1.2rem, 4vh, 2.5rem);
    text-align: center;
}

.love-quote {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: rgba(255, 200, 230, 0.7);
    padding: 0 20px;
    margin-bottom: 12px;
    max-width: 500px;
    line-height: 1.5;
    opacity: 0;
    animation: fadeIn 2s ease 3s forwards;
    transition: opacity 0.8s ease, transform 0.8s ease;
    min-height: 2em;
    text-shadow: 0 0 15px rgba(255, 100, 180, 0.3);
}

.love-quote.changing {
    opacity: 0;
    transform: translateY(10px);
}

.hint {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(0.55rem, 1.4vw, 0.75rem);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeIn 2s ease 2s forwards;
    text-align: center;
    line-height: 1.6;
}

/* ── Music Button ──────────────────────────────────────────── */

.music-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 80, 150, 0.25);
    color: rgba(255, 180, 220, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.music-btn:hover {
    background: rgba(255, 80, 150, 0.15);
    border-color: rgba(255, 80, 150, 0.5);
    color: #ffb3d9;
    box-shadow: 0 0 20px rgba(255, 80, 150, 0.2);
}

.music-btn.playing {
    border-color: var(--rose);
    color: var(--rose);
    animation: musicPulse 2s ease-in-out infinite;
}

.music-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Floating Petals ───────────────────────────────────────── */

.petals-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.petal {
    position: absolute;
    font-size: 16px;
    opacity: 0;
    animation: petalFall linear forwards;
    filter: drop-shadow(0 0 4px rgba(255, 100, 150, 0.5));
    will-change: transform;
}

@keyframes petalFall {
    0% {
        opacity: 0;
        transform: translateY(-5vh) translateX(0) rotate(0deg) scale(0.5);
    }
    10% {
        opacity: 0.8;
        transform: translateY(5vh) translateX(20px) rotate(45deg) scale(1);
    }
    50% {
        opacity: 0.6;
        transform: translateY(50vh) translateX(-30px) rotate(180deg) scale(0.9);
    }
    100% {
        opacity: 0;
        transform: translateY(105vh) translateX(40px) rotate(360deg) scale(0.4);
    }
}

/* ── Animations ────────────────────────────────────────────── */

@keyframes titleReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes musicPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 77, 138, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 77, 138, 0.5), 0 0 50px rgba(255, 77, 138, 0.2);
    }
}

/* pulse hint on interaction */
.hint.pulse {
    animation: pulseHint 0.8s ease;
}

@keyframes pulseHint {
    0% {
        color: var(--blush);
        text-shadow: 0 0 15px rgba(255, 179, 217, 0.6);
    }
    100% {
        color: rgba(255, 255, 255, 0.35);
        text-shadow: none;
    }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 480px) {
    .love-quote {
        padding: 0 16px;
        font-size: 0.85rem;
    }
}