/* --- VARIABLES & BASE --- */
:root {
    --paper: #fffdf0;
    --ink: #1a1a1a;
    --gold: #fbc02d;
    --blood: #8b0000;
}

body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background-color: #000; font-family: 'Special Elite', serif;
    display: flex; flex-direction: column; overflow: hidden;
}

/* CONTENEUR DE SCÈNE */
#viewport {
    height: calc(100vh - 180px); /* place au panel texte */
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #050505;
    position: relative;
    overflow: hidden;
}

/*ZONE DE JEU CANVAS */
#game-canvas {
    position: relative;
    height: 100%;
    aspect-ratio: 16 / 9;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%; /* Important pour que les zones % matchent */
    box-shadow: 0 0 50px rgba(0,0,0,1);
    transition: background-image 0.5s ease-in-out;
}

/* --- ZONES INTERACTIVES --- */
.interactive-zone {
    position: absolute;
    cursor: pointer;
    z-index: 10;
}

/* --- UI TEXTE (PANEL BAS) --- */
.ui-panel {
    height: 180px;
    width: 100vw;
    background: #000;
    border-top: 2px solid #1a1a1a;
    padding: 20px 10%;
    box-sizing: border-box;
    color: var(--paper);
    position: relative;
    flex-shrink: 0;
}

.speaker { color: var(--gold); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 2px; }
.text { font-size: 1.2rem; line-height: 1.4; transition: opacity 0.3s; }

/* --- ÉLÉMENTS COMMUNS (BOUTONS) --- */
.btn-retour {
    position: absolute; top: 20px; left: 20px;
    padding: 10px 15px; background: rgba(0,0,0,0.8);
    border: 1px solid var(--paper); color: var(--paper);
    cursor: pointer; font-family: 'Special Elite';
    z-index: 200; text-decoration: none;
}

.tools-container {
    position: absolute; top: 15px; right: 15px;
    display: flex; gap: 10px; z-index: 200;
}

.tool-btn {
    background: rgba(0,0,0,0.8); border: 1px solid var(--paper);
    color: var(--paper); padding: 8px 12px; cursor: pointer;
    font-family: 'Special Elite';
}
.tool-btn.active { background: var(--blood); }

/* --- OVERLAY 3D (EXAMEN D'OBJETS) --- */
#canvas-3d-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    display: none; 
    z-index: 50;
}

#btn-close-3d {
    position: absolute; top: 20px; right: 20px;
    background: var(--blood); color: white; border: 1px solid var(--paper);
    font-family: 'Special Elite'; padding: 10px 20px;
    cursor: pointer; z-index: 100;
}

/* --- SYSTÈME UV (BUREAU) --- */
#uv-overlay {
    position: absolute; inset: 0;
    background: rgba(20, 0, 50, 0.7);
    mix-blend-mode: multiply;
    pointer-events: none; opacity: 0;
    transition: opacity 0.5s; z-index: 5;
}

#uv-flashlight {
    position: absolute;
    width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(150, 100, 255, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 6;
    transform: translate(-50%, -50%);
}

#hidden-code {
    position: absolute;
    color: #b388ff; font-size: 1.2rem;
    text-shadow: 0 0 10px #b388ff;
    opacity: 0; pointer-events: none; z-index: 20;
    transform: translate(-50%, -50%);
}

#thought-overlay {
    position: fixed; inset: 0; background: #000; z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 1s; color: #fff;
}

#thought-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, #1a1a1a 0%, #000 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 1.5s ease-in-out;
    color: #fff;
    overflow: hidden;
}

.thought-content {
    width: 90%;
    max-width: 1000px;
    display: flex;
    align-items: center;
    gap: 50px;
}

.thought-visuals {
    position: relative;
    width: 400px;
}

.detective-thought-sprite {
    height: 500px;
    filter: sepia(1) contrast(1.2) brightness(0.6) blur(1px);
    mask-image: linear-gradient(to right, black 60%, transparent);
    animation: pulseFilter 4s infinite alternate;
}

.thought-text-container {
    flex: 1;
    border-left: 2px solid var(--gold);
    padding-left: 40px;
}

.thought-text {
    font-family: 'Special Elite', serif;
    font-size: 1.6rem;
    line-height: 1.7;
    font-style: italic;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

#evidence-popups {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Les petits flashs des indices trouvés */
.mini-evidence-flash {
    position: absolute;
    background: rgba(251, 192, 45, 0.15);
    border: 1px solid var(--gold);
    padding: 12px 20px;
    font-size: 0.9rem;
    color: var(--gold);
    border-radius: 2px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    white-space: nowrap;
    
    /* Animation d'apparition en fondu */
    animation: quickFadeIn 0.8s ease-out forwards;
    font-family: 'Special Elite', serif;
    text-transform: uppercase;
    backdrop-filter: blur(2px);
}

.leave-button-style {
    /* --- Positionnement --- */
    /* Fixé en bas au centre de l'écran pour être toujours visible */
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* S'assure qu'il passe par-dessus les autres éléments */

    /* --- Typographie (Style Enquête / Film Noir) --- */
    font-family: 'Courier New', Courier, monospace; /* Effet machine à écrire */
    font-size: 1.1rem;
    font-weight: bold;
    color: #f4f1ea; /* Blanc cassé / couleur papier */
    text-transform: uppercase;
    letter-spacing: 2px;

    /* --- Apparence du bouton --- */
    background-color: #1a1a1a; /* Gris très sombre / Noir */
    border: 2px solid #d3af37; /* Bordure dorée / laiton */
    border-radius: 5px;
    padding: 15px 35px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);

    /* --- Transitions pour l'interactivité --- */
    transition: all 0.3s ease;
    
    /* Animation pour une apparition en douceur (Optionnel) */
    animation: slideUpFade 0.5s ease-out forwards;
}

/* --- Effet au survol (Hover) --- */
.leave-button-style:hover {
    background-color: #d3af37; /* Le fond devient doré */
    color: #1a1a1a; /* Le texte devient noir */
    box-shadow: 0 6px 25px rgba(211, 175, 55, 0.4); /* Halo lumineux doré */
    transform: translateX(-50%) scale(1.05); /* Grossit légèrement */
}

/* --- Effet au clic (Active) --- */
.leave-button-style:active {
    transform: translateX(-50%) scale(0.95); /* S'enfonce légèrement */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* --- Animation d'apparition --- */
@keyframes slideUpFade {
    from {
        opacity: 0;
        bottom: 10px;
    }
    to {
        opacity: 1;
        bottom: 40px;
    }
}

@keyframes flyIn {
    from { opacity: 0; transform: translate(50px, 20px) rotate(10deg); }
    to { opacity: 1; transform: translate(0, 0) rotate(-5deg); }
}

@keyframes pulseFilter {
    from { filter: sepia(1) contrast(1.2) brightness(0.6) blur(1px); }
    to { filter: sepia(0.8) contrast(1.1) brightness(0.7) blur(0px); }
}

@keyframes quickFadeIn {
    from { 
        opacity: 0; 
        scale: 1.5; /* Arrive de "devant" l'écran */
    }
    to { 
        opacity: 1; 
        scale: 1;
    }
}