/* --- POLICES --- */
@font-face {
    font-family: 'Starlight';
    src: url('../assets/fonts/Starlight.ttf') format('truetype');
}

@font-face {
    font-family: 'IMFell';
    src: url('../assets/fonts/IMFellDWPica.ttf') format('truetype');
}

/* --- GÉNÉRAL --- */
body, html { 
    margin: 0; 
    padding: 0; 
    overflow: hidden; 
    background: #050208; 
    color: white; 
}

canvas.js-canvas-3d {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;  
    height: 100% !important; 
    display: block;
    z-index: 1; 
}

/* --- ÉCRANS DE BASE --- */
#loading-screen, #intro-screen, #story-screen, #transition-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: #050208;
    transition: opacity 1s ease;
}

#transition-screen { background: black; z-index: 600; }
.is-hidden { opacity: 0; pointer-events: none; display: none !important; }

/* --- ÉCRAN D'INTRO --- */
.main-title {
    font-family: 'Starlight', serif;
    font-size: clamp(3rem, 15vw, 10rem);
    color: #add8e6;
    letter-spacing: clamp(10px, 4vw, 30px);
    margin: 0;
    text-shadow: 0 0 50px rgba(173, 216, 230, 0.4);
    animation: titleGlow 4s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 30px rgba(173, 216, 230, 0.3); transform: scale(1); }
    to { text-shadow: 0 0 60px rgba(173, 216, 230, 0.6); transform: scale(1.05); }
}

.experience-tagline {
    font-family: 'Starlight', serif;
    font-size: clamp(0.8rem, 3vw, 1.8rem);
    color: #eedace; 
    opacity: 0.8;
    letter-spacing: clamp(2px, 1vw, 4px);
    margin-top: -10px;
    margin-bottom: clamp(40px, 8vw, 100px); 
    width: 100%;
    text-align: center;
    display: block; 
}

/* --- CONTRÔLE DU SON --- */
#sound-control-container {
    position: fixed;
    top: clamp(15px, 3vw, 30px); 
    left: clamp(15px, 3vw, 30px);
    z-index: 200;
}

.sound-control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: clamp(6px, 1.5vw, 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease; 
}

.sound-control-btn:hover {
    transform: scale(1.15); 
}

.sound-control-btn:hover .sound-bars .bar {
    background-color: #fff; 
    box-shadow: 0 0 8px rgba(238, 218, 206, 0.8); 
}

.sound-bars {
    display: flex;
    align-items: flex-end; 
    justify-content: center;
    gap: clamp(2px, 0.5vw, 4px); 
    height: clamp(20px, 3vw, 28px); 
}

.sound-bars .bar {
    width: clamp(2px, 0.5vw, 4px);
    background-color: #eedace;
    border-radius: 4px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    animation: playSound infinite alternate ease-in-out;
}

@keyframes playSound {
    0% { height: 30%; }
    100% { height: 100%; }
}

.sound-bars .bar:nth-child(1) { height: 60%; animation-duration: 0.6s; }
.sound-bars .bar:nth-child(2) { height: 100%; animation-duration: 0.9s; }
.sound-bars .bar:nth-child(3) { height: 40%; animation-duration: 0.7s; }
.sound-bars .bar:nth-child(4) { height: 80%; animation-duration: 0.8s; }
.sound-bars .bar:nth-child(5) { height: 50%; animation-duration: 0.5s; }

.sound-control-btn.is-muted .sound-bars .bar {
    height: clamp(4px, 1vw, 6px) !important; 
    animation: none !important; 
    background-color: rgba(238, 218, 206, 0.4);
    box-shadow: none;
}

.sound-control-btn.is-muted:hover .sound-bars .bar {
    background-color: rgba(238, 218, 206, 0.8);
}

/* --- BOUTONS MAGIQUES --- */
.magic-btn {
    display: inline-block;
    padding: clamp(10px, 2vw, 12px) clamp(20px, 4vw, 30px);
    background: rgba(33, 21, 27, 0.7); 
    color: #fba648; 
    font-family: 'Starlight', serif;
    font-size: clamp(1rem, 3vw, 1.4rem); 
    letter-spacing: clamp(1px, 0.5vw, 2px);
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid rgba(251, 166, 72, 0.5); 
    border-radius: 50px; 
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.4s ease;
}

.magic-btn:hover {
    background: rgba(111, 18, 7, 0.8); 
    border-color: #fba648;
    color: #eedace; 
    box-shadow: 0 0 20px rgba(251, 166, 72, 0.6);
    transform: translateY(-2px); 
}

