:root {
    --c-rose-gold: #b76e79;
    --c-soft-pink: #ffd1dc;
    --c-cream: #fffdd0;
    --c-white: #ffffff;
    --c-dark: #1a1a1a;
    
    --f-title: 'Great Vibes', cursive;
    --f-serif: 'Cormorant Garamond', serif;
    --f-sans: 'Poppins', sans-serif;
    --f-elegant: 'Playfair Display', serif;

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: #050505;
    color: var(--c-white);
    font-family: var(--f-sans);
    overflow-x: hidden;
    overscroll-behavior: none;
}

/* Typography */
h1, h2, h3 { font-family: var(--f-serif); font-weight: 400; }
.great-vibes { font-family: var(--f-title); }

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

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--c-white);
    padding: 12px 28px;
    border-radius: 30px;
    font-family: var(--f-sans);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.4s ease;
}
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(183, 110, 121, 0.5);
    transform: translateY(-2px);
}

/* Intro Screen */
#intro-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 2s ease;
}
.intro-content { text-align: center; }
.pre-title { font-size: 1.5rem; letter-spacing: 5px; opacity: 0.7; }
.main-title { font-family: var(--f-title); font-size: 6rem; color: var(--c-rose-gold); text-shadow: 0 0 20px rgba(183, 110, 121, 0.5); margin: 10px 0; }
.loading-text { font-family: var(--f-serif); font-style: italic; margin-top: 20px; color: var(--c-soft-pink); }
.hidden { display: none !important; opacity: 0; pointer-events: none; }

/* UI Layer */
#ui-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
.audio-controls { position: absolute; top: 30px; right: 30px; pointer-events: auto; display: flex; align-items: center; gap: 15px; }
.icon-btn { padding: 10px; border-radius: 50%; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; }
#audio-visualizer { width: 100px; height: 40px; }

.weather-indicator { position: absolute; top: 30px; left: 30px; font-family: var(--f-serif); font-style: italic; letter-spacing: 2px; opacity: 0.7; }

