/* ==========================================================================
   CLIENT/ASSETS/CSS/EXERCICES.CSS
   Style exclusif pour les cahiers d'exercices interactifs du Module Communication
   ========================================================================== */

/* ==========================================================================
   1. VARIABLES & CONFIGURATION DE BASE
   ========================================================================== */
:root {
    /* --- Palette Chromatique (Thème "Papier & Or") --- */
    --exo-bg-page: #f9f7ea;       /* Fond crème */
    --exo-primary: #a89446;       /* Or Vieilli */
    --exo-primary-dark: #8a7830;  /* Or Foncé (Textes forts) */
    --exo-secondary: #e6dfc3;     /* Beige soutenu (Bordures) */
    --exo-text: #4a4a4a;          /* Gris lecture */
    --exo-paper: #ffffff;         /* Blanc pur (Zones d'écriture) */
    --exo-shadow: 0 4px 15px rgba(168, 148, 70, 0.15);
    
    /* --- Typographie --- */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;
    --font-hand: 'Courier New', monospace;
}

body {
    background-color: var(--exo-bg-page);
    color: var(--exo-text);
    font-family: var(--font-body);
}

/* --- SÉCURITÉ GLOBALE ANTI-DÉBORDEMENT --- */
html, body {
    max-width: 100%;
    overflow-x: clip; /* Coupe net tout ce qui dépasse à droite */
    margin: 0;
    padding: 0;
    position: relative; /* Stabilise le positionnement fixed */
}

/* ==========================================================================
   2. LAYOUT & HERO SECTION
   ========================================================================== */
.exo-content {
    max-width: 1000px;
    padding-bottom: 6rem;
}

.exo-section {
    margin-bottom: 5rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    color: var(--exo-primary-dark);
    margin-bottom: 0.8rem;
}

/* --- Hero --- */
.exo-hero {
    padding-top: 13rem; 
    padding-bottom: 5rem;
    text-align: center;
    background: radial-gradient(circle at center, #ffffff 0%, var(--exo-bg-page) 70%);
}

.exo-hero .overline {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 3px;
    color: var(--exo-primary);
    display: inline-block;
    border-bottom: 1px solid var(--exo-secondary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.exo-section .title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--exo-primary-dark);
    margin-bottom: 2rem;
    text-wrap: balance;
}

.exo-hero .title {
    font-family: var(--font-heading);
    font-size: 4rem;
    color: var(--exo-primary-dark);
    margin: 0 auto 1rem auto;
    line-height: 1.2;
    max-width: 900px;
    text-align: center;
    text-wrap: balance;
}

.exo-hero .subtitle {
    font-size: 1.3rem;
    font-style: italic;
    color: var(--exo-text);
    opacity: 0.8;
    margin: 1rem auto 0 auto;
    font-family: var(--font-heading);
    max-width: 750px;
    text-align: center;
    text-wrap: balance;
}

/* ==========================================================================
   3. BARRE D'OUTILS (TOOLBAR & INSTRUCTIONS)
   ========================================================================== */

/* --- Note Explicative (Au-dessus de la barre) --- */
.toolbar-instruction-box {
    max-width: 950px;
    margin: 0 auto 1.5rem auto;
    background-color: rgba(168, 148, 70, 0.1);
    border: 1px solid rgba(168, 148, 70, 0.3);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    color: var(--exo-text);
    line-height: 1.5;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
    flex: 1;
}

.instruction-item i {
    width: 36px;
    height: 36px;
    color: var(--exo-primary-dark);
    flex-shrink: 0;
    stroke-width: 1.5px;
}

.instruction-item .feather-smartphone {
    width: 40px;  /* On passe de 36px à 44px */
    height: 40px;
}

.instruction-item span { font-size: 1.15rem; }

.instruction-item strong {
    color: var(--exo-primary-dark);
    font-weight: 700;
    font-size: 1.25rem;
    display: block;
    margin-bottom: 0.3rem;
}

.instruction-item em {
    font-style: normal;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--exo-primary);
}

.instruction-divider {
    width: 2px;
    height: 60px;
    background-color: rgba(168, 148, 70, 0.3);
    flex-shrink: 0;
}

/* --- Barre Sticky (Sauvegarder / Restaurer) --- */
.toolbar-sticky {
    position: sticky;
    top: 90px;
    z-index: 900;
    background-color: var(--exo-paper);
    border: 1px solid var(--exo-secondary);
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--exo-shadow);
    margin-bottom: 4rem;
    transition: all 0.3s ease;
}

