@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Quicksand:wght@300;400;600&family=Merriweather:wght@300;400;700&display=swap');

/* ============================
   1. VARIABLES & RESET
   ============================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* PALETTE ESPACE PROFOND */
    --bg-deep: #000103; /* Noir quasi pur */
    --bg-night: #02040a; /* Bleu nuit très sombre */
    
    --text-light: #e2e8f0; /* Blanc cassé */
    --accent-celestial: #a5c9e3; /* Bleu Ciel Lumineux */
    
    --glass-bg: rgba(2, 4, 10, 0.85); /* Verre sombre et opaque */
    --glass-border: rgba(165, 201, 227, 0.15); /* Bordure subtile */
}

/* SUPPRESSION DES SCROLLBARS (Tout en gardant le scroll) */
::-webkit-scrollbar { width: 0px; background: transparent; }
* { -ms-overflow-style: none; scrollbar-width: none; }

body {
    font-family: 'Quicksand', sans-serif;
    background: linear-gradient(to bottom, var(--bg-deep), var(--bg-night));
    height: 100vh; width: 100vw;
    color: var(--text-light);
    overflow: hidden;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 1s ease;
}

/* ============================
   2. ANIMATIONS D'ÉTOILES (DENSE & LENT)
   ============================ */
.stars-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}

/* Génération d'étoiles via Box-Shadow (Très performant) */
.stars {
    width: 1px; height: 1px; background: transparent;
    box-shadow: 
        10vw 10vh #FFF, 20vw 80vh #FFF, 35vw 40vh #FFF, 50vw 90vh #FFF, 80vw 10vh #FFF, 95vw 50vh #FFF, 
        5vw 95vh #FFF, 60vw 20vh #FFF, 90vw 85vh #FFF, 40vw 60vh #FFF, 15vw 30vh #FFF, 70vw 70vh #FFF, 
        30vw 15vh #FFF, 85vw 35vh #FFF, 25vw 55vh #FFF, 55vw 5vh #FFF, 12vw 88vh #FFF, 66vw 44vh #FFF, 
        92vw 12vh #FFF, 44vw 22vh #FFF, 5vw 5vh #FFF, 18vw 25vh #FFF, 98vw 98vh #FFF, 52vw 12vh #FFF,
        /* Étoiles bleutées */
        15vw 15vh 1px #a5c9e3, 75vw 75vh 1px #a5c9e3, 33vw 33vh 1px #a5c9e3, 88vw 88vh 1px #a5c9e3,
        /* Densité supplémentaire */
        45vw 25vh #FFF, 10vw 60vh #FFF, 82vw 40vh #FFF, 65vw 10vh #FFF;
    animation: animStar 300s linear infinite; opacity: 0.9;
}

.stars-bg {
    width: 2px; height: 2px; background: transparent;
    box-shadow: 12vw 12vh #FFF, 28vw 82vh #FFF, 38vw 42vh #FFF, 52vw 92vh #FFF, 82vw 12vh #FFF, 14vw 64vh 1px #FFF;
    animation: animStar 450s linear infinite; opacity: 0.5;
}

@keyframes animStar { from { transform: translateX(0); } to { transform: translateX(-100vw); } }

/* ÉTOILE FILANTE (Traverse tout l'écran rapidement) */
.shooting-star {
    position: absolute; top: 30%; left: 120%; 
    width: 150px; height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,1));
    animation: shooting 20s ease-in-out infinite; /* Passe toutes les 20s */
    opacity: 0; transform: rotate(-35deg);
}

@keyframes shooting {
    0% { transform: translateX(0) translateY(0) rotate(-35deg); opacity: 1; }
    5% { transform: translateX(-150vw) translateY(100vh) rotate(-35deg); opacity: 0; } /* Traverse vite (5% du temps) */
    100% { opacity: 0; }
}

/* ============================
   3. UI GLOBALE & LAYOUT
   ============================ */
.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 1s ease-in-out; padding: 20px; z-index: 10;
}
.hidden { display: none !important; }
.active { display: flex !important; }

h1.main-title {
    font-family: 'Cinzel', serif; font-size: 3rem; letter-spacing: 4px; text-transform: uppercase;
    background: linear-gradient(to bottom, #ffffff 0%, var(--accent-celestial) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 25px rgba(165, 201, 227, 0.4)); margin-bottom: 20px; text-align: center;
}
.subtitle { color: var(--accent-celestial); opacity: 0.9; margin-bottom: 30px; letter-spacing: 1px; text-align: center; }

/* Panneaux de Verre */
.glass-panel, .content-box, .intro-block, .editor-container {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.9);
    border-radius: 20px; padding: 2.5rem 2rem; width: 100%;
}
.content-box { max-width: 550px; text-align: center; }
.container-narrow { width: 100%; max-width: 450px; display: flex; flex-direction: column; align-items: center; }

/* ============================
   4. TYPOGRAPHIE SPÉCIALE (LETTRINE)
   ============================ */
