body, html { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
}

#map { 
    width: 100%; 
    height: 100vh; 
}

/* 🗺️ Le filtre Vintage Sépia sur la carte */
.leaflet-layer { 
    filter: sepia(0.6) hue-rotate(-15deg) contrast(1.1) brightness(0.9); 
}

/* 🎬 STYLE DE LA BANDE SUPÉRIEURE FLOTTANTE */
#top-bar {
    position: absolute;
    top: 15px; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 90%; 
    max-width: 1400px; 
    z-index: 1000;
    background-color: rgba(244, 236, 216, 0.95);
    padding: 10px 25px;
    border: 2px solid #000; 
    border-radius: 4px; 
    box-shadow: 4px 4px 0px rgba(0,0,0,1); 
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

/* ALIGNEMENT ZONE GAUCHE */
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px; 
}

/* CONTENEUR ET BARRES DE RECHERCHE (Standard + Jeu) */
.search-wrapper {
    position: relative;
    width: 250px;
    transition: width 0.2s ease;
}

.search-wrapper:focus-within {
    width: 320px; 
}

#search-bar, #game-search-bar {
    width: 100%;
    box-sizing: border-box;
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 8px 15px;
    font-family: 'Georgia', serif;
    font-size: 14px;
    color: #000;
    font-weight: bold;
    border-radius: 4px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    outline: none;
    transition: background-color 0.2s ease;
}

#search-bar:focus, #game-search-bar:focus {
    background-color: #fff;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

#search-bar::placeholder, #game-search-bar::placeholder {
    color: #555;
    font-weight: normal;
    font-style: italic;
}

/* MENUS DÉROULANTS DES SUGGESTIONS (Standard + Jeu) */
#search-suggestions, #game-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #f4ecd8;
    border: 2px solid #000;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
    border-radius: 4px;
    margin-top: 5px;
    padding: 0;
    list-style: none;
    display: none; 
    z-index: 1001;
    overflow-y: auto;
    max-height: 200px;
}

#search-suggestions li, #game-suggestions li {
    padding: 10px 15px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 1px solid #000;
    transition: all 0.2s ease;
}

#search-suggestions li:last-child, #game-suggestions li:last-child {
    border-bottom: none;
}

#search-suggestions li:hover, #game-suggestions li:hover {
    background-color: #000;
    color: #f4ecd8;
}

/* MENU DÉROULANT DU BOUTON MINI-JEUX */
.dropdown-container {
    position: relative;
    display: inline-block;
    padding-bottom: 15px; 
    margin-bottom: -15px; 
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #f4ecd8;
    border: 2px solid #000;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
    border-radius: 4px;
    margin-top: 0px; 
    padding: 0;
    list-style: none;
    display: none; 
    z-index: 1001;
    min-width: 180px;
    overflow: hidden;
}

/* 🟢 NOUVEAU : On utilise une classe .show pour ouvrir le menu via Javascript */
.dropdown-menu.show {
    display: block !important;
}

.dropdown-menu li {
    padding: 10px 15px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 1px solid #000;
    transition: all 0.2s ease;
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu li:hover {
    background-color: #000;
    color: #f4ecd8;
}

/* 🔘 STYLE DES BOUTONS DE LA BARRE SUPÉRIEURE (Mis à jour) */
#random-btn, #suggest-btn, #play-btn, #category-btn, #campaign-btn, #timeline-toggle-btn, #game-replay-btn, #toggle-game2-btn,#categories-plus-btn,#settings-btn {
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 8px 15px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #000;
    font-weight: bold;
    border-radius: 4px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#random-btn:hover, #suggest-btn:hover, #play-btn:hover, #category-btn:hover, #campaign-btn:hover, #timeline-toggle-btn:hover, #game-replay-btn:hover, #toggle-game2-btn:hover,#categories-plus-btn:hover,#settings-btn:hover {
    background-color: #000;
    color: #f4ecd8;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

/* LOGO */
#header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

#header-logo img {
    width: 45px;
    height: 45px;
}

