/* ==========================================================================
   1. VARIABLES DE COULEURS & RESETS
   ========================================================================== */
:root {
    --bg-dark-purple: #0e0a14;  /* Encore plus sombre, presque noir opaque */
    --cloud-yellow: #a83232;    /* Rouge sang / Trauma */
    --cloud-blue: #4d5660;      /* Gris cendreux des ruines */
    --ui-dark: #05060a;          /* Bordures lourdes */
    --ui-medium: #151824;       /* En-têtes */
    --text-light: #b9c3d0;      /* Blanc cassé froid */
    --accent-red: #ff3b3b;      /* Rouge écarlate (Teinte des yeux du boss) */
    --boss-pink: #e64a72;       /* Teinte rose de l'iris du boss */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    line-height: 1.8;
    color: var(--text-light);
    background-color: var(--bg-dark-purple);
    overflow-x: hidden;
}

.pixel-art {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   2. SPLASH SCREEN (ACCUEIL)
   ========================================================================== */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--ui-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.logo-container-splash {
    display: flex;
    align-items: flex-end;
}

.splash-logo-img {
    max-width: 160px;
    height: auto;
}

.logo-extension {
    font-size: 10px;
    color: var(--cloud-yellow);
    margin-left: 6px;
    padding-bottom: 2px;
}

.logo-floating {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.pixel-art-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: var(--text-light);
    background-color: var(--ui-medium);
    padding: 15px 40px;
    border: 4px solid var(--ui-dark);
    cursor: pointer;
    box-shadow: inset -4px -4px 0px #090b12, inset 4px 4px 0px var(--cloud-blue), 0px 6px 0px #000;
}

.pixel-art-btn:active, .pixel-art-btn.clicked {
    transform: translateY(6px);
    box-shadow: inset -4px -4px 0px var(--cloud-blue), inset 4px 4px 0px #000, 0px 0px 0px #000;
}

#loading-container {
    width: 260px;
    text-align: center;
}

#loading-bar {
    width: 0%;
    height: 12px;
    background-color: var(--cloud-yellow);
    border: 3px solid var(--ui-dark);
    margin-bottom: 10px;
}

#loading-text {
    font-size: 8px;
    color: var(--cloud-blue);
}

/* ==========================================================================
   3. NOUVEAU LAYOUT PROFESSIONNEL (SIDEBAR + MAIN)
   ========================================================================== */
.container {
    max-width: 1000px; /* Élargi pour casser l'effet de vide */
    margin: 0 auto;
    padding: 0 20px;
}

.background-sky {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('decor_ciel.png');
    background-size: cover;
    opacity: 0.15; /* Très sombre pour l'angoisse */
    z-index: -2;
}

.main-header {
    padding: 40px 0 20px 0;
}

.logo-container-main {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.main-logo-img-fix {
    max-width: 150px;
}

/* GRILLE DU SITE */
.layout-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr; /* Remplis parfaitement l'espace latéral */
    gap: 30px;
    align-items: start;
    margin-top: 20px;
}

/* LA SIDEBAR */
.sidebar-nav {
    background-color: rgba(5, 6, 10, 0.9);
    border: 4px solid var(--ui-dark);
    padding: 20px;
    box-shadow: 0px 6px 0px rgba(0,0,0,0.4);
}

.sidebar-title {
    font-size: 9px;
    color: var(--cloud-blue);
    border-bottom: 2px solid var(--ui-medium);
    padding-bottom: 10px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.sidebar-nav .nav-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 12px;
    color: var(--text-light);
    background-color: transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.sidebar-nav .nav-button:hover, .sidebar-nav .nav-button.active {
    color: var(--accent-red);
    background-color: var(--ui-medium);
    padding-left: 18px; /* Effet de décalage au survol */
}

.sidebar-status-box {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 2px solid var(--ui-medium);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 8px;
    color: var(--cloud-yellow);
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-red);
}

.pulse {
    animation: pulseGlow 1.5s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* ==========================================================================
   4. COMPOSANTS DU LOG ET DESIGN DU BOSS (image_e05b82.png)
   ========================================================================== */
.character-dialog {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #05060a;
    border-left: 4px solid var(--cloud-yellow);
    padding: 15px 20px;
    margin-bottom: 25px;
}

.character-sprite {
    width: 32px;
    height: auto;
}

.dialog-author {
    color: var(--cloud-blue);
    font-size: 9px;
}

.dialog-text {
    font-size: 9px;
    font-style: italic;
}

.game-box {
    background-color: rgba(5, 6, 10, 0.85);
    border: 4px solid var(--ui-dark);
    box-shadow: 0px 8px 0px rgba(0,0,0,0.5);
    margin-bottom: 25px;
}

.box-header {
    background-color: var(--ui-medium);
    padding: 10px 15px;
    font-size: 9px;
    color: var(--text-light);
    border-bottom: 4px solid var(--ui-dark);
}

.box-content {
    padding: 20px;
}

.log-date {
    display: block;
    font-size: 8px;
    color: var(--cloud-yellow);
    margin-bottom: 12px;
}

/* MISE EN PAGE DU BOSS FINAL */
.entity-box {
    border-color: var(--cloud-yellow);
}

.boss-showcase {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    background-color: #0c0e14;
    border: 4px solid var(--ui-dark);
    padding: 15px;
    margin: 20px 0;
}

.boss-img-container {
    background-color: #928886; /* Rappel du fond gris de image_e05b82.png */
    border: 3px solid var(--ui-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    line-height: 0;
}

.boss-sprite-anim {
    width: 100%;
    max-width: 120px;
    height: auto;
    /* Lévitation instable et saccadée spécifique pour ce boss */
    animation: jitterFloat 2.5s steps(4) infinite;
}

@keyframes jitterFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0px); }
}

