/* =========================================================
   LA TECH - Feuille de style principale
   ========================================================= */

/* --- VARIABLES & BASE --- */
:root {
    --primary-color:  #1e2428;    /* charbon profond */
    --accent-color:   #3a4a58;    /* gris-bleu acier foncé */
    --light-bg:       #e6e9ec;    /* gris clair pour les sections */
    --exercise-bg:    #f1f3f5;    /* gris très clair */
    --cream-bg:       var(--exercise-bg);
    --text-color:     #2c2f33;
    --card-height:    250px;
    --text-correct:   #27ae60;
    --text-error:     #eb4d4b;
    --text-current:   #4e606e;    /* gris-bleu acier */
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: #fafafa;
    padding-top: 90px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- NAVBAR --- */
.custom-nav {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding-top: 5px;
    padding-bottom: 5px;
}

.logo-img {
    height: 78px;
    width: auto;
    display: block;
}

.nav-link {
    font-weight: 500;
    color: var(--primary-color) !important;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--accent-color) !important;
}

/* --- BOUTONS : coins carrés + couleurs de la palette --- */
.btn {
    border-radius: 0 !important;
}

.btn-primary {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #fff !important;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}
.btn-primary:disabled {
    background-color: #8a9baa !important;
    border-color: #8a9baa !important;
}

.btn-outline-primary {
    color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    background: transparent !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:active {
    background-color: var(--accent-color) !important;
    color: #fff !important;
}

.btn-outline-info {
    color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    background: transparent !important;
}
.btn-outline-info:hover,
.btn-outline-info:active {
    background-color: var(--accent-color) !important;
    color: #fff !important;
}

.btn-don {
    background-color: var(--accent-color);
    border: none;
    color: white !important;
    font-weight: 600;
    padding: 8px 20px;
    transition: transform 0.2s, background-color 0.2s;
}

.btn-don:hover {
    background-color: var(--primary-color);
    transform: scale(1.05);
    color: white !important;
}

/* --- RÉSEAUX SOCIAUX (footer) --- */
.footer-social-link {
    color: #fff;
    transition: color 0.2s, transform 0.2s;
    display: inline-flex;
}
.footer-social-link:hover {
    transform: scale(1.15);
}
.footer-social-link:first-child:hover { color: #1877f2; }
.footer-social-link:last-child:hover  { color: #e1306c; }

/* --- MESSAGES FLASH --- */
.flash-container {
    margin-top: 1rem;
    padding-top: 1rem;
}

.hero-section {
    width: 100%;
    min-height: 300px;

    background-image: url("../images/banniere-iro.png");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;

    margin-bottom: 0;
}

/* --- TITRES DE SECTION --- */
.section-title {
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.separator {
    width: 60px;
    height: 4px;
    background-color: var(--accent-color);
    margin-top: 10px;
    opacity: 1;
    border: none;
}

/* --- CARTES EXERCICES (image plein format + overlay) --- */
.custom-card {
    position: relative;
    height: var(--card-height);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.custom-card:hover {
    transform: translateY(-5px);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.custom-card:hover .card-img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.82), rgba(0,0,0,0.22));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    color: white;
}

.card-overlay h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.card-overlay p {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.9;
    font-weight: 300;
}

.card-overlay .badge {
    align-self: flex-start;
}

/* =========================================================
   PAGE ACCUEIL — EXERCICES + VIDEOS
   ========================================================= */

.exercices-section {
    margin-top: 3rem;
}

/*
 * Les trois colonnes ont la même hauteur.
 * Les vidéos latérales s'étirent donc automatiquement
 * sur toute la hauteur des 4 cartes centrales.
 */
.exercices-layout {
    align-items: stretch !important;
}

.exercices-layout > [class*="col-"] {
    display: flex;
}


/* ---------- GRILLE DES 4 EXERCICES ---------- */

.exercices-grid {
    flex: 1;
    align-content: stretch;
}

.exercices-grid > div {
    display: flex;
}

.exercices-grid .card-link {
    display: block;
    width: 100%;
}

.exercices-grid .custom-card {
    width: 100%;
}


/* ---------- VIDEOS LATERALES ---------- */

.video-iro-sidebar {
    width: 100%;
    height: 100%;
    min-height: calc((var(--card-height) * 2) + 1.5rem);

    border-radius: 15px;
    overflow: hidden;

    background: #000;

    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.12);
}

.video-iro-sidebar iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
}


/* =========================================================
   BARRE ENTRE EXERCICES ET SECTION GRATUITE
   ========================================================= */

.home-section-divider {
    width: min(1100px, 90%);
    height: 1px;

    background-color: #d5d9dd;

    margin: 2rem auto 1.5rem;
}


/* =========================================================
   SECTION DON / EXPERIENCE GRATUITE
   ========================================================= */

.donation-section {
    background-color: var(--light-bg);

    /*
     * Section volontairement rapprochée de la partie
     * exercices.
     */
    padding: 2rem 0 3rem;

    margin: 0;

    position: relative;
}

.donation-section .fa-hand-holding-heart {
    color: var(--accent-color) !important;
}

.donation-box {
    border: 1px solid rgba(0, 0, 0, 0.06);

    max-width: 880px;

    margin-left: auto;
    margin-right: auto;
}


/* ---------- BOUTON PAYPAL ---------- */

.paypal-donation-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 10px;

    background: #003087;

    color: #fff !important;

    font-size: 1.1rem;
    font-weight: 600;

    padding: 14px 32px;

    border-radius: 6px;

    text-decoration: none;

    border: none;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.paypal-donation-button:hover {
    color: #fff !important;

    transform: translateY(-2px);

    opacity: 0.92;
}


/* =========================================================
   RESPONSIVE ACCUEIL
   ========================================================= */

@media (max-width: 991.98px) {

    /*
     * Sur tablette/mobile les éléments passent les uns
     * sous les autres. Les vidéos retrouvent donc
     * un format 16:9 plus adapté.
     */
    .video-iro-sidebar {
        height: auto;
        min-height: 0;

        aspect-ratio: 16 / 9;

        max-width: 700px;

        margin-left: auto;
        margin-right: auto;
    }

    .home-section-divider {
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }

    .donation-section {
        padding-top: 1.5rem;
    }
}


@media (max-width: 575.98px) {

    .exercices-section {
        margin-top: 2rem;
    }

    .home-section-divider {
        width: 95%;
    }

    .donation-section {
        padding: 1.25rem 0 2rem;
    }

    .paypal-donation-button {
        width: 100%;

        padding-left: 18px;
        padding-right: 18px;

        font-size: 1rem;
    }
}
/* --- CARTES QCM (image + texte en dessous) --- */
.qcm-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #dde1e5;
    transition: all 0.3s ease;
    height: 100%;
}

.qcm-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
    transform: translateY(-3px);
}