#header-logo h1 {
    margin: 0;
    font-family: 'Georgia', serif;
    font-size: 24px;
    color: #000;
    letter-spacing: 3px;
    font-weight: bold;
}

/* 💬 Bulles (Popups) Sépia & Noir */
.leaflet-popup-content-wrapper {
    background-color: #f4ecd8; 
    border-radius: 4px; 
    border: 2px solid #000;
    color: #000;
    font-family: 'Georgia', serif; 
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

.leaflet-popup-tip { 
    background-color: #f4ecd8; 
}

/* 🎥 Vidéos YouTube */
.video-container {
    position: relative; 
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden; 
    margin-top: 10px; 
    border: 2px solid #000; 
    background-color: #000;
}

.video-container iframe { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    border: none; 
}

#toggle-game2-btn {
    padding: 3px 8px;
    font-size: 11px;
    margin-right: 8px;
}

/* ==========================================
   STYLE DES REGROUPEMENTS DE POINTS (CLUSTERS)
   ========================================== */
.leaflet-cluster-anim .leaflet-marker-icon, 
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

/* On rend le conteneur principal transparent */
.marker-cluster {
    background-color: transparent !important; 
}

/* C'est la div intérieure qu'on stylise façon Reelmap */
.marker-cluster div {
    background-color: #f4ecd8 !important; /* Votre beige/sépia */
    border: 3px solid #000;
    color: #000;
    font-family: 'Georgia', serif;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 4px 4px 0px rgba(0,0,0,1); /* L'ombre néo-brutaliste */
    width: 38px;
    height: 38px;
    margin-top: 1px;
    margin-left: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Petit effet au survol du groupe */
.marker-cluster:hover div {
    background-color: #000 !important;
    color: #f4ecd8;
}

/* ==========================================
   🎬 BARRE INFÉRIEURE (TIMELINE, FILTRES & CAMPAGNE)
   ========================================== */

#controls-container {
    position: absolute;
    bottom: 30px; 
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    z-index: 1000;
}

#filter-bar {
    background-color: rgba(244, 236, 216, 0.95);
    padding: 15px 25px;
    border: 2px solid #000;
    border-radius: 4px;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

#normal-filters, #campaign-controls {
    width: 100%;
}

/* --- 1. MODE CAMPAGNE (BOUTONS) --- */
#campaign-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

#campaign-controls button {
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 6px 12px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#campaign-controls button:hover:not(:disabled) {
    background-color: #000;
    color: #f4ecd8;
}

#campaign-controls button:disabled {
    background-color: #ccc;
    color: #666;
    border-color: #999;
    cursor: not-allowed;
}

#camp-quit-btn {
    margin-left: 15px;
    background-color: #000 !important;
    color: #f4ecd8 !important;
}

#camp-quit-btn:hover {
    background-color: #d32f2f !important;
    border-color: #d32f2f !important;
}

/* --- 2. NOUVELLE TIMELINE (DOUBLE SLIDER) --- */
#timeline-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    color: #000;
}

#year-min-label, #year-max-label {
    background: #fff;
    border: 2px solid #000;
    padding: 2px 8px;
    border-radius: 3px;
    min-width: 45px;
    text-align: center;
}

.range-slider {
    position: relative;
    width: 100%;
    height: 35px;
}

.slider-track {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: #ccc;
    border: 1px solid #000;
    z-index: 1;
}

.slider-range {
    position: absolute;
    top: 15px;
    height: 5px;
    background-color: #000;
    z-index: 2;
}

.slider-ticks {
    position: absolute;
    top: 25px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 10px;
    font-weight: bold;
    z-index: 0;
    padding: 0 5px;
    box-sizing: border-box;
}