.emotional-text p:first-of-type::first-letter, 
.book-content::first-letter {
    font-family: 'Cinzel', serif; font-size: 3.5rem; float: left; 
    margin-right: 12px; margin-top: -5px; line-height: 0.8; 
    color: var(--accent-celestial); 
    text-shadow: 0 0 10px rgba(165, 201, 227, 0.4);
}

.emotional-text {
    margin: 25px auto 40px auto; 
    font-family: 'Merriweather', serif; font-size: 1rem; line-height: 1.6; 
    color: var(--text-light); opacity: 0.95; text-align: justify; font-weight: 300; 
    position: relative; padding: 0 25px;
}
.emotional-text::before, .emotional-text::after {
    position: absolute; font-family: 'Cinzel', serif; font-size: 3rem; 
    color: var(--accent-celestial); opacity: 0.4; line-height: 0;
}
.emotional-text::before { content: '“'; top: 10px; left: -10px; }
.emotional-text::after { content: '”'; bottom: -10px; right: -10px; }
.emotional-text p { margin-bottom: 15px; }


/* ============================
   5. INPUTS & BOUTONS
   ============================ */
.input-field, .zen-input {
    background: rgba(0, 0, 0, 0.6) !important; 
    border: 1px solid rgba(165, 201, 227, 0.15) !important;
    color: var(--text-light) !important; border-radius: 10px; padding: 16px;
    width: 100%; outline: none; font-family: 'Quicksand'; transition: 0.3s;
    
    /* Espacement demandé */
    margin-bottom: 25px !important; 
}
.input-field:focus {
    border-color: var(--accent-celestial) !important; background: rgba(0, 0, 0, 0.8) !important;
}
.input-field::placeholder { color: rgba(226, 232, 240, 0.3) !important; }

.btn-full, .btn-main {
    background: linear-gradient(135deg, rgba(165, 201, 227, 0.2), rgba(2, 6, 23, 0.6));
    border: 1px solid rgba(165, 201, 227, 0.3); color: var(--text-light);
    padding: 16px; border-radius: 50px; cursor: pointer; transition: 0.3s; width: 100%;
    font-family: 'Quicksand'; font-weight: 600; margin-bottom: 10px;
}
.btn-full:hover, .btn-main:hover {
    background: rgba(165, 201, 227, 0.25); border-color: var(--accent-celestial); 
    transform: translateY(-2px); box-shadow: 0 0 15px rgba(165, 201, 227, 0.2);
}

/* ============================
   6. ÉLÉMENTS FIXES (HEADER, MUTE, TABS)
   ============================ */
.top-bar-fixed {
    position: fixed; top: 0; left:0; width: 100%; padding: 15px 25px; z-index: 100;
    background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(165, 201, 227, 0.1);
    display: flex; justify-content: space-between; align-items: center;
}

/* BOUTON MUTE SVG ACCUEIL (FLOTTANT) */
.mute-icon-svg {
    position: fixed; top: 25px; right: 25px; z-index: 200;
    background: rgba(5, 10, 20, 0.6); backdrop-filter: blur(5px);
    border: 1px solid rgba(165, 201, 227, 0.3); color: var(--accent-celestial);
    width: 44px; height: 44px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    cursor: pointer; padding: 10px;
}

/* BOUTON MUTE SVG PANEL (HEADER) */
.header-mute-btn {
    background: transparent; border: none; width: 32px; height: 32px; 
    cursor: pointer; color: var(--accent-celestial); /* Force la couleur */
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: 0.3s;
}
.header-mute-btn:hover { color: #fff; filter: drop-shadow(0 0 5px var(--accent-celestial)); transform: scale(1.1); }
.header-mute-btn svg { width: 100%; height: 100%; fill: currentColor; }

/* NAVIGATION TABS */
.tabs-nav-container {
    position: fixed; top: 65px; left:0; width: 100%; z-index: 90;
    display: flex; justify-content: center; padding-bottom: 10px;
    background: linear-gradient(to bottom, rgba(0,0,0, 0.9) 0%, transparent 100%);
}
.tabs-nav {
    display: flex; gap: 15px; background: rgba(15, 23, 42, 0.8);
    padding: 5px; border-radius: 50px; border: 1px solid rgba(165, 201, 227, 0.1);
}
.tab-btn {
    background: transparent; border: none; color: rgba(226, 232, 240, 0.5);
    padding: 8px 20px; cursor: pointer; font-family: 'Quicksand'; font-weight: 600;
    transition: 0.3s; border-radius: 40px; font-size: 0.9rem;
}
.tab-btn.active { color: var(--text-light); background: rgba(165, 201, 227, 0.2); }


/* ============================
   7. CONTENU DU PANEL
   ============================ */
.main-container {
    margin-top: 130px; width: 100%; max-width: 650px; padding: 0 15px;
    height: calc(100vh - 130px); overflow-y: auto; padding-bottom: 50px;
}
.view-section { display: none !important; animation: fadeIn 0.4s ease; }
.view-section.active { display: block !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Champs Éditeur Compacts */
.chapter-input { 
    margin-bottom: 10px !important; padding: 8px !important; font-size: 0.9rem; 
    border: none !important; border-bottom: 1px dashed rgba(165, 201, 227, 0.4) !important; background: transparent !important; 
}
.title-input { 
    font-family: 'Cinzel'; font-size: 1.4rem; 
    border: none !important; border-bottom: 1px solid rgba(165, 201, 227, 0.2) !important; 
    background: transparent !important; padding: 10px 0 !important; margin-bottom: 15px !important; 
}
.content-input { 
    min-height: 250px; line-height: 1.6; font-family: 'Merriweather'; font-size: 1rem; 
    resize: none; background: rgba(0,0,0,0.2) !important; border: none !important; 
}

/* Mood Selector */
.mood-selector { display: flex; justify-content: center; gap: 15px; margin: 10px 0; }
.mood-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; opacity: 0.4; filter: grayscale(1) brightness(1.5); transition: 0.3s; }
.mood-btn.selected { opacity: 1; filter: grayscale(0) drop-shadow(0 0 10px var(--accent-celestial)); transform: scale(1.2); }

/* Bibliothèque */
.chapters-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 5px 0; margin-bottom: 15px; }
.chapter-tag { background: rgba(165, 201, 227, 0.05); padding: 6px 14px; border-radius: 15px; white-space: nowrap; font-size: 0.8rem; cursor: pointer; border: 1px solid rgba(165, 201, 227, 0.15); color: rgba(226, 232, 240, 0.7); }
.chapter-tag.active { background: rgba(165, 201, 227, 0.25); border-color: var(--accent-celestial); color: var(--text-light); }

