/* ── MOBILE APP-LIKE CSS TEMPLATE ── */
/* Ce fichier est chargé conditionnellement via css.php pour le "Mode Test Mobile" ou le "Mode Global Mobile" */

/* Filet de sécurité : ces éléments ne sont rendus par PHP que si le drapeau mobile est actif,
   mais ce drapeau seul ne suffit pas à les cacher sur desktop (Test/Pour tous actif tout en
   consultant le site en grande largeur). Masqués par défaut, ré-affichés uniquement sous
   1024px (téléphone + tablette) dans la media query ci-dessous. */
html body .header-handle,
html body .tabbar,
html body .tile-preview-profile,
html body .tile-preview-badges,
html body .legend-item-dup {
    display: none;
}

/* Verrouille le défilement de la page derrière une tuile ouverte (posé par le JS de css.php).
   Défini hors media query : la classe n'existe qu'en mode mobile. */
html body.afr-block-open {
    overflow: hidden;
}

@media (max-width: 1024px), (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) {
    :root {
        /* Tailles et Espacements */
        --app-padding: 16px;
        --btn-height: 56px;
        --input-height: 56px;
        --border-radius-lg: 24px;
        --border-radius-md: 16px;
        --border-radius-sm: 12px;
        
        /* Ombres ludiques et profondeur */
        --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.12);
        --shadow-btn: 0 4px 12px rgba(var(--rgb-primary), 0.3);
        --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.2);

        /* Dimensions et calage de la carte héroïque */
        --hero-map-height: 380px;
        --hero-map-bottom-offset: 20px;
        --hero-map-offset: 0px;
        /* Halo de la carte : début / fin du fondu du masque ovale (réglables dans l'éditeur de thème) */
        --hero-map-fade-start: var(--hero-map-fade-start-mobile, 25%);
        --hero-map-fade-end: var(--hero-map-fade-end-mobile, 100%);
        /* Réglages « actifs » de la carte : valeurs téléphone ici, valeurs tablette dans le bloc tablette.
           Les règles communes téléphone + tablette (hauteur, position, échelle, écart boutons) lisent ces
           variables, sinon elles imposaient les valeurs téléphone aux tablettes (corrigé le 06/10/2026). */
        --hero-map-active-height: var(--hero-map-height-mobile, var(--hero-map-height, 380px));
        --hero-map-active-x: var(--hero-map-offset-x-mobile, -30px);
        --hero-map-active-y: var(--hero-map-offset-y-mobile, 0px);
        --hero-map-active-scale: var(--hero-map-scale-mobile, 1);
        /* Position des boutons (07/10/2026) : les boutons sont une couche posée en bas de la tuile carte,
           hors du flux ; + = ils montent, - = ils descendent. Rien d'autre ne bouge (carte, tuile, blocs
           suivants), plus de placement automatique sous le cercle ni d'allongement de la tuile. */
        --hero-map-active-btn-bottom: var(--hero-map-btn-bottom-mobile, 0px);
        /* Allongement de la tuile carte : aucun depuis le détachement des boutons (conservé à 0 pour les calculs
           qui le référencent : hauteur de la tuile, compensation d'Objectifs / Patriotes) */
        --hero-map-tile-extra: 0px;
        /* Objectifs / Patriotes détachés de la carte : leur bas suit le bas de la tuile carte (grille) ;
           on annule le déplacement de ce bas par rapport à la tuile de référence (position 0, hauteur de
           référence, aucun allongement), puis on applique leur propre position (06/10/2026). */
        --hero-map-ref-height: 380px;
        /* Agrandir le cercle du halo : le cadre de la carte déborde d'autant tout autour (marges négatives),
           sans prendre de place dans la tuile */
        --hero-map-active-halo-grow: var(--hero-map-halo-grow-mobile, 0px);
        --hero-map-active-tile-shift: var(--hero-map-tile-shift-mobile, 0px);
        --hero-side-active-shift: var(--hero-side-shift-mobile, 0px);
        --hero-side-translate: calc(var(--hero-side-active-shift) - var(--hero-map-active-tile-shift) - (var(--hero-map-active-height) - var(--hero-map-ref-height)) - var(--hero-map-tile-extra));

        /* Header rétractable & Boutons du menu supérieur (Mobile / portrait par défaut) */
        --header-padding: calc(env(safe-area-inset-top) + 4px) 6px 4px 6px;
        --header-gap: 6px;
        --header-btn-height: 20px;
        --header-btn-padding: 0 5px;
        --header-btn-font-size: 9px;
        --header-btn-gap: 3px 4px;
        --header-audio-vol-width: 36px;
    }

    /* 1. TYPOGRAPHIE ET FOND */
    html body {
        font-size: 16px !important;
        background: var(--bg-main) !important;
        padding-bottom: calc(58px + env(safe-area-inset-bottom)) !important; /* Calé sur la hauteur réelle de .tabbar */
        -webkit-tap-highlight-color: transparent !important;
        overscroll-behavior-y: contain !important;
    }
    /* 21e Siècle : seul univers clair (textes bleu foncé). Son --bg-main est bleu nuit (#003d79), ce qui rendait
       illisibles sur téléphone les titres posés directement sur le fond (forum, messages, échecs, Scrabble…).
       On garde le dégradé clair du tableau de bord, comme sur ordinateur. L'accueil et la connexion restent sombres. */
    html body.theme-jour:not(.page-index):not(.page-login):not(.page-register) {
        background: var(--bg-gradient-dashboard, var(--bg-main)) !important;
    }

    /* Retour visuel générique au tap pour tout ce qui n'a pas déjà son propre :active
       (boutons/inputs ci-dessous ont leur propre scale, celui-ci couvre le reste) */
    html body a:active:not(.btn):not(.nav-item),
    html body [role="button"]:active:not(.btn) {
        opacity: 0.6;
        transition: opacity 60ms ease;
    }

    h1 { font-size: 24px !important; margin-bottom: 16px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }

    /* 2. BOUTONS MASSIFS (Fat-Finger Friendly)
       Ne s'applique QU'aux boutons "nus" (sans style en ligne) : tout bouton qui porte son propre
       style (croix ronde de modale, puces de rayon, options de quiz, boutons audio...) a déjà été
       dessiné pour son contexte. Un !important de feuille battant le style en ligne, l'ancienne
       règle les transformait en barres pleine largeur de 56px et cassait les modales.
       Sont aussi exclus : tout ce qui est dans une modale, et les variantes compactes. */
    html body .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
    html body button:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
    html body .button:not(.ui-chrome):not([style]):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
    html body .page-dashboard .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
    html body .page-shared .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn) {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: var(--btn-height) !important;
        width: 100% !important; /* Pleine largeur sur mobile */
        border-radius: var(--border-radius-lg) !important;
        font-size: 18px !important;
        font-weight: bold !important;
        margin: 12px 0 !important;
        padding: 0 24px !important;
        box-shadow: var(--shadow-btn) !important;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s !important;
        border: none !important;
        letter-spacing: 0.5px !important;
    }

    html body .btn:not([style]):not(#stt-global-btn):not(.stt-mic-btn):active,
    html body button:not([style]):not(#stt-global-btn):not(.stt-mic-btn):active,
    html body .button:not([style]):not(#stt-global-btn):not(.stt-mic-btn):active {
        transform: scale(0.96) translateY(2px) !important;
        box-shadow: 0 2px 6px rgba(var(--rgb-primary), 0.2) !important;
    }

    /* Protection inviolable du bouton Micro STT */
    #stt-global-btn,
    button#stt-global-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        margin: 0 !important;
        top: 15px !important;
        right: 15px !important;
        left: auto !important;
        bottom: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2147483647 !important;
    }

    /* 3. INPUTS ET FORMULAIRES */
    html body input[type="text"],
    html body input[type="email"],
    html body input[type="password"],
    html body input[type="number"],
    html body input[type="search"],
    html body input[type="tel"],
    html body input[type="url"],
    html body input[type="date"],
    html body input:not([type]),
    html body select,
    html body textarea {
        width: 100% !important;
        min-height: var(--input-height) !important;
        border-radius: var(--border-radius-md) !important;
        font-size: 16px !important; /* Évite le zoom auto sur iOS */
        padding: 0 16px !important;
        margin-bottom: 16px !important;
        border: 2px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        color: var(--text-main) !important;
        transition: border-color 0.3s, box-shadow 0.3s !important;
    }

    input:focus, select:focus, textarea:focus {
        border-color: var(--color-primary) !important;
        box-shadow: 0 0 0 4px rgba(var(--rgb-primary), 0.2) !important;
        outline: none !important;
    }

    /* 4. CARTES (CARD UI) — pas de backdrop-filter en mobile : un élément avec backdrop-filter
       devient un contexte de positionnement pour ses descendants en position:fixed (B11/B3).
       Les modales de jeu (action_pillar_modal.php, etc.) ne passent pas par le système
       d'accordéon .dashboard-block-wrapper.expanded et n'étaient donc jamais couvertes par
       le filet de sécurité plus bas — elles se retrouvaient piégées dans la carte qui les
       contient, et scrollaient "sous" le footer au lieu de rester par-dessus tout. */
    html body .card,
    html body .panel,
    html body .container-box,
    html body .dashboard-card {
        border-radius: var(--border-radius-lg) !important;
        padding: var(--app-padding) !important;
        margin: 16px 0 !important;
        /* Filet de sécurité : le thème "jour" (constaté en direct dans le navigateur,
           19/09) ne définit pas --bg-card du tout. var() sans repli avec une valeur vide
           rend toute la déclaration invalide, donc background restait transparent — illisible
           une fois le backdrop-filter retiré (qui masquait le problème par un flou avant). */
        background: var(--bg-card, rgba(10, 10, 20, 0.88)) !important;
        box-shadow: var(--shadow-card) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* 4.1. PLEINE LARGEUR (M5) + DÉBLOCAGE DES MODALES PLEIN ÉCRAN (B11) */
    html body .shared-main,
    html body .centered-main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
    }
    html body.page-dashboard .dashboard-container {
        display: grid !important;
        grid-template-columns: repeat(12, 1fr) !important;
        column-gap: 4px !important;
        row-gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 6px 16px 6px !important;
        box-sizing: border-box !important;
        background-size: 100% auto !important;
        background-repeat: repeat-y !important;
        background-position: top center !important;
    }
    /* Bandeau d'en-tête pour les tableaux de bord personnalisés (Communication, Jeux, etc.) */
    html body .custom-dashboard-header-banner {
        grid-column: 1 / -1 !important;
        order: 0 !important;
        width: 100% !important;
        margin: 0 0 15px 0 !important;
        box-sizing: border-box !important;
    }
    html body .card {
        padding: 12px !important;
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Filet de sécurité : neutralise le piège backdrop-filter/transform sur .card
       quand un bloc imbriqué passe en modale plein écran (B3) */
    html body.fullscreen-modal-open .card,
    html body.fullscreen-modal-open .panel,
    html body.fullscreen-modal-open .container-box,
    html body.fullscreen-modal-open .dashboard-card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        filter: none !important;
    }

    /* Décloisonnement des prime-blocks intermédiaires en mobile :
       permet à toutes les tuiles de former une grille continue en 6 rangées */
    html body .dashboard-prime-block:not(.has-hero-map):not(:last-child) {
        display: contents !important;
    }
    html body .dashboard-prime-block:last-child {
        grid-column: 1 / -1 !important;
        order: 9999 !important;
        width: 100% !important;
    }

    /* Masquer le faux bloc espaceur header_banner qui décalait la carte vers le bas */
    html body .dashboard-prime-block.has-hero-map > .dashboard-block-wrapper[data-block-id="header_banner"] {
        display: none !important;
    }

    /* Bloc d'en-tête (Affiche patriotique + Carte héroïque) */
    html body .dashboard-prime-block.has-hero-map {
        grid-column: 1 / -1 !important;
        order: 1 !important;
        position: relative !important;
        z-index: 1 !important;
        display: grid !important;
        grid-template-columns: repeat(12, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) auto auto !important;
        row-gap: 0 !important;
        column-gap: 2px !important;
        margin-left: -10px !important;
        margin-right: -10px !important;
        width: calc(100% + 20px) !important;
        /* Haut de la tuile calé sur une hauteur de référence fixe (380px) : la hauteur réglée fait grandir
           la tuile vers le bas, « Position de la tuile » la déplace en entier (06/10/2026) */
        padding: max(20px, calc(var(--zone-bottom-pct, 140%) - 380px + var(--hero-map-tile-shift-mobile, 0px))) 4px 0 10px !important;
        margin-bottom: var(--hero-map-bottom-offset-mobile, 25px) !important;
    }

    /* Tablette (Portrait & Paysage tactile) : centrage harmonieux et hauteur adaptée */
    @media (min-width: 768px) {
        :root {
            /* Hauteur et calage de la carte sur tablette */
            --hero-map-height: var(--hero-map-height-tablet, 650px);
            --hero-map-bottom-offset: var(--hero-map-bottom-offset-tablet, 20px);
            --hero-map-offset: 0px;
            --hero-map-fade-start: var(--hero-map-fade-start-tablet, 25%);
            --hero-map-fade-end: var(--hero-map-fade-end-tablet, 100%);
            /* Sans réglage tablette, repli sur le réglage téléphone (apparence d'avant la correction) */
            --hero-map-active-height: var(--hero-map-height-tablet, var(--hero-map-height-mobile, 380px));
            --hero-map-active-x: var(--hero-map-offset-x-tablet, var(--hero-map-offset-x-mobile, -30px));
            --hero-map-active-y: var(--hero-map-offset-y-tablet, var(--hero-map-offset-y-mobile, 0px));
            --hero-map-active-scale: var(--hero-map-scale-tablet, var(--hero-map-scale-mobile, 1));
            --hero-map-active-btn-bottom: var(--hero-map-btn-bottom-tablet, 0px);
            --hero-map-ref-height: 650px;
            --hero-map-active-halo-grow: var(--hero-map-halo-grow-tablet, 0px);
            --hero-map-active-tile-shift: var(--hero-map-tile-shift-tablet, 0px);
            --hero-side-active-shift: var(--hero-side-shift-tablet, 0px);

            /* Header rétractable & Boutons sur tablette */
            --header-padding: calc(env(safe-area-inset-top) + 6px) 12px 6px 12px;
            --header-gap: 10px;
            --header-btn-height: 22px;
            --header-btn-padding: 0 6px;
            --header-btn-font-size: 10px;
            --header-btn-gap: 6px;
            --header-audio-vol-width: 55px;
        }
        html body.page-dashboard .dashboard-container {
            width: 100% !important;
            max-width: 1100px !important;
            margin-left: auto !important;
            margin-right: auto !important;
            padding: 0 16px !important;
            box-sizing: border-box !important;
        }
        html body .dashboard-prime-block {
            max-width: 1100px !important;
            margin-left: auto !important;
            margin-right: auto !important;
            width: 100% !important;
            box-sizing: border-box !important;
        }
        html body .tabbar {
            width: 100% !important;
            max-width: 100% !important;
            left: 0 !important;
            right: 0 !important;
            translate: none !important;
            border-radius: 0 !important;
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            border-bottom: none !important;
        }
        /* Header rétractable pleine largeur sur tablette */
        html body nav.shared-nav.site-header {
            width: 100% !important;
            max-width: 100% !important;
            left: 0 !important;
            right: 0 !important;
            translate: none !important;
            border-radius: 0 !important;
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            border-top: none !important;
        }
        /* Sur tablette (portrait & paysage) : les boutons d'action s'alignent rigoureusement sur une seule ligne */
        html body nav.shared-nav.site-header .site-header-actions,
        html body nav.shared-nav.site-header > div:nth-child(2) {
            flex-wrap: nowrap !important;
            gap: 6px !important;
            justify-content: flex-end !important;
        }
        /* Sur tablette, calage dynamique avec la hauteur agrandie de la carte */
        html body .dashboard-prime-block.has-hero-map {
            /* Référence fixe 650px sur tablette (voir le bloc téléphone) */
            padding-top: max(0px, calc(var(--zone-bottom-pct, 140%) - 650px + var(--hero-map-tile-shift-tablet, 0px))) !important;
            padding-bottom: 0 !important;
            margin-bottom: var(--hero-map-bottom-offset-tablet, 25px) !important;
        }
        /* Hauteur agrandie sur tablette pour la carte héroïque */
        html body .dashboard-block-wrapper[data-block-id="hero_map"],
        html body .dashboard-block-wrapper[data-block-id="map"],
        html body .dashboard-block-wrapper[data-block-id="hero_map"].expanded,
        html body .dashboard-block-wrapper[data-block-id="map"].expanded {
            height: calc(var(--hero-map-active-height, 650px) + var(--hero-map-tile-extra, 0px)) !important;
            min-height: calc(var(--hero-map-active-height, 650px) + var(--hero-map-tile-extra, 0px)) !important;
            max-height: calc(var(--hero-map-active-height, 650px) + var(--hero-map-tile-extra, 0px)) !important;
        }
        html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-container,
        html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-container {
            gap: 0 !important; /* la carte est seule dans le flux : les boutons sont une couche par-dessus */
        }
        html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-overlay,
        html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-overlay {
            margin: 0 !important;
            transform: translateY(calc(var(--hero-map-active-btn-bottom, 0px) * -1)) !important;
        }
        html body #map {
            min-height: 520px !important;
            transform: translate(var(--hero-map-offset-x-tablet, -80px), var(--hero-map-offset-y-tablet, 0px)) scale(var(--hero-map-scale-tablet, 1)) !important;
            -webkit-transform: translate(var(--hero-map-offset-x-tablet, -80px), var(--hero-map-offset-y-tablet, 0px)) scale(var(--hero-map-scale-tablet, 1)) !important;
        }
        html body .dashboard-block-wrapper[data-block-id="network_status_legende"] {
            margin-top: 4px !important;
        }

        /* ── OPTIMISATIONS DÉDIÉES TABLETTE (PORTRAIT & PAYSAGE) ── */

        /* 1. Boutons sur tablette : largeur maîtrisée plutôt qu'étirée sur 1000px */
        html body .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
        html body button:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
        html body .button:not(.ui-chrome):not([style]):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
        html body .page-dashboard .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn),
        html body .page-shared .btn:not(.ui-chrome):not([style]):not(.btn-sm):not(.btn-xs):not(.btn-compact):not(.modal *):not(#stt-global-btn):not(.stt-mic-btn) {
            max-width: 440px !important;
            margin-left: auto !important;
            margin-right: auto !important;
        }

        /* 2. Centrage du contenu et de l'en-tête dans les tuiles ouvertes pour un confort de lecture optimal */
        html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]).expanded .block-section-content,
        html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]).expanded .block-section-header {
            max-width: 840px !important;
            margin-left: auto !important;
            margin-right: auto !important;
            width: 100% !important;
            box-sizing: border-box !important;
        }

        /* 3. Défis de territoire : affichage en 2 colonnes équilibrées */
        html body #section-territory-challenges > div[style*="grid"],
        html body .territory-challenges-card > div[style*="grid"] {
            grid-template-columns: repeat(2, 1fr) !important;
            gap: 16px !important;
        }

        /* 4. Profil sur tablette : disposition fluide à deux colonnes */
        html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-main-layout {
            flex-direction: row !important;
            align-items: flex-start !important;
            justify-content: space-around !important;
            text-align: left !important;
            flex-wrap: wrap !important;
            gap: 24px !important;
        }
        html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-user-info {
            align-items: flex-start !important;
            text-align: left !important;
        }

        /* 5. Modales sur tablette (portrait & paysage) : taille lightbox élégante avec marge périphérique */
        html body #actionPillarModal .modal-content,
        html body #inplayModal .modal-content,
        html body #explorerModal .modal-content,
        html body #guide-modal-overlay .guide-modal-content,
        html body #create-story-modal .card,
        html body #new-campaign-modal .card,
        html body #global-game-modal,
        html body #bottom-post-viewer > div,
        html body [id^="gps-tutorial-modal-"] .guide-modal-content,
        html body [id^="quiz-tutorial-modal-"] .guide-modal-content {
            max-width: 760px !important;
            max-height: 88dvh !important;
            border-radius: 20px !important;
            margin: auto !important;
        }
    }
    
    /* ── 6 RANGÉES DU DASHBOARD (MOBILE & TABLETTE) ── */

    /* INTER-LIGNE : STATUT DE TERRITOIRE / LÉGENDE & GUIDE (placé entre hero-map et profil) */
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] {
        grid-column: span 12 !important;
        order: 5 !important;
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 10px 14px !important;
        margin-top: 4px !important;
        margin-bottom: 6px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
        cursor: default !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"].expanded .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"].expanded .block-section-footer {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .block-section-content {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .card {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        height: auto !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        margin-bottom: 6px !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] button[onclick*="openSupportGuide"],
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .btn-guide-trigger {
        width: auto !important;
        max-width: fit-content !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        min-height: 28px !important;
        padding: 3px 10px !important;
        border-radius: 14px !important;
        font-size: 0.72em !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-marquee-wrapper {
        width: 100% !important;
        overflow: hidden !important;
        mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%) !important;
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%) !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-items-container,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .card > div:last-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 20px !important;
        margin-top: 4px !important;
        width: max-content !important;
        animation: legendTicker 22s linear infinite !important;
        will-change: transform !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-marquee-wrapper:hover .legend-items-container,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-marquee-wrapper:active .legend-items-container {
        animation-play-state: paused !important;
    }
    @keyframes legendTicker {
        0% { transform: translateX(0); }
        100% { transform: translateX(-50%); }
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-item {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-item.legend-item-dup {
        display: inline-flex !important;
    }
    /* Le cadre du défilement garde la largeur de la tuile (la règle « .card > div:last-child » ci-dessus le
       visait aussi : il prenait toute la largeur de la bande, ~1700px, et la tuile se faisait glisser au doigt).
       Seule la bande .legend-items-container défile (09/10/2026). */
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .dashboard-inplaye-wrapper .card > div.legend-marquee-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        animation: none !important;
        transform: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .dashboard-inplaye-wrapper .block-section-content {
        overflow-x: hidden !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-dot {
        width: 8px !important;
        height: 8px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
        box-shadow: 0 0 6px currentColor !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-text {
        font-size: 0.6em !important;
        font-weight: 800 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 4px !important;
        color: var(--text-main, #ffffff) !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-state {
        display: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-sub {
        display: inline !important;
        opacity: 0.75 !important;
        font-size: 0.9em !important;
        font-weight: normal !important;
        color: inherit !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* LIGNE 1 : PROFIL (1 tuile pleine largeur) */
    html body .dashboard-block-wrapper[data-block-id="profile"] {
        grid-column: span 12 !important;
        order: 10 !important;
        height: 68px !important;
        min-height: 68px !important;
        max-height: 68px !important;
        padding: 0 !important;
        margin: 0 0 10px 0 !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }

    /* LIGNE 2 : BADGES DE DISTINCTION (1 tuile pleine largeur) */
    html body .dashboard-block-wrapper[data-block-id="recent_badges"] {
        grid-column: span 12 !important;
        order: 20 !important;
        height: auto !important;
        min-height: 98px !important;
        max-height: none !important;
        padding: 0 !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 215, 0, 0.25) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }

    /* ── TUILES SUIVANTES : PLEINE LARGEUR (SPAN 12), EMPILEMENT VERTICAL & GABARIT BADGES (~94px) ── */

    /* FIL D'ACTU & CAMPAGNES (1 tuile pleine largeur chacune sous les badges) */
    html body .dashboard-block-wrapper[data-block-id="stories"] {
        grid-column: span 12 !important;
        order: 25 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="campaigns"] {
        grid-column: span 12 !important;
        order: 26 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }

    /* MES RECRUES & STATISTIQUES (1 tuile pleine largeur chacune) */
    html body .dashboard-block-wrapper[data-block-id="recruits"] {
        grid-column: span 12 !important;
        order: 30 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="stats"] {
        grid-column: span 12 !important;
        order: 31 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }

    /* TOP COMMUNES & TOP TERRITOIRES (1 tuile pleine largeur chacune) */
    html body .dashboard-block-wrapper[data-block-id="top_territories"] {
        grid-column: span 12 !important;
        order: 40 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="expansion"] {
        grid-column: span 12 !important;
        order: 41 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }

    /* EXPÉDITIONS, MISSIONS & QUÊTES, DÉFIS DE TERRITOIRE (1 tuile pleine largeur chacune) */
    html body .dashboard-block-wrapper[data-block-id="action_banner"] {
        grid-column: span 12 !important;
        order: 50 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="weekly_missions"] {
        grid-column: span 12 !important;
        order: 51 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="territory_challenges"] {
        grid-column: span 12 !important;
        order: 52 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    /* Cartes de défi : icône du jeu au centre de l'en-tête, réduite pour laisser la place au titre
       (même règle sous 600 px dans la vue territory_challenges.php, qui joue aussi hors mode mobile) */
    html body .dashboard-block-wrapper[data-block-id="territory_challenges"] .tc-card-head .tc-head-icon {
        font-size: 0.75em;
    }
    html body .dashboard-block-wrapper[data-block-id="territory_challenges"] .tc-card-head .tc-head-icon img {
        max-width: 44px !important;
        max-height: 44px !important;
    }

    /* MISSIONS MAJEURES (1 tuile pleine largeur) */
    html body .dashboard-block-wrapper[data-block-id="current_event"] {
        grid-column: span 12 !important;
        order: 60 !important;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        margin-bottom: 12px !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 14px !important;
        overflow: visible !important;
    }
    /* Missions passées à la ligne (règle générale des tuiles ouvertes) : centrées au lieu d'être calées à gauche */
    html body .dashboard-block-wrapper[data-block-id="current_event"].expanded #events-grid {
        justify-content: center !important;
    }

    /* Masquer le faux bloc espaceur header_banner et les modules secondaires masqués */
    html body .dashboard-prime-block > .dashboard-block-wrapper[data-block-id="header_banner"],
    html body .dashboard-block-wrapper[data-block-id="network_status_depts"] {
        display: none !important;
    }

    /* Masquer tout faux footer s'il n'est pas dans le dernier prime-block */
    html body .dashboard-prime-block:not(:last-child) > .dashboard-block-wrapper.zone-footer,
    html body .dashboard-prime-block:not(:last-child) > .dashboard-block-wrapper[data-block-id="footer_banner"] {
        display: none !important;
    }
    html body .dashboard-prime-block:last-child > .dashboard-block-wrapper.zone-footer ~ .dashboard-block-wrapper.zone-footer,
    html body .dashboard-prime-block:last-child > .dashboard-block-wrapper[data-block-id="footer_banner"] ~ .dashboard-block-wrapper[data-block-id="footer_banner"] {
        display: none !important;
    }

    /* Masquer le header mobile générique pour Profil et Badges en mode tuile repliée */
    html body .dashboard-block-wrapper[data-block-id="profile"]:not(.expanded) .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="recent_badges"]:not(.expanded) .block-section-header {
        display: none !important;
    }

    /* Afficher les prévisualisations dédiées pour Profil et Badges en mode tuile repliée */
    html body .dashboard-block-wrapper[data-block-id="profile"]:not(.expanded) .tile-preview-profile {
        display: flex !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"]:not(.expanded) .tile-preview-badges {
        display: flex !important;
    }

    /* Masquer les prévisualisations lorsque la modale est ouverte */
    html body .dashboard-block-wrapper.expanded .tile-preview-profile,
    html body .dashboard-block-wrapper.expanded .tile-preview-badges {
        display: none !important;
    }

    /* ── STYLES DES APERÇUS DE TUILES PERSONNALISÉES ── */
    html body .dashboard-block-wrapper[data-block-id="profile"]:not(.expanded) .dashboard-inplaye-wrapper,
    html body .dashboard-block-wrapper[data-block-id="profile"]:not(.expanded) .tile-preview-profile,
    html body .dashboard-block-wrapper[data-block-id="recent_badges"]:not(.expanded) .dashboard-inplaye-wrapper,
    html body .dashboard-block-wrapper[data-block-id="recent_badges"]:not(.expanded) .tile-preview-badges {
        overflow: visible !important;
    }
    .tile-preview-profile {
        display: none;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 10px 0 0 !important;
        box-sizing: border-box;
        overflow: visible !important;
    }
    .preview-profile-avatar-wrap {
        position: relative;
        width: 96px !important;
        height: 96px !important;
        border-radius: 50% !important;
        border: 2.5px solid var(--color-primary, #0055a4) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 85, 164, 0.45) !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
        background: rgba(0, 0, 0, 0.4) !important;
        margin-left: -10px !important;
        z-index: 5 !important;
    }
    .preview-profile-avatar-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .preview-profile-badge-img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        pointer-events: none;
    }
    .preview-profile-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        text-align: left;
    }
    .preview-profile-pseudo {
        font-size: 14px;
        font-weight: 800;
        letter-spacing: 0.5px;
        color: var(--text-main, #ffffff);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .preview-profile-meta-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    .preview-profile-meta-item {
        font-size: 11px;
        color: var(--text-muted, #aaa);
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    .preview-meta-label {
        font-size: 9px;
        letter-spacing: 0.5px;
        opacity: 0.7;
        text-transform: uppercase;
    }
    .preview-meta-val {
        color: var(--color-primary, #64b5f6);
        font-weight: 800;
    }
    .preview-profile-meta-sep {
        color: rgba(255, 255, 255, 0.2);
        font-size: 10px;
    }
    .preview-profile-arrow {
        flex-shrink: 0;
    }
    .preview-action-pill {
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.5px;
        padding: 6px 12px;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: var(--text-main, #fff);
        white-space: nowrap;
    }

    /* ── PREVIEW BADGES ── */
    .tile-preview-badges {
        display: none;
        width: 100%;
        height: 100%;
        min-height: 98px !important;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 4px 8px 4px 8px !important;
        box-sizing: border-box;
        overflow: visible !important;
    }
    .preview-badges-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 4px !important;
    }
    .preview-badges-title-wrap {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .preview-badges-icon {
        font-size: 14px;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .preview-badges-icon img,
    .preview-badges-icon .module-icon,
    .preview-badges-icon-img {
        height: 18px !important;
        width: auto !important;
        max-width: 24px !important;
        object-fit: contain !important;
        vertical-align: middle !important;
        margin: 0 !important;
        border-radius: 3px !important;
        filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4)) !important;
    }
    .preview-badges-title {
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        background: var(--gradient-card-title, linear-gradient(90deg, #64b5f6, #0055a4));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    .preview-badges-count-pill {
        font-size: 10px;
        font-weight: 800;
        background: rgba(255, 215, 0, 0.2);
        border: 1px solid rgba(255, 215, 0, 0.4);
        color: #ffd700;
        padding: 1px 7px;
        border-radius: 10px;
    }
    .preview-badges-action {
        font-size: 10px;
        font-weight: 800;
        color: var(--text-muted, #aaa);
        letter-spacing: 0.5px;
    }
    .preview-badges-list-scroll {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        justify-content: safe center !important;
        gap: 8px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        /* overflow-x:auto rogne aussi verticalement : marge interne pour laisser respirer le halo
           (15px de flou), compensée par une marge négative pour ne pas agrandir la tuile */
        padding: 14px 16px 14px 16px !important;
        margin: -10px 0 -10px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .preview-badges-list-scroll::-webkit-scrollbar {
        display: none;
    }
    .preview-badge-item {
        flex-shrink: 0 !important;
        width: 68px !important;
        height: 68px !important;
        border-radius: 50% !important;
        background: rgba(0, 0, 0, 0.3) !important;
        border: 2px solid rgba(255, 215, 0, 0.4) !important;
        /* Halo de couleur selon le niveau (variable --badge-halo posée en ligne par layout.php),
           plus d'ombre noire par défaut (disgracieuse sur les thèmes clairs) */
        box-shadow: var(--badge-halo, none) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        margin: 0 !important;
    }
    .preview-badge-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    .preview-badge-fallback {
        font-size: 34px !important;
    }
    .preview-badges-empty {
        font-size: 11px;
        opacity: 0.6;
        color: var(--text-muted, #ccc);
        font-style: italic;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 6px 0 !important;
    }

    /* La plupart des blocs ont leur propre titre dans leur contenu : replié avec overflow:hidden */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-content,
    html body .dashboard-block-wrapper:not(.expanded) .block-section-footer {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    html body .dashboard-block-wrapper {
        position: relative;
        z-index: 10;
        transition: transform 0.2s ease, z-index 0s, margin 0s;
        height: auto !important;
        min-height: 94px !important;
        max-height: none !important;
        display: flex;
        flex-direction: column;
        align-items: stretch !important; /* CRITIQUE : empêche tout rétrécissement / centrage dynamique lié à la longueur du texte */
        justify-content: center;
        gap: 0;
        margin: 0 !important;
        border-radius: 14px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: var(--bg-surface, rgba(128, 128, 128, 0.15)) !important;
        overflow: visible !important;
        padding: 0 !important;
        cursor: pointer;
    }
    html body .dashboard-block-wrapper:not(.expanded),
    html body .dashboard-block-wrapper:not(.expanded) .dashboard-inplaye-wrapper {
        overflow: visible !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        align-self: stretch !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* En tuile (repliée) : disposition générale horizontale, médaillon axé sur l'avatar à gauche, libellé et action à droite */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header {
        height: 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        align-self: stretch !important;
        min-height: 94px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        text-align: left !important;
        pointer-events: none; /* Le clic est géré par le wrapper parent */
    }

    /* Le conteneur icône+texte injecté en JS : position relative avec padding-left pour réserver la place fixe du médaillon */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > div:first-child,
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding-left: 82px !important; /* Dégage proprement le médaillon circulaire de 74px calé à -10px */
        padding-right: 12px !important;
        margin: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        align-self: stretch !important;
        height: 100% !important;
        min-height: 94px !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    /* Le libellé général : titre agrandi et mis en valeur avec dégradé patriotique */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > div:first-child > span:last-child:not(.mobile-title-stack),
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title > span:last-child:not(.mobile-title-stack),
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title .mobile-title-main {
        font-size: 13px !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        text-align: left !important;
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        line-height: 1.25 !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        margin: 0 !important;
        padding: 0 !important;
        background: var(--gradient-card-title, linear-gradient(90deg, #64b5f6, #0055a4)) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
    }

    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title > .mobile-title-stack {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        text-align: left !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title .mobile-title-subtitle {
        font-size: 11px !important;
        font-weight: 500 !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        line-height: 1.25 !important;
        color: var(--text-muted, rgba(255, 255, 255, 0.8)) !important;
        -webkit-text-fill-color: var(--text-muted, rgba(255, 255, 255, 0.8)) !important;
        background: none !important;
        margin-top: 2px !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
    }

    /* Icône générale : LIBÉRÉE SANS CERCLE, TAILLE DOUBLÉE (~80px) ET CALÉE SUR L'AXE GAUCHE */
    html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]):not(.expanded) .block-section-header > div:first-child > *:not(:last-child),
    html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]):not(.expanded) .mobile-injected-title > *:not(:last-child),
    html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]):not(.expanded) .block-section-header > div:first-child > img:first-child,
    html body .dashboard-block-wrapper:not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]):not(.expanded) .mobile-injected-title > img:first-child {
        position: absolute !important;
        left: -8px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px !important;
        border-radius: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        z-index: 5 !important;
        overflow: visible !important;
        pointer-events: none !important;
    }

    /* Images d'icônes : doublées de taille avec ombre portée 3D */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > div:first-child img,
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title img {
        width: 100% !important;
        height: 100% !important;
        max-width: 80px !important;
        max-height: 80px !important;
        object-fit: contain !important;
        vertical-align: middle !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.65)) !important;
    }
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > div:first-child > *:not(:last-child) img,
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title > *:not(:last-child) img {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
    }
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > div:first-child > span:first-child,
    html body .dashboard-block-wrapper:not(.expanded) .mobile-injected-title > span:first-child {
        font-size: 52px !important;
        line-height: 1 !important;
        filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.65)) !important;
    }

    /* Pilule d'action droite (VOIR ›) harmonisée avec la tuile profil */
    html body .dashboard-block-wrapper:not(.expanded):not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]) .mobile-accordion-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        padding: 6px 12px !important;
        border-radius: 20px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        color: var(--text-main, #fff) !important;
        margin-right: 12px !important;
        margin-left: 8px !important;
        flex-shrink: 0 !important;
        cursor: pointer !important;
        pointer-events: none !important;
    }
    html body .dashboard-block-wrapper:not(.expanded):not([data-block-id="hero_map"]):not([data-block-id="map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="profile"]):not([data-block-id="recent_badges"]) .mobile-accordion-icon::after {
        content: "VOIR ›";
        font-size: 10px !important;
        font-weight: 800 !important;
        letter-spacing: 0.5px !important;
        color: var(--text-main, #fff) !important;
    }

    html body .dashboard-block-wrapper.expanded .block-section-header {
        min-height: 50px;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        pointer-events: none; /* Le clic est géré par le wrapper parent */
    }

    /* L'indicateur visuel (Chevron) injecté en JS : masqué en tuile, visible
       en modale (bouton "✕ Fermer" du header sticky) */
    html body .mobile-accordion-icon {
        font-size: 20px;
        transition: transform 0.3s ease;
        opacity: 0.7;
    }
    html body .dashboard-block-wrapper:not(.expanded) .mobile-accordion-icon {
        display: none;
    }

    /* M6 : 2 des 3 sous-blocs Réseau restent fusionnés (décision du 11/09) — "Patriotes
       Engagés" est réaffiché à côté d'Objectifs, à la demande de l'utilisateur (18/09). */
    html body .dashboard-block-wrapper[data-block-id="network_status_depts"] {
        display: none !important;
    }

    /* "Patriotes Engagés" : même traitement qu'Objectifs — toujours ouvert, à côté de la
       carte, se place automatiquement sous Objectifs dans la colonne étroite. */
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        cursor: default;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"].expanded .block-section-header {
        justify-content: flex-start !important;
    }

    /* 4.7. TABBAR (M4) — remplace intégralement le FAB + bottom sheet en mobile.
       Rendue par footer.php uniquement si le drapeau mobile PHP est actif (rollback
       par toggle). z-index 950, sous la modale plein écran (100000) : une tuile
       ouverte recouvre volontairement la barre (décision prise avec l'utilisateur),
       même réponse que pour la carte plein écran. */
    html body .nav-mobile-toggle,
    html body .floating-nav {
        display: none !important; 
    }

    html body .tabbar {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        z-index: 950 !important;
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        background: var(--bg-header, var(--bg-main)) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.2) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        height: auto !important; /* Hauteur ajustée automatiquement selon le min-height des items */
        /* Évite un flicker de repaint du backdrop-filter au scroll sur iOS Safari
           (le footer semblait passer devant pendant un instant) : force sa propre
           couche de composition plutôt que d'être repeint avec le reste de la page. */
        transform: translateZ(0) !important;
        will-change: transform !important;
    }
    html body .tabbar::-webkit-scrollbar {
        display: none !important;
    }

    html body .tabbar-item {
        flex: 1 0 auto !important;
        min-width: 68px !important;
        max-width: 110px !important;
        min-height: 56px !important; /* Espace réduit pour coller au bord du bas */
        padding: 4px 6px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important; /* Gap réduit entre icône et texte */
        font-size: 11px !important;
        line-height: 1.1 !important;
        text-align: center !important;
        white-space: nowrap !important;
        text-decoration: none !important;
        color: var(--text-main, #fff) !important;
        opacity: 0.75;
    }
    html body .tabbar-item.is-active {
        opacity: 1;
        color: var(--color-primary, #64b5f6) !important;
        font-weight: 700 !important;
    }
    html body .tabbar-item .tabbar-icon {
        font-size: 28px !important; /* Icônes agrandies */
        line-height: 1 !important;
    }
    html body .tabbar-item .tabbar-icon img {
        height: 28px !important; /* Icônes agrandies */
        width: auto !important;
    }
    html body .tabbar-item[aria-disabled="true"] {
        opacity: 0.4 !important;
        filter: grayscale(1) !important;
        pointer-events: none !important;
        cursor: not-allowed !important;
    }

    /* État Ouvert : Modale Plein Écran (SAUF pour la Carte et le dernier bloc/footer,
       qui sont volontairement marqués "expanded" par le JS pour rester dans le flux
       normal — pas pour devenir une modale plein écran par-dessus toute la page) */
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]):not(.footer_banner):not(.is-footer).expanded {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 100000 !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important; /* Crucial pour le scroll iOS */
        /* Rétablissement du pattern net du thème pour la modale ouverte */
        background-color: var(--bg-main, #0a0a0a) !important;
        background-image: var(--module-bg-image, none) !important;
        background-size: 100% auto !important;
        background-repeat: repeat-y !important;
        background-position: top center !important;
        background-blend-mode: var(--module-bg-blend, normal) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        cursor: default;
    }

    /* Défis de territoire : colonne unique pleine largeur empilée verticalement sur mobile et tablette */
    html body #section-territory-challenges > div[style*="grid"],
    html body .territory-challenges-card > div[style*="grid"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 10px 16px 10px !important;
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    html body #section-territory-challenges > div[style*="grid"] > div,
    html body .territory-challenges-card > div[style*="grid"] > div {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Piliers d'Expédition (Bâtir, Défendre, Unir, Honorer) : colonne unique compacte, blasons x2 (96px) */
    html body #action-pillars.card.action-banner-card {
        padding: 10px 8px 12px 8px !important;
        margin-bottom: 10px !important;
    }
    html body #action-pillars .action-banner-header {
        margin-bottom: 8px !important;
    }
    html body .action-pillars-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 0 4px !important;
        max-width: 320px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    html body .action-pillar-item {
        padding: 5px 10px 6px 10px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        text-align: center !important;
        max-width: 320px !important;
        margin: 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    html body .action-pillar-item .pillar-icon {
        font-size: 3.2em !important;
        margin-top: 0 !important;
        margin-bottom: 4px !important;
    }
    html body .action-pillar-item .pillar-img {
        width: 96px !important;
        height: 96px !important;
        margin-top: 0 !important;
        margin-bottom: 4px !important;
        filter: drop-shadow(0px 4px 8px rgba(0,0,0,0.35)) !important;
    }
    html body .action-pillar-item .pillar-title {
        font-size: 0.75em !important;
        letter-spacing: 1px !important;
        margin-bottom: 2px !important;
        display: block !important;
    }
    html body .action-pillar-item .pillar-desc {
        display: block !important;
        font-size: 0.68em !important;
        opacity: 0.85 !important;
        max-width: 300px !important;
        line-height: 1.2 !important;
    }
    html body .action-global-map-btn {
        max-width: 320px !important;
        margin: 8px auto 0 auto !important;
        padding: 6px 12px !important;
    }
    html body .action-global-map-btn strong {
        font-size: 0.72em !important;
        white-space: nowrap !important;
        letter-spacing: 0.5px !important;
    }
    html body .action-global-map-btn .map-btn-icon {
        font-size: 1.1em !important;
        flex-shrink: 0 !important;
    }

    /* Certains boutons de contenu (blocs jeux/modules) devenaient invisibles sur le nouveau
       fond de modale — filet de sécurité générique plutôt que de deviner lesquels un par un. */
    html body .dashboard-block-wrapper.expanded .block-section-content button,
    html body .dashboard-block-wrapper.expanded .block-section-content .btn {
        border: 1px solid var(--color-primary, var(--border-header, rgba(255,255,255,0.35))) !important;
    }

    /* Pour la CARTE : on la garde inline (dans le flux) même quand elle est expanded.
       "hero_map" est l'identifiant réel en base (le fallback "map" est conservé pour le
       thème par défaut). */
    html body .dashboard-block-wrapper[data-block-id="map"].expanded,
    html body .dashboard-block-wrapper[data-block-id="hero_map"].expanded,
    html body .dashboard-block-wrapper[data-block-id="map"],
    html body .dashboard-block-wrapper[data-block-id="hero_map"] {
        /* + --hero-map-tile-extra : la tuile s'allonge quand les boutons descendent (position négative, écart, débordement du cercle) */
        /* (le cadre de la tuile ne coupe plus le halo : voir la règle overflow juste après) */
        height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        min-height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        max-height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        overflow: visible !important;
        cursor: default;
        background: transparent !important; /* Laisse voir le fond du prime block */
        border: none !important;
        box-shadow: none !important;
    }

    /* Halo de la carte jamais coupé : la carte agrandie (Échelle) ou déplacée peut dépasser de la tuile,
       son masque circulaire suffit à la découper (téléphone et tablette uniquement, 06/10/2026) */
    html body .dashboard-block-wrapper[data-block-id="hero_map"] > .dashboard-inplaye-wrapper,
    html body .dashboard-block-wrapper[data-block-id="map"] > .dashboard-inplaye-wrapper,
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-card,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-card,
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-grid,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-grid,
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-container,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-container {
        overflow: visible !important;
    }

    /* "Objectifs Nationaux" : toujours ouvert, à côté de la carte (voir grid-row plus bas
       sur hero_map) — reste dans le flux, pas de hauteur fixe imposée par la tuile de base. */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        cursor: default;
    }

    /* Objectifs + Patriotes : leur contenu est dimensionné pour une carte desktop pleine
       largeur, trop grand dans la colonne étroite mobile — texte et marges internes réduits
       plutôt que la boîte elle-même (un transform:scale laisserait un vide). Taille rétablie
       aux 2/3 de l'original après un premier essai trop agressif (18/09, 3e retour) ; la
       hauteur suit maintenant les lignes de grille fixes de 260px posées plus haut, plus de
       plafond distinct à maintenir en double. */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"],
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] {
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .block-section-content,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .block-section-content {
        font-size: 0.8em !important;
        padding: 2px !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .block-section-content *,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .block-section-content * {
        margin-top: 0.15em !important;
        margin-bottom: 0.15em !important;
    }

    /* Header fixe en haut de la modale avec léger dépoli */
    html body .dashboard-block-wrapper.expanded .block-section-header {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        background: rgba(10, 10, 20, 0.35) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        /* Était à 100001 : au sein du contexte d'empilement de la tuile ouverte, ce bandeau passait
           par-dessus toute modale de jeu restée dans la tuile (leur z-index est inférieur) et
           masquait leur bouton Fermer. Il n'a besoin que de rester au-dessus du contenu défilant. */
        z-index: 1000 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 0 15px;
        display: flex !important;
        justify-content: flex-end !important; /* seul le bouton fermer reste, aligné à droite */
    }

    /* Optimisation Performance Mobile : Fond semi-opaque net sans recalcul de flou GPU au scroll */
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .card,
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .panel,
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .container-box,
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .dashboard-card,
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .territory-challenges-card,
    html body .dashboard-block-wrapper:not([data-block-id="map"]):not([data-block-id="hero_map"]):not([data-block-id="network_status_objectifs"]):not([data-block-id="network_status_patriotes"]):not([data-block-id="network_status_legende"]):not([data-block-id="reputation_halo_legende"]).expanded .weekly-missions-card {
        background: var(--module-card-bg, rgba(16, 16, 26, 0.92)) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    }

    /* Les conteneurs intermédiaires restent transparents pour éviter d'obscurcir le fond */
    html body .dashboard-block-wrapper.expanded .dashboard-inplaye-wrapper,
    html body .dashboard-block-wrapper.expanded .block-section-content {
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Le bandeau ignore le toucher (pointer-events:none, hérité de l'état tuile) ; seule la
       commande "Fermer" doit y rester cliquable : c'est désormais le SEUL moyen de refermer une
       tuile ouverte (un tap dans le contenu ne la ferme plus). Cible confortable (44px). */
    html body .dashboard-block-wrapper.expanded .mobile-accordion-icon {
        pointer-events: auto !important;
        cursor: pointer;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }

    /* Le contenu du bloc porte-t-il déjà son propre titre visible (card-header, h1-h4...) ?
       Détection automatique côté JS (classe .no-own-title posée sur le bloc), plutôt qu'une
       liste figée d'identifiants — se met à jour toute seule si de nouveaux blocs sont
       ajoutés, au lieu d'exiger une modification CSS à chaque fois (18/09, 2e retour :
       plusieurs blocs de jeu affichaient encore le petit titre injecté à tort). */
    html body .dashboard-block-wrapper.expanded:not(.no-own-title) .block-section-header > div:first-child {
        display: none !important;
    }
    html body .dashboard-block-wrapper.no-own-title.expanded .block-section-header {
        justify-content: flex-start !important;
    }
    /* Le titre injecté restait visuellement petit même une fois seul (18/09, 4e retour) :
       aligné sur la taille des vrais titres de contenu (ex. Badges, Recrues, ~1.4em). */
    html body .dashboard-block-wrapper.no-own-title.expanded .block-section-header > div:first-child > span:last-child {
        font-size: 1.4em !important;
    }
    html body .dashboard-block-wrapper.no-own-title.expanded .block-section-header > div:first-child {
        gap: 10px !important;
    }
    /* hero_map/map, objectifs et patriotes n'ont ni titre injecté ni bouton fermer une fois la duplication retirée :
       le bandeau sticky n'a plus rien à montrer, autant ne pas lui réserver de hauteur. */
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="map"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="map"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .block-section-footer,
    html body .dashboard-block-wrapper[data-block-id="reputation_halo_legende"] .block-section-header,
    html body .dashboard-block-wrapper[data-block-id="reputation_halo_legende"] .block-section-footer {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    /* Bulle « ? » d'aide : copiée par le script sur la tuile fermée (entre le titre et « VOIR »).
       Le bandeau ignore le toucher : le « ? » seul le reçoit, un toucher ouvre la bulle sans ouvrir la tuile.
       Cible agrandie au doigt, sans sélection ni menu à l'appui long. */
    html body .dashboard-block-wrapper:not(.expanded) .block-section-header > .afr-tile-help {
        pointer-events: auto !important;
        width: 26px !important;
        height: 26px !important;
        font-size: 15px !important;
        margin: 0 0 0 4px !important;
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }
    /* Tuile ouverte : la copie disparaît avec le titre du bandeau, et le « ? » du titre de la tuile aussi
       (il n'existe plus que sur la tuile fermée) */
    html body .dashboard-block-wrapper.expanded .block-section-header > .afr-tile-help,
    html body .dashboard-block-wrapper.has-tile-help.expanded .block-section-content .tile-tooltip-container {
        display: none !important;
    }


    /* Uniformisation des tailles d'icônes extraites dans les en-têtes mobiles */
    html body .dashboard-block-wrapper .block-section-header > div > span > i,
    html body .dashboard-block-wrapper .block-section-header > div > span:not(.mobile-title-stack) > span {
        font-size: 1.2em !important;
        line-height: 1 !important;
        vertical-align: middle !important;
    }

    /* Spécifique PRIME BLOCK : l'image de zone est désormais un vrai élément de grille
       (voir layout.php) qui réserve sa propre place — plus besoin de hauteur minimale ni
       de padding-top artificiels ici, ils créaient un grand vide sous les blocs sans
       beaucoup de contenu (ex. footer). */
    html body .dashboard-prime-block {
        background-color: transparent !important; /* Laisse le motif s'afficher */
        position: relative;
        z-index: 1 !important;
    }
    
    /* Annuler le piégeage de la position: fixed causé par backdrop-filter sur le parent ! */
    html body .dashboard-prime-block.has-fullscreen-modal {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        z-index: 100000 !important;
    }

    /* Restauration des images de fond (patterns) sur les prime blocks 
       (le background-image: none supprimait les patterns demandés par l'utilisateur) */
    html body .dashboard-prime-block[class*="zone-"] {
        /* On laisse le background inline s'appliquer */
    }

    /* Le header/footer banner (réutilisant le bloc header_banner) */
    html body .dashboard-block-wrapper[data-block-id="header_banner"] {
        height: auto !important;
        max-height: none !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        pointer-events: none !important; /* EMPÊCHE de bloquer le clic sur le menu mobile en dessous ! */
    }
    
    /* PIED DE PAGE : Le prime block footer (portant l'image de zone footer) et son contenu header_banner */
    html body .dashboard-prime-block.zone-footer,
    html body .dashboard-prime-block:last-child {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        aspect-ratio: var(--zone-ar, auto) !important;
        margin: 10px 0 0 0 !important;
        padding: 0 !important;
    }
    html body .dashboard-prime-block.zone-footer .dashboard-block-wrapper,
    html body .dashboard-prime-block.zone-footer .dashboard-inplaye-wrapper,
    html body .dashboard-prime-block.zone-footer .block-section-content,
    html body .dashboard-prime-block:last-child .dashboard-block-wrapper,
    html body .dashboard-prime-block:last-child .dashboard-inplaye-wrapper,
    html body .dashboard-prime-block:last-child .block-section-content,
    html body .dashboard-block-wrapper.is-footer,
    html body .dashboard-block-wrapper.zone-footer {
        background: transparent !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        height: auto !important;
    }
    html body .dashboard-prime-block.zone-footer .block-section-header,
    html body .dashboard-prime-block.zone-footer .block-section-footer,
    html body .dashboard-prime-block.zone-footer .mobile-accordion-icon,
    html body .dashboard-prime-block:last-child .block-section-header,
    html body .dashboard-prime-block:last-child .block-section-footer,
    html body .dashboard-prime-block:last-child .mobile-accordion-icon,
    html body .dashboard-block-wrapper.is-footer .block-section-header,
    html body .dashboard-block-wrapper.is-footer .block-section-footer,
    html body .dashboard-block-wrapper.is-footer .mobile-accordion-icon {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    /* Réduction de moitié de l'espaceur du haut spécifiquement sur mobile + 80px d'ajustement bas (uniquement sur le header banner du haut, JAMAIS sur le footer) */
    html body .dashboard-prime-block:not(:last-child):not(.has-hero-map):not(.zone-footer) > .dashboard-block-wrapper[data-block-id="header_banner"]:not(.zone-footer):not(.is-footer) {
        min-height: calc((var(--block-min-height, 500px) / 2) + 80px) !important;
    }
    html body .dashboard-prime-block.zone-footer > .dashboard-block-wrapper[data-block-id="header_banner"],
    html body .dashboard-prime-block:last-child > .dashboard-block-wrapper[data-block-id="header_banner"],
    html body .dashboard-block-wrapper[data-block-id="header_banner"].zone-footer,
    html body .dashboard-block-wrapper[data-block-id="header_banner"].is-footer,
    html body .dashboard-block-wrapper[data-block-id="footer_banner"] {
        min-height: 0 !important;
        height: 100% !important;
        aspect-ratio: var(--zone-ar, auto) !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    html body .dashboard-block-wrapper[data-block-id="header_banner"] .mobile-accordion-icon,
    html body .dashboard-block-wrapper[data-block-id="footer_banner"] .mobile-accordion-icon,
    html body .header-banner-card.empty-banner {
        display: none !important;
        min-height: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Bloc héros de la carte : on utilise "span 9" (3/4 de 12 colonnes) */
    html body .dashboard-block-wrapper[data-block-id="hero_map"],
    html body .dashboard-block-wrapper[data-block-id="map"],
    html body .dashboard-block-wrapper.map_leaflet,
    html body .dashboard-block-wrapper#map {
        grid-column: 1 / span 9 !important;
        grid-row: 1 / span 3 !important;
        height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        min-height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        max-height: calc(var(--hero-map-active-height, 380px) + var(--hero-map-tile-extra, 0px)) !important;
        background: transparent !important; /* Retirer le gros grisé du wrapper */
        z-index: 10 !important;
        align-items: stretch !important;
        width: 100% !important;
        margin-bottom: 0 !important; 
    }
    /* Objectifs Nationaux et Patriotes Engagés : span 3 (1/4 de 12 colonnes, ancrés à droite en bas au pied de la carte) */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] {
        grid-column: 10 / span 3 !important;
        grid-row: 2 !important;
        background: transparent !important;
        height: auto !important;
        min-height: 0 !important;
        align-self: end !important;
        max-height: none !important;
        margin-bottom: 4px !important;
        overflow: visible !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] {
        grid-column: 10 / span 3 !important;
        grid-row: 3 !important;
        background: transparent !important;
        height: auto !important;
        min-height: 0 !important;
        align-self: end !important;
        margin-bottom: 0 !important; /* Alignement parfait avec le bas de la map et l'image de fond */
        overflow: visible !important;
    }
    /* Position propre d'Objectifs + Patriotes (curseur de l'éditeur de thème), indépendante de la carte */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"],
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] {
        transform: translateY(var(--hero-side-translate, 0px)) !important;
        position: relative !important;
        z-index: 11 !important;
    }

    /* Empêcher la carte de prendre toute la hauteur de la ligne si elle est trop grande,
       et restaurer la transparence + le halo (box-shadow) d'origine ! */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card {
        height: auto !important;
        min-height: 0 !important;
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: unset !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }
    
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .card {
        height: auto !important;
        min-height: 0 !important;
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: unset !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
    }

    html body .dashboard-block-wrapper[data-block-id="hero_map"] .card,
    html body .dashboard-block-wrapper[data-block-id="map"] .card {
        height: 100% !important; /* La carte doit prendre tout l'espace */
        background: transparent !important; 
        background-color: transparent !important; 
        box-shadow: unset !important; 
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Compresser au maximum l'intérieur des modales de droite pour réduire la hauteur globale */
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .card {
        padding: 2px !important;
        margin: 0 !important;
        gap: 0 !important;
        justify-content: center !important;
        align-items: center !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card-title-container,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .card-title-container {
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        justify-content: center !important;
        flex-direction: column !important; /* Forcer vertical pour correspondre à Objectifs et réduire la largeur */
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card > div,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .card > div {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        line-height: 1.1 !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] strong,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] strong {
        margin: 0 !important;
    }

    /* Masquer le texte descriptif d'Objectif National sur mobile mais conserver le chiffre/nombre à atteindre */
    @media (max-width: 768px) {
        html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .objectif-population-label,
        html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .objectif-target-label {
            display: none !important;
        }
        html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card > div[style*="font-size: 2.2em"] {
            font-size: 1.6em !important;
        }
        html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .objectif-target-box {
            margin-top: 2px !important;
            padding: 0 !important;
            gap: 0 !important;
        }
        html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .objectif-target-count {
            font-size: 0.85em !important;
            font-weight: 800 !important;
            line-height: 1.1 !important;
            display: block !important;
        }
    }

    /* Réduction drastique des espaces autour de la carte et du titre en mobile */
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-card,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-card {
        padding: 8px 8px 0 6px !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
    }
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-grid,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-grid {
        height: 100% !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
    }
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .card-header,
    html body .dashboard-block-wrapper[data-block-id="map"] .card-header {
        padding-bottom: 0 !important;
        margin-bottom: 2px !important;
    }
    /* Masquer le libellé texte "CARTE" sur téléphone et tablette pour ne conserver strictement que l'icône */
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .card-header .hero-map-title-text,
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .card-header span:last-child,
    html body .dashboard-block-wrapper[data-block-id="map"] .card-header .hero-map-title-text,
    html body .dashboard-block-wrapper[data-block-id="map"] .card-header span:last-child {
        display: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-container,
    html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-container {
        gap: 0 !important; /* la carte est seule dans le flux : les boutons sont une couche par-dessus */
        min-height: 280px !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }
    html body .dashboard-block-wrapper[data-block-id="hero_map"] #map,
    html body .dashboard-block-wrapper[data-block-id="map"] #map {
        order: 1 !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        width: calc(100% + 2 * var(--hero-map-active-halo-grow, 0px)) !important; /* + « Agrandir le cercle » (voir html body #map) */
    }

    /* Permettre le défilement horizontal UNIQUEMENT si strictement nécessaire (ex: vrais tableaux) */
    html body .dashboard-block-wrapper.expanded .block-section-content {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }

    /* Suppression de overflow:hidden sur le body car ça freeze le scroll sur iOS ! */
    /* Laissez le body normal, le modal en fixed avec z-index et overflow-y: auto suffit */

    /* Mais par défaut, forcer les éléments internes (comme les défis) à passer à la ligne plutôt que scroller */
    html body .dashboard-block-wrapper.expanded .block-section-content [style*="display: flex"],
    html body .dashboard-block-wrapper.expanded .block-section-content [style*="display:flex"],
    html body .dashboard-block-wrapper.expanded .block-section-content .grid-container,
    html body .dashboard-block-wrapper.expanded .block-section-content .flex-row {
        flex-wrap: wrap !important;
    }
    
    /* Empêcher les conteneurs flex en colonne de créer une 2ème colonne latérale (ex: Stats) */
    html body .dashboard-block-wrapper.expanded .block-section-content [style*="flex-direction: column"],
    html body .dashboard-block-wrapper.expanded .block-section-content [style*="flex-direction:column"],
    html body .dashboard-block-wrapper.expanded .block-section-content [style*="flex-direction: column !important"],
    html body .dashboard-block-wrapper.expanded .block-section-content .card {
        flex-wrap: nowrap !important;
        height: auto !important;
    }

    /* Modal Profil : disposition verticale ("monter et descendre") */
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-main-layout,
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded [style*="margin: 15px 0; display:flex; align-items:flex-start; gap:20px;"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 15px !important;
        width: 100% !important;
    }
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-info-and-blasons,
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded [style*="display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap;"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 15px !important;
        width: 100% !important;
    }
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-user-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
    }
    html body .dashboard-block-wrapper[data-block-id="profile"].expanded .profile-blasons-grid {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        max-width: 100% !important;
        margin: 10px auto 0 auto !important;
    }

    /* Modal Badges : vertical, 3 colonnes actifs, 6 colonnes verrouillés */
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        padding: 10px 0 !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="width: 1px"],
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="width:1px"] {
        display: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row: 1 / span 2"],
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row:1 / span 2"],
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row: 1/span 2"] {
        width: calc(33.333% - 10px) !important;
        max-width: 130px !important;
        display: flex !important;
        justify-content: center !important;
    }
    /* Badges débloqués : pas de défilement en boucle dans la vue agrandie, grille normale */
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-active-window,
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-active-track {
        display: contents !important;
        animation: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-active-clone {
        display: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-active-cell {
        width: calc(33.333% - 10px) !important;
        max-width: 130px !important;
        display: flex !important;
        justify-content: center !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row: span 1"],
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row:span 1"] {
        width: calc(16.666% - 8px) !important;
        max-width: 75px !important;
        display: flex !important;
        justify-content: center !important;
    }
    @media (max-width: 600px) {
        html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row: span 1"],
        html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badges-carousel > div[style*="grid-row:span 1"] {
            width: calc(33.333% - 8px) !important;
        }
    }
    html body .dashboard-block-wrapper[data-block-id="recent_badges"].expanded .badge-item-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Modal Mes Recrues : suppression du scroll interne 250px et formatage du tableau */
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded [style*="max-height: 250px"],
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded [style*="max-height:250px"],
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-table-container {
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded table {
        font-size: 0.85em !important;
        width: 100% !important;
    }
    /* Titres séparés de la liste (recruits.php) : la liste ne défile plus seule, le cadre extérieur fait défiler
       titres et liste ensemble à l'horizontale ; largeur mini pour que le texte sur une ligne tienne dans les colonnes */
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-scroll-x {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-inner {
        min-width: 600px !important; /* tient sans défilement sur tablette (768 px) ; court défilement sur téléphone */
        height: auto !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-body {
        max-height: none !important;
        overflow: visible !important;
    }
    /* Colonnes à largeur fixe : un texte trop long passe à la ligne au lieu de déborder sur la colonne voisine */
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-head th,
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded .recruits-body td {
        white-space: normal !important;
    }
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded th,
    html body .dashboard-block-wrapper[data-block-id="recruits"].expanded td {
        padding: 8px 6px !important;
        white-space: nowrap !important;
    }

    /* Modal Top Communes : même comportement que Top Territoires (liste scrollable + bandeau légende visible en bas) */
    html body .dashboard-block-wrapper[data-block-id="top_territories"].expanded .block-section-content {
        overflow-x: hidden !important;
    }
    html body .dashboard-block-wrapper[data-block-id="top_territories"].expanded #section-top-territories {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        height: auto !important;
    }
    html body .dashboard-block-wrapper[data-block-id="top_territories"].expanded .communes-scroll-container,
    html body .dashboard-block-wrapper[data-block-id="top_territories"].expanded .top-communes-grid {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        max-height: 440px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }


    /* Réduction drastique de la hauteur du widget footer (si jamais utilisé) */
    html body .footer-banner-card {
        padding: 12px !important;
    }
    html body .footer-banner-card h3 {
        font-size: 1.1em !important;
        margin-bottom: 6px !important;
    }
    html body .footer-banner-card p {
        font-size: 0.8em !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
    }

    /* Réduction du VRAI footer (shared-footer) sur mobile */
    html body .shared-footer {
        padding: 15px 10px !important;
        margin-top: 10px !important;
    }
    html body .shared-footer p {
        margin: 5px 0 !important;
        font-size: 0.8em !important;
    }

    /* La Navbar possède déjà son propre z-index et position:fixed (voir .site-header plus bas). */
    
    html body .dashboard-block-wrapper.expanded .mobile-accordion-icon {
        transform: none !important;
        font-size: 13px;
        background: rgba(255, 60, 60, 0.15);
        color: var(--ui-danger-text, #ffcccc);
        padding: 4px 10px;
        border-radius: 6px;
        font-family: Arial, sans-serif;
        font-weight: bold;
        letter-spacing: 0.5px;
    }

    /* 4.6. CORRECTION DE LA CARTE (MAP) */
    html body #map {
        height: 100% !important; /* Prend la taille allouée par la grille */
        min-height: 280px !important;
        flex: 1 1 auto !important;
        /* Agrandir le cercle (curseur de l'éditeur) : cadre plus grand de grow px tout autour, sans changer sa case */
        margin: calc(var(--hero-map-active-halo-grow, 0px) * -1) !important;
        box-sizing: border-box !important;
        width: calc(100% + 2 * var(--hero-map-active-halo-grow, 0px)) !important;
        transform: translate(var(--hero-map-active-x, -30px), var(--hero-map-active-y, 0px)) scale(var(--hero-map-active-scale, 1)) !important; /* Calage dynamique via variables (téléphone ou tablette) */
        -webkit-transform: translate(var(--hero-map-active-x, -30px), var(--hero-map-active-y, 0px)) scale(var(--hero-map-active-scale, 1)) !important;
        border-radius: var(--border-radius-lg) !important;
        /* Halo circulaire (diamètre = plus petit côté de la carte) */
        mask-image: radial-gradient(circle closest-side at center, rgba(0,0,0,1) var(--hero-map-fade-start, 25%), rgba(0,0,0,0) var(--hero-map-fade-end, 100%)) !important;
        -webkit-mask-image: radial-gradient(circle closest-side at center, rgba(0,0,0,1) var(--hero-map-fade-start, 25%), rgba(0,0,0,0) var(--hero-map-fade-end, 100%)) !important;
        -webkit-mask-repeat: no-repeat !important;
        mask-repeat: no-repeat !important;
        -webkit-mask-position: center !important;
        mask-position: center !important;
    }
    
    /* Neutralisation absolue de tout flou sur l'ensemble de ces 3 blocs et de leurs composants */
    html body .dashboard-block-wrapper[data-block-id="hero_map"],
    html body .dashboard-block-wrapper[data-block-id="map"],
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"],
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"],
    html body .dashboard-block-wrapper[data-block-id="hero_map"] *,
    html body .dashboard-block-wrapper[data-block-id="map"] *,
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] *,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] * {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    html body .dashboard-block-wrapper[data-block-id="hero_map"] .card,
    html body .dashboard-block-wrapper[data-block-id="map"] .card,
    html body .dashboard-block-wrapper[data-block-id="network_status_objectifs"] .card,
    html body .dashboard-block-wrapper[data-block-id="network_status_patriotes"] .card {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Les boutons/pastille de hero_map : couche posée en bas de la tuile carte, hors du flux (la carte
       occupe toute la tuile) ; « Position des boutons » les monte (+) ou les descend (-) sans rien pousser */
    html body .hero-map-overlay {
        position: absolute !important;
        inset: auto 0 0 0 !important;
        order: 2 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 6px !important;
        z-index: 1001 !important; /* au-dessus de la carte Leaflet */
        pointer-events: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateY(calc(var(--hero-map-active-btn-bottom, 0px) * -1)) !important;
    }
    html body .hero-map-overlay > * {
        pointer-events: auto !important;
    }
    html body .hero-map-overlay-buttons {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        max-width: 100% !important;
    }
    html body .hero-map-overlay button {
        font-size: 0.75em !important;
        min-height: 30px !important;
        height: auto !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        touch-action: manipulation !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        min-width: fit-content !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    }
    html body .hero-map-overlay > div:last-child {
        font-size: 0.72em !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        min-width: fit-content !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    }
    /* Chiffres des clusters 3D de la carte : taille divisée par deux sur mobile & tablette (18px -> 9px) */
    html body .afr-3d-tricolor-cluster span {
        font-size: 9px !important;
        text-shadow: 
            0.5px 0.5px 0px var(--primary-light), 
            1px 1px 0px var(--primary-light), 
            1.5px 1.5px 0px #ffffff, 
            2px 2px 0px #ffffff, 
            2.5px 2.5px 0px var(--color-danger), 
            3px 3px 0px var(--color-danger), 
            4px 4px 4px rgba(var(--rgb-black), 0.9) !important;
    }
    @media (max-width: 480px) {
        html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-card,
        html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-card {
            padding: 6px 6px 0 6px !important;
        }
        html body .dashboard-block-wrapper[data-block-id="hero_map"] .hero-map-container,
        html body .dashboard-block-wrapper[data-block-id="map"] .hero-map-container {
            gap: 0 !important;
        }
        html body #map {
            transform: translate(var(--hero-map-offset-x-mobile, -25px), var(--hero-map-offset-y-mobile, 0px)) scale(var(--hero-map-scale-mobile, 1)) !important;
            -webkit-transform: translate(var(--hero-map-offset-x-mobile, -25px), var(--hero-map-offset-y-mobile, 0px)) scale(var(--hero-map-scale-mobile, 1)) !important;
        }
        html body .hero-map-overlay {
            gap: 4px !important;
        }
        html body .hero-map-overlay-buttons {
            gap: 4px !important;
        }
        html body .hero-map-overlay button {
            font-size: 0.7em !important;
            min-height: 28px !important;
            padding: 3px 6px !important;
        }
        html body .hero-map-overlay > div:last-child {
            font-size: 0.68em !important;
            padding: 3px 6px !important;
        }
    }

    /* 5. NAVIGATION / HEADER — M1 : replié par défaut derrière une languette.
       .site-header n'est posée sur la nav par header.php que si le drapeau mobile
       ($isMobAct) est actif : rollback instantané en désactivant le toggle, sans
       dépendre uniquement de la largeur d'écran. */
    .header {
        border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg) !important;
        padding: 12px !important;
        margin-bottom: 12px !important;
        box-shadow: var(--shadow-soft) !important;
    }

    html body nav.shared-nav.site-header {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        z-index: 999998 !important;
        display: flex !important;
        flex-direction: row !important; /* UNE SEULE LIGNE */
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: var(--header-gap, 6px) !important;
        margin: 0 !important;
        padding: var(--header-padding, calc(env(safe-area-inset-top) + 4px) 6px 4px 6px) !important;
        background: var(--bg-header, var(--bg-main)) !important;
        box-shadow: var(--shadow-soft) !important;
        max-height: none !important;
        height: auto !important;
        min-height: 38px !important;
        overflow: visible !important; /* INDISPENSABLE : permet à la languette (.header-handle) à top:100% de rester visible repliée */
        /* Rétraction complète : seule la languette (.header-handle) dépasse en haut */
        transform: translateY(-100%) !important; 
        transition: transform .28s cubic-bezier(.32,.72,0,1) !important;
    }
    html body nav.shared-nav.site-header.open {
        transform: translateY(0) !important;
    }
    /* B3.1 (hors tabulation quand replié) appliqué aux DEUX <div> de contenu, pas au <nav>
       lui-même : un visibility:hidden sur le <nav> — même contré par un visibility:visible
       sur la languette, enfant direct — rendait la languette invisible au pointeur (le test
       en direct dans le navigateur le montre : élément géométriquement au bon endroit,
       jamais retourné par elementFromPoint ni cliquable, alors qu'un clic JS direct
       fonctionne). En ciblant les <div> plutôt que le <nav>, la languette n'hérite plus rien
       et n'a jamais besoin d'un contre-visibility (19/09). */
    html body nav.shared-nav.site-header:not(.open) > div {
        visibility: hidden !important;
    }
    html body nav.shared-nav.site-header.open > div {
        visibility: visible !important;
    }

    /* 1er conteneur : Logo + Musique sur la même ligne compacte */
    html body nav.shared-nav.site-header > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
    }
    html body nav.shared-nav.site-header .site-logo-link {
        display: inline-flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }
    /* Logo du menu repliable : 2,5 fois plus grand depuis le 09/11/2026 (20 -> 50 px, 24 -> 60 px sur tablette) */
    html body nav.shared-nav.site-header .site-logo-img {
        height: 50px !important;
        max-height: 50px !important;
        width: auto !important;
        object-fit: contain !important;
        margin: 0 !important;
    }
    html body nav.shared-nav.site-header #audio-control-ui {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
    }
    html body nav.shared-nav.site-header #audio-control {
        padding: 2px 5px !important;
        font-size: 0.65em !important;
        border-radius: 10px !important;
        gap: 2px !important;
        white-space: nowrap !important;
    }
    /* Sur mobile portrait, masquer le libellé texte "MUSIQUE" pour ne laisser que l'icône et libérer 45px d'espace précieux */
    html body nav.shared-nav.site-header #audio-control #audio-label {
        display: none !important;
    }
    @media (min-width: 768px) {
        html body nav.shared-nav.site-header #audio-control #audio-label {
            display: inline !important;
        }
        html body nav.shared-nav.site-header .site-logo-img {
            height: 60px !important;
            max-height: 60px !important;
        }
    }
    /* Curseur de volume : compact en mobile portrait (piloté par variable), confortable sur tablette */
    html body nav.shared-nav.site-header #audio-volume {
        width: var(--header-audio-vol-width, 36px) !important;
        height: 22px !important;
        min-height: 22px !important;
        padding: 8px 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        background: transparent !important;
        touch-action: pan-x !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        cursor: pointer !important;
    }
    html body nav.shared-nav.site-header #audio-volume::-webkit-slider-runnable-track {
        height: 4px !important;
        background: rgba(255, 255, 255, 0.25) !important;
        border-radius: 2px !important;
    }
    html body nav.shared-nav.site-header #audio-volume::-webkit-slider-thumb {
        -webkit-appearance: none !important;
        appearance: none !important;
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: #64b5f6 !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
        margin-top: -4px !important;
        cursor: pointer !important;
    }
    html body nav.shared-nav.site-header #audio-volume::-moz-range-track {
        height: 4px !important;
        background: rgba(255, 255, 255, 0.25) !important;
        border-radius: 2px !important;
    }
    html body nav.shared-nav.site-header #audio-volume::-moz-range-thumb {
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: #64b5f6 !important;
        border: none !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
        cursor: pointer !important;
    }

    /* Espace réservé en haut de page pour la languette, uniquement si le header mobile existe */
    html body {
        padding-top: 26px !important;
    }
    /* Accueil : son propre menu ne se replie pas et n'a pas de languette, pas d'espace réservé (09/11/2026) */
    html body.page-index {
        padding-top: 0 !important;
    }

    /* La languette : toujours visible/atteignable, même header replié (contraste franc,
       pas un simple trait gris — c'est la seule voie de déconnexion en mobile) */
    html body nav.shared-nav.site-header .header-handle {
        visibility: visible !important;
        position: absolute !important;
        top: 100% !important; /* Place exactement sous le header, peu importe la hauteur */
        bottom: auto !important;
        left: 50% !important;
        translate: -50% 0 !important;
        width: 64px !important;
        height: 26px !important;
        min-height: 26px !important;
        border-radius: 0 0 14px 14px !important;
        display: grid !important;
        place-items: center !important;
        background: var(--color-primary, #0055a4) !important;
        color: #fff !important;
        font-size: 14px !important;
        border: none !important;
        box-shadow: var(--shadow-soft) !important;
        z-index: 999999 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }

    /* Thème 19e Siècle (Delacroix) : assigner la couleur opaque et solide des Chevaliers (#5e5846) */
    html body.theme-nuit nav.shared-nav.site-header .header-handle {
        background: #5e5846 !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-top: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
    }

    /* Bouton Vocal Speech-to-Text en mobile et tablette : calé en haut à droite pour ne jamais empiéter sur le menu du bas */
    #stt-global-btn {
        top: 15px !important;
        right: 15px !important;
        bottom: auto !important;
        left: auto !important;
    }

    /* 2e conteneur : Les 4 boutons (Actualités, Dashboard, Soutien, Déconnexion) — resserrés au maximum */
    html body nav.shared-nav.site-header .site-header-actions,
    html body nav.shared-nav.site-header > div:nth-child(2) {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: wrap !important; /* Mobile portrait : se placent harmonieusement sur 2 lignes sans déborder */
        gap: var(--header-btn-gap, 3px 4px) !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    html body nav.shared-nav.site-header a:not(.site-logo-link) {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: var(--header-btn-height, 20px) !important;
        height: var(--header-btn-height, 20px) !important;
        padding: var(--header-btn-padding, 0 5px) !important;
        font-size: var(--header-btn-font-size, 9px) !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        text-decoration: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        letter-spacing: -0.2px !important;
        line-height: 1 !important;
    }

    /* Déconnexion : identifiable sans ambiguïté — toujours visible et accessible */
    html body nav.shared-nav.site-header a.mobile-header-logout {
        background: rgba(255, 60, 60, 0.22) !important;
        color: #ffcccc !important;
        font-weight: 700 !important;
        border-color: rgba(255, 60, 60, 0.4) !important;
    }
    html body nav.shared-nav.site-header a.mobile-header-support {
        background: rgba(255, 0, 0, 0.12) !important;
        border-color: rgba(255, 0, 0, 0.25) !important;
    }

    /* 6. OPTIMISATION LEAFLET (Carte) */
    #map, .leaflet-container {
        border-radius: var(--border-radius-lg) !important;
        overflow: hidden !important;
        box-shadow: var(--shadow-soft) !important;
    }

    /* ==========================================================================
       6.1. SYSTÈME UNIFIÉ DES MODALES & OVERLAYS DU DASHBOARD (Mobile & Tablette)
       ========================================================================== */

    /* 6.1.1 Échelle d'empilement & Backdrops universels
       Une tuile ouverte est en z-index 100000 et la languette du header en 999999.
       Toutes les modales de contenu/jeu passent au premier plan absolu (1000001). */
    html body #actionPillarModal,
    html body #inplayModal,
    html body #explorerModal,
    html body #guide-modal-overlay,
    html body #create-story-modal,
    html body #badge-details-modal,
    html body #new-campaign-modal,
    html body #global-game-modal-backdrop,
    html body #bottom-post-viewer,
    html body [id^="gps-tutorial-modal-"],
    html body [id^="quiz-tutorial-modal-"],
    html body #profile-edit-modal {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1000001 !important;
        background: rgba(0, 0, 0, 0.75) !important;
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
        align-items: center !important;
        justify-content: center !important;
        padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px) 12px !important;
        box-sizing: border-box !important;
        overscroll-behavior: contain !important;
    }

    /* Préservation stricte de la fermeture (display: none) */
    html body #actionPillarModal[style*="display:none"],
    html body #actionPillarModal[style*="display: none"],
    html body #inplayModal[style*="display:none"],
    html body #inplayModal[style*="display: none"],
    html body #explorerModal[style*="display:none"],
    html body #explorerModal[style*="display: none"],
    html body #guide-modal-overlay[style*="display:none"],
    html body #guide-modal-overlay[style*="display: none"],
    html body #create-story-modal[style*="display:none"],
    html body #create-story-modal[style*="display: none"],
    html body #badge-details-modal[style*="display:none"],
    html body #badge-details-modal[style*="display: none"],
    html body #new-campaign-modal[style*="display:none"],
    html body #new-campaign-modal[style*="display: none"],
    html body #global-game-modal-backdrop[style*="display:none"],
    html body #global-game-modal-backdrop[style*="display: none"],
    html body #bottom-post-viewer[style*="display:none"],
    html body #bottom-post-viewer[style*="display: none"],
    html body [id^="gps-tutorial-modal-"][style*="display:none"],
    html body [id^="gps-tutorial-modal-"][style*="display: none"],
    html body [id^="quiz-tutorial-modal-"][style*="display:none"],
    html body [id^="quiz-tutorial-modal-"][style*="display: none"],
    html body #profile-edit-modal[style*="display:none"],
    html body #profile-edit-modal[style*="display: none"] {
        display: none !important;
    }

    /* 6.1.2 Boîtes de dialogue unifiées (Dialogs) */
    html body #actionPillarModal .modal-content,
    html body #inplayModal .modal-content,
    html body #explorerModal .modal-content,
    html body #guide-modal-overlay .guide-modal-content,
    html body #create-story-modal .card,
    html body #badge-details-modal > div,
    html body #new-campaign-modal .card,
    html body #global-game-modal,
    html body #bottom-post-viewer > div,
    html body [id^="gps-tutorial-modal-"] .guide-modal-content,
    html body [id^="quiz-tutorial-modal-"] .guide-modal-content,
    html body #profile-edit-modal > div {
        width: 100% !important;
        max-width: 680px !important;
        max-height: calc(100dvh - 28px) !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: var(--border-radius-md, 16px) !important;
        box-sizing: border-box !important;
        position: relative !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        margin: auto !important;
        background: rgba(18, 18, 28, 0.94) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8) !important;
    }

    /* Rétablissement du thème et du motif (pattern) pour les modales d'expéditions et de jeu (Mobile & Tablette) */
    html body #actionPillarModal .modal-content {
        background-color: var(--module-card-bg, var(--card-bg, rgba(26, 26, 36, 0.95))) !important;
        background-image: var(--module-bg-image, none) !important;
        background-size: var(--module-bg-size, cover) !important;
        background-repeat: var(--module-bg-repeat, repeat) !important;
        background-position: var(--module-bg-position, center) !important;
        background-blend-mode: var(--module-bg-blend, normal) !important;
        border: 1px solid var(--module-primary, #2196f3) !important;
    }

    html body #actionPillarModalHeader {
        background: transparent !important;
        border-bottom: 1px solid var(--module-border, rgba(255, 255, 255, 0.1)) !important;
    }

    html body #actionPillarModalDynamicContent {
        background: transparent !important;
    }

    html body #inplayModal .modal-content {
        background-color: var(--inplay-bg, var(--module-card-bg, rgba(26, 26, 36, 0.95))) !important;
        background-image: var(--module-bg-image, none) !important;
        background-size: var(--module-bg-size, cover) !important;
        background-repeat: var(--module-bg-repeat, repeat) !important;
        background-position: var(--module-bg-position, center) !important;
        background-blend-mode: var(--module-bg-blend, normal) !important;
        border: 1px solid var(--inplay-primary, #2196f3) !important;
    }

    /* Rétablissement du thème et du motif (pattern) pour le Guide et tous les tutoriels (Mobile & Tablette) */
    html body #guide-modal-overlay .guide-modal-content,
    html body [id^="gps-tutorial-modal-"] .guide-modal-content,
    html body [id^="quiz-tutorial-modal-"] .guide-modal-content,
    html body .guide-modal-content {
        background-color: var(--inplay-bg, var(--module-card-bg, rgba(26, 26, 36, 0.95))) !important;
        background-image: var(--module-bg-image, none) !important;
        background-size: var(--module-bg-size, cover) !important;
        background-repeat: var(--module-bg-repeat, repeat) !important;
        background-position: var(--module-bg-position, center) !important;
        background-blend-mode: var(--module-bg-blend, normal) !important;
    }


    /* 6.1.3 Structure Flexbox 3 étages : Header fixe, Body défilant, Footer fixe */
    html body #actionPillarModalHeader,
    html body #inplayModal .modal-content > div:first-of-type,
    html body #explorerModal .modal-content > div:first-of-type,
    html body #bottom-post-viewer > div > div:first-of-type,
    html body #create-story-modal .card > h3,
    html body #new-campaign-modal .card > h2,
    html body #global-game-modal > div:first-of-type,
    html body #profile-edit-modal > div:first-of-type {
        flex-shrink: 0 !important;
    }

    html body #actionPillarModalDynamicContent,
    html body #inplayModalDynamicContent,
    html body #inplayValidationForm,
    html body #explorerResultsContainer,
    html body #create-story-form,
    html body #new-campaign-form,
    html body #global-game-modal-content,
    html body [id^="gps-tutorial-modal-"] .guide-modal-content > div:nth-of-type(2),
    html body [id^="quiz-tutorial-modal-"] .guide-modal-content > div:nth-of-type(2),
    html body #profile-edit-modal > div:nth-of-type(2) {
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    html body #actionPillarModal .modal-content > div:last-of-type,
    html body #inplayModalFooter,
    html body #explorerModal .modal-content > div:last-of-type,
    html body #create-story-form > button[type="submit"],
    html body #new-campaign-form > button[type="submit"],
    html body #profile-edit-modal > div:last-of-type {
        flex-shrink: 0 !important;
    }

    /* 6.1.4 Ergonomie tactile des boutons de fermeture ("Fat-Finger Friendly") */
    html body #actionPillarModal button[onclick*="closeActionPillarModal"],
    html body #inplayModal button[onclick*="closeInPlayModal"],
    html body #explorerModal button[onclick*="closeExplorerModal"],
    html body #create-story-modal span[onclick*="closeCreateStoryModal"],
    html body #badge-details-modal button[onclick*="badge-details-modal"],
    html body #new-campaign-modal button[onclick*="new-campaign-modal"],
    html body #profile-edit-modal span[onclick*="profile-edit-modal"],
    html body #bottom-post-viewer button[onclick*="backToTopics"],
    html body #global-game-modal button[onclick*="closeGlobalGameModal"] {
        min-width: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
        z-index: 100 !important;
        font-size: 1.6em !important;
    }

    /* 6.1.5 Spécificités Forum Modal (#bottom-post-viewer) */
    html body #bottom-post-viewer {
        padding: 8px !important;
    }
    html body #bottom-post-viewer > div {
        height: calc(100dvh - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        padding: 12px 14px !important;
    }
    html body #bottom-post-viewer .chat-toolbar {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        padding-bottom: 6px !important;
        margin-bottom: 10px !important;
        gap: 6px !important;
    }
    html body #bottom-post-viewer .chat-toolbar > div {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        min-width: max-content !important;
    }
    html body #bottom-post-viewer .toolbar-btn {
        min-width: 34px !important;
        min-height: 34px !important;
        padding: 4px 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    html body #bottom-post-viewer #chat-messages {
        height: auto !important;
        flex: 1 1 auto !important;
        min-height: 120px !important;
        max-height: none !important;
    }
    html body #bottom-post-viewer #chat-input {
        min-height: 46px !important;
        max-height: 90px !important;
        padding: 10px 12px !important;
        font-size: 16px !important; /* Prévient le zoom forcé iOS */
    }
    html body #bottom-post-viewer button[onclick*="sendMessage"] {
        height: 46px !important;
        min-height: 46px !important;
        padding: 0 18px !important;
        width: auto !important;
        margin: 0 !important;
        border-radius: 8px !important;
    }

    /* 6.1.6 Spécificités Story Modal (#create-story-modal) */
    html body #create-story-modal .gradient-selection-box {
        height: 38px !important;
        min-width: 38px !important;
    }
    html body #create-story-modal button[id^="tcolor-btn-"] {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }
    html body #create-story-modal textarea {
        font-size: 16px !important; /* Prévient le zoom forcé iOS */
        min-height: 70px !important;
    }

    /* 6.1.7 Spécificités Profil Modal (#profile-edit-modal) */
    html body #profile-edit-modal {
        background: rgba(0, 0, 0, 0.85) !important;
    }
    html body #profile-edit-modal > div {
        background: var(--bg-global-dark, #0d0d1e) !important;
        border: 1px solid var(--border-active, #0055a4) !important;
        border-radius: 16px !important;
        padding: 16px !important;
        max-width: 500px !important;
    }
    html body #profile-edit-modal input,
    html body #profile-edit-modal select {
        font-size: 16px !important; /* Prévient le zoom forcé iOS */
        min-height: 44px !important;
        padding: 8px 12px !important;
    }
    html body #profile-edit-modal button {
        min-height: 44px !important;
        font-size: 15px !important;
    }

    /* 6.1.8 Spécificités Jeu Global (#global-game-modal) */
    html body #global-game-modal {
        height: 92dvh !important;
        max-height: 92dvh !important;
    }

    /* 7. Bandeau d'accès direct « Missions, Quêtes et Jeux » visible et adapté sur mobile & tablette */
    html body #geo-quete-widget {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: center !important;
        gap: 5px !important;
        margin: 8px 10px 6px 10px !important;
        padding: 9px 12px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
    }
    html body #geo-quete-widget .geo-quete-widget-top {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100% !important;
    }
    html body #geo-quete-widget h4 {
        font-size: 0.92rem !important;
        margin: 0 !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }
    html body #geo-quete-widget p {
        font-size: 0.78rem !important;
        color: #ffffff !important;
        margin: 0 !important;
        line-height: 1.25 !important;
        width: 100% !important;
    }
    html body #geo-quete-widget a {
        padding: 6px 11px !important;
        font-size: 0.78rem !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    @media (min-width: 768px) {
        html body #geo-quete-widget {
            max-width: 1068px !important;
            margin: 10px auto 8px auto !important;
            padding: 12px 18px !important;
            gap: 6px !important;
        }
        html body #geo-quete-widget h4 {
            font-size: 1.05rem !important;
        }
        html body #geo-quete-widget p {
            font-size: 0.88rem !important;
            color: #ffffff !important;
        }
        html body #geo-quete-widget a {
            font-size: 0.88rem !important;
            padding: 8px 15px !important;
        }
    }
}