.range-slider input[type="range"] {
    position: absolute;
    top: 5px;
    left: 0;
    width: 100%;
    -webkit-appearance: none;
    appearance: none; /* Nécessaire pour afficher notre propre curseur */
    background: none;
    pointer-events: none;
    z-index: 3;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    width: 20px;
    height: 20px;
    background-color: #f4ecd8;
    border: 3px solid #000;
    border-radius: 50%;
    cursor: grab;
    margin-top: 2px; /* Centre le bouton sur la ligne Chrome/Safari */
}

.range-slider input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    background-color: #000;
}

.range-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 14px;
    height: 14px;
    background-color: #f4ecd8;
    border: 3px solid #000;
    border-radius: 50%;
    cursor: grab;
}

.range-slider input[type="range"]::-moz-range-thumb:active {
    cursor: grabbing;
    background-color: #000;
}

/* STYLE DES PANNEAUX DE MINI-JEUX */
#game-modal, #game-modal-2 {
    position: absolute;
    top: 100px;  
    left: 5%;    
    width: 450px; 
    background-color: rgba(244, 236, 216, 0.95);
    border: 2px solid #000;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
    border-radius: 4px;
    padding: 20px;
    z-index: 2000;
    display: none; 
    flex-direction: column;
    gap: 15px;
    font-family: 'Georgia', serif;
    color: #000;
}

.game-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 2px solid #000; 
    padding-bottom: 10px; 
}

.game-header h2 { 
    margin: 0; 
    font-size: 18px; 
    font-weight: bold; 
}

.close-game-btn { 
    background: #000; 
    color: #f4ecd8; 
    border: none; 
    padding: 5px 10px; 
    cursor: pointer; 
    font-weight: bold; 
    border-radius: 4px; 
}

.hint { 
    margin: 5px 0; 
    font-size: 14px; 
}

#game-status, #game-2-status { 
    margin: 0; 
    font-weight: bold; 
    font-size: 14px; 
    min-height: 20px; 
}

#game-submit-btn, #game-2-next-btn { 
    background-color: #f4ecd8; 
    border: 2px solid #000; 
    padding: 8px 15px; 
    font-family: 'Georgia', serif; 
    font-size: 14px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    box-shadow: 2px 2px 0px rgba(0,0,0,1); 
    border-radius: 4px; 
    width: 100%; 
}

#game-submit-btn:hover, #game-2-next-btn:hover { 
    background-color: #000; 
    color: #f4ecd8; 
}

#game-submit-btn:disabled {
    background-color: #ccc;
    color: #666;
    box-shadow: none;
    cursor: not-allowed;
    border-color: #666;
}

/* HACK CSS */
#game-2-video {
    width: 100%;
    height: 250px; 
    margin-top: 10px;
    border: 2px solid #000;
    overflow: hidden; 
    position: relative;
    background-color: #000;
}

#game-2-video iframe {
    position: absolute;
    top: -60px; 
    left: 0;
    width: 100%;
    height: calc(100% + 60px); 
    border: none;
}

/* --- MODE CAMPAGNE --- */
#normal-filters, #campaign-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

#campaign-controls button {
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 6px 12px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#campaign-controls button:hover {
    background-color: #000;
    color: #f4ecd8;
}

#campaign-controls button:disabled {
    background-color: #ccc;
    color: #666;
    border-color: #999;
    cursor: not-allowed;
}

#camp-quit-btn {
    margin-left: 15px;
    background-color: #000 !important;
    color: #f4ecd8 !important;
}

#camp-quit-btn:hover {
    background-color: #d32f2f !important;
    border-color: #d32f2f !important;
}

/* ==========================================
   STYLE DU NOUVEAU JEU : QUIZ HISTORIQUE
   ========================================== */
#quiz-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 30%; 
    transform: translateY(-50%); 
    background-color: #f4ecd8;
    padding: 25px;
    border: 2px solid #000;
    box-shadow: 6px 6px 0px rgba(0,0,0,1);
    z-index: 2000;
    width: 350px;
    flex-direction: column;
    text-align: center;
    
    /* 🟢 CORRECTION : Empêche la modale de déborder sur les petits écrans d'ordinateur */
    max-height: calc(100vh - 120px); /* 100% de l'écran moins la place du menu en haut */
    overflow-y: auto; /* Active le scroll uniquement si nécessaire */
}

