/* --- CONFIGURATION DES COULEURS --- */
:root {
    --primary: #5D4037;    /* Chocolat Foncé */
    --secondary: #5D4037;  /* Chocolat au Lait */
    --accent: #FFD54F;     /* Or / Jaune Pâques */
    --spring: #8BC34A;     /* Vert Prairie */
    --paper: #FDF5E6;      /* Vieux Papier / Grimoire */
    --success: #81C784;    /* Vert Validation */
    --error: #E57373;      /* Rouge Erreur */
    --shadow: rgba(0,0,0,0.15);
}

/* --- RESET & BASE --- */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--spring) !important;
    color: var(--primary);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    line-height: 1.4;
}

/* --- CLASSES SPECIFIQUES AU THEME --- */
.grimoire-body {
    background-color: var(--spring) !important;
    background-image: radial-gradient(rgba(255,255,255,0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

.grimoire-card {
    background-color: var(--paper) !important;
    background-image: url('https://www.transparenttextures.com/patterns/fiber-paper.png');
    border: 2px solid #D7CCC8;
    position: relative;
}

/* --- CONTENEURS --- */
.container {
 .container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 10px 15px; /* Réduit de 20px à 10px/15px */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* CHANGE 'center' par 'flex-start' pour remonter */
    min-height: auto; /* CHANGE '100vh' par 'auto' */
}

.card {
    background: white;
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 10px 30px var(--shadow);
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-out;
}

/* --- TYPOGRAPHIE --- */
h1, h2, h3 {
    margin-top: 0;
    font-weight: 750;
    text-align: center;
}

.section-title {
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 8px;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* --- FORMULAIRES --- */
input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #FFFDE7;
}

input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 8px rgba(141, 110, 99, 0.2);
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.8rem;
    color: var(--secondary);
    text-transform: uppercase;
}

.label-grimoire {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--secondary);
    margin-bottom: 8px;
    text-align: left;
}

.pin-input {
    text-align: center;
    letter-spacing: 12px;
    font-size: 1.2rem !important;
    background-color: #FFFDE7 !important;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
}

/* --- BOUTONS --- */
.btn-action {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    display: block;
    text-align: center;
    box-shadow: 0 4px 12px rgba(93, 64, 55, 0.3);
    transition: transform 0.2s;
}

.btn-mascotte {
    /* 1. Structure & Taille */
    display: block;
    width: 100%;
    height: 60px;
    padding: 0; /* On met le padding à 0 et on joue sur line-height pour le centrage */
    line-height: 60px; /* Doit être égal à la hauteur pour un centrage vertical parfait */
    margin-top: 10px;
    border-radius: 12px;
    box-sizing: border-box;
    
    /* 2. Style Visuel */
    border: none;
    background-color: #5D4037 !important; /* Marron */
    color: white !important;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    
    /* 3. Typographie */
    font-family: inherit;
    font-size: 16px;
    font-weight: 500 !important;
    text-transform: uppercase;

    /* 4. LE SECRET DE L'IDENTITÉ (Reset Navigateur) */
    appearance: none;          /* Supprime le style système du bouton */
    -webkit-appearance: none;  /* Pour Safari/iOS */
    outline: none;             /* Enlève le contour bleu au clic */
    vertical-align: middle;    /* Aligne les deux types d'éléments de la même façon */
}

/* Correction spécifique pour la balise <button> qui ajoute parfois des marges internes */
button.btn-mascotte {
    overflow: visible;
    margin: 20px 0 0 0;
}
.btn-secondary {
    width: 100%;
    padding: 14px;
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 15px;
    font-weight: 500;
    text-decoration: none;
    display: block;
    text-align: center;
    transition: all 0.2s;
}

.btn-action:active, .btn-secondary:active {
    transform: scale(0.97);
}

.remove-btn {
    background: var(--error);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0 12px;
    cursor: pointer;
}

/* --- ELEMENTS DE LA CARTE (MAP) & NAVIGATION --- */
#map {
    background-color: transparent !important;
}

.leaflet-container {
    background-color: transparent !important;
}

