/* ============================================================
   QUIZ-ECRITE.CSS — Épreuve « Expression Écrite » (Tâches 1/2/3)
   Interface candidate : rédaction guidée, compteur intelligent,
   auto-sauvegarde, auto-évaluation, réponse modèle, correction IA.
   Préfixe : .qe-
   ============================================================ */

:root {
    /* Thème bleu (les noms --qe-green* sont conservés pour ne pas tout réécrire) */
    --qe-green:        #2563eb;   /* bleu principal */
    --qe-green-dark:   #1e3a8a;   /* bleu foncé */
    --qe-green-light:  #dbeafe;   /* bleu clair (encadrés) */
    --qe-green-soft:   #eff6ff;   /* bleu très clair (fonds) */
    --qe-accent:       #2563eb;   /* accent bleu */
    --qe-ink:          #1e293b;
    --qe-muted:        #64748b;
    --qe-border:       #e2e8f0;
    --qe-red:          #dc2626;
    --qe-amber:        #f59e0b;
    --qe-bg:           #f1f5f9;
    --qe-radius:       16px;
    --qe-shadow:       0 4px 24px rgba(15, 23, 42, .07);
}

/* ── Wrapper global ── */
.qe-wrapper {
    max-width: 980px;
    margin: 24px auto 64px;
    padding: 0 16px;
}

/* ════════════ MODAL DE DÉMARRAGE ════════════ */
.qe-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(8, 30, 22, .55);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(3px);
}
.qe-modal {
    background: #fff; border-radius: 20px; padding: 34px 30px;
    max-width: 520px; width: 100%; box-shadow: 0 24px 70px rgba(0,0,0,.28);
    text-align: center; animation: qe-pop .25s ease;
}
@keyframes qe-pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qe-modal-icon { font-size: 2.6rem; margin-bottom: 10px; }
.qe-modal h2 { font-size: 1.35rem; font-weight: 800; color: var(--qe-ink); margin-bottom: 4px; }
.qe-modal-sub { color: var(--qe-muted); font-size: .9rem; margin-bottom: 18px; }
.qe-task-preview { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 22px; }
.qe-task-preview-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--qe-green-soft); border: 1px solid var(--qe-green-light);
    border-radius: 10px; font-size: .85rem; color: var(--qe-green-dark);
}
.qe-task-preview-item b { background: var(--qe-green); color: #fff; width: 26px; height: 26px;
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem; flex-shrink: 0; }
.qe-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.qe-mode-btn {
    padding: 16px; border-radius: 12px; border: 2px solid var(--qe-green); background: var(--qe-green-soft);
    cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.qe-mode-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(26,92,72,.18); }
.qe-mode-btn .qe-mode-emoji { font-size: 1.5rem; margin-bottom: 6px; }
.qe-mode-btn .qe-mode-title { font-weight: 700; color: var(--qe-green-dark); font-size: .95rem; }
.qe-mode-btn .qe-mode-desc { font-size: .76rem; color: var(--qe-muted); margin-top: 2px; }
.qe-modal-back { font-size: .85rem; color: #94a3b8; text-decoration: none; }
.qe-modal-back:hover { color: var(--qe-green); }

/* ════════════ EN-TÊTE STICKY (titre + timer + étapes) ════════════ */
.qe-topbar {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, var(--qe-green) 0%, var(--qe-green-dark) 100%);
    color: #fff; border-radius: var(--qe-radius); padding: 16px 20px; margin-bottom: 18px;
    box-shadow: var(--qe-shadow);
}
.qe-topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qe-topbar-title { font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.qe-topbar-title i { opacity: .9; }
.qe-timer {
    display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16);
    padding: 8px 14px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
}
.qe-timer.qe-timer-warn { background: rgba(220,38,38,.9); animation: qe-blink 1s infinite; }
@keyframes qe-blink { 50% { opacity: .55; } }
.qe-timer-hidden { display: none; }