#btn-enter {
    padding: clamp(10px, 2vw, 15px) clamp(20px, 5vw, 40px);
    background: none;
    border: 2px solid #add8e6;
    color: #add8e6;
    font-family: 'Starlight', serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    cursor: pointer;
    letter-spacing: clamp(2px, 1vw, 4px);
    transition: all 0.4s ease;
    text-transform: uppercase;
}

#btn-enter:hover {
    background: #add8e6;
    color: #050208;
    box-shadow: 0 0 25px rgba(173, 216, 230, 0.6);
}

/* --- ÉCRAN D'INFORMATION --- */
#info-screen {
    position: fixed;
    inset: 0;
    z-index: 1500; 
    background-color: #050208; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.info-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.info-title {
    font-family: 'Starlight', serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: #add8e6;
    letter-spacing: clamp(3px, 1.5vw, 6px);
    margin: 0 0 30px 0;
    text-shadow: 0 0 20px rgba(173, 216, 230, 0.5);
}

.info-text {
    font-family: 'ImFell', serif;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #add8e6 !important; 
    letter-spacing: 2px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-shadow: none !important; 
    opacity: 1 !important; 
}

.info-highlight {
    color: #add8e6;
    text-shadow: none !important;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: bold;
}

.info-divider {
    border: 0;
    border-top: 1px solid rgba(173, 216, 230, 0.5);
    width: 40px;
    margin: 10px 0 25px 0;
    box-shadow: none; 
}

#btn-start-story {
    margin-top: 20px;
    padding: clamp(10px, 2vw, 15px) clamp(20px, 5vw, 40px);
    background: none;
    border: 1px solid #add8e6; 
    border-radius: 50px; 
    color: #add8e6;
    font-family: 'Starlight', serif;
    font-size: clamp(1.2rem, 4vw, 2rem);
    cursor: pointer;
    letter-spacing: clamp(2px, 1vw, 4px);
    transition: all 0.4s ease;
    text-transform: uppercase;
}

#btn-start-story:hover {
    background: #add8e6;
    color: #050208;
    box-shadow: 0 0 25px rgba(173, 216, 230, 0.6);
}

.instruction-mobile { display: none; }
.instruction-desktop { display: block; }

@media (max-width: 1100px) {
    .instruction-desktop { display: none !important; }
    .instruction-mobile { display: block !important; }
}

/* --- NARRATION --- */
#story-screen {
    z-index: 500; 
}

.story-container {
    position: relative;
    width: clamp(280px, 80%, 800px); 
    text-align: center;
}

.story-phrase {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70%; 
    text-align: center; 
    display: flex;
    justify-content: center;
    font-family: 'IMFell', serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem); 
    color: #add8e6;
    opacity: 0;
    filter: blur(10px);
    text-shadow: 0 0 20px rgba(173, 216, 230, 0.3);
}

.intro-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center; /* Aligne le bouton et le texte au centre */
    justify-content: center;
    width: 100%;
    text-align: center;
    margin: 0 auto; /* S'assure que le bloc est centré */
}

.story-phrase.highlight {
    color: #fba648;
    font-weight: bold;
}

#btn-skip-intro {
    position: absolute;
    bottom: clamp(5%, 10vh, 10%);
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #fba648;
    color: #fba648;
    font-family: 'IMFell', serif;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    cursor: pointer;
    border-radius: 50px; 
    z-index: 50;
    transition: 0.3s;
}

#btn-skip-intro:hover {
    background: rgba(251, 166, 72, 0.2);
    box-shadow: 0 0 15px rgba(251, 166, 72, 0.6);
}

/* --- LÉGENDE DES ACTES --- */
#bottom-narrative {
    position: fixed;
    bottom: clamp(20px, 5vw, 40px); 
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    width: max-content;
    max-width: 90vw;
}

.parchment-mini {
    background-color: #eedace; 
    background-image: 
        radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(0,0,0,0.05) 100%),
        url('https://www.transparenttextures.com/patterns/paper.png');
    padding: clamp(8px, 2vw, 12px) clamp(20px, 5vw, 40px); 
    clip-path: polygon(
        2% 5%, 15% 0%, 85% 2%, 98% 5%, 100% 15%, 
        97% 85%, 99% 95%, 85% 100%, 15% 98%, 2% 95%, 
        0% 85%, 3% 15%
    );
    border: 1px solid #370406; 
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.6),
        inset 0 0 20px rgba(111, 18, 7, 0.2); 
    transform: rotate(-0.5deg); 
}