#quiz-difficulty-selection button,
#quiz-answers button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background-color: #fff;
    border: 2px solid #000;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#quiz-difficulty-selection button:hover,
#quiz-answers button:hover:not(:disabled) {
    background-color: #e5e5e5;
}

/* Remplacement du style de l'ancien bouton par le nouveau */
#quiz-next-btn, #quiz-view-event-btn, #game-2-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background-color: #3b82f6;
    color: white;
    border: 2px solid #000;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background-color 0.2s;
}

#quiz-next-btn:hover, #quiz-view-event-btn:hover, #game-2-submit-btn:hover {
    background-color: #2563eb;
}

/* STYLE DU JEU FICTION OU RÉEL (Même base que le Quiz) */
#fiction-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 30%; 
    transform: translateY(-50%);
    background-color: #f4ecd8;
    padding: 25px;
    border: 2px solid #000;
    box-shadow: 6px 6px 0px rgba(0,0,0,1);
    z-index: 2000;
    width: 350px;
    flex-direction: column;
    text-align: center;
    box-sizing: border-box;
    font-family: 'Georgia', serif;

    /* 🟢 CORRECTION : Pareil pour le jeu de fiction */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* On groupe les comportements mobiles avec les autres modales */
@media screen and (max-width: 1024px) {
    #fiction-modal {
        left: 50% !important; 
        top: 32% !important;
        transform: translate(-50%, -50%) !important; 
        width: 90% !important;
        max-width: 320px;
        transition: top 0.3s ease, transform 0.3s ease;
    }
    
    /* Permet à la fenêtre de remonter quand l'explication s'affiche pour ne pas masquer les boutons */
    #fiction-modal.shift-up-mobile {
        max-height: 85vh !important; 
        overflow-y: auto !important;
        top: 75px !important;
        transform: translate(-50%, 0) !important;
    }

    
}

/* ==========================================
   STYLE DU NOUVEAU SYSTÈME D'AUTHENTIFICATION
   ========================================== */

#auth-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 30%; /* Alignement identique à celui de votre Quiz */
    transform: translateY(-50%);
    background-color: #f4ecd8;
    padding: 25px;
    border: 2px solid #000;
    box-shadow: 6px 6px 0px rgba(0,0,0,1);
    z-index: 2000;
    width: 350px;
    flex-direction: column;
}

.auth-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
}

.auth-tabs button {
    flex: 1;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: #666;
}

.auth-tabs button.active {
    color: #000;
    border: 2px solid #000;
    border-bottom: none;
    background-color: #fff;
    border-radius: 4px 4px 0 0;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 12px;
}

.auth-input-group label {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 4px;
}

.auth-input-group input {
    padding: 10px;
    border: 2px solid #000;
    border-radius: 4px;
    font-family: inherit;
}

#auth-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background-color: #10b981; /* Vert dynamique */
    color: white;
    border: 2px solid #000;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: background-color 0.2s;
}

#auth-submit-btn:hover {
    background-color: #059669;
}

#auth-status-message {
    margin-top: 10px;
    font-weight: bold;
    font-size: 13px;
}

/* ==========================================
   📱 RESPONSIVE (Tablettes & Mobiles)
   ========================================== */
