:root {
    --deep-blue: #020b1a;
    --royal-blue: #0f1c3f;
    --cyan-glow: #00f3ff;
    --purple-nebula: #4a0e8f;
    --white-glow: rgba(255, 255, 255, 0.9);
    --font-heading: 'Cinzel', serif;
    --font-subheading: 'Cormorant Garamond', serif;
    --font-body: 'Poppins', sans-serif;
    --font-script: 'Dancing Script', cursive;
    --font-signature: 'Great Vibes', cursive;
}

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

body {
    background-color: var(--deep-blue);
    color: white;
    font-family: var(--font-body);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    -webkit-tap-highlight-color: transparent;
}

#webgl {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

/* --- INTRO OVERLAY --- */
#intro-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 1.5s ease;
}

.intro-content { text-align: center; }

.intro-line {
    font-family: var(--font-subheading);
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.2em;
    opacity: 0;
    transform: translateY(20px);
    color: var(--cyan-glow);
    margin-bottom: 1rem;
}

.intro-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 4rem);
    background: linear-gradient(to right, #fff, var(--cyan-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: scale(0.9);
    margin: 2rem 0;
}

.intro-start {
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    opacity: 0;
    animation: pulse-opacity 2s infinite;
}

.fade-in-up { animation: fadeInUp 1s forwards; }
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1s; }
.delay-3 { animation-delay: 1.5s; }
.delay-4 { animation-delay: 2.5s; }

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse-opacity {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* --- HERO UI --- */
#hero-ui {
    position: relative;
    z-index: 10;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: clamp(2rem, 5vh, 4rem) 1rem;
    pointer-events: none; /* Let clicks pass to canvas when needed */
}

#hero-ui > * { pointer-events: auto; }

.hero-text-container { text-align: center; margin-top: 10dvh; }

.hero-subtitle {
    font-family: var(--font-subheading);
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.5em;
    color: var(--cyan-glow);
    text-shadow: 0 0 20px var(--cyan-glow);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    margin-top: 0.5rem;
    text-shadow: 0 0 30px rgba(0, 243, 255, 0.5);
}

.controls-bottom {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 2rem;
}

.glass-btn {
    background: rgba(15, 28, 63, 0.4);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.glass-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    transform: scale(1.05);
}

/* Ripple Effect */
.ripple::after {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.6s, opacity 0.6s;
}
.ripple:active::after { transform: scale(2); opacity: 1; transition: 0s; }

/* Music Player */
.music-player {
    width: min(90%, 400px);
    padding: 1rem 1.5rem;
    border-radius: 20px;
    background: rgba(2, 11, 26, 0.6);
    border: 1px solid rgba(0, 243, 255, 0.2);
    backdrop-filter: blur(15px);
}

.track-info { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.8rem; }
.track-name { font-weight: 500; color: var(--cyan-glow); }
.artist { font-family: var(--font-subheading); font-style: italic; opacity: 0.8; }

.progress-container {
    width: 100%; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 0.8rem;
}
.progress-fill {
    width: 0%; height: 100%;
    background: var(--cyan-glow);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--cyan-glow);
    transition: width 0.1s linear;
}

.player-controls { display: flex; align-items: center; justify-content: space-between; }
.ctrl-btn {
    background: none; border: none;
    color: white; font-size: 1.2rem;
    cursor: pointer; padding: 0.5rem;
}
#volume-slider {
    width: 80px; accent-color: var(--cyan-glow);
}

/* --- LOVE LETTER MODAL --- */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease;
}
.modal.active { opacity: 1; pointer-events: auto; }

.letter-content {
    width: min(90%, 600px);
    max-height: 80dvh;
    padding: 3rem;
    background: rgba(15, 28, 63, 0.7);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.1);
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.5s ease;
}
.modal.active .letter-content { transform: translateY(0); }

.close-btn {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none;
    color: white; font-size: 2rem;
    cursor: pointer; opacity: 0.6;
}
.close-btn:hover { opacity: 1; }

.signature {
    font-family: var(--font-signature);
    font-size: 2rem;
    color: var(--cyan-glow);
}

.letter-body {
    font-family: var(--font-subheading);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 2rem 0;
    white-space: pre-wrap;
    color: rgba(255,255,255,0.9);
}

.letter-footer { text-align: right; }

/* --- ENDING SCREEN --- */
#ending-screen {
    position: fixed; inset: 0;
    z-index: 150;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: radial-gradient(circle, rgba(2,11,26,0.9) 0%, #000 100%);
    opacity: 0; pointer-events: none;
    transition: opacity 2s ease;
}
#ending-screen.active { opacity: 1; pointer-events: auto; }

.ending-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
}
.ending-names {
    font-family: var(--font-script);
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--cyan-glow);
}

.hidden { display: none !important; }

/* Mobile Optimization */
@media (max-width: 768px) {
    .letter-content { padding: 2rem 1.5rem; }
    .controls-bottom { gap: 0.5rem; }
    .glass-btn { padding: 0.6rem 1rem; font-size: 0.7rem; }
}