.boss-specs p {
    font-size: 9px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.sub-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed var(--ui-medium);
}

.sub-section h3 {
    font-size: 10px;
    color: var(--boss-pink);
    margin-bottom: 10px;
}

/* Éléments divers */
.img-wrapper {
    margin-top: 15px;
    border: 4px solid var(--ui-dark);
}

.game-screenshot {
    width: 100%;
    height: auto;
}

blockquote {
    border-left: 3px solid var(--accent-red);
    padding-left: 12px;
    margin: 15px 0;
    color: var(--cloud-blue);
    font-style: italic;
    font-size: 9px;
}

.alert-box { border-color: var(--accent-red); }
.error-text { color: var(--accent-red); font-size: 9px; margin-bottom: 10px; }

.progress-wrapper { margin-bottom: 15px; }
.progress-label { display: block; font-size: 8px; margin-bottom: 5px; }
.mini-progress { height: 12px; background-color: var(--ui-dark); border: 2px solid var(--ui-medium); padding: 1px; }
.mini-bar { height: 100%; background-color: var(--cloud-yellow); }

.game-footer {
    text-align: center;
    font-size: 8px;
    color: var(--cloud-blue);
    padding: 40px 0;
    grid-column: span 2;
}

/* Écrans tactiles / Mobiles */
@media (max-width: 768px) {
    .layout-wrapper { grid-template-columns: 1fr; }
    .boss-showcase { grid-template-columns: 1fr; }
}

/* ==========================================================================
   NIVEAU SUPÉRIEUR : MINI-JEU & EFFETS DE SECOUSSE (GLITCH)
   ========================================================================== */
.terminal-screen {
    background-color: #05060a;
    border: 4px solid var(--ui-medium);
    padding: 20px;
    margin-top: 15px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.choices-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--cloud-blue);
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: 5px 0;
    outline: none;
    transition: color 0.1s;
}

.choice-btn:hover {
    color: var(--accent-red);
}

/* ANIMATION CRITIQUE : Secousse de tout le site (Glitch) */
.screen-shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0% { transform: translate(0, 0); filter: hue-rotate(0deg); }
    10% { transform: translate(-4px, 3px); filter: hue-rotate(90deg); }
    30% { transform: translate(4px, -2px); }
    50% { transform: translate(-3px, -3px); filter: hue-rotate(180deg); }
    70% { transform: translate(3px, 2px); }
    90% { transform: translate(-2px, 1px); }
    100% { transform: translate(0, 0); filter: hue-rotate(0deg); }
}

/* ==========================================================================
   VISUEL ET ANIMATION DU PARCHEMIN (CORRIGÉ)
   ========================================================================== */
.letter-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column; /* Aligne la page et le bouton verticalement */
    align-items: center;    /* Centre la page et le bouton horizontalement */
    width: 100%;
}

.pixel-paper {
    background-image: url('papier.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    color: #1e160a;
    padding: 35px 30px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    line-height: 1.8;
    width: 100%;
    max-width: 450px;
    min-height: 220px;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transform: translate(0, 0);
}

/* EFFET DE GLITCH SACCADÉ AU CHANGEMENT DE PAGE (PAS DE VERT) */
.page-turning {
    animation: pixelGlitch 0.2s steps(2) infinite;
}

@keyframes pixelGlitch {
    0% { 
        transform: translate(1px, -1px); 
        filter: brightness(0.8);
        opacity: 0.8;
    }
    50% { 
        transform: translate(-1px, 1px); 
        filter: brightness(1.2);
        opacity: 0.5;
    }
    100% { 
        transform: translate(0px, -1px); 
        filter: brightness(1);
        opacity: 0.9;
    }
}

/* BOUTON PARFAITEMENT CENTRÉ AVEC LA PAGE */
.letter-next-btn {
    font-size: 8px !important;
    padding: 10px !important;
    background-color: var(--ui-medium) !important;
    color: var(--text-light) !important;
    border: 4px solid var(--ui-dark) !important;
    box-shadow: inset -4px -4px 0px #000, 0px 4px 0px #000 !important;
    width: 100%;
    max-width: 450px; /* Même largeur max que le papier pour s'aligner pile poil */
    margin-top: 15px;
    cursor: pointer;
}

/* ANIMATION DE SECOUSSE ADOUCIE (MOINS FORTE) */
.screen-shake {
    animation: gentle-shake 0.4s ease-in-out;
}

@keyframes gentle-shake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-1px, 1px); }
    30% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, -1px); }
    70% { transform: translate(1px, 1px); }
    90% { transform: translate(0px, 0px); }
    100% { transform: translate(0, 0); }
}