@media screen and (max-width: 1024px) {
    /* 1. La barre devient une colonne */
    #top-bar {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
        width: 95%;
    }

    

    /* 2. On ajuste les éléments pour qu'ils ne débordent pas */
    .top-bar-left {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap; /* Les boutons passent à la ligne proprement */
        gap: 5px;
    }

    /* 3. Réduction de la recherche pour laisser de la place aux boutons */
    .search-wrapper {
        width: 200px;
    }

    /* 4. On réduit la taille des boutons sur tablette pour éviter les retours à la ligne inutiles */
    #random-btn, #suggest-btn, #play-btn, #category-btn, #campaign-btn, #auth-nav-btn, #timeline-toggle-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* 5. Recentrage des Modals pour tous les petits écrans */
    #auth-modal, #game-modal, #game-modal-2, #quiz-modal {
        left: 50% !important; 
        top: 32% !important;
        transform: translate(-50%, -50%) !important; 
        width: 90% !important;
        max-width: 320px;
        transition: top 0.3s ease, transform 0.3s ease; /* 🟢 AJOUT : Rend le glissement fluide */
    }
    /* 🟢 NOUVELLE RÈGLE : Modale déplacée vers le haut après avoir répondu */
    #quiz-modal.shift-up-mobile {
        /* Permet à la modale de scroller de l'intérieur si l'affiche la rend trop grande pour un petit écran */
        max-height: 85vh !important; 
        overflow-y: auto !important;
        top: 50px !important; /* La place juste en dessous de la barre de menu */
        transform: translate(-50%, 0) !important; /* Annule le centrage vertical (-50%) */
        z-index: 2000;
    }
    
    #game-modal-2 {
        top: auto !important; /* Annule le centrage vers le haut (32%) */
        bottom: 20px !important; /* Place la modale à 20px du bas de l'écran */
        transform: translate(-50%, 0) !important; /* Annule le décalage vertical du transform */
    }

/* 📱 1. POP-UP MODE CAMPAGNE (Au-dessus du point, reliée à la carte) */
    .mobile-campaign-popup {
        bottom: 0 !important; /* On laisse Leaflet la faire grandir vers le haut */
        top: auto !important; /* Annule tout top forcé */
        margin-bottom: 15px !important; /* Petit espace avec le marqueur */
    }

    .mobile-campaign-popup .leaflet-popup-content-wrapper {
        border-radius: 12px !important;
        box-shadow: 0px -4px 15px rgba(0,0,0,0.3) !important;
    }

    .mobile-campaign-popup .leaflet-popup-tip-container {
        display: block !important; 
        /* La flèche pointe naturellement vers le bas, on la garde visible */
    }

    /* ----------------------------------------------------- */
    /* (Ne modifiez pas la suite, gardez votre code actuel) */
    /* 📱 2. POP-UP MODE NORMAL (En dessous du point, centrée) */
    /* .mobile-normal-popup { ... } */

    /* 📱 2. POP-UP MODE NORMAL (En dessous du point, centrée) */
    .mobile-normal-popup {
        bottom: auto !important; /* 🟢 LA LIGNE MAGIQUE : annule l'ancrage vers le haut de Leaflet */
        top: 20px !important; /* 🟢 Décale la pop-up vers le bas (laissant la place au point) */
        margin-bottom: 0 !important; /* Annule le comportement natif de Leaflet qui pousse vers le haut */
    }

    .mobile-normal-popup .leaflet-popup-content-wrapper {
        border-radius: 12px !important;
        box-shadow: 0px 4px 15px rgba(0,0,0,0.3) !important;
    }

    .mobile-normal-popup .leaflet-popup-tip-container {
        /* On inverse la flèche pour qu'elle pointe vers le HAUT (vers le marqueur) */
        top: -20px !important; 
        bottom: auto !important;
        transform: rotate(180deg) !important; 
    }
    /* 📱 Cache le menu supérieur quand un mode est actif */
    #top-bar.hidden-on-mobile {
        display: none !important;
    }    
}


@media screen and (max-width: 600px) {
    /* Sur mobile, on force la recherche à prendre toute la largeur */
    .search-wrapper {
        width: 100%;
    }
    
    #header-logo h1 {
        font-size: 16px; /* Titre plus discret sur téléphone */
    }
}

/* ==========================================
   🎬 STYLE DE LA MODALE PLEIN ÉCRAN DÉTAILS (CORRIGÉ MOBILE)
   ========================================== */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(244, 236, 216, 0.98); /* Fond sépia */
    z-index: 3000; /* Bien au-dessus de Leaflet (1000) et des jeux (2000) */
    display: none; /* Géré par le JS */
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    font-family: 'Georgia', serif;
    color: #000;
    padding: 10px; /* Petit espace de sécurité sur les bords de l'écran mobile */
}