/* Barre de progression du temps */
.qe-timebar-wrap { height: 5px; background: rgba(255,255,255,.2); border-radius: 999px; margin-top: 12px; overflow: hidden; }
.qe-timebar { height: 100%; width: 100%; background: #bfdbfe; border-radius: 999px; transition: width 1s linear; }

/* ── Stepper des tâches ── */
.qe-steps { display: flex; gap: 10px; margin-top: 14px; }
.qe-step {
    flex: 1; cursor: pointer; background: rgba(255,255,255,.12); border: 1.5px solid transparent;
    border-radius: 12px; padding: 9px 10px; text-align: center; transition: all .18s; color: #dbeafe;
}
.qe-step:hover { background: rgba(255,255,255,.22); }
.qe-step.active { background: #fff; color: var(--qe-green-dark); border-color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.qe-step.done .qe-step-badge { background: var(--qe-accent); color: #fff; }
.qe-step-badge {
    width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.3); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; margin-bottom: 4px;
}
.qe-step.active .qe-step-badge { background: var(--qe-green); color: #fff; }
.qe-step-label { display: block; font-size: .8rem; font-weight: 700; }
.qe-step-words { display: block; font-size: .68rem; opacity: .8; margin-top: 1px; }

/* ════════════ CARTE PRINCIPALE DE LA TÂCHE ════════════ */
.qe-card { background: #fff; border-radius: var(--qe-radius); box-shadow: var(--qe-shadow); padding: 24px; }
.qe-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.qe-card-head .qe-task-no {
    width: 42px; height: 42px; border-radius: 12px; background: var(--qe-green);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.qe-card-head h3 { font-size: 1.1rem; font-weight: 800; color: var(--qe-ink); margin: 0; }
.qe-card-head .qe-card-head-sub { font-size: .8rem; color: var(--qe-muted); }

/* Bloc Consigne */
.qe-consigne {
    display: flex; gap: 12px; background: #eff6ff; border-left: 4px solid #2563eb;
    border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
}
.qe-consigne i { color: #2563eb; font-size: 1.15rem; margin-top: 2px; }
.qe-consigne-body strong { display: block; color: var(--qe-ink); font-size: .9rem; margin-bottom: 2px; }
.qe-consigne-body p { margin: 0; color: #475569; font-size: .86rem; line-height: 1.5; }

/* Documents (tâche 3) */
.qe-docs { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .qe-docs.two { grid-template-columns: 1fr 1fr; } }
.qe-doc {
    background: var(--qe-green-soft); border: 1px solid var(--qe-green-light);
    border-radius: 12px; padding: 14px 16px;
}
.qe-doc h4 { font-size: .82rem; font-weight: 800; color: var(--qe-green-dark); margin: 0 0 6px;
    display: flex; align-items: center; gap: 6px; }
.qe-doc p { margin: 0; font-size: .86rem; line-height: 1.55; color: #1e293b; }

/* Bloc Sujet */
.qe-sujet {
    background: var(--qe-green-light); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px;
}
.qe-sujet-label { font-size: .72rem; font-weight: 800; letter-spacing: .08em; color: var(--qe-green-dark); }
.qe-sujet-text { font-size: 1rem; font-weight: 600; color: var(--qe-ink); margin: 6px 0 8px; line-height: 1.5; }
.qe-sujet-range { font-size: .82rem; font-weight: 700; color: var(--qe-red); }

/* Zone de rédaction */
.qe-editor-wrap { position: relative; }
.qe-textarea {
    width: 100%; min-height: 280px; resize: vertical; border: 2px solid var(--qe-border);
    border-radius: 12px; padding: 16px; font-size: .98rem; line-height: 1.7; color: var(--qe-ink);
    transition: border-color .15s; background: #fcfdfe;
}
.qe-textarea:focus { outline: none; border-color: var(--qe-green); box-shadow: 0 0 0 4px rgba(26,92,72,.1); }

/* Barre d'état sous la zone (compteur + autosave) */
.qe-editor-status {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 10px;
}
.qe-counter {
    display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 700;
    padding: 5px 12px; border-radius: 999px; transition: all .2s;
}
.qe-counter .qe-count-num { font-variant-numeric: tabular-nums; }
.qe-counter.low  { background: #fef2f2; color: var(--qe-red); }
.qe-counter.ok   { background: #dcfce7; color: #15803d; }
.qe-counter.over { background: #fff7ed; color: #c2410c; }
.qe-count-progress {
    flex: 1; min-width: 140px; max-width: 320px; height: 7px; background: #eef2f6;
    border-radius: 999px; overflow: hidden; margin: 0 6px;
}
.qe-count-progress > span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .25s, background .25s; }
.qe-autosave { font-size: .78rem; color: var(--qe-muted); display: inline-flex; align-items: center; gap: 5px; }
.qe-autosave i { color: var(--qe-accent); }

/* Astuce / outils */
.qe-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.qe-tool-btn {
    font-size: .8rem; font-weight: 600; color: var(--qe-green-dark); background: var(--qe-green-soft);
    border: 1px solid var(--qe-green-light); border-radius: 8px; padding: 7px 12px; cursor: pointer; transition: background .15s;
}
.qe-tool-btn:hover { background: var(--qe-green-light); }

/* ════════════ NAVIGATION BAS ════════════ */
.qe-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.qe-btn {
    display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
    font-weight: 700; font-size: .92rem; padding: 12px 22px; border-radius: 11px; transition: all .15s; text-decoration: none;
}
.qe-btn:disabled { opacity: .4; cursor: not-allowed; }
.qe-btn-ghost { background: #fff; color: var(--qe-green-dark); border: 1.5px solid var(--qe-border); }
.qe-btn-ghost:hover:not(:disabled) { border-color: var(--qe-green); }
.qe-btn-primary { background: var(--qe-green); color: #fff; }
.qe-btn-primary:hover:not(:disabled) { background: var(--qe-green-dark); transform: translateY(-1px); }
.qe-btn-finish { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.qe-btn-finish:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(21,128,61,.3); }

/* ════════════ ÉCRAN DE RÉSULTAT / BILAN ════════════ */
.qe-result { animation: qe-pop .3s ease; }
.qe-result-hero {
    background: linear-gradient(135deg, var(--qe-green) 0%, var(--qe-green-dark) 100%); color: #fff;
    border-radius: var(--qe-radius); padding: 28px; text-align: center; margin-bottom: 20px; box-shadow: var(--qe-shadow);
}
.qe-result-hero h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.qe-result-hero p { opacity: .9; margin: 0; }
.qe-result-task { background: #fff; border-radius: var(--qe-radius); box-shadow: var(--qe-shadow); padding: 22px; margin-bottom: 18px; }
.qe-result-task-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qe-result-task-head .qe-task-no { width: 36px; height: 36px; font-size: .95rem; border-radius: 10px; }
.qe-result-task-head h3 { font-size: 1rem; font-weight: 800; margin: 0; color: var(--qe-ink); }
.qe-wordpill { margin-left: auto; font-size: .78rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.qe-wordpill.ok { background: #dcfce7; color: #15803d; }
.qe-wordpill.low { background: #fef2f2; color: var(--qe-red); }
.qe-wordpill.over { background: #fff7ed; color: #c2410c; }

.qe-yourtext {
    background: #f8fafc; border: 1px solid var(--qe-border); border-radius: 10px;
    padding: 14px 16px; font-size: .9rem; line-height: 1.65; color: #334155; white-space: pre-wrap; margin-bottom: 16px;
}
.qe-yourtext.empty { color: #94a3b8; font-style: italic; }

/* Grille d'auto-évaluation */
.qe-selfeval { margin-bottom: 16px; }
.qe-selfeval > h4, .qe-block-title {
    font-size: .9rem; font-weight: 800; color: var(--qe-ink); margin: 0 0 10px;
    display: flex; align-items: center; gap: 8px;
}
.qe-block-title i { color: var(--qe-green); }
.qe-criterion { padding: 11px 0; border-bottom: 1px dashed var(--qe-border); }
.qe-criterion:last-child { border-bottom: none; }
.qe-criterion-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.qe-criterion-name { font-size: .87rem; font-weight: 700; color: #334155; }
.qe-stars { display: inline-flex; gap: 3px; }
.qe-star { cursor: pointer; font-size: 1.15rem; color: #cbd5e1; transition: transform .1s, color .1s; }
.qe-star:hover { transform: scale(1.18); }
.qe-star.filled { color: #f59e0b; }
.qe-criterion-hint { font-size: .76rem; color: var(--qe-muted); }

/* Disclosure (réponse modèle) */
.qe-disclosure { border: 1px solid var(--qe-green-light); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.qe-disclosure-btn {
    width: 100%; display: flex; align-items: center; gap: 10px; background: var(--qe-green-soft);
    border: none; cursor: pointer; padding: 13px 16px; font-weight: 700; color: var(--qe-green-dark); font-size: .88rem;
}
.qe-disclosure-btn .qe-chev { margin-left: auto; transition: transform .2s; }
.qe-disclosure-btn.open .qe-chev { transform: rotate(180deg); }
.qe-disclosure-body { padding: 16px; font-size: .9rem; line-height: 1.7; color: #1e293b; white-space: pre-wrap; display: none; }
.qe-disclosure-body.open { display: block; }

/* Correction IA */
.qe-ai-box { border: 1px solid var(--qe-border); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fbfdff; }
.qe-ai-btn {
    display: inline-flex; align-items: center; gap: 8px; background: #0f172a; color: #fff;
    border: none; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: .86rem; cursor: pointer; transition: opacity .15s;
}
.qe-ai-btn:hover { opacity: .9; }
.qe-ai-btn:disabled { opacity: .55; cursor: progress; }
.qe-ai-note { font-size: .78rem; color: var(--qe-muted); margin-top: 8px; }
.qe-ai-level { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 800; color: var(--qe-green-dark); }
.qe-ai-level .qe-ai-badge { background: var(--qe-green); color: #fff; padding: 3px 12px; border-radius: 999px; font-size: .95rem; }
.qe-ai-crit { background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.qe-ai-crit b { color: var(--qe-ink); font-size: .85rem; }
.qe-ai-crit .note { float: right; color: var(--qe-green); font-weight: 800; }
.qe-ai-crit p { margin: 4px 0 0; font-size: .82rem; color: #475569; }
.qe-ai-cols { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 700px) { .qe-ai-cols { grid-template-columns: 1fr 1fr; } }
.qe-ai-listcard { border-radius: 10px; padding: 12px 14px; }
.qe-ai-listcard.pos { background: #f0fdf4; border: 1px solid #bbf7d0; }
.qe-ai-listcard.neg { background: #fff7ed; border: 1px solid #fed7aa; }
.qe-ai-listcard h5 { margin: 0 0 6px; font-size: .82rem; font-weight: 800; }
.qe-ai-listcard.pos h5 { color: #15803d; } .qe-ai-listcard.neg h5 { color: #c2410c; }
.qe-ai-listcard ul { margin: 0; padding-left: 18px; }
.qe-ai-listcard li { font-size: .82rem; margin-bottom: 4px; color: #334155; }
.qe-ai-fix { border-left: 3px solid var(--qe-amber); background: #fffbeb; border-radius: 6px; padding: 8px 12px; margin-top: 8px; font-size: .82rem; }
.qe-ai-fix .old { color: var(--qe-red); text-decoration: line-through; }
.qe-ai-fix .new { color: #15803d; font-weight: 700; }
.qe-fix-type { display: inline-block; color: #fff; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 10px; margin-right: 6px; vertical-align: middle; }
.qe-spinner { display:inline-block; width:15px; height:15px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: qe-spin .7s linear infinite; }
@keyframes qe-spin { to { transform: rotate(360deg); } }

/* Actions finales */
.qe-result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .qe-card { padding: 18px 15px; }
    .qe-step-label { font-size: .72rem; }
    .qe-mode-grid { grid-template-columns: 1fr; }
    .qe-topbar-title { font-size: .95rem; }
    .qe-nav { flex-wrap: wrap; }
    .qe-btn { flex: 1; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════
   REFONTE 3 COLONNES — Navigation / Éditeur / Outils
   ════════════════════════════════════════════════════════════ */

.qe-app { max-width: 1400px; margin: 16px auto 56px; padding: 0 16px; }

/* ── Barre supérieure ── */
.qe-appbar {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid var(--qe-border); border-radius: 14px;
    padding: 12px 18px; box-shadow: var(--qe-shadow); margin-bottom: 10px;
}
.qe-appbar-back {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #475569; text-decoration: none; border: 1px solid var(--qe-border); transition: background .15s;
}
.qe-appbar-back:hover { background: #f1f5f9; }
.qe-appbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.qe-appbar-name { font-weight: 800; color: var(--qe-ink); font-size: 1.05rem; }
.qe-appbar-sub  { font-size: .78rem; color: var(--qe-muted); }
.qe-appbar .qe-timer { margin-left: auto; margin-right: auto; }

/* Minuteur (style clair de la maquette) — surcharge le style historique */
.qe-timer {
    display: inline-flex; align-items: center; gap: 8px;
    background: #eff6ff; color: #1e3a8a; border: 1.5px solid #bfdbfe;
    padding: 8px 18px; border-radius: 999px;
    font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem;
}
.qe-timer.qe-timer-warn { background: #fef2f2; color: #dc2626; border-color: #fecaca; animation: qe-blink 1s infinite; }

/* Barre de temps (autonome, sous la barre supérieure) */
.qe-timebar-wrap { height: 4px; background: #e2e8f0; border-radius: 999px; margin: 0 2px 16px; overflow: hidden; }
.qe-timebar { height: 100%; width: 100%; background: #3b82f6; border-radius: 999px; transition: width 1s linear; }

/* ── Grille 3 colonnes ── */
.qe-layout {
    display: grid; grid-template-columns: 280px minmax(0, 1fr) 290px;
    gap: 16px; align-items: start;
}
.qe-nav-col, .qe-tools-col { position: sticky; top: 16px; }

.qe-col-title {
    font-size: .82rem; font-weight: 800; color: var(--qe-ink);
    display: flex; align-items: center; gap: 8px; margin: 4px 4px 12px;
}
.qe-col-title i { color: var(--qe-green); }

/* ── Cartes de navigation (gauche) ── */
.qe-nav-card {
    width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--qe-border);
    border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: all .15s;
}
.qe-nav-card:hover { border-color: #bfdbfe; }
.qe-nav-card.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb); border-color: transparent;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}
.qe-nav-card-title { font-weight: 800; color: var(--qe-ink); font-size: .95rem; }
.qe-nav-card-sub   { font-size: .76rem; color: var(--qe-muted); margin-top: 3px; }
.qe-nav-card.active .qe-nav-card-title, .qe-nav-card.active .qe-nav-card-sub { color: #fff; }
.qe-nav-card.done .qe-nav-card-title::after { content: ' ✓'; color: #16a34a; }
.qe-nav-card.active.done .qe-nav-card-title::after { color: #fff; }
.qe-nav-bar { height: 5px; background: #e2e8f0; border-radius: 999px; margin-top: 9px; overflow: hidden; }
.qe-nav-bar > span { display: block; height: 100%; width: 0; background: #22c55e; border-radius: 999px; transition: width .25s; }
.qe-nav-card.active .qe-nav-bar { background: rgba(255,255,255,.35); }
.qe-nav-card.active .qe-nav-bar > span { background: #fff; }

/* Avertissement + astuce */
.qe-warn {
    display: flex; gap: 10px; background: #fffbeb; border: 1px solid #fde68a;
    border-radius: 12px; padding: 12px 14px; font-size: .78rem; color: #92400e; line-height: 1.45; margin-top: 6px;
}
.qe-warn i { color: #f59e0b; margin-top: 2px; flex-shrink: 0; }
.qe-nav-hint { display: flex; gap: 8px; font-size: .76rem; color: var(--qe-muted); margin-top: 12px; padding: 0 4px; line-height: 1.45; }
.qe-nav-hint i { color: #94a3b8; margin-top: 2px; flex-shrink: 0; }

/* ── En-tête de tâche (centre) ── */
.qe-task-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.qe-task-header .qe-task-no {
    width: 40px; height: 40px; border-radius: 11px; background: var(--qe-green); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; flex-shrink: 0;
}
.qe-task-header-info { flex: 1; min-width: 0; }
.qe-task-header-info h3 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--qe-ink); }
.qe-task-header-sub { font-size: .8rem; color: var(--qe-muted); margin-top: 2px; }
.qe-mask-btn {
    display: inline-flex; align-items: center; gap: 6px; background: #f8fafc; border: 1px solid var(--qe-border);
    border-radius: 9px; padding: 7px 12px; font-size: .8rem; font-weight: 600; color: #475569; cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.qe-mask-btn:hover { background: #f1f5f9; }

/* ── Bas de l'éditeur : compteur + flèches ── */
.qe-editor-bottom { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.qe-count-range { font-weight: 600; }
.qe-bottom-nav { margin-left: auto; display: flex; gap: 8px; }
.qe-arrow {
    width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--qe-border);
    background: #fff; color: #475569; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.qe-arrow:hover:not(:disabled) { border-color: var(--qe-green); color: var(--qe-green); }
.qe-arrow-next { background: var(--qe-green); color: #fff; border-color: var(--qe-green); }
.qe-arrow-next:hover:not(:disabled) { background: var(--qe-green-dark); color: #fff; }
.qe-arrow:disabled { opacity: .4; cursor: not-allowed; }

/* ── Colonne Outils (droite) ── */
.qe-tools-box {
    background: #fff; border: 1px solid var(--qe-border); border-radius: 14px;
    padding: 14px; margin-bottom: 14px; box-shadow: var(--qe-shadow);
}
.qe-tools-label { font-size: .78rem; font-weight: 800; color: var(--qe-ink); margin-bottom: 10px; }
.qe-chars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qe-char {
    aspect-ratio: 1 / 1; border: 1px solid var(--qe-border); border-radius: 9px; background: #f8fafc;
    font-size: 1rem; font-weight: 600; color: var(--qe-ink); cursor: pointer; transition: all .12s;
}
.qe-char:hover { background: var(--qe-green); color: #fff; border-color: var(--qe-green); transform: translateY(-1px); }

.qe-prog-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 0; border-bottom: 1px dashed var(--qe-border); font-size: .84rem; color: #334155; font-weight: 600;
}
.qe-prog-row:last-child { border-bottom: none; }
.qe-prog-pill {
    font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px;
    background: #eef2f6; color: #64748b; font-variant-numeric: tabular-nums;
}
.qe-prog-pill.ok { background: #dcfce7; color: #15803d; }

.qe-finish-btn {
    width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; border: none; border-radius: 12px;
    padding: 14px; font-weight: 800; font-size: .95rem; cursor: pointer; transition: all .15s; box-shadow: 0 6px 16px rgba(234, 88, 12, .3);
}
.qe-finish-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(234, 88, 12, .42); }

/* ── Responsive : effondrement en une colonne ── */
@media (max-width: 1100px) {
    .qe-layout { grid-template-columns: 1fr; }
    .qe-nav-col, .qe-tools-col { position: static; }
    .qe-chars { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 560px) {
    .qe-appbar { flex-wrap: wrap; }
    .qe-appbar .qe-timer { margin: 0; }
    .qe-chars { grid-template-columns: repeat(6, 1fr); }
}

/* ════════════════════════════════════════════════════════════
   TABLEAU DE BORD — BILAN & CORRECTION IA
   ════════════════════════════════════════════════════════════ */
.qe-rd { max-width: 1120px; margin: 0 auto 64px; padding: 0 16px; animation: qe-pop .3s ease; }

/* Hero */
.qe-rd-hero {
    background: linear-gradient(135deg, #3b5bdb 0%, #2545c9 100%); color: #fff;
    border-radius: 0 0 26px 26px; padding: 40px 24px 70px; text-align: center;
    margin: 0 -16px 0; box-shadow: var(--qe-shadow);
}
.qe-rd-hero h2 { font-size: 2rem; font-weight: 800; margin: 0; }

/* Carte résumé (3 stats) qui chevauche le hero */
.qe-rd-summary {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    background: #fff; border-radius: 18px; box-shadow: 0 14px 40px rgba(15,23,42,.12);
    margin: -44px auto 22px; max-width: 1040px; overflow: hidden;
}
.qe-rd-stat { padding: 26px 18px; text-align: center; }
.qe-rd-stat-mid { border-left: 1px solid var(--qe-border); border-right: 1px solid var(--qe-border); }
.qe-rd-stat-label { font-size: .92rem; color: var(--qe-muted); margin-bottom: 10px; }
.qe-rd-stat-score { font-size: 2.6rem; font-weight: 800; color: var(--qe-red); line-height: 1; }
.qe-rd-stat-time  { font-size: 2.1rem; font-weight: 800; color: var(--qe-ink); line-height: 1; }
.qe-rd-stat-sub   { font-size: .85rem; color: var(--qe-muted); margin-top: 8px; }
.qe-rd-level-badge {
    display: inline-block; background: #fee2e2; color: #dc2626; font-weight: 800; font-size: 1.7rem;
    padding: 6px 20px; border-radius: 12px; line-height: 1;
}

/* Note éliminatoire */
.qe-rd-elim {
    background: #fef2f2; border: 1px solid #fecaca; border-radius: 14px;
    padding: 18px 22px; max-width: 1040px; margin: 0 auto 20px;
}
.qe-rd-elim strong { display: block; color: #b91c1c; font-size: 1rem; margin-bottom: 6px; }
.qe-rd-elim p { margin: 0; color: #dc2626; font-size: .9rem; line-height: 1.55; }

/* Actions */
.qe-rd-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 18px auto 26px; }
.qe-rd-restart {
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; border: none;
    box-shadow: 0 6px 16px rgba(37,99,235,.3);
}
.qe-rd-restart:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37,99,235,.4); }

/* Chargement (correction en cours) */
.qe-rd-loading {
    max-width: 1040px; margin: 0 auto; background: #fff; border: 1px solid var(--qe-border);
    border-radius: 16px; padding: 40px; text-align: center; color: var(--qe-muted); font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: var(--qe-shadow);
}
.qe-spinner.dark { width: 20px; height: 20px; border: 3px solid #cbd5e1; border-top-color: #2563eb; }

/* Cartes par tâche */
.qe-rd-task {
    max-width: 1040px; margin: 0 auto 22px; background: #fff; border: 1px solid var(--qe-border);
    border-radius: 18px; padding: 26px; box-shadow: var(--qe-shadow);
}
.qe-rd-task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.qe-rd-task-head-info { min-width: 0; }
.qe-rd-task-head-info h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; color: var(--qe-ink); }
.qe-rd-task-sujet { margin: 0; font-size: .92rem; color: var(--qe-muted); line-height: 1.5; }
.qe-rd-task-score { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.qe-rd-task-note { font-size: 1.6rem; font-weight: 800; }
.qe-rd-task-note.good { color: #16a34a; }
.qe-rd-task-note.bad  { color: var(--qe-red); }
.qe-rd-level-pill { background: #fee2e2; color: #dc2626; font-weight: 800; font-size: .8rem; padding: 4px 11px; border-radius: 999px; }

/* Colonnes Points positifs / Axes d'amélioration */
.qe-rd-cols { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 760px) { .qe-rd-cols { grid-template-columns: 1fr 1fr; } }
.qe-rd-fb { border-radius: 14px; padding: 18px 20px; }
.qe-rd-fb h4 { margin: 0 0 12px; font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.qe-rd-fb ul { margin: 0; padding-left: 4px; list-style: none; }
.qe-rd-fb li { font-size: .9rem; line-height: 1.55; margin-bottom: 10px; padding-left: 18px; position: relative; color: #334155; }
.qe-rd-fb li::before { content: '•'; position: absolute; left: 2px; font-weight: 800; }
.qe-rd-fb.pos { background: #f0fdf4; border: 1px solid #bbf7d0; }
.qe-rd-fb.pos h4 { color: #15803d; }
.qe-rd-fb.pos li::before { color: #22c55e; }
.qe-rd-fb.neg { background: #fffbeb; border: 1px solid #fde68a; }
.qe-rd-fb.neg h4 { color: #c2410c; }
.qe-rd-fb.neg li::before { color: #f59e0b; }

@media (max-width: 700px) {
    .qe-rd-summary { grid-template-columns: 1fr; }
    .qe-rd-stat-mid { border: none; border-top: 1px solid var(--qe-border); border-bottom: 1px solid var(--qe-border); }
    .qe-rd-hero h2 { font-size: 1.5rem; }
    .qe-rd-task-head { flex-direction: column; }
}