/* Achievement Toast */
.achievement-toast { position: absolute; bottom: -100px; right: 30px; background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border: 1px solid var(--c-rose-gold); padding: 15px 20px; border-radius: 12px; display: flex; align-items: center; gap: 15px; transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.achievement-toast.show { bottom: 30px; }
.ach-icon { font-size: 2rem; }
.ach-text h4 { font-size: 0.9rem; color: var(--c-rose-gold); }
.ach-text p { font-size: 0.8rem; margin-top: 5px; }

/* Cinematic Sections */
.cinematic-section { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; padding: 100px 20px; z-index: 10; }
.section-title { font-family: var(--f-title); font-size: 4rem; color: var(--c-soft-pink); text-shadow: 0 0 15px rgba(255,209,220,0.3); margin-bottom: 20px; text-align: center; }
.section-desc { font-family: var(--f-serif); font-size: 1.2rem; font-style: italic; opacity: 0.8; margin-bottom: 50px; text-align: center; }

/* Hero */
.hero-text { text-align: center; }
.hero-text .subtitle { font-size: 1rem; letter-spacing: 8px; text-transform: uppercase; margin-bottom: -10px; opacity: 0.8; }
.hero-text .title { font-size: 4rem; letter-spacing: 15px; font-weight: 300; margin-left: 15px; }
.hero-text .name { font-family: var(--f-title); font-size: 8rem; color: var(--c-rose-gold); line-height: 0.8; text-shadow: 0 0 30px rgba(183,110,121,0.6); }

/* Scroll Indicator */
.scroll-indicator { margin-top: 10vh; display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: var(--f-serif); font-style: italic; opacity: 0.6; }
.mouse { width: 24px; height: 36px; border: 2px solid #fff; border-radius: 12px; position: relative; }
.wheel { width: 4px; height: 8px; background: #fff; border-radius: 2px; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); animation: scroll 1.5s infinite; }
@keyframes scroll { 0% { top: 6px; opacity: 1; } 100% { top: 20px; opacity: 0; } }

/* Floating Gallery */
.gallery-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; max-width: 1200px; perspective: 1000px; }
.gallery-item { width: 250px; height: 350px; border-radius: 15px; overflow: hidden; cursor: pointer; position: relative; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 15px 35px rgba(0,0,0,0.5); transition: transform 0.5s ease; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: opacity 0.5s; filter: grayscale(20%) sepia(10%); }
.gallery-item:hover img { opacity: 1; filter: grayscale(0%) sepia(0%); transform: scale(1.05); }
.gallery-item::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-shadow: inset 0 0 20px rgba(183,110,121,0.5); pointer-events: none; border-radius: 15px; }

/* Memory Book */
.book-container { perspective: 1500px; width: 300px; height: 400px; }
.book { width: 100%; height: 100%; transform-style: preserve-3d; position: relative; transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1); cursor: pointer; }
.page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 5px 15px 15px 5px; transform-origin: left center; transition: transform 1.5s cubic-bezier(0.645, 0.045, 0.355, 1); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 30px; box-shadow: inset 0 0 30px rgba(0,0,0,0.5); }
.cover { background: linear-gradient(135deg, #2a2a2a, #111); border: 2px solid var(--c-rose-gold); z-index: 2; }
.cover h3 { font-family: var(--f-title); font-size: 3rem; color: var(--c-rose-gold); }
.content { background: var(--c-cream); color: var(--c-dark); transform: rotateY(0deg); z-index: 1; }
.book.open .cover { transform: rotateY(-160deg); }
.book.open { transform: translateX(50%); }

/* Envelope / Love Letter */
.envelope-wrapper { position: relative; width: 300px; height: 200px; cursor: pointer; perspective: 1000px; }
.envelope { width: 100%; height: 100%; background: #c28892; position: relative; transform-style: preserve-3d; transition: transform 0.8s ease; border-radius: 5px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.envelope::before { content: ''; position: absolute; top: 0; left: 0; width: 0; height: 0; border-style: solid; border-width: 0 150px 100px 150px; border-color: transparent transparent #b76e79 transparent; z-index: 3; bottom: 0; top: auto; }
.flap { position: absolute; top: 0; left: 0; width: 0; height: 0; border-style: solid; border-width: 100px 150px 0 150px; border-color: #a85e69 transparent transparent transparent; z-index: 4; transform-origin: top; transition: transform 0.6s 0.2s ease, z-index 0s 0.6s; }
.envelope.open .flap { transform: rotateX(180deg); z-index: 1; }
.letter { position: absolute; bottom: 0; left: 5%; width: 90%; height: 90%; background: var(--c-cream); z-index: 2; transition: transform 0.8s 0.6s ease; padding: 20px; box-shadow: 0 0 10px rgba(0,0,0,0.2); border-radius: 5px; overflow: hidden; }
.envelope.open .letter { transform: translateY(-150px); z-index: 5; height: 300px; }
.typed-text { font-family: var(--f-serif); font-size: 1.1rem; color: var(--c-dark); font-style: italic; white-space: pre-wrap; }
.hint { text-align: center; margin-top: 30px; font-family: var(--f-serif); font-style: italic; opacity: 0.6; }

/* Game Grid */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; width: 100%; max-width: 1000px; }
.game-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 15px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.3s; backdrop-filter: blur(10px); }
.game-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.1); border-color: var(--c-rose-gold); box-shadow: 0 10px 20px rgba(183,110,121,0.2); }
.game-icon { font-size: 2.5rem; margin-bottom: 10px; }
.game-name { font-family: var(--f-elegant); font-size: 1.2rem; }

/* Modals */
.glass-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 1000; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.4s ease; }
.close-btn { position: absolute; top: 30px; right: 30px; background: transparent; border: none; font-size: 1.5rem; width: 50px; height: 50px; }
#viewer-img { max-width: 90%; max-height: 90%; border-radius: 10px; box-shadow: 0 0 50px rgba(183,110,121,0.3); object-fit: contain; }

/* Game Modal Interiors */
.game-header { display: flex; justify-content: space-between; width: 100%; max-width: 600px; margin-bottom: 20px; font-family: var(--f-elegant); }
#game-canvas-container { width: 100%; max-width: 600px; height: 400px; background: rgba(0,0,0,0.5); border: 1px solid var(--glass-border); border-radius: 15px; position: relative; overflow: hidden; }
.game-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 20px; z-index: 10; }

/* Ending */
#ending { text-align: center; }
.ending-name { font-family: var(--f-title); font-size: 6rem; color: var(--c-white); opacity: 0; text-shadow: 0 0 30px rgba(255,255,255,0.8); margin-bottom: 20px; }
.ending-quote { font-family: var(--f-serif); font-size: 1.5rem; font-style: italic; opacity: 0; max-width: 600px; line-height: 1.6; }

/* Secret */
#secret-page { position: fixed; top:0; left:0; width:100%; height:100%; background: radial-gradient(circle, #b76e79 0%, #1a1a1a 100%); z-index: 10000; display: flex; justify-content: center; align-items: center; text-align: center; }
.secret-content h1 { font-size: 5rem; color: var(--c-cream); margin-bottom: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .main-title { font-size: 4rem; }
    .hero-text .name { font-size: 5rem; }
    .section-title { font-size: 3rem; }
    #game-canvas-container { height: 300px; }
}