.modal-content-details {
    position: relative;
    width: 95%;
    max-width: 800px;
    
    /* 🟢 CORRECTION ULTRA-IMPORTANTE POUR MOBILE : */
    max-height: 90vh; /* La modale ne dépassera JAMAIS 90% de la hauteur de l'écran */
    overflow-y: auto; /* Active le défilement (scroll) automatique si le contenu est trop grand */
    
    background-color: #fff;
    padding: 30px 25px; /* Légère réduction du padding pour optimiser l'espace mobile */
    border: 3px solid #000;
    box-shadow: 6px 6px 0px rgba(0,0,0,1); /* Style Néo-brutaliste */
    border-radius: 4px;
    animation: fadeInModal 0.2s ease-out;
    box-sizing: border-box;
}

/* On nettoie la règle qu'on avait mise sur l'id de description pour que le défilement */
/* se fasse naturellement sur toute la boîte de la modale plutôt que sur un petit paragraphe */
#dm-event-description {
    font-size: 16px;
    line-height: 1.6;
    margin-top: 15px;
    margin-bottom: 0;
}

/* ==========================================
   STYLE DU BOUTON "EN SAVOIR PLUS" (POP-UP)
   ========================================== */
.btn-more-info {
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 8px 15px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #000;
    font-weight: bold;
    border-radius: 4px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-more-info:hover {
    background-color: #000;
    color: #f4ecd8;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #f4ecd8;
    border: 2px solid #000;
    padding: 6px 14px;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #000;
    font-weight: bold;
    border-radius: 4px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background-color: #000;
    color: #f4ecd8;
    box-shadow: 4px 4px 0px rgba(0,0,0,1);
}

/* ==========================================
   📂 STYLE DU BOUTON ET MODALE CATÉGORIES
   ========================================== */


/* Grille des catégories dans la modale */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: #fff;
    border: 3px solid #000;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 6px 6px 0px rgba(0,0,0,1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease;
}

.category-card:hover {
    transform: translateY(-5px); /* Petit effet de soulèvement au survol */
}

.category-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
    color: #d32f2f;
}

.category-card p {
    font-size: 15px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
    flex-grow: 1; /* Pousse le bouton toujours tout en bas de la carte */
}

/* ==========================================
   📱 ADAPTATION MOBILE DU BOUTON CATÉGORIES
   ========================================== */
@media screen and (max-width: 1024px) {
    #categories-plus-btn {
        font-size: 11px;           /* On réduit la taille du texte */
        padding: 6px 8px;          /* On réduit les marges internes */
    }
}

@media screen and (max-width: 480px) {
    #categories-plus-btn {
        font-size: 11px;           /* Encore plus petit sur smartphone */
        padding: 6px 10px;
    }
}

/* ==========================================
   STYLE DE LA LÉGENDE DU MODE CAMPAGNE
   ========================================== */
#campaign-legend {
    display: none; /* Masqué par défaut, affiché via JS */
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 2px dashed #000;
    font-family: 'Georgia', serif;
    font-size: 13px;
    font-weight: bold;
    color: #000;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border: 2px solid #000;
    border-radius: 3px;
    box-shadow: 1px 1px 0px rgba(0,0,0,1);
}

/* ==========================================
   STYLE DU MENU ARCHIVES
   ========================================== */
.archive-item {
    background: #f4ecd8;
    border: 2px solid #000;
    padding: 12px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-family: 'Georgia', serif;
    font-size: 14px;
    box-shadow: 2px 2px 0px rgba(0,0,0,1);
}
.archive-item button {
    background: #3b82f6;
    color: white;
    border: 2px solid #000;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
    transition: background 0.2s;
}
.archive-item button:hover { background: #2563eb; }
.archive-item.played { opacity: 0.6; } /* Grise légèrement si déjà joué */