/* 8. Mouvement réduit : respecte la préférence système, quelle que soit la largeur d'écran */
@media (prefers-reduced-motion: reduce) {
    html body .site-header {
        transition: none !important;
    }
    html body .dashboard-actions .action:active .icon {
        scale: 1 !important;
    }
    ::view-transition-group(*) {
        animation: none !important;
    }
    /* Légende « Statuts Territoires » : plus de défilement, piste dupliquée masquée,
       les éléments passent à la ligne si besoin */
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-items-container,
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .card > div:last-child {
        animation: none !important;
        width: 100% !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-items-container {
        flex-wrap: wrap !important;
        row-gap: 6px !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-marquee-wrapper {
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-item.legend-item-dup {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Légende « Statuts Territoires » (téléphone, 09/10/2026) : fenêtre de défilement agrandie pour que le
       halo des pastilles ne soit plus rogné, espace sous le texte réduit d'environ 30 % (46 -> 32 px).
       Sélecteurs plus précis que le <style> de network_status_legende.php, qui l'emporterait sinon. */
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .legend-marquee-wrapper {
        padding: 3px 0 6px 0 !important;
    }
    html body .dashboard-block-wrapper[data-block-id="network_status_legende"] .dashboard-inplaye-wrapper .card {
        padding-bottom: 10px !important;
        border-radius: 10px !important; /* suit l'arrondi du cadre, au lieu d'angles droits */
    }
    /* Tuile centrée dans son cadre arrondi : même marge en haut et en bas (le <style> de la tuile mettait
       la marge basse à 0) */
    html body .dashboard-container .dashboard-prime-block .dashboard-block-wrapper[data-block-id="network_status_legende"] {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
    .reduce-on-mobile {
        font-size: 0.4em !important; /* Réduit de 50% par rapport à 0.8em */
        padding: 2px 5px !important;
    }

    /* Optimisation Performance : Soulagement GPU et économie de batterie mobile */
    html body.page-dashboard::before,
    html body.page-dashboard::after {
        animation: none !important;
    }

    /* Défilement inertiel garanti sur tous les conteneurs mobiles */
    .dashboard-block-wrapper.expanded,
    .modal-content,
    .guide-modal-content,
    #chat-messages,
    #global-game-modal-content {
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
    }
}

/* ── 9. MISE EN PAGE MESSAGERIE (Mobile & Tablette) ── */
html body.page-messages .dashboard-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    height: calc(100dvh - 70px) !important;
    margin: 0 !important;
    padding: 10px 10px calc(65px + env(safe-area-inset-bottom)) 10px !important;
    box-sizing: border-box !important;
}

html body.page-messages .card {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    min-height: 0 !important;
}

html body.page-messages #pm-view {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

html body.page-messages #pm-list {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    padding: 12px 12px 25px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

html body.page-messages .pm-item {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px !important;
}

html body.page-messages .pm-content-full {
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

@media (min-width: 768px) {
    html body.page-messages .dashboard-container {
        max-width: 1000px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 16px 16px calc(75px + env(safe-area-inset-bottom)) 16px !important;
    }
    html body.page-messages .pm-item {
        padding: 20px !important;
    }
    html body.page-messages #pm-list {
        padding: 18px 20px 30px 20px !important;
    }
}

/* ── SECTION MISSIONS HEBDOMADAIRES (AFFICHAGE STRICT 1 COLONNE SANS SCROLL HORIZONTAL) ── */
#section-weekly-missions,
.weekly-missions-card,
html body .dashboard-block-wrapper[data-block-id="weekly_missions"].expanded .weekly-missions-card {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
@media (max-width: 768px) {
    #section-weekly-missions #missions-list-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    #section-weekly-missions .mission-category-group {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
}

