:root {
    --success: #0F766E;
    --success-dark: #115E59;
    --success-light: #5AAE9F;
    --success-soft: #E7F4F1;
    --success-pale: #F5F8F7;
    --text: #18221d;
    --muted: #6d776f;
    --border: #dfe6e1;
    --bg: #f5f8f6;
    --paper: #fff;
    --danger: #dc3545;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
button, a { font: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }

.ce-exam-page { min-height: 100vh; background: #f5f8f6; }
.exam-layout { min-height: 100vh; display: grid; grid-template-columns: 325px 1fr; gap: 10px; padding: 8px 10px 10px; }

/* =========================
   BARRE LATÉRALE
   ========================= */
.exam-sidebar {
    background: #fff;
    border: 1px solid #dfe6e1;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 18px);
    position: sticky;
    top: 8px;
}
.brand-block { display:flex; align-items:center; gap:11px; padding:8px 8px 15px; }
.brand-mark { width:42px; height:42px; border-radius:12px; background:var(--success); color:#fff; display:grid; place-items:center; font-weight:900; }
.brand-block strong { display:block; font-size:16px; }
.brand-block small { color:var(--muted); }
.timer-card {
    margin:0 1px 12px;
    background:linear-gradient(135deg,#0F766E,#115E59);
    border-radius:15px;
    padding:12px 12px 11px;
    color:#fff;
    display:grid;
    grid-template-columns:30px 1fr;
    column-gap:8px;
}
.timer-icon { grid-row:span 2; font-size:25px; align-self:start; }
.timer-card strong { font-size:21px; display:block; }
.timer-card span { font-size:12px; opacity:.95; }
.timer-track { grid-column:1/-1; height:8px; background:rgba(255,255,255,.35); border-radius:10px; overflow:hidden; margin-top:10px; }
.timer-track span { display:block; height:100%; background:#fff; border-radius:inherit; transition:width .4s linear; }
.timer-warning { filter:saturate(1.15); }

.answered-summary { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:0 0 10px; }
.answered-summary > div { border:1px solid #e1e8e3; border-radius:10px; padding:8px; text-align:center; background:#fbfdfb; }
.answered-summary strong { display:block; color:var(--success-dark); font-size:18px; }
.answered-summary span { color:var(--muted); font-size:10px; }
.nav-title { font-weight:800; font-size:14px; padding:0 2px 8px; border-bottom:1px solid #e9efeb; }
.question-nav { display:grid; grid-template-columns:repeat(8,1fr); gap:6px; padding:8px 0; }
.question-nav-btn { height:34px; border:1px solid #dde5df; background:#F8FAF9; border-radius:9px; color:#34433a; font-weight:700; font-size:12px; }
.question-nav-btn:hover { border-color:#8cc8a7; }
.question-nav-btn.current { background:var(--success); border-color:var(--success); color:#fff; box-shadow:0 2px 6px rgba(15,118,110,.20); }
.question-nav-btn.answered:not(.current) { background:#e7f8ed; border-color:#8FC4BA; color:#115E59; }
.legend { display:flex; flex-wrap:wrap; gap:12px; border-top:1px solid #e9efeb; padding:10px 0; font-size:11px; color:var(--muted); }
.legend span { display:flex; align-items:center; gap:4px; }
.legend i { display:inline-block; width:13px; height:13px; border-radius:4px; border:1px solid #dbe2dd; }
.legend-current { background:var(--success); border-color:var(--success)!important; }
.legend-answered { background:#e7f8ed; border-color:#8FC4BA!important; }
.legend-empty { background:#F8FAF9; }
.quit-btn { margin-top:auto; border:1px solid #f1b7bb; color:#dc3545; background:#fff; border-radius:9px; padding:10px; font-weight:700; }
.quit-btn:hover { background:#fff7f7; }

/* =========================
   ZONE PRINCIPALE
   ========================= */
.exam-main { min-width:0; padding:4px 12px 14px 0; }
.exam-topbar { min-height:66px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:0 12px 4px; }
.module-label { font-size:12px; font-weight:800; letter-spacing:.08em; color:var(--success); }
.exam-topbar h1 { margin:5px 0 0; font-size:20px; }
.question-counter { color:#657069; font-weight:700; }

.question-card {
    min-height:calc(100vh - 95px);
    background:#fff;
    border:1px solid #e0e7e2;
    border-radius:17px;
    padding:20px 18px 16px;
    display:flex;
    flex-direction:column;
    box-shadow:0 6px 25px rgba(16,47,44,.055);
}
.question-headline { text-align:center; padding:0 15px 14px; }
.question-headline h2 { margin:0; font-size:18px; line-height:1.4; }

/* Le texte support occupe la place qu'occupait l'audio dans la CO. */
.reading-stage {
    display:grid;
    grid-template-columns:150px minmax(0, 700px);
    justify-content:center;
    align-items:center;
    gap:14px;
    min-height:310px;
    padding:0 0 8px;
}
.reading-tools {
    width:150px;
    border:1px solid #CFE2DE;
    border-radius:15px;
    background:#F4F9F8;
    padding:10px;
    align-self:center;
    box-shadow:0 4px 12px rgba(100,80,10,.05);
}
.reading-tools-title {
    text-align:center;
    color:#115E59;
    font-size:11px;
    font-weight:800;
    padding-bottom:8px;
    margin-bottom:7px;
    border-bottom:1px solid #DCE7E4;
}
.tool-btn {
    width:100%;
    border:1px solid #8FC4BA;
    background:#fff;
    color:#115E59;
    border-radius:999px;
    min-height:34px;
    padding:0 10px;
    font-size:12px;
    font-weight:700;
    margin-top:6px;
}
.tool-btn.active { background:#E7F4F1; }
.tool-btn:disabled { opacity:.45; cursor:not-allowed; }

.reading-paper {
    position:relative;
    min-height:290px;
    max-height:410px;
    overflow:auto;
    border:2px solid #CFE0DC;
    border-radius:15px;
    background:
        linear-gradient(180deg,rgba(255,255,255,.98),rgba(251,253,251,.98)),
        repeating-linear-gradient(0deg,transparent 0,transparent 31px,rgba(25,135,84,.025) 32px);
    padding:20px 25px 22px;
    box-shadow:0 7px 18px rgba(20,70,45,.06);
}
.reading-paper::after {
    content:'4C2';
    position:absolute;
    right:22px;
    bottom:8px;
    font-size:54px;
    font-weight:900;
    color:rgba(25,135,84,.045);
    pointer-events:none;
    user-select:none;
}
.paper-label { color:var(--success); font-size:10px; letter-spacing:1.1px; font-weight:900; }
.paper-title { margin:5px 0 13px; font-size:17px; color:#10211F; }
.reading-content {
    position:relative;
    z-index:1;
    font-family:Georgia,'Times New Roman',serif;
    font-size:17px;
    line-height:1.68;
    color:#24342F;
}
.reading-content p { margin:0 0 15px; white-space:pre-wrap; }
.reading-content p:last-child { margin-bottom:0; }
.reading-content mark.ce-highlight { background:#fff19c; padding:0 2px; border-radius:2px; }

/* Question et réponses sous le texte, comme dans la référence visuelle. */
.ce-question-block { margin-top:4px; padding:0 0 4px; }
.question-meta { display:flex; justify-content:center; align-items:center; gap:8px; margin:5px 0 8px; }
.question-meta span { border-radius:999px; padding:7px 12px; background:#F4F8F7; color:#5E6F6C; font-size:11px; font-weight:800; }
.question-meta #questionBadge { background:var(--success-soft); color:var(--success-dark); }
.question-meta #answeredBadge.answered { background:#E7F4F1; color:#115E59; }
.ce-question-block h2 { font-size:18px; line-height:1.45; margin:3px auto 14px; max-width:1000px; text-align:center; }
.answers-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; max-width:1000px; margin:0 auto; width:100%; }
.answer-btn { min-height:56px; border:2px solid #D6E2DF; background:#fff; border-radius:14px; display:flex; align-items:center; text-align:left; padding:10px 14px; color:#10211F; transition:.15s ease; }
.answer-btn:hover { border-color:#9bcdb0; background:#fbfefc; }
.answer-btn.selected { border-color:var(--success); background:var(--success-soft); box-shadow:inset 0 0 0 1px rgba(15,118,110,.08); }
.answer-letter { width:30px; height:30px; border-radius:50%; background:#EEF3F1; display:grid; place-items:center; flex:0 0 auto; font-weight:800; color:#4C5D59; margin-right:10px; }
.answer-btn.selected .answer-letter { background:var(--success); color:#fff; }
.answer-text { font-size:14px; line-height:1.4; }

.question-footer { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:12px; margin-top:auto; padding-top:18px; }
.nav-btn, .next-btn { min-height:42px; border-radius:10px; padding:0 18px; font-weight:800; }
.nav-btn { justify-self:start; border:1px solid #DCE7E4; background:#fff; color:#5E6F6C; }
.nav-btn:hover:not(:disabled) { border-color:#8FC4BA; color:var(--success-dark); }
.nav-btn:disabled { opacity:.45; cursor:not-allowed; }
.next-btn { justify-self:end; border:0; background:#0F766E; color:#fff; cursor:pointer; }
.next-btn:hover { background:var(--success); }
.current-pill { min-width:96px; padding:10px 15px; text-align:center; border:1px solid #B9D8D2; color:var(--success); background:#E7F4F1; border-radius:20px; font-weight:800; font-size:13px; }

.finish-overlay { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(15,35,24,.45); z-index:1000; }
.finish-overlay.visible { display:flex; }
.finish-box { background:#fff; border-radius:18px; padding:35px; text-align:center; width:min(90%,390px); box-shadow:0 20px 60px rgba(0,0,0,.2); }
.spinner { width:38px; height:38px; border:4px solid #DCEEEA; border-top-color:var(--success); border-radius:50%; animation:spin .8s linear infinite; margin:0 auto 15px; }
.finish-box h2 { margin:0 0 7px; font-size:19px; }
.finish-box p { margin:0; color:var(--muted); }
@keyframes spin { to { transform:rotate(360deg); } }

@media (max-width:1050px) {
    .exam-layout { grid-template-columns:270px 1fr; }
    .question-nav { grid-template-columns:repeat(6,1fr); }
    .reading-stage { grid-template-columns:125px minmax(0,1fr); }
    .reading-tools { width:125px; }
}
@media (max-width:780px) {
    .exam-layout { display:block; padding:0; }
    .exam-sidebar { position:relative; top:0; min-height:auto; border-radius:0 0 16px 16px; margin-bottom:8px; }
    .brand-block { padding-bottom:10px; }
    .timer-card { margin-bottom:8px; }
    .question-nav { grid-template-columns:repeat(8,1fr); }
    .quit-btn { margin-top:12px; }
    .exam-main { padding:0 8px 8px; }
    .exam-topbar { padding:12px 6px; }
    .question-card { min-height:auto; padding:18px 12px 14px; }
    .reading-stage { grid-template-columns:1fr; align-items:stretch; min-height:0; }
    .reading-tools { width:100%; display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:8px; }
    .reading-tools-title { width:100%; margin:0; }
    .tool-btn { width:auto; margin:0; }
    .reading-paper { min-height:250px; max-height:430px; padding:17px; }
    .reading-content { font-size:16px; }
    .answers-grid { grid-template-columns:1fr; }
    .question-footer { grid-template-columns:1fr 1fr; }
    .current-pill { display:none; }
    .nav-btn, .next-btn { width:100%; }
}
@media (max-width:460px) {
    .question-nav { grid-template-columns:repeat(6,1fr); }
    .question-nav-btn { height:32px; }
    .question-headline h2 { font-size:16px; }
    .ce-question-block h2 { font-size:16px; }
    .reading-paper { padding:15px; }
}


/* V18 — stabilité desktop : aucun élément mobile visible et aucune page à faire défiler */
.mobile-exam-bar { display:none; }

@media (min-width:781px) {
    html, body.ce-exam-page {
        height:100%;
        min-height:100%;
        overflow:hidden;
    }
    body.ce-exam-page .exam-layout {
        height:100vh;
        min-height:100vh;
        overflow:hidden;
    }
    body.ce-exam-page .exam-main {
        height:100vh;
        min-height:0;
        overflow:hidden;
    }
    body.ce-exam-page .question-card {
        height:calc(100vh - 95px);
        min-height:0;
        overflow:hidden;
    }
    body.ce-exam-page .reading-stage {
        min-height:0;
        flex:1 1 auto;
    }
    body.ce-exam-page .reading-paper {
        max-height:100%;
        min-height:220px;
    }
}

/* ==========================================================
   V16 — MOBILE CE : interface compacte type examen
   ========================================================== */
.mobile-exam-bar { display:none; }
.mobile-nav-close { display:none; }

/* Taille du texte du document selon sa longueur.
   Les classes sont ajoutées par user-ce.js. */
.reading-content.ce-text-short { font-size:30px; line-height:1.52; }
.reading-content.ce-text-medium { font-size:25px; line-height:1.55; }
.reading-content.ce-text-long { font-size:21px; line-height:1.62; }
.reading-content.ce-text-very-long { font-size:18px; line-height:1.68; }

@media (max-width:780px) {
    html, body { min-height:100%; }
    body.ce-exam-page { background:#F5F8F7; overflow-x:hidden; }

    body.ce-exam-page::before {
        content:'';
        position:fixed;
        inset:0;
        background:rgba(20,27,24,.52);
        z-index:998;
        opacity:0;
        pointer-events:none;
        transition:opacity .18s ease;
    }
    body.ce-exam-page.mobile-nav-open::before { opacity:1; pointer-events:auto; }

    .exam-layout { display:block; min-height:100vh; padding:0; }

    .exam-main { padding:58px 0 0; }
    .exam-topbar { display:none; }

    .mobile-exam-bar {
        position:fixed;
        z-index:997;
        top:0;
        left:0;
        right:0;
        height:58px;
        background:#fff;
        border-top:2px solid var(--success);
        border-bottom:1px solid #DCE7E4;
        display:grid;
        grid-template-columns:1fr auto 1fr;
        align-items:center;
        padding:0 10px;
        box-shadow:0 2px 10px rgba(20,35,28,.05);
    }

    .mobile-timer {
        justify-self:start;
        min-width:74px;
        height:32px;
        padding:0 11px;
        display:inline-flex;
        align-items:center;
        justify-content:center;
        gap:6px;
        border-radius:18px;
        background:#E7F4F1;
        color:#115E59;
        font-size:14px;
        font-weight:800;
    }
    .mobile-timer-icon { font-size:15px; line-height:1; }
    .mobile-counter { font-size:14px; color:#374151; font-weight:700; }
    .mobile-grid-btn,
    .mobile-exit-btn {
        width:36px;
        height:36px;
        border:0;
        border-radius:10px;
        display:grid;
        place-items:center;
        font-size:20px;
    }
    .mobile-actions { justify-self:end; display:flex; align-items:center; gap:8px; }
    .mobile-grid-btn { background:#f1f4f6; color:#374151; }
    .mobile-exit-btn { background:#dc3545; color:#fff; }

    .question-card {
        min-height:calc(100vh - 58px);
        border:0;
        border-radius:0;
        box-shadow:none;
        padding:10px 8px 76px;
        background:#fff;
    }
    .question-headline { display:none; }

    .reading-stage {
        display:flex;
        flex-direction:column;
        gap:8px;
        min-height:0;
        padding:0;
    }
    .reading-paper {
        order:1;
        width:100%;
        min-height:0;
        max-height:none;
        overflow:visible;
        border:2px solid #2f80ff;
        border-radius:14px;
        padding:27px 18px 17px;
        box-shadow:none;
        background:#fff;
    }
    .paper-label { display:none; }
    .paper-title { margin:7px 0 14px; font-size:16px; }
    .reading-content { font-size:22px; line-height:1.62; }
    .reading-content.ce-text-short { font-size:24px; line-height:1.55; }
    .reading-content.ce-text-medium { font-size:21px; line-height:1.58; }
    .reading-content.ce-text-long { font-size:18px; line-height:1.62; }
    .reading-content.ce-text-very-long { font-size:16px; line-height:1.65; }
    .reading-content p { margin-bottom:16px; }

    .reading-tools {
        order:2;
        align-self:center;
        width:auto;
        max-width:calc(100% - 40px);
        min-height:40px;
        display:flex;
        align-items:center;
        gap:6px;
        padding:5px 8px;
        border:1px solid #f0b72f;
        border-radius:999px;
        background:#fff;
        box-shadow:0 3px 10px rgba(100,80,10,.08);
    }
    .reading-tools-title {
        width:auto;
        padding:0 4px 0 0;
        margin:0;
        border:0;
        font-size:10px;
    }
    .tool-btn {
        width:34px;
        min-height:30px;
        height:30px;
        margin:0;
        padding:0;
        border-radius:50%;
        font-size:0;
        display:grid;
        place-items:center;
    }
    .tool-btn::first-letter { font-size:15px; }
    #highlightBtn::after { content:'✎'; font-size:15px; }
    #eraseBtn::after { content:'⌫'; font-size:15px; }

    .ce-question-block { margin-top:2px; padding:0 12px; }
    .question-meta { display:none; }
    .ce-question-block h2 {
        margin:4px auto 12px;
        font-size:13px;
        line-height:1.4;
        max-width:100%;
    }
    .answers-grid { grid-template-columns:1fr; gap:6px; max-width:none; }
    .answer-btn {
        min-height:40px;
        border-width:1px;
        border-radius:10px;
        padding:6px 10px;
    }
    .answer-letter { width:26px; height:26px; font-size:12px; margin-right:8px; }
    .answer-text { font-size:13px; }

    .question-footer {
        position:fixed;
        z-index:996;
        left:0;
        right:0;
        bottom:0;
        height:62px;
        margin:0;
        padding:7px 10px;
        grid-template-columns:1fr 1fr;
        gap:10px;
        background:rgba(255,255,255,.98);
        border-top:1px solid #DCE7E4;
        box-shadow:0 -2px 10px rgba(20,35,28,.06);
    }
    .current-pill { display:none; }
    .nav-btn, .next-btn {
        width:100%;
        min-height:40px;
        border-radius:10px;
        padding:0 12px;
    }

    /* Le panneau de navigation devient une bottom-sheet. */
    .exam-sidebar {
        position:fixed;
        z-index:999;
        left:0;
        right:0;
        bottom:0;
        top:auto;
        width:100%;
        min-height:0;
        max-height:78vh;
        overflow:auto;
        margin:0;
        padding:0 15px 16px;
        border:0;
        border-radius:16px 16px 0 0;
        box-shadow:0 -10px 35px rgba(20,35,28,.16);
        transform:translateY(110%);
        transition:transform .2s ease;
        background:#fff;
    }
    .exam-sidebar.mobile-open { transform:translateY(0); }
    .exam-sidebar .brand-block,
    .exam-sidebar .timer-card,
    .exam-sidebar .answered-summary,
    .exam-sidebar .quit-btn { display:none; }
    .exam-sidebar .nav-title {
        position:relative;
        margin:0 -15px 10px;
        padding:18px 15px 16px;
        border-bottom:1px solid #DCE7E4;
        font-size:17px;
    }
    .mobile-nav-close {
        display:grid;
        place-items:center;
        position:absolute;
        right:10px;
        top:11px;
        width:34px;
        height:34px;
        border:0;
        background:transparent;
        color:#667085;
        font-size:26px;
    }
    .question-nav {
        grid-template-columns:repeat(8,1fr);
        gap:8px;
        padding:4px 0 14px;
    }
    .question-nav-btn {
        height:42px;
        border-radius:10px;
        font-size:14px;
        background:#f8fafc;
    }
    .question-nav-btn.current {
        box-shadow:0 2px 7px rgba(25,135,84,.22);
    }
    .legend {
        border-top:1px solid #DCE7E4;
        border-bottom:1px solid #DCE7E4;
        padding:11px 0;
        gap:14px;
        margin-bottom:12px;
    }
}

@media (max-width:460px) {
    .mobile-exam-bar { height:56px; }
    .exam-main { padding-top:56px; }
    .mobile-timer { min-width:72px; height:31px; font-size:13px; }
    .mobile-grid-btn, .mobile-exit-btn { width:34px; height:34px; }
    .question-card { min-height:calc(100vh - 56px); padding-left:7px; padding-right:7px; }
    .reading-paper { padding:25px 17px 16px; }
    .question-nav { grid-template-columns:repeat(8,1fr); gap:7px; }
    .question-nav-btn { height:40px; }
}

/* ==========================================================
   V17 — CE : mobile minimaliste, barre supérieure stable
   ========================================================== */
@media (max-width: 780px) {
    html, body { width:100%; max-width:100%; overflow-x:hidden; }
    body.ce-exam-page { background:#f6f8f7; }

    .exam-layout { display:block !important; width:100%; min-height:100vh; padding:0 !important; }
    .exam-main { width:100%; min-width:0; padding:58px 0 70px !important; }
    .exam-topbar { display:none !important; }

    .mobile-exam-bar {
        display:grid !important;
        position:fixed !important;
        inset:0 0 auto 0 !important;
        z-index:2000 !important;
        width:100% !important;
        height:58px !important;
        padding:0 10px !important;
        display:grid !important;
        grid-template-columns:auto 1fr auto !important;
        align-items:center !important;
        gap:10px !important;
        background:#fff !important;
        border-top:2px solid var(--success) !important;
        border-bottom:1px solid #e5e9e6 !important;
        box-shadow:0 1px 5px rgba(20,40,28,.08) !important;
    }
    .mobile-timer {
        min-width:74px !important;
        height:32px !important;
        padding:0 10px !important;
        border-radius:18px !important;
        background:#e8f2ff !important;
        color:#115E59 !important;
        font-size:13px !important;
        font-weight:800 !important;
        white-space:nowrap !important;
    }
    .mobile-counter-wrap {
        min-width:0;
        display:flex;
        justify-content:center;
        align-items:center;
        gap:20px;
    }
    .mobile-counter,
    .mobile-answered-counter { font-size:13px; line-height:1; font-weight:700; color:#475467; white-space:nowrap; }
    .mobile-answered-counter { color:#7b8490; font-weight:500; }
    .mobile-actions { justify-self:end !important; display:flex !important; align-items:center !important; gap:6px !important; }
    .mobile-doc-icon,
    .mobile-grid-btn,
    .mobile-exit-btn {
        width:34px !important;
        height:34px !important;
        flex:0 0 34px !important;
        border-radius:9px !important;
        display:grid !important;
        place-items:center !important;
        font-size:19px !important;
    }
    .mobile-doc-icon { color:#475467; background:#f2f4f5; font-size:18px; }
    .mobile-grid-btn { border:0; background:#f2f4f5; color:#344054; }
    .mobile-exit-btn { border:0; background:#dc3545; color:#fff; }

    .question-card {
        width:calc(100% - 10px) !important;
        margin:6px 5px 0 !important;
        min-height:calc(100vh - 64px) !important;
        border:1px solid #e7ebe8 !important;
        border-radius:15px !important;
        box-shadow:0 7px 20px rgba(22,40,30,.08) !important;
        padding:18px 12px 70px !important;
        background:#fff !important;
    }
    .question-headline { display:block !important; padding:14px 10px 18px !important; }
    .question-headline h2 {
        margin:0 auto !important;
        max-width:370px !important;
        font-size:12px !important;
        line-height:1.35 !important;
        text-align:center !important;
        color:#111827 !important;
    }

    .reading-stage { gap:8px !important; }
    .reading-paper {
        width:100% !important;
        min-height:0 !important;
        max-height:none !important;
        overflow:visible !important;
        border:2px solid var(--success) !important;
        border-radius:14px !important;
        padding:20px 16px 15px !important;
        background:#fff !important;
    }
    .paper-label { display:none !important; }
    .paper-title { margin:0 0 12px !important; font-size:16px !important; font-style:italic; }
    .reading-content { color:#101828 !important; }
    .reading-content.ce-text-short { font-size:24px !important; line-height:1.52 !important; }
    .reading-content.ce-text-medium { font-size:20px !important; line-height:1.55 !important; }
    .reading-content.ce-text-long { font-size:17px !important; line-height:1.6 !important; }
    .reading-content.ce-text-very-long { font-size:15px !important; line-height:1.65 !important; }
    .reading-content p { margin:0 0 14px !important; }

    .reading-tools {
        width:max-content !important;
        max-width:100% !important;
        min-height:34px !important;
        margin:0 auto !important;
        padding:3px 7px !important;
        border:1px solid #f0b429 !important;
        border-radius:999px !important;
        gap:5px !important;
        background:#fff !important;
        box-shadow:0 2px 8px rgba(80,65,10,.08) !important;
    }
    .reading-tools-title { padding-right:3px !important; font-size:9px !important; font-weight:800 !important; }
    .tool-btn { width:29px !important; height:29px !important; min-height:29px !important; border-radius:50% !important; }

    .ce-question-block { margin-top:1px !important; padding:0 1px !important; }
    .question-meta { display:none !important; }
    .ce-question-block h2 {
        margin:5px 5px 11px !important;
        font-size:12px !important;
        line-height:1.35 !important;
        text-align:center !important;
        color:#111827 !important;
    }
    .answers-grid { grid-template-columns:1fr !important; gap:5px !important; margin-top:0 !important; min-height:0 !important; }
    .answer-btn {
        min-height:39px !important;
        border:2px solid #e1e5e9 !important;
        border-radius:10px !important;
        padding:5px 9px !important;
        background:#fff !important;
    }
    .answer-letter { width:25px !important; height:25px !important; flex:0 0 25px !important; margin-right:7px !important; font-size:11px !important; }
    .answer-text { font-size:13px !important; }
    .answer-btn.selected { border-color:var(--success) !important; background:var(--success-soft) !important; }
    .answer-btn.selected .answer-letter { background:var(--success) !important; color:#fff !important; }

    .question-footer {
        position:fixed !important;
        left:0 !important; right:0 !important; bottom:0 !important;
        z-index:1999 !important;
        height:62px !important;
        margin:0 !important;
        padding:7px 10px !important;
        display:grid !important;
        grid-template-columns:52px 1fr 52px !important;
        gap:8px !important;
        background:rgba(255,255,255,.98) !important;
        border-top:1px solid #e5e9e6 !important;
        box-shadow:0 -2px 9px rgba(20,40,28,.07) !important;
    }
    .current-pill { display:flex !important; align-items:center; justify-content:center; min-width:0 !important; padding:0 !important; border:0 !important; background:transparent !important; color:#344054 !important; }
    .current-pill span { font-size:13px; font-weight:800; }
    .nav-btn, .next-btn {
        width:52px !important;
        min-height:40px !important;
        height:40px !important;
        padding:0 !important;
        border-radius:9px !important;
        font-size:0 !important;
    }
    .nav-btn { justify-self:start !important; }
    .nav-btn::before { content:'←'; font-size:21px; }
    .next-btn { justify-self:end !important; background:#9b91f8 !important; }
    .next-btn::after { content:'→'; font-size:21px; }

    .exam-sidebar {
        position:fixed !important;
        z-index:3000 !important;
        left:0 !important; right:0 !important; bottom:0 !important; top:auto !important;
        width:100% !important;
        max-height:78vh !important;
        overflow:auto !important;
        margin:0 !important;
        padding:0 15px 16px !important;
        border:0 !important;
        border-radius:16px 16px 0 0 !important;
        box-shadow:0 -10px 35px rgba(20,35,28,.18) !important;
        transform:translateY(110%) !important;
        transition:transform .2s ease !important;
    }
    .exam-sidebar.mobile-open { transform:translateY(0) !important; }
    .exam-sidebar .brand-block,
    .exam-sidebar .timer-card,
    .exam-sidebar .answered-summary,
    .exam-sidebar .quit-btn { display:none !important; }
    .exam-sidebar .nav-title { margin:0 -15px 10px !important; padding:18px 15px 16px !important; border-bottom:1px solid #e5e9e6 !important; font-size:17px !important; font-weight:800; }
    .mobile-nav-close { display:grid !important; place-items:center !important; position:absolute !important; right:10px !important; top:10px !important; width:34px !important; height:34px !important; border:0 !important; background:transparent !important; color:#667085 !important; font-size:26px !important; }
    .question-nav { grid-template-columns:repeat(8,1fr) !important; gap:7px !important; padding:4px 0 14px !important; }
    .question-nav-btn { height:41px !important; border-radius:10px !important; font-size:13px !important; }
    .legend { border-top:1px solid #e5e9e6 !important; border-bottom:1px solid #e5e9e6 !important; padding:11px 0 !important; margin-bottom:12px !important; }

    body.ce-exam-page.mobile-nav-open { overflow:hidden; }
    body.ce-exam-page.mobile-nav-open::before { z-index:2999 !important; }
}

@media (max-width:380px) {
    .mobile-exam-bar { padding:0 7px !important; gap:6px !important; }
    .mobile-timer { min-width:70px !important; padding:0 7px !important; font-size:12px !important; }
    .mobile-counter-wrap { gap:10px !important; }
    .mobile-counter, .mobile-answered-counter { font-size:12px !important; }
    .mobile-doc-icon, .mobile-grid-btn, .mobile-exit-btn { width:32px !important; height:32px !important; flex-basis:32px !important; }
    .reading-paper { padding-left:13px !important; padding-right:13px !important; }
}

/* V19 — CE : le document occupe tout l'espace libéré. Aucun scroll interne. */
.question-headline, .question-meta { display:none !important; }

@media (min-width:781px) {
    body.ce-exam-page .reading-stage {
        flex:1 1 auto;
        min-height:0;
        grid-template-columns:150px minmax(0, 1fr);
        align-items:stretch;
        padding:0;
    }
    body.ce-exam-page .reading-paper {
        height:100%;
        min-height:0;
        max-height:none;
        overflow:hidden;
        display:flex;
        flex-direction:column;
    }
    body.ce-exam-page .reading-content {
        min-height:0;
        overflow:hidden;
    }
}

@media (max-width:780px) {
    body.ce-exam-page .reading-paper {
        max-height:none;
        overflow:hidden;
    }
}

/* V20 — restauration explicite de la navigation CE sur ordinateur */
@media (min-width:781px) {
    body.ce-exam-page .exam-layout {
        display:grid !important;
        grid-template-columns:325px minmax(0,1fr) !important;
        gap:10px !important;
        padding:8px 10px 10px !important;
    }
    body.ce-exam-page .exam-sidebar {
        display:flex !important;
        visibility:visible !important;
        position:sticky !important;
        top:8px !important;
        width:auto !important;
        min-height:calc(100vh - 18px) !important;
        height:auto !important;
        max-height:none !important;
        overflow:visible !important;
        transform:none !important;
        padding:12px !important;
        background:#fff !important;
        border:1px solid #dfe6e1 !important;
        border-radius:16px !important;
        box-shadow:none !important;
        z-index:auto !important;
    }
    body.ce-exam-page .exam-sidebar .brand-block,
    body.ce-exam-page .exam-sidebar .timer-card,
    body.ce-exam-page .exam-sidebar .answered-summary,
    body.ce-exam-page .exam-sidebar .nav-title,
    body.ce-exam-page .exam-sidebar .question-nav,
    body.ce-exam-page .exam-sidebar .legend,
    body.ce-exam-page .exam-sidebar .quit-btn {
        visibility:visible !important;
    }
    body.ce-exam-page .exam-sidebar .brand-block,
    body.ce-exam-page .exam-sidebar .timer-card,
    body.ce-exam-page .exam-sidebar .answered-summary,
    body.ce-exam-page .exam-sidebar .quit-btn {
        display:flex !important;
    }
    body.ce-exam-page .exam-sidebar .answered-summary {
        display:grid !important;
    }
    body.ce-exam-page .exam-sidebar .nav-title {
        display:block !important;
    }
    body.ce-exam-page .exam-sidebar .question-nav {
        display:grid !important;
    }
    body.ce-exam-page .exam-sidebar .legend {
        display:flex !important;
    }
    body.ce-exam-page .exam-sidebar .mobile-nav-close {
        display:none !important;
    }
}


/* Protection du texte support : sélection normale désactivée.
   Le JS active .highlight-mode uniquement pendant le surlignage.
*/
.reading-paper,
.reading-paper .paper-title,
.reading-paper .reading-content {
    -webkit-user-select:none;
    user-select:none;
}
.reading-content.highlight-mode {
    -webkit-user-select:text;
    user-select:text;
    cursor:text;
}
.reading-content mark.ce-highlight {
    background:#CDEEE8;
    color:inherit;
}