.qcm-img-wrapper {
    height: 180px;
    overflow: hidden;
    background: var(--exercise-bg);
}

.qcm-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.qcm-img-wrapper.qcm-img-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qcm-body {
    padding: 15px;
    text-align: center;
}

.qcm-body h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* =========================================================
   PAGES SPÉCIFIQUES
   ========================================================= */

/* --- CONTENEUR PRINCIPAL DES PAGES INTÉRIEURES --- */
.main-container {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.clavier-exercice-page {
    padding-top: 1.25rem;
}

#meilleur-score-card {
    margin-bottom: 0.75rem !important;
}

#meilleur-score-card .card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
}

#meilleur-score-card .card-body > * {
    margin-bottom: 0 !important;
}

#meilleur-score-contexte,
#meilleur-score-message,
#meilleur-score-precision {
    margin-top: 0 !important;
}

#meilleur-score-valeur {
    font-size: 1.15rem;
    line-height: 1;
}

.clavier-exercice-page .game-body {
    padding-top: 18px;
}

/* --- PAGES AUTH (inscription / connexion) --- */
.auth-container {
    /* 
       Le body a déjà 76px de padding-top.
       On ajoute 3rem (~48px) supplémentaires ici spécifiquement 
       pour que la carte auth soit bien visible sous la navbar.
    */
    padding-top: 3rem; 
    padding-bottom: 4rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.04);
}

