body { 
    font-family: 'Verdana', sans-serif; 
    background: #121212; 
    color: #dcdcdc; 
    display: flex; 
    justify-content: center; 
    padding: 20px; 
}
.app-card { 
    background: #1e1e1e; 
    border: 1px solid #444; 
    border-radius: 8px; 
    width: 800px; 
    padding: 30px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}
h1 { 
    color: #d4af37; 
    text-align: center; 
    text-transform: uppercase; 
    font-size: 1.5em;
    margin-bottom: 30px;
}
.row { display: flex; gap: 20px; margin-bottom: 20px; }
.col { flex: 1; }

label { color: #888; font-size: 0.7em; font-weight: bold; margin-bottom: 5px; display: block; }

input[type="text"], select { 
    width: 100%; 
    padding: 12px; 
    background: #111; 
    color: #fff; 
    border: 1px solid #333; 
    border-radius: 4px; 
    font-size: 1em;
    box-sizing: border-box;
}



#ecran-accueil,
#ecran-creation,
#ecran-fiche,
#ecran-inventaire,
#ecran-fouille,
#ecran-marchand,
#ecran-craft,
#ecran-aide,
#ecran-codex,
#ecran-carte {
    /* Un fond noir/marron très foncé, transparent à 10% */
    background-color: rgba(20, 15, 10, 0.25) !important; 
    
    /* L'EFFET RPG MODERNE (Optionnel mais génial) : 
       Ça floute légèrement l'image de fond JUSTE derrière la fenêtre, 
       ce qui rend tes textes super lisibles ! */
    backdrop-filter: blur(4px); 
    
    /* Un peu d'ombre pour décoller la fenêtre du fond */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
}





.ecran {
    /* ... tes autres réglages ... */
    
    /* On remplace la couleur unie (ex: #222) par un noir transparent à 85% */
    background: rgba(20, 20, 20, 0.85); 
    
    /* Petit bonus pour faire joli : un contour flou pour détacher le menu du fond */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7); 
}