.save-status {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--exo-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.save-status.status-success { color: #27ae60; }

.toolbar-actions { display: flex; gap: 0.5rem; }

.btn-tool {
    background: none;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--exo-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}
.btn-tool:hover {
    background-color: var(--exo-bg-page);
    border-color: var(--exo-secondary);
    color: var(--exo-primary-dark);
}
.btn-tool i { width: 14px; height: 14px; }

/* ==========================================================================
   4. BLOCS & CARTES (OBJECTIFS, RÈGLES)
   ========================================================================== */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-card, .warning-card {
    background: var(--exo-paper);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-top: 4px solid var(--exo-primary);
}

.info-card h3, .warning-card h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.9rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    color: var(--exo-primary-dark);
}

.info-card p {
    font-size: 1.35rem;
    line-height: 1.6;
}

.check-list { list-style: none; padding: 0; }

.check-list li {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
    font-size: 1.35rem;
    line-height: 1.6;
}

.check-list li::before {
    content: '•';
    color: var(--exo-primary);
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

/* --- Tags (Quoi Observer) --- */
.observation-guide { text-align: center; }

.observation-guide h4 {
    font-family: var(--font-heading);
    color: var(--exo-primary-dark);
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
}

.tags-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.2rem;
}

.tag {
    background-color: var(--exo-secondary);
    color: var(--exo-primary-dark);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ==========================================================================
   5. TABLEAUX (STRUCTURE COMMUNE)
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    box-shadow: var(--exo-shadow);
    border-radius: 8px;
    background: var(--exo-paper);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    table-layout: fixed; /* Force le respect des largeurs */
}

th {
    background-color: var(--exo-primary);
    color: #fff;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 1px;
    padding: 1rem;
    text-align: center;
    font-weight: normal;
    vertical-align: middle;
}

th small {
    display: block;
    font-family: var(--font-body);
    text-transform: none;
    opacity: 0.95;
    font-size: 1.2rem;
    margin-top: 0.2rem;
    font-weight: 400;
}

td {
    border-bottom: 1px solid var(--exo-secondary);
    padding: 0.5rem;
    vertical-align: top;
}

tr:last-child td { border-bottom: none; }

/* ==========================================================================
   6. FORMULAIRES & INPUTS
   ========================================================================== */

/* --- Inputs dans les tableaux --- */
.exo-input {
    width: 100%;
    box-sizing: border-box; /* Vital pour les dimensions */
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.8rem;
    
    /* Gestion du texte */
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    
    resize: none;
    height: 100%;
    min-height: 60px;
    vertical-align: top;
    overflow: hidden;
}

.exo-input:focus {
    outline: none;
    background-color: rgba(168, 148, 70, 0.05);
    border-radius: 4px;
}

/* --- Inputs Numériques --- */
.exo-input-number {
    width: 100%;
    text-align: center;
    border: 1px solid var(--exo-secondary);
    border-radius: 4px;
    padding: 0.5rem;
    font-weight: bold;
    color: var(--exo-primary-dark);
}
.exo-input-number:focus {
    outline: none;
    border-color: var(--exo-primary);
}

/* --- Zones de Texte (Papier Ligné) --- */
.reflection-block {
    background: var(--exo-paper);
    padding: 2.5rem;
    border-radius: 8px;
    margin-bottom: 2.5rem;
    border-left: 5px solid var(--exo-secondary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.question-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--exo-primary-dark);
    margin-bottom: 1.2rem;
}

.exo-textarea {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.6;
    background-color: #fafafa;
    min-height: 100px;
    transition: all 0.3s;
}

.exo-textarea.large {
    min-height: 180px;
    /* Effet Ligné */
    background-image: linear-gradient(#fafafa 29px, #e6dfc3 30px);
    background-size: 100% 30px;
    line-height: 30px;
    padding-top: 0;
}

.exo-textarea:focus {
    outline: none;
    border-color: var(--exo-primary);
    background-color: #fff;
    background-image: linear-gradient(#fff 29px, #e6dfc3 30px);
    box-shadow: 0 0 0 3px rgba(168, 148, 70, 0.1);
}

/* ==========================================================================
   7. FOOTER & NAVIGATION
   ========================================================================== */

/* --- Carte Session de Partage --- */
.preparation-card {
    border-top: none;
    border-left: 6px solid var(--exo-primary);
    background: var(--exo-paper); 
    padding: 3rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03); 
}

.preparation-card h3 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.preparation-card p {
    font-size: 1.35rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.check-list-small {
    list-style: none;
    padding: 0;
    margin-left: 3rem; 
}

.check-list-small li {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
    font-size: 1.2rem;
    line-height: 1.5;
}

.check-list-small li::before {
    content: '•';
    color: var(--exo-primary);
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

.note-box { margin-top: 2rem; }
.note-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--exo-primary-dark);
}

/* --- Citation --- */
.quote-footer {
    text-align: center;
    margin-top: 5rem;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.8rem;
    color: var(--exo-primary-dark);
    opacity: 0.9;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.quote-footer cite {
    display: block;
    font-size: 1.1rem;
    margin-top: 1rem;
    font-family: var(--font-body);
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.final-section { margin-bottom: 0; }

/* --- Bouton "J'ai terminé" --- */
.back-to-hub-cta {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
}

.back-to-hub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background-color: var(--exo-primary);
    color: #fff !important;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 148, 70, 0.3);
}

.back-to-hub-link:hover {
    background-color: var(--exo-primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(168, 148, 70, 0.4);
}

.back-to-hub-link i { width: 1.2rem; height: 1.2rem; }
.back-to-hub-link::after { display: none; }

/* --- Footer Override (Couleur Spécifique Module) --- */
.client-footer-minimal {
    background: var(--exo-primary-dark) !important; 
    margin-top: 0;
}
.client-footer-minimal .copyright {
    color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   8. SPÉCIFIQUE : SESSION 1 (Cartographie Intérieure)
   ========================================================================== */

/* A. Style de la première ligne d'exemple (Fine et stylisée) */
.journal-table tbody tr:first-child .exo-input {
    min-height: 0 !important; 
    height: 30px !important;
    padding: 5px 0 !important;
    font-size: 1.1rem; 
    font-style: italic;
    opacity: 0.6;
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
}

/* B. Largeur des colonnes du Tableau de Comptage (Ambiguités) */
.count-table th:first-child,
.count-table td:first-child {
    width: 130px;        /* Largeur fixe pour "Jour X" */
    min-width: 130px;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.count-table th:not(:first-child),
.count-table td:not(:first-child) {
    width: auto;         /* Les inputs se partagent le reste */
    padding: 0.5rem;
}

/* ==========================================================================
   9. SPÉCIFIQUE : SESSION 2 
   ========================================================================== */

/* On cible uniquement la Session 2 grâce à son ID */
body[data-exercice-id="com-s2-programmeur"] .info-card p,
body[data-exercice-id="com-s2-programmeur"] .warning-card p {
    font-size: 1.40rem; /* Taille harmonisée pour cette session */
    line-height: 1.6;
}

body[data-exercice-id="com-s2-programmeur"] .check-list li {
    font-size: 1.30rem; /* Liste à puces alignée sur le texte */
}

/* Petit ajustement bonus pour l'espace dans la box de droite session 2 */
body[data-exercice-id="com-s2-programmeur"] .warning-card h3 {
    margin-bottom: 1.5rem;
}

/* Centrage des inputs chiffres pour le tableau Étape 1 */
body[data-exercice-id="com-s2-programmeur"] .exo-input-number {
    width: 60px;       /* Largeur fixe et petite */
    display: block;    /* Nécessaire pour le margin auto */
    margin: 0 auto;    /* Centre la boîte horizontalement */
}

/* Ajustement pour que le "4" de l'exemple soit bien aligné verticalement */
body[data-exercice-id="com-s2-programmeur"] .journal-table tbody tr:first-child .exo-input {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0 !important; /* Reset du padding pour le centrage flex */
}

/* 1. CENTRAGE PARFAIT DE LA PREMIÈRE LIGNE (Exemples & Le "4") */
/* On cible spécifiquement la première ligne DE CETTE session */
body[data-exercice-id="com-s2-programmeur"] .journal-table tbody tr:first-child .exo-input {
    display: flex !important;       /* Active le mode Flexbox */
    align-items: center !important; /* Centre Verticalement */
    justify-content: center !important; /* Centre Horizontalement */
    padding: 0 !important;          /* Enlève le rembourrage qui gêne */
    height: 100% !important;        /* Force à prendre toute la hauteur de la cellule */
}

/* 2. CENTRAGE VERTICAL DE LA COLONNE FRÉQUENCE (Les boîtes à chiffres) */
/* On cible la dernière colonne (td:last-child) DE CETTE session */
body[data-exercice-id="com-s2-programmeur"] .journal-table td:last-child {
    vertical-align: middle !important; /* Centre le contenu (l'input) en hauteur */
}

/* 3. CENTRAGE HORIZONTAL DES BOÎTES À CHIFFRES */
/* On s'assure que l'input lui-même est au milieu de la case */
body[data-exercice-id="com-s2-programmeur"] .exo-input-number {
    display: block;
    margin: 0 auto; /* Centre horizontalement le bloc input */
    width: 60px;    /* Largeur fixe pour faire joli */
}

/* 4. CENTRAGE VERTICAL COLONNE MOTIVATION (Tableau Étape 4) */
/* On cible le 5ème bloc section de la page (qui correspond à l'étape 4) */
/* Et on cible la 2ème colonne de ce tableau */
body[data-exercice-id="com-s2-programmeur"] .exo-section:nth-of-type(5) td:nth-child(2) {
    vertical-align: middle !important;
}

/* ==========================================================================
   10. SPÉCIFIQUE : SESSION 3 (À venir)
   ========================================================================== */
/* 1. STYLISATION DES CARTES PROTOCOLES */
body[data-exercice-id="com-s3-systeme"] .warning-card {
    background-color: #fff;
    padding: 3.5rem; /* Beaucoup plus d'espace interne (aération) */
    border: 1px solid var(--exo-secondary); /* Bordure fine et élégante */
    border-top: 6px solid var(--exo-primary); /* Accentuation du haut */
    box-shadow: 0 10px 30px rgba(168, 148, 70, 0.08); /* Belle ombre portée */
    margin-bottom: 3rem; /* Espace entre les cartes */
    border-radius: 8px;
}

/* 2. TITRE DU PROTOCOLE */
body[data-exercice-id="com-s3-systeme"] .warning-card h3 {
    font-size: 2.2rem; /* Titre plus imposant */
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--exo-secondary);
    padding-bottom: 1rem; /* Ligne de séparation sous le titre */
}

/* 3. PARAGRAPHE "QUAND L'UTILISER" */
body[data-exercice-id="com-s3-systeme"] .warning-card p {
    font-size: 1.25rem;
    background-color: rgba(168, 148, 70, 0.08); /* Fond léger pour le contexte */
    padding: 1.2rem;
    border-radius: 6px;
    margin-bottom: 2.5rem; /* Gros espace avant la liste */
    color: var(--exo-primary-dark);
}

/* 4. LISTE DES ÉTAPES (AÉRATION MAXIMALE) */
body[data-exercice-id="com-s3-systeme"] .check-list li {
    margin-bottom: 1.5rem; /* Espace entre chaque étape */
    font-size: 1.3rem; /* Texte plus grand */
    padding-left: 0.5rem; /* Petit décalage */
    line-height: 1.6;
}

/* Mise en valeur des verbes d'action (ÉCOUTER, REFORMULER...) */
body[data-exercice-id="com-s3-systeme"] .check-list li strong {
    color: var(--exo-primary-dark);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem; /* Verbes plus gros */
    letter-spacing: 1px;
    margin-right: 0.5rem;
}

/* 5. CENTRAGE DES CHIFFRES (Tableau Semaine 2) */
/* A. Centrage horizontal de la boîte à chiffre elle-même */
body[data-exercice-id="com-s3-systeme"] .exo-input-number {
    display: block;
    margin: 0 auto; /* Centre la boîte horizontalement */
    width: 60px;    /* Largeur fixe et propre */
}

/* B. Centrage vertical dans la cellule */
/* On cible spécifiquement le tableau de la "Semaine 2" (qui est dans la 4ème section de la page) */
body[data-exercice-id="com-s3-systeme"] .exo-section:nth-of-type(4) td {
    vertical-align: middle !important;
}

/* C. Centrage des exemples (les chiffres "4", "3" en gris dans les premières lignes) */
body[data-exercice-id="com-s3-systeme"] .exo-section:nth-of-type(4) .exo-input {
    display: flex;       /* Nécessaire pour centrer une div */
    align-items: center; /* Vertical */
    justify-content: center; /* Horizontal */
    height: 100%;        /* Prend toute la hauteur de la case */
}

/* ==========================================================================
   11. COMPOSANT "GUIDE DU COACH" (BOUTON FLOTTANT & MODALE)
   ========================================================================== */

/* Le conteneur doit être en relatif pour servir de point de repère */
.header-with-info {
    position: relative; /* CRUCIAL */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

/* Le bouton d'info (i) */
.info-trigger-btn {
    background: none;
    border: 2px solid var(--exo-primary);
    color: var(--exo-primary);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.info-trigger-btn:hover, .info-trigger-btn.active {
    background-color: var(--exo-primary);
    color: #fff;
}

.info-trigger-btn i { width: 14px; height: 14px; }

/* La Boîte Flottante (VERSION LARGE) */
.coach-popover {
    display: none;
    position: absolute;
    
    /* Positionnement Latéral */
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    
    margin-left: 20px;   /* Un peu plus d'écart */
    margin-top: 0;
    
    /* MODIFICATION ICI : Largeur et Confort */
    width: 350px;        /* Beaucoup plus large */
    background-color: #fff;
    border: 1px solid var(--exo-secondary);
    border-radius: 12px; /* Coins plus arrondis */
    padding: 2rem;       /* Plus d'espace interne */
    box-shadow: 0 10px 50px rgba(0,0,0,0.15);
    z-index: 1000;
    
    text-align: left;
}

.coach-popover.is-visible {
    display: block;
    animation: popInRight 0.2s ease-out;
}

/* La Flèche (Pointant vers la GAUCHE désormais) */
.coach-popover::before {
    content: '';
    position: absolute;
    
    top: 50%;            /* Centré verticalement */
    left: -8px;          /* Sort de la boîte vers la gauche */
    transform: translateY(-50%);
    
    /* Création du triangle pointant à gauche */
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #fff; /* Couleur de la boîte */
    border-left: none;
    
    filter: drop-shadow(-2px 0 2px rgba(0,0,0,0.05));
}

.coach-popover h4 {
    font-family: 'Bebas Neue', sans-serif;
    color: var(--exo-primary-dark);
    font-size: 1.9rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-bottom: 1px solid var(--exo-secondary);
    padding-bottom: 0.4rem;
}

.coach-popover p {
    font-size: 1.4rem; /* Texte un peu plus gros (était 0.95) */
    line-height: 1.6;
    color: var(--exo-text);
    margin: 0;
}

/* Animation d'apparition latérale */
@keyframes popInRight {
    from { opacity: 0; transform: translate(-10px, -50%); }
    to { opacity: 1; transform: translate(0, -50%); }
}

/* RESPONSIVE : Sur mobile, on adapte la largeur */
@media (max-width: 500px) {
    .coach-popover {
        width: 300px; /* On garde une taille compacte sur petit écran */
        padding: 1.5rem;
    }
}

/* ==========================================================================
   12. RESPONSIVE (MOBILES & TABLETTES) - VERSION BOUTONS FLOTTANTS
   ========================================================================== */

/* --- TABLETTES (max 992px) --- */
@media (max-width: 992px) {
    .toolbar-instruction-box {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        width: 100%;
        margin: 0 auto 2rem auto;
        padding: 1.5rem;
        box-sizing: border-box;
    }
    .instruction-item {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .instruction-divider { display: none; }
    .instruction-item:first-child {
        border-bottom: 1px solid rgba(168, 148, 70, 0.2);
        padding-bottom: 1rem;
        margin-bottom: 0.5rem;
    }
    .coach-popover {
        /* On repasse en dessous */
        top: 100% !important;
        left: 50% !important;
        margin-left: 0 !important;
        margin-top: 20px !important;
        transform: translateX(-50%) !important;
        
        /* IMPORTANT : On force une largeur adaptée au mobile */
        width: 320px !important; 
        max-width: 90vw !important; /* Sécurité petits écrans */
    }
    
    /* On remet la flèche vers le HAUT */
    .coach-popover::before {
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid #fff;
        border-top: none;
    }
    
    /* On change l'animation pour qu'elle vienne du haut */
    .coach-popover.is-visible {
        animation: popInTop 0.2s ease-out;
    }
    
    @keyframes popInTop {
        from { opacity: 0; transform: translate(-50%, -10px); }
        to { opacity: 1; transform: translate(-50%, 0); }
    }
}

/* --- TOUS MOBILES (max 768px) --- */
@media (max-width: 768px) {
    
    /* 1. SÉCURITÉ GLOBALE */
    html, body {
        overflow-x: clip; 
        width: 100%;
        position: relative;
    }

    /* 2. CONTENEUR PRINCIPAL */
    .exo-content {
        width: 100%;
        padding: 0 15px 40px 15px;
        box-sizing: border-box;
        overflow: visible !important; 
    }

    .exo-hero { 
        padding: 8rem 15px 0 15px; 
        box-sizing: border-box;
    }
    .exo-hero .title { font-size: 2rem; }
    
    .two-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* 3. BOÎTE JAUNE (Instructions) */
    .toolbar-instruction-box {
        width: 100% !important;
        margin: 0 0 1rem 0 !important;
        padding: 1rem !important;
        border-radius: 8px;
        box-sizing: border-box;
        gap: 1rem;
    }

    .instruction-item {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 1rem;
    }

    .instruction-item i, .instruction-item .feather-smartphone {
        width: 24px !important;
        height: 24px !important;
        margin-top: 3px;
    }

    .instruction-item strong { font-size: 1rem; }
    .instruction-item span { font-size: 0.85rem; }

    /* 4. BARRE D'OUTILS (INVISIBLE, JUSTE UN CONTENEUR) */
    .toolbar-sticky {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 80px !important; 
        z-index: 800 !important;
        
        width: 100% !important;
        margin: 0 0 1.5rem 0 !important;
        
        /* ON RETIRE LE FOND BLANC ET LA BORDURE */
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        
        padding: 0.5rem 0 !important; /* Juste un peu d'espace vertical */
        
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        box-sizing: border-box !important;
        
        /* Permet de cliquer à travers les espaces vides si nécessaire */
        pointer-events: none; 
    }

    .toolbar-actions {
        display: flex !important;
        width: 100% !important;
        gap: 15px !important; /* Espace entre les boutons */
        justify-content: space-between;
        pointer-events: auto; /* Réactive le clic sur les boutons */
    }

    .btn-tool {
        flex: 1 !important;
        justify-content: center !important;
        
        /* STYLE "FLOTTANT" POUR LES BOUTONS */
        background-color: #ffffff !important; /* Fond blanc pour ressortir */
        border: 1px solid var(--exo-primary) !important;
        box-shadow: 0 4px 12px rgba(168, 148, 70, 0.15) !important; /* Ombre portée */
        
        padding: 12px 5px !important; 
        font-size: 0.85rem !important;
        border-radius: 50px !important; /* Forme pilule plus moderne */
    }
    
    .save-status { display: none !important; }
    .exo-textarea.large { background-image: none; }
    
    /* 5. TABLEAUX */
    .table-responsive {
        width: 100% !important;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: 0;
        margin-right: 0;
    }
    
    table { min-width: 600px; }

    /* ... (à la suite du code existant dans @media max-width: 768px) ... */

    /* 6. AJUSTEMENTS FIN DE PAGE (Citation & Footer) */
    .quote-footer {
        font-size: 1.3rem !important; /* Réduit de 1.8rem à 1.3rem */
        margin-top: 3rem !important;   /* Un peu moins d'espace au dessus */
        padding: 0 1rem;               /* Marge de sécurité latérale */
    }

    .quote-footer cite {
        font-size: 0.9rem !important;  /* Nom de l'auteur réduit */
        margin-top: 0.8rem !important;
    }

    /* Réduction du texte du footer */
    .client-footer-minimal .copyright {
        font-size: 0.75rem !important; /* Beaucoup plus discret (12px) */
        padding: 0 1rem;               /* Pour ne pas toucher les bords */
        line-height: 1.4;
    }
    
    .client-footer-minimal {
        padding: 1.5rem 0 !important; /* Hauteur du footer réduite */
    }
}

/* ==========================================================================
   AMÉLIORATION GLOBALE DE LA LISIBILITÉ DEMANDÉE (Instructions & Exemples)
   ========================================================================== */

/* Augmente la taille du paragraphe "Instructions" (le premier p) dans TOUS les exercices */
.observation-guide > p:first-of-type {
    font-size: 1.45rem !important;
    line-height: 1.5 !important;
}

/* Augmente le mot "Instructions :" lui-même s'il est dans un strong */
.observation-guide > p:first-of-type > strong {
    font-size: 1.5rem !important;
}

/* Augmente le texte "Exemple :" ou "Quelques exemples :" dans les alertes */
.warning-card > p:first-of-type,
.warning-card > p:first-of-type > strong {
    font-size: 1.35rem !important;
    line-height: 1.5 !important;
}

/* Augmente la taille de la question posée au-dessus de chaque zone de texte */
.question-label {
    font-size: 1.4rem !important;
    line-height: 1.4 !important;
}