.book-item { background: linear-gradient(90deg, rgba(165, 201, 227, 0.08) 0%, transparent 100%); border-left: 3px solid rgba(165, 201, 227, 0.2); padding: 15px; border-radius: 0 10px 10px 0; cursor: pointer; transition: 0.3s; margin-bottom: 10px; }
.book-item:hover { border-left-color: var(--accent-celestial); background: linear-gradient(90deg, rgba(165, 201, 227, 0.15) 0%, transparent 100%); }

/* ============================
   8. LECTURE & MENU FLOTTANT
   ============================ */
#reader-overlay { background: #000205 !important; } /* Fond noir total */

.floating-menu {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(165, 201, 227, 0.1); backdrop-filter: blur(10px);
    border: 1px solid rgba(165, 201, 227, 0.2); border-radius: 30px;
    padding: 10px 20px; display: flex; gap: 20px; z-index: 2001;
}
.float-btn {
    background: none; border: none; color: var(--accent-celestial);
    font-size: 0.95rem; font-family: 'Quicksand'; cursor: pointer; 
    opacity: 0.8; transition: 0.3s; display: flex; align-items: center; gap: 5px;
}
.float-btn:hover { opacity: 1; text-shadow: 0 0 10px var(--accent-celestial); }
.float-btn.delete:hover { color: #f87171; text-shadow: 0 0 10px #f87171; }

/* Link & Logo */
.top-bar { position: absolute; top: 25px; left: 25px; width: 100%; display: flex; justify-content: space-between; align-items: center; z-index: 20; }
.logo { font-family: 'Cinzel'; font-weight: 600; font-size: 1.3rem; letter-spacing: 2px; opacity: 0.9; color: var(--accent-celestial); text-shadow: 0 0 10px rgba(165, 201, 227, 0.3); }
.tiny-link { margin-top: 20px; font-size: 0.85rem; opacity: 0.7; text-align: center; cursor: pointer; transition:0.3s; }
.tiny-link:hover { opacity: 1; color: var(--accent-celestial); }
/* --- MODAL DE RENOMMAGE (Smooth & Glass) --- */
#rename-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 2, 5, 0.8); /* Fond sombre flou */
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease;
}
#rename-modal.visible { opacity: 1; }

.rename-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 30px rgba(165, 201, 227, 0.1);
    padding: 30px; border-radius: 20px;
    width: 90%; max-width: 350px;
    text-align: center;
    transform: scale(0.9); transition: transform 0.3s ease;
}
#rename-modal.visible .rename-box { transform: scale(1); }

.rename-title {
    font-family: 'Cinzel', serif; color: var(--accent-celestial);
    font-size: 1.2rem; margin-bottom: 20px;
}

.mini-btn {
    padding: 8px 20px; border-radius: 20px; border: 1px solid rgba(165, 201, 227, 0.3);
    background: rgba(165, 201, 227, 0.1); color: var(--text-light);
    cursor: pointer; font-family: 'Quicksand'; font-size: 0.9rem; transition: 0.3s;
}
.mini-btn:hover { background: rgba(165, 201, 227, 0.3); }

/* Icône Crayon dans les tags */
.edit-icon {
    margin-left: 8px; font-size: 0.8rem; opacity: 0.3; transition: 0.3s;
    display: inline-block; padding: 2px;
}
.chapter-tag:hover .edit-icon { opacity: 1; color: var(--accent-celestial); transform: scale(1.2); }