.auth-card .form-control {
    padding: 0.75rem 1rem;
    border-radius: 10px;
}

.auth-card .form-control:focus {
    border-color: var(--text-current);
    box-shadow: 0 0 0 0.2rem rgba(78, 96, 110, 0.15);
}

.auth-card .btn-primary {
    background-color: var(--primary-color);
    border: none;
    transition: background-color 0.2s;
}

.auth-card .btn-primary:hover {
    background-color: var(--accent-color);
}

/* --- CARTE EXERCICE (entête + corps) --- */
.game-card {
    background: var(--exercise-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    overflow: hidden;
    height: 100%;
}

.game-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
}

.game-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.game-body {
    padding: 25px;
}

/* --- CARTE LATÉRALE (conseils / contrôles) --- */
.control-card {
    background: var(--exercise-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-top: 5px solid var(--accent-color);
}

.control-title {
    font-size: 1rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 15px;
}

/* =========================================================
   EXERCICE DE FRAPPE (style "Dactylo Pro")
   ========================================================= */

.stats-bar {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dde1e5;
}

.stat-item {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-current);
    margin-top: 4px;
}

.timer-bar {
    width: 100%;
    height: 10px;
    background: #dde1e5;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.timer-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #198754 0%, #ffc107 70%, #dc3545 100%);
    transition: width 0.1s linear;
}

.texte-frappe,
.texte-a-taper {
    font-size: 1.9rem;
    line-height: 1.7;
    color: #1a1a1a;
    user-select: none;
    min-height: 76px;
    padding: 10px 15px 16px;
    background: var(--exercise-bg);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 96, 110, 0.45) transparent;
}

.zone-frappe-directe {
    cursor: text;
    outline: 3px solid rgba(78, 96, 110, 0.18);
    outline-offset: 2px;
}

.zone-frappe-directe:focus {
    outline-color: rgba(78, 96, 110, 0.45);
    box-shadow: 0 0 0 3px rgba(78, 96, 110, 0.14);
}
.texte-frappe::-webkit-scrollbar,
.texte-a-taper::-webkit-scrollbar {
    height: 8px;
}
.texte-frappe::-webkit-scrollbar-thumb,
.texte-a-taper::-webkit-scrollbar-thumb {
    background: rgba(78, 96, 110, 0.35);
    border-radius: 999px;
}

.caractere {
    display: inline-block;
    min-width: 0.55ch;
    position: relative;
    transition: color 0.1s;
}

.caractere.correct {
    color: var(--text-correct);
}

.caractere.incorrect {
    color: var(--text-error);
    border-bottom: 2px solid var(--text-error);
    background-color: rgba(235, 77, 75, 0.1);
    border-radius: 3px;
}

.caractere.actuel {
    background-color: #dde1e6;
    border-radius: 3px;
    color: #333;
}

.caractere.actuel::after {
    content: "";
    position: absolute;
    left: 0.08em;
    right: 0.08em;
    bottom: -0.18em;
    height: 3px;
    background: var(--text-current);
    border-radius: 999px;
    animation: curseur-frappe 1s steps(2, start) infinite;
}

@keyframes curseur-frappe {
    50% { opacity: 0; }
}

.zone-saisie {
    width: 100%;
    min-height: 90px;
    padding: 12px 15px;
    border: 2px solid #dde1e5;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 1.05rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.zone-saisie:focus {
    outline: none;
    border-color: var(--text-current);
    box-shadow: 0 0 0 3px rgba(78, 96, 110, 0.14);
}

.zone-saisie-cachee {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    left: -9999px;
    top: -9999px;
}

.aide-touche {
    margin-top: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(78, 96, 110, 0.25);
    border-left: 4px solid var(--text-current);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.80);
    color: var(--primary-color);
    font-weight: 600;
}