input[type="text"]:focus, select:focus { border-color: #d4af37; outline: none; }

.stats-container { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 10px; 
    margin: 25px 0;
}
.stat-box { background: #111; padding: 15px; border-radius: 4px; text-align: center; border-bottom: 2px solid #d4af37; }
.stat-label { font-size: 0.65em; color: #888; margin-bottom: 5px; }
.stat-value { font-size: 24px; font-weight: bold; }

.special-trait { color: #d4af37; font-size: 0.9em; margin-bottom: 15px; font-style: italic; }

.derived-stats { display: flex; justify-content: space-around; font-weight: bold; margin-bottom: 20px; }

.description-box { 
    background: #252525; 
    padding: 15px; 
    border-radius: 4px; 
    font-size: 0.9em; 
    line-height: 1.6; 
    color: #bbb;
}

.next-btn {
    background: #d4af37;
    color: #000;
    border: none;
    padding: 15px 40px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
}
.next-btn:hover { background: #fff; transform: translateY(-2px); }

.aide-section { margin-top: 30px; text-align: center; color: #555; border-top: 1px solid #333; padding-top: 15px; }

/* Statistiques dérivées épurées */
.derived-stats { 
    display: flex; 
    justify-content: space-around; 
    background: #111; 
    padding: 15px; 
    border-radius: 4px; 
    border: 1px solid #333; 
    margin-bottom: 20px;
}
.derived-item { text-align: center; font-size: 0.8em; color: #aaa; font-weight: bold; }
.derived-val { font-size: 24px; font-weight: bold; display: block; margin-top: 5px; }

/* Manuel Accordéon */
.encyclopedia {
    margin-top: 30px;
    background: #111;
    border: 1px solid #444;
    border-radius: 4px;
}
.encyclopedia summary {
    padding: 15px;
    color: #d4af37;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
}
.encyclopedia summary::-webkit-details-marker { display: none; }
.encyclopedia-content {
    padding: 15px;
    border-top: 1px solid #444;
    color: #bbb;
    font-size: 0.85em;
    line-height: 1.6;
}
.encyclopedia-content p { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed #333; }
.encyclopedia-content p:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.effet-20 { color: #ff9800; font-weight: bold; display: block; margin-top: 5px; }

/* --- LOOK ARCANUM (FICHE) --- */
.arcanum-header {
    display: flex;
    background: #1a110b;
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
    color: #ccc;
    font-size: 0.9em;
}
.header-info {
    flex: 1;
    padding-left: 20px;
    line-height: 1.6;
}

.arcanum-main-layout {
    display: flex;
    gap: 15px;
}

.arcanum-left-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Bloc Haut Gauche (Stats + Vies) */
.stats-top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #3e2d20; /* Aspect vieux bois */
    border: 2px solid #111;
    padding: 15px;
    box-shadow: inset 0 0 10px #000;
}
.stats-grid-5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 60%;
}
.stat-row {
    display: flex;
    align-items: center;
    background: #111;
    border: 1px solid #d4af37;
    border-radius: 15px;
    padding: 2px 10px;
}
.stat-row .stat-name { flex: 1; color: #dcdcdc; font-weight: bold; }
.btn-stat {
    background: #8b0000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 50%;
    width: 20px; height: 20px;
    font-size: 12px; font-weight: bold;
    cursor: pointer;
}
.btn-stat:hover { background: #ff0000; }
.stat-row .stat-value { width: 30px; text-align: center; color: #fff; font-size: 1.2em; }

/* Bulles Vie / Fatigue */
.vital-signs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-right: 20px;
}
.vital-bubble {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 3px solid #d4af37;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2em; font-weight: bold; color: #fff;
    box-shadow: 2px 2px 5px #000;
}
.health-bubble { background: radial-gradient(circle, #f44336, #8b0000); }
.fatigue-bubble { background: radial-gradient(circle, #2196f3, #00008b); }

/* Bloc Bas Gauche (Dérivées & Résistances) */
.stats-bottom-section {
    display: flex;
    gap: 10px;
    background: #1a110b;
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 10px;
}
.derived-box, .resistances-box { flex: 1; }
.box-title {
    text-align: center; color: #dcdcdc; font-variant: small-caps;
    border-bottom: 1px solid #444; margin-bottom: 5px; padding-bottom: 5px;
}
.derived-list { font-size: 0.75em; color: #aaa; line-height: 1.5; }
.derived-list span { color: #fff; float: right; }

/* Panneau Droit (Onglets) */
.arcanum-right-panel {
    flex: 1.5;
    background: #3e2d20;
    border: 2px solid #111;
    padding: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 10px #000;
}

/* Jauge Magie / Techno */
.alignment-meter {
    width: 40px;
    background: #dcdcdc;
    border: 2px solid #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
}
.meter-bar {
    flex: 1; width: 10px; background: #fff; border: 1px inset #888;
    margin: 5px 0; position: relative;
}
.meter-needle {
    position: absolute; left: -5px; width: 20px; height: 4px;
    background: red; border: 1px solid #000;
    transition: 0.3s;
}
/* --- LIGNES DE COMPÉTENCES --- */
.skill-category {
    margin-bottom: 20px;
}
.skill-category-title {
    color: #d4af37;
    border-bottom: 1px solid #444;
    margin: 0 0 10px 0;
    padding-bottom: 3px;
    font-variant: small-caps;
    font-size: 1.1em;
}
.skill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a110b;
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #333;
}
.skill-row:hover {
    border-color: #d4af37; /* S'illumine en doré au survol */
}
.skill-name {
    flex: 1;
    font-size: 0.85em;
    color: #dcdcdc;
    font-weight: bold;
}
.skill-stat-tag {
    font-size: 0.7em;
    color: #888;
    background: #000;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
    border: 1px solid #333;
}



/* Style pour les noms complets des stats */
.stat-label {
    cursor: help;
    border-bottom: 1px dotted #666;
}

.readonly .edit-only, 
.readonly .btn-stat {
    display: none !important;
}
	
	
	/* Modifie cette règle dans ton fichier style.css */
.readonly .btn-stat:not(.lvl-up-btn) {
    display: none !important;

}

/* On ne cache plus tout le bloc d'un coup */
/* On cache le bouton PLUS seulement si pointsDispo est à 0 */
.no-points .btn-plus {
visibility: hidden !important;}

/* On cache le bouton MOINS seulement si on n'a rien investi */
.no-invest .btn-moins {
visibility: hidden !important;}

/* On s'assure que le bouton LV UP reste TOUJOURS visible */
.lvl-up-btn {
    display: inline-block !important;
}

/* La classe readonly ne servira plus qu'à verrouiller APRÈS validation */
.is-locked .btn-stat:not(.lvl-up-btn) {
visibility: hidden !important;}


.btn-mj-small {
    background: #444;
    color: #ddd;
    border: 1px solid #666;
    padding: 4px 8px;
    font-size: 0.75em;
    cursor: pointer;
    border-radius: 2px;
}
.btn-mj-small:hover {
    background: #d4af37;
    color: #000;
}

/* --- BOUTON LEVEL UP (Façon Arcanum) --- */
.btn-lvl-up {
    position: absolute;
    top: -8px;
    right: -30px;
    background: radial-gradient(circle, #ff0000, #8b0000);
    color: white;
    border: 1px solid #000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 8px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn-lvl-up:hover {
    background: radial-gradient(circle, #ff4d4d, #b30000);
    transform: scale(1.1);
}

.btn-lvl-up:active {
    transform: scale(0.9);
}

/* --- SOUS-ONGLETS DES COMPÉTENCES --- */
.sub-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
}

.sub-tab-btn {
    flex: 1;
    background: #1a110b;
    color: #888;
    border: 1px solid #333;
    padding: 8px 5px;
    cursor: pointer;
    font-size: 0.75em;
    font-variant: small-caps;
    border-radius: 4px 4px 0 0;
    transition: 0.2s;
}

.sub-tab-btn:hover {
    background: #2a1b12;
    color: #ccc;
}

.sub-tab-btn.active {
    background: #3e2d20;
    color: #d4af37;
    border-color: #d4af37;
    border-bottom: 2px solid #3e2d20; /* Pour fusionner visuellement avec le bas */
    margin-bottom: -7px; /* Fait chevaucher la bordure */
    font-weight: bold;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}


/* --- MAGIE --- */
.magic-school {
    background: #1a110b;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 8px;
    padding: 5px 10px;
}

.magic-school:hover {
    border-color: #2196f3;
}

.magic-school-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.magic-school-title {
    color: #dcdcdc;
    font-weight: bold;
    font-variant: small-caps;
    font-size: 0.9em;
}

.magic-spells-list {
    margin-top: 5px;
    border-top: 1px dashed #333;
    padding-top: 5px;
}

/* --- ONGLETS MAGIE & TECH (Le conteneur) --- */
.magic-tabs {
    display: flex;
    flex-direction: row; /* Force l'alignement horizontal */
    flex-wrap: wrap;     /* Permet de passer à la ligne si on manque de place */
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #444;
    padding-bottom: 10px;
    width: 100%;
}

/* --- LES BOUTONS EMOJIS --- */
/* 1. CAS PAR DÉFAUT : Pas de points, pas survolé */
.magic-tab-btn {
    background: #1a110b;
    color: #888;
    border: 1px solid #333;
    padding: 5px;
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3em;
    border-radius: 4px;
    transition: 0.2s;
    opacity: 0.4;
    filter: grayscale(100%);
}

/* 2. CAS SURVOL OU ACTIF : On allume */
.magic-tab-btn:hover, 
.magic-tab-btn.active { 
    background: #2a1b12; 
    color: #ccc; 
    opacity: 1; 
    filter: grayscale(0%);
}

/* 3. CAS ONGLET SÉLECTIONNÉ : Bordure Dorée */
.magic-tab-btn.active {
    background: #3e2d20;
    color: #d4af37;
    border-color: #d4af37;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* 4. CAS POINTS INVESTIS : Bordure Verte (Même sans survol) */
.magic-tab-btn.has-points {
    opacity: 1;
    filter: grayscale(0%);
    border-color: #4caf50 !important;
    background: #1a2e1a;
}
.magic-content-pane { display: none; }
.magic-content-pane.active { display: block; }

/* Sorts (Grisés par défaut, Allumés quand appris) */
.spell-item {
    padding: 8px 0;
    border-bottom: 1px dashed #333;
    color: #555; /* Grisé si pas appris */
    transition: 0.3s;
}
.spell-item:last-child { border-bottom: none; }
.spell-item strong { color: #666; }

/* Quand le sort est appris (grâce au JS) */
.spell-item.learned { color: #bbb; }
.spell-item.learned strong { color: #dcdcdc; }
.spell-item.learned strong::before {
    content: '► ';
    color: #4caf50; /* Petite flèche verte */
}



/* --- ONGLETS PRINCIPAUX (Droite) --- */
.arcanum-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid #111;
}

.arc-tab-btn {
    flex: 1;
    background: #1a110b;
    color: #888;
    border: 1px solid #333;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-weight: bold;
    font-variant: small-caps;
    font-size: 0.9em;
    transition: 0.2s;
}

.arc-tab-btn:hover { background: #2a1b12; color: #ccc; }

.arc-tab-btn.active {
    background: #3e2d20;
    color: #d4af37;
    border-color: #d4af37;
    border-bottom: 2px solid #3e2d20; /* Fusionne avec le panneau du dessous */
    margin-bottom: -2px; 
}


/* --- SOUS-ONGLETS DES COMPÉTENCES --- */
.sub-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
}

.sub-tab-btn {
    flex: 1;
    background: #1a110b;
    color: #888;
    border: 1px solid #333;
    padding: 8px 5px;
    cursor: pointer;
    font-size: 0.75em;
    font-variant: small-caps;
    border-radius: 4px 4px 0 0;
    transition: 0.2s;
}

.sub-tab-btn:hover {
    background: #2a1b12;
    color: #ccc;
}

.sub-tab-btn.active {
    background: #3e2d20;
    color: #d4af37;
    border-color: #d4af37;
    border-bottom: 2px solid #3e2d20; 
    margin-bottom: -7px; 
    font-weight: bold;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}


/* Sécurité pour l'affichage des boutons */
.edit-only { visibility: visible ; }
.is-locked .edit-only { visibility: hidden !important; }

/* Empêche les boutons de s'afficher si le script dit de les cacher */
.btn-stat {
    transition: visibility 0.1s;
}



/* Animation de clignotement */
@keyframes pulse-level-up {
    0% { background-color: #4caf50; box-shadow: 0 0 5px #4caf50; }
    50% { background-color: #ff9800; box-shadow: 0 0 20px #ff9800; transform: scale(1.05); }
    100% { background-color: #4caf50; box-shadow: 0 0 5px #4caf50; }
}

.alerte-level-up {
    animation: pulse-level-up 1.5s infinite;
    border: 2px solid #fff !important;
    color: white !important;
}



/* ========================================= */
/* ADAPTATION MOBILE               */
/* ========================================= */

@media (max-width: 980px) {
    /* 1. On annule les largeurs fixes pour prendre 100% de l'écran */
    .app-card, #ecran-fiche { 
        width: 100% !important; 
        max-width: 100%;
        padding: 15px; 
        box-sizing: border-box; 
    }

    /* 2. L'écran de création passe sur 1 ou 2 colonnes */
    .row { flex-direction: column; gap: 10px; }
    .stats-container { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    
    /* 3. L'en-tête de la fiche (Nom, Race...) s'empile au lieu d'être côte à côte */
    div[style*="gap: 40px"] { flex-direction: column; gap: 15px !important; }
    div[style*="border-left"] { 
        border-left: none !important; 
        padding-left: 0 !important; 
        border-top: 1px dashed #444; 
        padding-top: 10px; 
    }

    /* 4. Le Layout Principal : Le panneau Droit passe SOUS le panneau Gauche */
    .arcanum-main-layout { flex-direction: column; }
    .arcanum-left-panel, .arcanum-right-panel { width: 100%; }

    /* 5. Les statistiques et les bulles de vie */
    .stats-top-section { flex-direction: column; align-items: stretch; }
    .stats-grid-5 { width: 100%; margin-bottom: 20px; }
    
    /* On met les bulles de Vie et Fatigue côte à côte en bas des stats */
    .vital-signs { 
        flex-direction: row; 
        justify-content: center; 
        gap: 40px; 
        padding-right: 0; 
        margin-top: 10px;
    }

    /* 6. Les Stats Dérivées et Résistances s'empilent */
    .stats-bottom-section { flex-direction: column; }

    /* 7. La jauge d'alignement se centre en bas */
    .alignment-meter { 
        height: 150px; 
        margin: 20px auto 0 auto; 
        flex-direction: column;
    }

    /* 8. Les boutons du bas s'empilent proprement */
    div[style*="justify-content: space-between"] {
        flex-direction: column;
        gap: 10px;
    }
    .next-btn { width: 100%; }
}

/* Petite correction pour les très petits écrans (téléphones verticaux) */
@media (max-width: 480px) {
    .stats-container { grid-template-columns: 1fr; } /* 1 seule colonne pour les stats à la création */
}


/* ========================================= */
/* ÉCRAN GROUPE                              */
/* ========================================= */

#ecran-groupe {
    width: 800px;
    margin: auto;
    background: rgba(20, 12, 6, 0.45);
    border: 1px solid rgba(74, 58, 40, 0.5);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    padding: 0;
    overflow: hidden;
}

.groupe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(10, 6, 3, 0.4);
    border-bottom: 1px solid rgba(74, 58, 40, 0.4);
}

.groupe-header h2 {
    margin: 0;
    color: #d4af37;
    font-variant: small-caps;
    font-size: 1.3em;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(212,175,55,0.4);
}

.groupe-header-ornement {
    color: #4a3a28;
    font-size: 1.4em;
    letter-spacing: 2px;
    user-select: none;
}

.groupe-btn-retour {
    background: transparent;
    color: #888;
    border: 1px solid #4a3a28;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.groupe-btn-retour:hover {
    border-color: #d4af37;
    color: #d4af37;
}

.groupe-body {
    padding: 20px;
}

.groupe-session-info {
    text-align: center;
    color: #555;
    font-size: 0.75em;
    font-variant: small-caps;
    letter-spacing: 2px;
    margin-bottom: 20px;
    border-bottom: 1px solid #2a1d12;
    padding-bottom: 12px;
}

.groupe-session-info span {
    color: #8b6914;
}

.groupe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.groupe-card {
    background: rgba(18, 10, 4, 0.5);
    border: 1px solid rgba(58, 42, 24, 0.6);
    border-radius: 6px;
    padding: 14px;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.groupe-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    opacity: 0.4;
}

.groupe-card:hover {
    border-color: #5a4020;
    box-shadow: 0 0 12px rgba(0,0,0,0.6);
}

.groupe-card.est-mort {
    filter: grayscale(80%);
    border-color: #3a1010;
    opacity: 0.7;
}

.groupe-card.est-mort::before {
    background: linear-gradient(90deg, transparent, #8b0000, transparent);
}

.groupe-card.est-moi {
    border-color: #3a5020;
}

.groupe-card.est-moi::before {
    background: linear-gradient(90deg, transparent, #4caf50, transparent);
    opacity: 0.6;
}

.groupe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.groupe-card-nom {
    font-weight: bold;
    color: #d4af37;
    font-size: 0.95em;
    font-variant: small-caps;
}

.groupe-card-niveau {
    font-size: 0.7em;
    color: #666;
    background: #0a0705;
    border: 1px solid #2a1d12;
    padding: 2px 6px;
    border-radius: 3px;
}

.groupe-card-statut {
    font-size: 0.72em;
    color: #555;
    margin-bottom: 8px;
    font-style: italic;
}

.groupe-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.68em;
    color: #666;
    margin-bottom: 3px;
}

.groupe-bar-track {
    height: 6px;
    background: #0a0705;
    border: 1px solid #2a1d12;
    border-radius: 3px;
    margin-bottom: 7px;
    overflow: hidden;
}

.groupe-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.groupe-bar-fill.pv {
    background: linear-gradient(90deg, #8b0000, #e53935);
    box-shadow: 0 0 4px rgba(229,57,53,0.5);
}

.groupe-bar-fill.pv.critique {
    background: linear-gradient(90deg, #4a0000, #8b0000);
    animation: barre-critique 1s infinite;
}

.groupe-bar-fill.ft {
    background: linear-gradient(90deg, #00008b, #1565c0);
    box-shadow: 0 0 4px rgba(21,101,192,0.5);
}

@keyframes barre-critique {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.groupe-card-lieu {
    margin-top: 8px;
    font-size: 0.68em;
    color: #555;
    text-align: right;
    font-style: italic;
}

.groupe-card-lieu.meme-lieu {
    color: #4caf50;
}

.groupe-vide {
    grid-column: 1 / -1;
    text-align: center;
    color: #444;
    font-style: italic;
    font-size: 0.9em;
    padding: 40px 0;
}

.mj-tab-btn {
    flex: 1;
    background: #333;
    color: #aaa;
    border: 1px solid #444;
    padding: 10px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.mj-tab-btn.active {
    background: #ff9800;
    color: #000;
    border-color: #fff;
}

.mj-section {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ================= ÉCRAN COMPAGNONS ================= */

#ecran-compagnons {
    position: fixed;
    inset: 0;
    background: rgba(15, 8, 3, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
}

.compagnons-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 18px 20px;
    background: rgba(10, 6, 3, 0.50);
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
    font-family: 'Georgia', serif;
    color: #d4af37;
    font-size: 1.1em;
    letter-spacing: 0.12em;
    font-variant: small-caps;
}

.compagnons-header-ornement {
    color: #d4af37;
}

.compagnons-btn-retour {
    position: absolute;
    left: 15px;
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #d4af37;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 3px;
}
.compagnons-btn-retour:hover { background: rgba(212, 175, 55, 0.15); }

.compagnons-body {
    padding: 20px;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
}

.compagnons-max-info {
    text-align: center;
    color: #888;
    font-size: 0.78em;
    letter-spacing: 0.05em;
    margin-bottom: 18px;
    text-transform: uppercase;
}

/* Carte individuelle d'un compagnon */
.compagnon-card {
    position: relative;
    background: rgba(20, 12, 5, 0.55);
    border: 1px solid rgba(212, 175, 55, 0.20);
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
    overflow: hidden;
}

.compagnon-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.5), transparent);
}

.compagnon-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.compagnon-nom {
    color: #d4af37;
    font-size: 1.05em;
    font-variant: small-caps;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.compagnon-niveau {
    color: #888;
    font-size: 0.8em;
    background: rgba(212,175,55,0.10);
    border: 1px solid rgba(212,175,55,0.20);
    padding: 1px 7px;
    border-radius: 3px;
}

.compagnon-identite {
    color: #aaa;
    font-size: 0.78em;
    margin-bottom: 5px;
}

.compagnon-antecedent {
    color: #777;
    font-size: 0.75em;
    font-style: italic;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Barres PV/FT */
.compagnon-bars { margin-bottom: 12px; }

.compagnon-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #aaa;
    margin-bottom: 3px;
}

.compagnon-bar-track {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.compagnon-bar-fill.pv  { height: 100%; background: #c0392b; border-radius: 3px; transition: width 0.3s; }
.compagnon-bar-fill.ft  { height: 100%; background: #1565c0; border-radius: 3px; transition: width 0.3s; }

/* Grille des stats — lecture seule */
.compagnon-stats-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.compagnon-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    padding: 5px 0;
}

.cs-label {
    font-size: 0.65em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cs-val {
    font-size: 1.1em;
    color: #ddd;
    font-weight: bold;
}

.compagnon-equip {
    font-size: 0.75em;
    color: #b0824a;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 7px;
    margin-top: 5px;
}

.compagnon-comps {
    font-size: 0.72em;
    color: #6a9aaa;
    margin-top: 5px;
}

/* ================= ÉCRAN DE COMBAT ================= */

#ecran-combat {
    position: fixed;
    inset: 0;
    background: rgba(8, 3, 3, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 300;
    display: none; /* flex quand actif */
    flex-direction: column;
    overflow: hidden;
}

.combat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(100, 0, 0, 0.55);
    border-bottom: 2px solid #8b0000;
    animation: combatPulse 2s ease-in-out infinite;
}

@keyframes combatPulse {
    0%, 100% { border-bottom-color: #8b0000; }
    50%       { border-bottom-color: #e53935; }
}

@keyframes poison-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px #ff6b35; }
    50%       { opacity: 0.6; box-shadow: 0 0 10px #ff6b35; }
}

.combat-header-titre {
    color: #ff6b6b;
    font-size: 1.3em;
    font-variant: small-caps;
    font-family: 'Georgia', serif;
    letter-spacing: 0.25em;
    font-weight: bold;
}

.combat-header-ornement { color: #8b0000; font-size: 1.1em; }

.combat-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.combat-col {
    flex: 1;
    padding: 18px 16px;
    overflow-y: auto;
}

.combat-col.ennemis { border-right: 1px solid rgba(139,0,0,0.4); }

.combat-col-titre {
    text-align: center;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888;
    margin-bottom: 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.combat-col.ennemis .combat-col-titre { color: #ff6b6b; }
.combat-col.joueurs .combat-col-titre { color: #4caf50; }

.combat-separateur {
    width: 1px;
    background: rgba(255,255,255,0.05);
}

/* Carte ennemi */
.combat-ennemi-card {
    background: rgba(80, 5, 5, 0.35);
    border: 1px solid rgba(139,0,0,0.4);
    border-radius: 5px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.combat-ennemi-nom {
    color: #ff8a80;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.combat-ennemi-niv {
    font-size: 0.72em;
    color: #666;
    font-weight: normal;
}

/* Carte joueur */
.combat-joueur-card {
    background: rgba(10, 30, 10, 0.40);
    border: 1px solid rgba(76,175,80,0.25);
    border-radius: 5px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.combat-joueur-card.est-moi  { border-color: rgba(76,175,80,0.7); }
.combat-joueur-card.est-mort { filter: grayscale(1); border-color: #8b0000; opacity: 0.6; }

.combat-joueur-nom {
    color: #a5d6a7;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.combat-joueur-niv { font-size: 0.72em; color: #666; font-weight: normal; }

/* Barres communes */
.combat-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7em;
    color: #999;
    margin-bottom: 2px;
}

.combat-bar-track {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.combat-bar-fill        { height: 100%; border-radius: 3px; transition: width 0.4s; }
.combat-bar-fill.pv     { background: #c62828; }
.combat-bar-fill.ft     { background: #1565c0; }

.combat-vide {
    color: #555;
    text-align: center;
    font-style: italic;
    font-size: 0.82em;
    padding: 20px 0;
}

/* ── Barre d'ordre de jeu ── */
.combat-ordre-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: rgba(0,0,0,0.55);
    border-bottom: 1px solid rgba(139,0,0,0.35);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.combat-ordre-bar::-webkit-scrollbar { display: none; }

.combat-tour-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 0.75em;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.25s;
    opacity: 0.5;
}
.combat-tour-pill.tour-joueur   { background: rgba(76,175,80,0.12); border-color: rgba(76,175,80,0.25); color: #a5d6a7; }
.combat-tour-pill.tour-ennemi   { background: rgba(180,0,0,0.18);   border-color: rgba(220,50,50,0.40); color: #ff8a80; }
.combat-tour-pill.tour-compagnon { background: rgba(212,175,55,0.12); border-color: rgba(212,175,55,0.30); color: #ffe082; }
.combat-tour-pill.tour-moi      { background: rgba(76,175,80,0.25); border-color: #4caf50; color: #fff; font-weight: 600; }
.combat-tour-pill.actuel {
    opacity: 1;
    font-weight: bold;
    font-size: 0.88em;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(212,175,55,0.6);
    border-color: #d4af37 !important;
    color: #fff !important;
}
.tour-vitesse { font-size: 0.85em; opacity: 0.7; margin-left: 3px; }
.tour-fleche  { color: #333; font-size: 0.8em; flex-shrink: 0; }

/* ── Panneau sorts ── */
.combat-actions-panel {
    padding: 10px 14px;
    background: rgba(10,5,20,0.7);
    border-top: 1px solid rgba(103,58,183,0.4);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    min-height: 0;
    max-height: 28vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.combat-actions-titre {
    width: 100%;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9575cd;
    margin-bottom: 2px;
}

.combat-sort-btn {
    background: rgba(103,58,183,0.3);
    border: 1px solid #7c4dff;
    color: #e1bee7;
    padding: 7px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 0.8em;
    transition: background 0.15s;
}
.combat-sort-btn:hover:not(:disabled) { background: rgba(103,58,183,0.6); }
.combat-sort-btn.epuise { opacity: 0.35; cursor: not-allowed; border-color: #444; }
.sort-nom  { font-weight: bold; }
.sort-meta { font-size: 0.78em; color: #9575cd; }

/* Cibles */
.combat-cibles-label {
    width: 100%;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}
.combat-cibles-label.ennemi { color: #ff8a80; }
.combat-cibles-label.allie  { color: #a5d6a7; }

.combat-cible-btn {
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82em;
    border: 1px solid;
}
.combat-cible-btn.ennemi { background: rgba(139,0,0,0.3); border-color: #c62828; color: #ff8a80; }
.combat-cible-btn.allie  { background: rgba(27,94,32,0.3); border-color: #4caf50; color: #a5d6a7; }
.combat-cible-btn:hover  { filter: brightness(1.3); }

.cible-pv { color: #888; font-size: 0.78em; margin-left: 5px; }

/* Compagnon dans combat */
.compagnon-card-combat {
    border-color: rgba(212,175,55,0.25) !important;
    background: rgba(30,20,5,0.45) !important;
}

/* Bouton Attaquer */
.combat-sort-btn.attaque {
    border-color: #c62828;
    background: rgba(139,0,0,0.25);
    color: #ff8a80;
}
.combat-sort-btn.attaque:hover { background: rgba(139,0,0,0.5); }

.combat-annuler-btn {
    background: transparent;
    border: 1px solid #444;
    color: #666;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78em;
    margin-left: auto;
}
.combat-annuler-btn:hover { border-color: #888; color: #aaa; }

.combat-mort-label { color: #555; font-size: 0.72em; text-align: center; margin-top: 4px; }

/* Bouton MJ tour suivant */
.combat-btn-mj {
    background: #1a3a1a;
    color: #4caf50;
    border: 1px solid #4caf50;
    padding: 6px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    margin-top: 6px;
}
.combat-btn-mj:hover { background: rgba(76,175,80,0.25); }

/* ── Historique de combat ── */
.combat-log {
    max-height: 75px;
    overflow-y: auto;
    padding: 6px 14px;
    background: rgba(0,0,0,0.55);
    border-top: 1px solid #2a1a00;
    font-size: 0.78em;
    color: #bbb;
    display: flex;
    flex-direction: column-reverse;
}
.combat-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    line-height: 1.4;
}
.combat-log-entry:last-child { border-bottom: none; }
.combat-log-entry.log-critique {
    color: #ffd700;
    text-shadow: 0 0 6px rgba(255,215,0,0.4);
    font-weight: bold;
}
.combat-log-entry.log-echec {
    color: #ff6b6b;
    text-shadow: 0 0 6px rgba(255,60,60,0.3);
    font-weight: bold;
}

/* Footer statut */
.combat-footer {
    padding: 10px 20px;
    background: rgba(0,0,0,0.5);
    border-top: 1px solid rgba(139,0,0,0.3);
    text-align: center;
}

#combat-statut {
    color: #888;
    font-size: 0.78em;
    font-style: italic;
    letter-spacing: 0.05em;
}

/* ================= JAUGES XP ================= */
.xp-leds {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.xp-led {
    width: 14px;
    height: 8px;
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    display: inline-block;
    transition: background 0.2s;
}
.xp-led.active {
    background: #d4af37;
    border-color: #f5d06e;
    box-shadow: 0 0 4px rgba(212,175,55,0.6);
}
.xp-leds-label {
    font-size: 0.65em;
    color: #888;
    margin-left: 4px;
}
.xp-leds-other { opacity: 0.5; }
.xp-leds-other .xp-led.active { background: #888; border-color: #aaa; box-shadow: none; }

/* ── Toast notifications (remplace les alert()) ─────────────── */
.toast-notif {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(16px);
    background: rgba(20,20,20,0.97); color: #ddd; padding: 10px 22px;
    border-radius: 8px; border: 1px solid #555; z-index: 99999;
    opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
    max-width: 82%; text-align: center; font-size: 0.9em; box-shadow: 0 4px 18px rgba(0,0,0,0.6);
}
.toast-notif.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-notif.toast-success { border-color: #4caf50; color: #a5d6a7; }
.toast-notif.toast-error   { border-color: #e53935; color: #ef9a9a; }
.toast-notif.toast-gold    { border-color: #d4af37; color: #ffe082; }

/* ── MJ level-up compagnon ───────────────────────────────────── */
.comp-levelup-panel { background:#1a1a1a; border:1px solid #d4af37; border-radius:6px; padding:10px; margin-top:6px; }
.comp-levelup-panel .lvup-titre { color:#d4af37; font-size:0.78em; font-weight:bold; margin-bottom:6px; }
.lvup-section-titre { color:#d4af37; font-size:0.75em; font-weight:bold; text-transform:uppercase; letter-spacing:1px;
    margin:8px 0 4px; border-bottom:1px solid #333; padding-bottom:2px; }
.comp-levelup-btn { background:#2a2a2a; border:1px solid #555; color:#ddd; border-radius:4px;
    padding:4px 8px; font-size:0.72em; cursor:pointer; margin:2px; }
.comp-levelup-btn:hover { border-color:#d4af37; color:#d4af37; }

/* ── Compagnon : équipement ──────────────────────────────────── */
.compagnon-equip-slots { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.comp-eq-slot { background:#111; border:1px dashed #333; border-radius:4px;
    padding:3px 6px; font-size:0.7em; display:flex; align-items:center; gap:4px; }
.comp-eq-slot.equipped { border-color:#4caf50; background:#1a2a1a; }
.comp-eq-slot.blocked  { border-color:#8b4513; background:#1a0a00; }
.comp-eq-label { color:#666; font-size:0.85em; white-space:nowrap; }
.comp-eq-nom   { color:#ddd; }

/* ── Compagnon : inventaire & sorts ─────────────────────────── */
.compagnon-spells  { font-size:0.72em; color:#9575cd; margin-top:4px; }
.compagnon-invent  { font-size:0.72em; color:#80cbc4; margin-top:4px; }
.compagnon-invent-item { display:inline-block; background:#1e2a1e; border:1px solid #2e4a2e;
    border-radius:3px; padding:2px 6px; margin:1px 2px; }
.comp-inv-btn { background:#1a2a1a; border:1px solid #4caf50; color:#81c784; border-radius:3px;
    padding:2px 5px; font-size:0.7em; cursor:pointer; }
.comp-inv-btn:hover { background:#2a3a2a; }
#modal-comp-don button:hover { filter:brightness(1.2); }
/* ── Lancer de dé d20 (accueil) ─────────────────────────────── */
@keyframes d20-shake {
    0%   { transform: rotate(0deg)   scale(1);    }
    15%  { transform: rotate(-18deg) scale(1.15); }
    30%  { transform: rotate(14deg)  scale(1.2);  }
    45%  { transform: rotate(-10deg) scale(1.15); }
    60%  { transform: rotate(8deg)   scale(1.1);  }
    75%  { transform: rotate(-5deg)  scale(1.05); }
    90%  { transform: rotate(3deg)   scale(1.02); }
    100% { transform: rotate(0deg)   scale(1);    }
}
@keyframes d20-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}
@keyframes d20-crit {
    0%, 100% { text-shadow: 0 0 8px #ffd700, 0 0 20px #ffd700; }
    50%       { text-shadow: 0 0 20px #ffd700, 0 0 40px #ffaa00; }
}
#btn-d20.rolling {
    animation: d20-shake 0.6s ease-out;
    pointer-events: none;
}
#d20-resultat.pop {
    animation: d20-pop 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
#d20-resultat.crit {
    animation: d20-crit 1s ease-in-out infinite;
}