.parchment-mini p {
    margin: 0;
    font-family: 'Starlight', serif;
    font-weight: 700;
    font-size: clamp(0.85rem, 2.5vw, 1.1rem); 
    color: #370406; 
    letter-spacing: clamp(1px, 0.5vw, 3px);
    text-transform: uppercase;
    filter: drop-shadow(1px 1px 0px rgba(255,255,255,0.4));
    text-align: center;
}

/* --- NAVIGATION LATÉRALE --- */
#camera-nav {
    position: fixed;
    left: clamp(10px, 3vw, 30px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
}

.nav-pill.vertical {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 15px);
    padding: clamp(8px, 1.5vw, 12px) clamp(5px, 1vw, 8px);
    background: rgba(30, 32, 35, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
    width: clamp(38px, 6vw, 46px);
    height: clamp(38px, 6vw, 46px);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* --- ÉCRAN D'INTERACTION --- */
#interaction-screen {
    position: fixed;
    inset: 0;
    z-index: 999; 
    background: #050208; 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1s ease;
}

#interaction-text {
    color: #fba648; 
    font-family: 'IMFell', serif;
    font-size: clamp(1.5rem, 5vw, 2.5rem); 
    text-align: center;
    padding: 0 15%; 
    max-width: 900px; 
    line-height: 1.4;
}

/* --- BOÎTE DE DIALOGUE --- */
#dialogue-box {
    display: none; 
    position: absolute; 
    bottom: clamp(5%, 8vh, 8%); 
    left: 50%; 
    transform: translateX(-50%); 
    width: 90%; 
    max-width: 700px; 
    padding: clamp(20px, 4vw, 35px) clamp(25px, 5vw, 50px); 
    text-align: center; 
    z-index: 500; 
    cursor: pointer; 
    clip-path: polygon(
        2% 5%, 15% 0%, 85% 2%, 98% 5%, 100% 15%, 
        97% 85%, 99% 95%, 85% 100%, 15% 98%, 2% 95%, 
        0% 85%, 3% 15%
    );
    background-color: #eedace;
    background-image: 
        radial-gradient(circle at center, rgba(255,255,255,0.4) 0%, rgba(0,0,0,0.1) 100%),
        url('https://www.transparenttextures.com/patterns/paper.png');
    border: 1px solid #370406;
    box-shadow: 
        0 15px 35px rgba(0,0,0,0.7), 
        inset 0 0 45px #370406; 
}

#dialogue-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(55, 4, 6, 0.7) 150%);
    pointer-events: none;
    z-index: 1;
}

#dialogue-text {
    font-size: clamp(1.1rem, 3.5vw, 1.6rem); 
    font-family: 'IMFell', serif; 
    margin-bottom: clamp(10px, 2vw, 15px);
    color: #21151b; 
    font-weight: bold;
}

#dialogue-indicator {
    font-size: clamp(0.8rem, 2.5vw, 1rem); 
    color: #6f1207; 
    margin: 0; 
    font-style: italic;
    font-weight: bold;
}

#dialogue-speaker {
    margin: 0 0 5px 0;
    font-family: 'Starlight', serif;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 1000;
    color: #6f1207; 
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.5vw, 2px);
    border-bottom: 2px solid rgba(55, 4, 6, 0.2); 
    display: inline-block;
    padding-bottom: 2px;
}

/* --- INTERFACE DU LIVRE ET HORLOGE --- */
#book-ui, #clock-ui {
    display: none; 
    position: fixed !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100vw !important; 
    height: 100vh !important; 
    z-index: 50 !important; 
    pointer-events: none !important; 
    background: #000 !important;
}

#book-video-bg, #clock-video-bg {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    object-fit: cover !important; 
    z-index: 1 !important;
    filter: brightness(0.7) !important; 
}

/* --- INTERFACE VIDÉO FINALE --- */
#video-ui {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    overflow: hidden;
}

.video-center-box {
    position: absolute;
    top: 75%; 
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; 
    max-width: 650px;
    padding: clamp(15px, 4vw, 30px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center
}

#portfolio-link {
    margin: 15px auto 0 auto;
    display: inline-block;
}

#crystal-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    filter: brightness(1.0);
}

.video-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom, 
        rgba(5, 2, 8, 0.9) 0%, 
        rgba(0, 0, 0, 0) 30%, 
        rgba(0, 0, 0, 0) 70%, 
        rgba(5, 2, 8, 0.9) 100%
    );
    z-index: 2;
    pointer-events: none; 
}

#video-title {
    position: absolute;
    top: clamp(10%, 15vh, 15%);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 10;
    color: #fba648;
    font-family: 'IMFell', serif;
    font-size: clamp(2rem, 8vw, 4rem); 
    margin: 0;
    letter-spacing: clamp(2px, 1vw, 4px);
    text-align: center;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
}