.aide-touche kbd {
    background: var(--primary-color);
    color: white;
    border-radius: 5px;
    padding: 0.15rem 0.45rem;
    font-size: 0.9em;
}

/* =========================================================
   RUBRIQUE INITIATION CLAVIER
   ========================================================= */

.lesson-card {
    background: var(--exercise-bg);
    border: 1px solid rgba(30, 36, 40, 0.12);
    border-radius: 8px;
    padding: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.lesson-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 0;
}

.lesson-toggle {
    cursor: pointer;
    user-select: none;
}

.lesson-toggle-icon {
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(30, 36, 40, 0.06);
    color: var(--primary-color);
    font-size: 1rem;
    transition: transform 0.2s ease, background 0.15s;
}

.lesson-toggle:hover .lesson-toggle-icon {
    background: rgba(30, 36, 40, 0.12);
}

.lesson-toggle.open .lesson-toggle-icon {
    transform: rotate(180deg);
}

.lesson-links[hidden] {
    display: none;
}

.lesson-links:not([hidden]) {
    margin-top: 1rem;
}

.lesson-number {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    color: var(--primary-color);
}

.lesson-card p {
    margin: 0;
    color: #666;
    font-size: 0.92rem;
    line-height: 1.35;
}

.lesson-links {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.lesson-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(30, 36, 40, 0.1);
    border-radius: 8px;
    color: var(--primary-color);
    font-weight: 600;
    transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.lesson-link:hover {
    background: white;
    border-color: var(--text-current);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.lesson-link-icon {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.65;
}

/* =========================================================
   TIPS SECURITE
   ========================================================= */

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.tip-card {
    display: flex;
    gap: 0.9rem;
    padding: 1.1rem;
    background: var(--exercise-bg);
    border: 1px solid rgba(30, 36, 40, 0.12);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.tip-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.tip-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 0.45rem;
    line-height: 1.35;
}

.tip-card p {
    margin: 0;
    color: #555;
    font-size: 0.92rem;
    line-height: 1.55;
}

/* =========================================================
   QCM (questions & propositions)
   ========================================================= */

.question-qcm {
    background: var(--exercise-bg);
    padding: 1.5rem 1.75rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border-left: 4px solid var(--accent-color);
}

.question-qcm h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.propositions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.proposition {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    border: 1px solid #dde1e5;
    margin-bottom: 0 !important;
}

.proposition:hover {
    background-color: var(--light-bg);
    border-color: #c5cad0;
}

.proposition input[type="radio"] {
    cursor: pointer;
    accent-color: var(--text-current);
}

.proposition.correcte {
    background-color: #dcfce7;
    border-color: var(--text-correct);
    color: #166534;
}

.proposition.incorrecte {
    background-color: #fee2e2;
    border-color: var(--text-error);
    color: #991b1b;
}

/* =========================================================
   CARTE DE RÉSULTATS (frappe + qcm)
   ========================================================= */

.resultats-card {
    background: var(--exercise-bg);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.04);
}

.resultat-item {
    text-align: center;
    padding: 1rem;
}

.resultat-label {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.resultat-valeur {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.resultat-valeur small {
    font-size: 1rem;
    color: #888;
    font-weight: 400;
}

/* =========================================================
   CLAVIER VISUEL AZERTY
   ========================================================= */

.clavier-visuel {
    background: #c8c8c8;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.25), 0 6px 18px rgba(0,0,0,0.12);
    user-select: none;
    overflow-x: auto;
}

.clavier-rangee {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.touche {
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    border-radius: 6px;
    border: none;
    border-bottom: 3px solid rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    color: #222;
    cursor: default;
    transition: background-color 0.08s, transform 0.08s, border-bottom-width 0.08s, box-shadow 0.08s;
    text-align: center;
    position: relative;
    padding: 2px 4px;
}

.touche-shift {
    font-size: 0.58rem;
    color: #555;
    line-height: 1;
    align-self: flex-end;
    margin-right: 2px;
}

.touche-alt {
    font-size: 0.58rem;
    color: #555;
    line-height: 1;
    align-self: flex-end;
    margin-right: 2px;
}

.touche-main {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
}

.touche-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: #444;
}

/* Couleurs par doigt */
.doigt-pg { background: #FFB3BA; } /* auriculaire gauche — rose   */
.doigt-ag { background: #AED6F1; } /* annulaire gauche  — bleu    */
.doigt-mg { background: #ABEBC6; } /* majeur gauche     — vert    */
.doigt-ig { background: #F9E79F; } /* index gauche      — jaune   */
.doigt-po { background: #D5D8DC; } /* pouce             — gris    */
.doigt-id { background: #F9E79F; } /* index droit       — jaune   */
.doigt-md { background: #ABEBC6; } /* majeur droit      — vert    */
.doigt-rd { background: #AED6F1; } /* annulaire droit   — bleu    */
.doigt-pd { background: #FFB3BA; } /* auriculaire droit — rose    */

/* Touche active : surbrillance orange */
.touche.active {
    background-color: #E67E22 !important;
    color: white !important;
    transform: translateY(2px);
    border-bottom-width: 1px;
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
}

.touche.active .touche-shift,
.touche.active .touche-alt,
.touche.active .touche-label {
    color: rgba(255,255,255,0.75);
}

/* =========================================================
   RESPONSIVE (ajustements sur mobile)
   ========================================================= */

@media (max-width: 768px) {
    .hero-section {
        min-height: 220px;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .stats-bar {
        gap: 15px;
        flex-wrap: wrap;
    }
    .stat-value {
        font-size: 1.4rem;
    }
    .texte-frappe {
        font-size: 1.4rem;
    }
    .resultat-valeur {
        font-size: 1.8rem;
    }
}

/* =========================================================
   EXERCICE SOURIS — Clics sur cibles (exo 1)
   ========================================================= */

/* --- Cartes de sélection du mode (config) --- */
.mode-card {
    display: block;
    cursor: pointer;
    margin: 0;
    height: 100%;
}
.mode-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mode-card-body {
    border: 2px solid #dde1e5;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    color: var(--primary-color);
    height: 100%;
}
.mode-card:hover .mode-card-body {
    border-color: var(--text-current);
    background: var(--light-bg);
}
.mode-card input:checked + .mode-card-body {
    border-color: var(--text-current);
    background: #dde1e6;
    box-shadow: 0 4px 12px rgba(58, 74, 88, 0.15);
}

.theme-card-body {
    min-height: 210px;
}

.theme-card-icon {
    color: var(--text-current);
}

.theme-card-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: var(--theme-icon-filter, none);
}

/* --- Boutons de difficulté (30s, 60s, ...) --- */
.bouton-option {
    padding: 0.6rem 1.5rem;
    border: 2px solid #dde1e5;
    background: white;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--primary-color);
}
.bouton-option:hover {
    border-color: var(--text-current);
}
.bouton-option.active {
    background: var(--text-current);
    border-color: var(--text-current);
    color: white;
}

/* --- Zone de jeu --- */
.zone-jeu {
    position: relative;
    width: 100%;
    height: 450px;
    background: var(--exercise-bg);
    border-radius: 12px;
    overflow: hidden;
    cursor: crosshair;
    user-select: none;
    margin-top: 1rem;
}

/* --- Cibles --- */
.cible {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    animation: apparition 0.2s ease-out;
    transition: transform 0.1s;
}
.cible:hover {
    transform: scale(1.15);
}
@keyframes apparition {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@keyframes disparition {
    to { transform: scale(1.8); opacity: 0; }
}
.cible.touchee {
    animation: disparition 0.2s ease-out forwards;
    pointer-events: none;
}

/* --- Points du mode Grille --- */
.point-grille {
    width: 10px;
    height: 10px;
}

/* --- Message d'attente mode Grille --- */
.msg-attente-grille {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(255,255,255,0.88);
    padding: 6px 18px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
}

/* --- Compte à rebours 3-2-1-GO --- */
.compte-a-rebours {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary-color);
    animation: pulse 0.7s ease-in-out;
}
@keyframes pulse {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* =========================================================
   EXERCICE SOURIS — Types de clics (exo 2)
   ========================================================= */

.zone-action {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    padding: 2rem;
    background: var(--exercise-bg);
    border-radius: 12px;
    margin-top: 1rem;
    user-select: none;
}

.contenu-jeu {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.action-demandee-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.nom-action-affiche {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-current);
    margin-bottom: 1.5rem;
}

.rectangle-clic {
    width: 100%;
    max-width: 500px;
    height: 180px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transition: background-color 0.35s ease;
    -webkit-user-select: none;
    user-select: none;
}

.rectangle-indice {
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
    letter-spacing: 0.5px;
}

@keyframes flash-correct {
    0%   { filter: brightness(1.6) saturate(1.4); }
    100% { filter: brightness(1) saturate(1); }
}

@keyframes shake-erreur {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-10px); }
    40%      { transform: translateX(10px); }
    60%      { transform: translateX(-7px); }
    80%      { transform: translateX(7px); }
}

.rectangle-clic.correct-flash {
    animation: flash-correct 0.32s ease-out forwards;
}

.rectangle-clic.erreur-shake {
    animation: shake-erreur 0.4s ease-out forwards;
}

/* =========================================================
   EXERCICE SOURIS — Glisser-Déposer (exo 3)
   ========================================================= */

/* Message de consigne affiché en haut de la zone de jeu */
.gd-consigne {
    font-size: 0.95rem;
    color: #4a5568;
    background: var(--exercise-bg);
    border-left: 4px solid var(--accent-color);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    margin-bottom: 1.25rem;
}

/* Layout principal : 2 colonnes (pool gauche + grille droite) */
.glisser-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 768px) {
    .glisser-layout {
        grid-template-columns: 1fr;
    }
}

/* --- Colonne gauche : pool des éléments à placer --- */
.zone-source-wrapper {
    background: var(--exercise-bg);
    border-radius: 10px;
    padding: 0.75rem;
    border: 1px solid #dde1e5;
}

.zone-source-titre {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #dde1e5;
}

.pool-elements {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 120px;
}

/* Carte gris clair d'un élément glissable */
.element-glissable {
    background: #e8eaed;
    border: 1px solid #b0b8c1;
    border-radius: 5px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    cursor: grab;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, opacity 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.element-label {
    flex: 1;
}

.btn-info-element {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-color);
    background: #fff;
    color: var(--accent-color);
    font-size: 0.65rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.btn-info-element:hover {
    background: var(--accent-color);
    color: #fff;
}

/* Popup d'information */
.info-popup {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
    padding: 1rem;
    width: 280px;
    max-width: calc(100vw - 20px);
}

.info-popup img {
    width: 100%;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    object-fit: cover;
    max-height: 160px;
}

.info-popup p {
    font-size: 0.82rem;
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

.info-popup-fermer {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.info-popup-fermer:hover {
    color: #111;
}

.element-glissable:hover {
    border-color: var(--text-current);
    background: #dde1e5;
}

/* Opacité réduite pendant le glisser */
.element-glissable.en-deplacement {
    opacity: 0.35;
    cursor: grabbing;
}

/* Élément correctement placé → vert */
.element-glissable.correct {
    background: #dcfce7;
    border-color: var(--text-correct);
    color: #166534;
    cursor: default;
    font-weight: 600;
}

/* Élément déposé au mauvais endroit → rouge + vibration */
.element-glissable.incorrect {
    background: #fee2e2;
    border-color: var(--text-error);
    color: #991b1b;
    animation: shake-erreur 0.5s ease-out forwards;
}

/* --- Grille de catégories (colonne droite) --- */
.grille-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem;
}

@media (max-width: 992px) {
    .grille-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .grille-categories {
        grid-template-columns: 1fr;
    }
}

/* Zone de dépôt d'une catégorie */
.categorie-zone {
    border: 2px dashed #c2c8ce;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    min-height: 100px;
}

/* En-tête foncé de la catégorie */
.categorie-zone-titre {
    background: var(--primary-color);
    color: white;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Conteneur interne où sont déposés les éléments corrects */
.categorie-contenu {
    padding: 0.5rem;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* Surlignage quand un élément est glissé au-dessus */
.categorie-zone.survol {
    border-color: var(--text-current);
    border-style: solid;
    background: #dde1e6;
}

/* Bordure verte quand tous les éléments sont placés */
.categorie-zone.complete {
    border-color: var(--text-correct);
    border-style: solid;
}

/* =========================================================
   Exercice 5 — Suivi de tracé
   ========================================================= */

/* Cartes de sélection des niveaux */
.niveau-card {
    background: var(--exercise-bg);
    border: 2px solid #dde1e5;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.niveau-card:hover {
    transform: translateY(-3px);
    border-color: var(--text-current);
    box-shadow: 0 6px 18px rgba(58, 74, 88, 0.18);
}
.niveau-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.niveau-numero {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--text-current);
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.niveau-nom {
    font-weight: 600;
    color: var(--primary-color);
}
.niveau-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Conteneur du canvas (responsive, ratio 800x450) */
.trace-canvas-container {
    width: 100%;
    max-width: 880px;
    max-height: calc(100vh - 340px);
    aspect-ratio: 800 / 450;
    background: var(--exercise-bg);
    border-radius: 12px;
    overflow: hidden;
    margin: 1rem auto 0;
    border: 1px solid #dde1e5;
}
.trace-canvas-container svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='8' fill='black'/%3E%3C/svg%3E") 10 10, crosshair;
    user-select: none;
}

/* ============================================================
   TRAITEMENT DE TEXTE
   ============================================================ */

.tt-layout {
    display: flex;
    min-height: calc(100vh - 76px - 80px);
    align-items: stretch;
    border-top: 1px solid #dde1e5;
}

/* --- Sidebar --- */
.tt-sidebar {
    width: 230px;
    min-width: 230px;
    background: #fff;
    border-right: 1px solid #dde1e5;
    padding: 1.5rem 0 2rem;
    flex-shrink: 0;
}

.tt-sidebar-title {
    font-weight: 700;
    color: var(--primary-color);
    padding: 0.4rem 1.2rem 0.9rem;
    font-size: 0.95rem;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tt-nav-link {
    display: block;
    padding: 0.55rem 1.2rem;
    color: #444;
    font-size: 0.88rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.tt-nav-link:hover {
    background: var(--exercise-bg);
    color: var(--primary-color);
    border-left-color: #aaa;
}

.tt-nav-link.actif {
    background: #e2e6ea;
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

/* --- Zone principale --- */
.tt-main {
    flex: 1;
    padding: 2rem 2.5rem;
    background: #fff;
    min-width: 0;
}

.tt-page-titre {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 0;
}

/* --- Boîte d'instructions --- */
.tt-instructions {
    background: var(--exercise-bg);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.25rem;
}

.tt-instructions ol {
    margin: 0;
    padding-left: 1.5rem;
    color: #333;
    font-size: 0.92rem;
    line-height: 2;
}

/* --- Éditeur --- */
.tt-editor-zone {
    border: 1px solid #c8c8c8;
    border-radius: 6px;
}

.tt-editor-zone .ql-toolbar.ql-snow {
    border-radius: 6px 6px 0 0;
}

.tt-editor-zone .ql-container.ql-snow {
    border-radius: 0 0 6px 6px;
}

.ql-snow .ql-picker-options {
    z-index: 200;
}

.tt-toolbar {
    background: #ebebeb;
    border-bottom: 1px solid #d0d0d0;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.tt-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 7px;
    cursor: pointer;
    font-size: 0.85rem;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.1s;
    font-family: inherit;
}

.tt-btn:hover  { background: #ddd; }
.tt-btn:active { background: #ccc; }

.tt-color-btn  { position: relative; }

.tt-a-icon {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    border-bottom: 3px solid currentColor;
}

.tt-sep {
    width: 1px;
    height: 22px;
    background: #ccc;
    margin: 0 3px;
    flex-shrink: 0;
}

.tt-select {
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.82rem;
    background: #fff;
    cursor: pointer;
    color: #333;
}

.tt-editeur {
    min-height: 210px;
    padding: 1.2rem 1.5rem;
    outline: none;
    font-family: 'Times New Roman', serif;
    font-size: 14px;
    line-height: 1.9;
    background: #fff;
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- Copier-coller --- */
.tt-copy-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    font-family: 'Poppins', sans-serif;
}

.tt-copy-box {
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    padding: 0.65rem 0.9rem;
    min-height: 56px;
    font-size: 0.9rem;
    font-family: 'Times New Roman', serif;
    background: #fff;
    outline: none;
    line-height: 1.6;
}

.tt-copy-cible {
    background: var(--exercise-bg);
    border-style: dashed;
}

.tt-copy-grand {
    min-height: 130px;
    white-space: pre-wrap;
}

/* --- Boutons nav bas de page --- */
.tt-nav-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dde1e5;
}

/* Responsive */
@media (max-width: 768px) {
    .tt-layout    { flex-direction: column; }
    .tt-sidebar   { width: 100%; border-right: none; border-bottom: 1px solid #dde1e5; padding: 1rem 0; }
    .tt-main      { padding: 1.25rem; }
}

/* ---- Quill — labels police et taille ---- */

/* Sidebar scrollable (clavier : 22 leçons) */
.tt-sidebar-scroll nav {
    max-height: calc(100vh - 76px - 58px);
    overflow-y: auto;
}

/* Zone principale sans padding propre */
.tt-main.tt-main-wrap {
    padding: 0;
    overflow-y: auto;
}

/* Dropdowns défilables à la molette */
.ql-snow .ql-picker-options {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Largeur du sélecteur de police */
.ql-snow .ql-picker.ql-font { width: 150px; }

/* Affiche le nom de la police dans le label et dans chaque option */
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
    content: attr(data-value) !important;
}
/* Label par défaut (aucune police sélectionnée) */
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=""]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=""]::before {
    content: 'Sans Serif' !important;
}

/* Chaque option affichée dans sa propre police */
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Arial"]        { font-family: Arial; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Times New Roman"] { font-family: 'Times New Roman'; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Courier New"]  { font-family: 'Courier New'; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Georgia"]      { font-family: Georgia; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Verdana"]      { font-family: Verdana; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Trebuchet MS"] { font-family: 'Trebuchet MS'; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Comic Sans MS"]{ font-family: 'Comic Sans MS'; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Impact"]       { font-family: Impact; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Tahoma"]       { font-family: Tahoma; }
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Palatino"]     { font-family: Palatino; }

/* Tailles : affiche le chiffre sans "px" */
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before { content: attr(data-value) !important; }

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="9px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="9px"]::before  { content: '9'  !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="10px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="10px"]::before { content: '10' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="11px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="11px"]::before { content: '11' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="12px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="12px"]::before { content: '12' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="14px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="14px"]::before { content: '14' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="16px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="16px"]::before { content: '16' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="18px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="18px"]::before { content: '18' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="20px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="20px"]::before { content: '20' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="24px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="24px"]::before { content: '24' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="28px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="28px"]::before { content: '28' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="32px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="32px"]::before { content: '32' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="36px"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="36px"]::before { content: '36' !important; }



/* --- Style pour les iframes latérales (Sidebar) --- */
.video-iro-sidebar {
    width: 100%;
    max-width: 280px; /* Largeur contrôlée */
    aspect-ratio: 9 / 16; /* Force le format vertical pour égaler la hauteur des 4 cartes empilées */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    background: #000;
    margin: 0 auto;
}

.video-iro-sidebar iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Ajustement responsive : sur mobile, on empile tout */
@media (max-width: 768px) {
    .video-iro-sidebar {
        max-width: 200px; 
        margin-bottom: 1rem;
    }
}