.tag-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 25px;
}
.ui-top { 
    width: 100%; 
    /* Augmente la première valeur (le haut) à 30px ou 40px */
    padding: 0px 0px 0px 0px !important; 
    z-index: 2000; 
    display: flex; 
    justify-content: center; 
    background: var(--spring);
    flex-shrink: 0; 
    box-sizing: border-box;
}

.type-tag.btn-map {
      display: inline-block;
    text-align: center;
    background-color: var(--accent);
    border-radius: 25px;
    padding: 12px 25px;
    min-width: 220px;
    font-size: 18px;
    font-weight: 500;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    text-transform: uppercase;
    margin-bottom: 0px;   /* Ajuste la valeur selon l'espace voulu */
    vertical-align: middle;
}


.type-tag.btn-tag {
    display: inline-block;
    text-align: center;
    background-color: var(--accent);
    border-radius: 25px;
    padding: 12px 25px;
    min-width: 220px;
    font-size: 18px;
    font-weight: 500;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    text-transform: uppercase;
    margin-bottom: 30px;   /* Ajuste la valeur selon l'espace voulu */
    vertical-align: middle;
}

#menuOverlay {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(93, 64, 55, 0.98);
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.close-btn { 
    position: absolute; 
    top: 20px; 
    right: 25px; 
    font-size: 40px; 
    color: white; 
    cursor: pointer; 
}

.score-box {
    background: var(--accent);
    color: var(--primary);
    padding: 10px 25px;
    border-radius: 50px;
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: 500;
}

.menu-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 1.4rem;
    margin: 15px 0;
    text-transform: uppercase;
    font-weight: 500;
}

/* --- MISSIONS PHOTOS (Selfies & Objets) --- */
.preview-img { 
    width: 100%; 
    max-height: 350px; 
    object-fit: contain; 
    border-radius: 15px; 
    display: none; 
    margin-top: 15px; 
    border: 3px solid white; 
    box-shadow: 0 5px 15px var(--shadow); 
}

#fileInput { 
    display: none; 
}

.upload-zone {
    border: 3px dashed var(--spring);
    padding: 25px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.leaflet-grab {
    cursor: grab;
}
.leaflet-drag-target {
    cursor: grabbing;
}
/* Empêche la sélection de texte pendant qu'on bouge la carte */
#map {
    user-select: none;
    -webkit-user-select: none;
}

.body-carte {
    margin: 0;
    padding: 25px 0 0 0 !important; /* Réduit de 45px à 25px en haut, et 0 en bas */
    width: 100%;
    height: 100vh; /* Utilise toute la hauteur de l'écran */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Empêche le scroll global */
    justify-content: center; 
    background: #8BC34A; 
    flex-shrink: 0; 
    z-index: 2000;
}





.body-carte .ui-top {
    width: 100%;
    padding: 0px 0 0px 0;
    background: #8BC34A;
    flex-shrink: 0; /* Le menu garde sa taille */
    display: flex;
    justify-content: center;
    z-index: 1000;
}

.body-carte #map {
    flex-grow: 1; /* La carte prend tout le reste de la place */
    width: 100%;
}

/* --- Zone du Puzzle (Le Parchemin) --- */
        .puzzle-board {
            position: relative;
            /* On adapte la taille pour mobile (ex: 300px de large) */
            width: 300px; 
            height: 500px; 
            background-image: url('images/puzzle.png'); /* CHEMIN VERS VOTRE FICHIER */
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
            border: 2px solid #5D4037;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.3);
            margin: 20px auto;
            background-color: rgba(255,255,255,0.2); /* Fond léger si l'image charge mal */
        }

        /* --- Les Pièces du Puzzle --- */
        .piece-puzzle {
            position: absolute;
            width: 100px; /* 300px / 3 colonnes */
            height: 100px; /* 500px / 5 lignes */
            background-image: url('images/puzzle.png'); /* MÊME FICHIER */
            background-size: 300px 500px; /* Taille totale identique au plateau */
            background-repeat: no-repeat;
            cursor: grab;
            touch-action: none;
            z-index: 10;
            border: 1px solid rgba(0,0,0,0.1); /* Bordure fine pour distinguer les pièces */
            box-sizing: border-box;
        }