#video-quote {
    color: #fba648;
    font-family: 'IMFell', serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem); 
    font-weight: bold;
    text-align: center;
    line-height: 1.4;
    margin: 0 0 clamp(10px, 3vw, 20px) 0;
}

#btn-close-video {
    position: absolute;
    top: clamp(15px, 4vw, 30px); 
    right: clamp(15px, 4vw, 40px);
    z-index: 20;
    background: none;
    border: none;
    color: #fba648;
    font-size: clamp(2.5rem, 6vw, 3.5rem); 
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.9);
    rotate: 45deg;
}

#btn-close-video:hover {
    transform: scale(1.2) rotate(90deg);
    color: #eedace;
}

/* --- RESTART SYSTEM --- */
#restart-container {
    position: fixed;
    top: 100px;
    left: 30px;
    z-index: 9999; 
    pointer-events: all; 
}

#restart-container.is-hidden {
    display: none;
    pointer-events: none;
}

#btn-restart {
    padding: 10px 20px;
    background: rgba(5, 2, 8, 0.6);
    border: 1px solid #add8e6;
    border-radius: 50px;
    color: #add8e6;
    font-family: 'Starlight', serif;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

#btn-restart:hover {
    background: #add8e6;
    color: #050208;
    box-shadow: 0 0 15px rgba(173, 216, 230, 0.5);
}

/* --- LISTE DES AMES (MOBILE SEULEMENT) --- */
#mobile-soul-list {
    display: none; 
    position: fixed;
    right: 0; 
    top: 50%;
    transform: translateY(-50%); 
    z-index: 99999;
}

.soul-list-content {
    display: flex;
    flex-direction: column; 
    gap: 8px; 
    align-items: flex-end; 
}

.soul-item {
    background: #eedace; 
    background-image: url('https://www.transparenttextures.com/patterns/paper.png');
    border: 1px solid #370406;
    border-right: none; 
    color: #370406;
    font-family: 'Starlight', serif;
    font-size: 0.85rem;
    padding: 12px 20px 12px 25px;
    border-radius: 15px 0 0 15px; 
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    box-shadow: -4px 4px 10px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    width: fit-content;
    min-width: 100px;
    text-align: left;
}

.soul-item:hover {
    background-color: #fba648; 
    padding-right: 35px; 
    color: white;
}

#mobile-soul-list:not(.is-hidden) {
    display: block !important;
}

/* Masquer le menu mobile sur desktop */
@media (min-width: 1101px) {
    #mobile-soul-list {
        display: none !important; 
    }
}

/* --- BOUTON CRÉDITS --- */
#btn-credits {
    position: absolute;
    bottom: clamp(15px, 4vw, 30px);
    right: clamp(15px, 4vw, 30px);
    background: none;
    border: none;
    color: #eedace;
    font-family: 'IMFell', serif;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    cursor: pointer;
    letter-spacing: 2px;
    opacity: 0.6;
    transition: all 0.3s ease;
    text-transform: uppercase;
    z-index: 50;
}

#btn-credits:hover {
    opacity: 1;
    text-shadow: 0 0 10px rgba(238, 218, 206, 0.8);
    transform: scale(1.05);
}

/* --- ÉCRAN DES CRÉDITS --- */
#credits-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(5, 2, 8, 0.95); 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.credits-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    padding: clamp(20px, 5vw, 40px);
    border: 1px solid rgba(173, 216, 230, 0.2);
    border-radius: 10px;
    background: radial-gradient(circle at center, rgba(30, 32, 35, 0.6) 0%, rgba(5, 2, 8, 0.9) 100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Scrollbar personnalisée pour la modale */
.credits-container::-webkit-scrollbar {
    width: 6px;
}
.credits-container::-webkit-scrollbar-thumb {
    background: #add8e6;
    border-radius: 10px;
}

.credits-main-title {
    font-family: 'Starlight', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    color: #add8e6;
    letter-spacing: 4px;
    margin-top: 0;
    margin-bottom: 30px;
    text-shadow: 0 0 15px rgba(173, 216, 230, 0.4);
}

.credits-section {
    margin-bottom: 25px;
}

.credits-section h3 {
    font-family: 'Starlight', serif;
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: #fba648;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.credits-section p {
    font-family: 'IMFell', serif;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #eedace;
    line-height: 1.6;
    margin: 0;
}

/* Bouton fermer */
#btn-close-credits {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #add8e6;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#btn-close-credits:hover {
    transform: scale(1.2) rotate(90deg);
    color: #fba648;
}