/* CDMP Prep — feuille de style unique · thème clair neutre */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #eef0f3;
  --line: #dfe3e8;
  --line-2: #c9d0d8;
  --ink: #1e252c;
  --ink-2: #3b444e;
  --muted: #69737e;
  --accent: #5a7088;         /* gris acier : seule couleur d'accent */
  --accent-strong: #3c5066;
  --accent-bg: rgba(90, 112, 136, .10);
  --btn: #2b333c;
  --btn-ink: #ffffff;
  --head: #161c22;
  --bar: #ffffff;
  --ok: #1f7a50;
  --ok-bg: rgba(31, 122, 80, .10);
  --ko: #b23a30;
  --ko-bg: rgba(178, 58, 48, .09);
  --mid: #9a6512;
  --mid-bg: rgba(154, 101, 18, .11);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 38, .06), 0 4px 14px rgba(20, 28, 38, .05);
  /* teintes des schémas */
  --t1: #8ea4bb; --t2: #8bb5a8; --t3: #c4ad8c; --t4: #ab9bc2; --t5: #c49c9c; --t6: #97a9c2; --t7: #a8bc8c; --t8: #bba3c0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--accent-strong); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { color: var(--head); line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
strong { color: var(--head); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 1rem; } .mt2 { margin-top: 2rem; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: 1rem; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Barre du haut */
.topbar { background: var(--bar); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: .7rem 1.2rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .2px; }
.brand:hover { color: var(--head); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--accent-strong); display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; align-items: center; gap: .3rem; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; padding: .4rem .75rem; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a.active { background: var(--surface-3); color: var(--head); }
.nav-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 .4rem; }
.nav-user { font-weight: 600; }
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav-inner { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem; display: flex; gap: .2rem; flex-wrap: wrap; }
.subnav a { padding: .75rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; font-size: .95rem; }
.subnav a.active, .subnav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.main { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.2rem 4rem; }
.main.wide { max-width: 1400px; }

/* Messages */
.flash { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; font-weight: 500; }
.flash-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.flash-error { background: var(--ko-bg); border-color: color-mix(in srgb, var(--ko) 40%, transparent); color: var(--ko); }
.flash-info { background: var(--accent-bg); border-color: var(--line-2); color: var(--accent-strong); }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; }

/* Boutons */
.btn { display: inline-block; border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); padding: .55rem 1.05rem; border-radius: 8px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: #3c4652; border-color: #3c4652; color: var(--btn-ink); }
.btn-gold { background: var(--accent); border-color: var(--accent); color: var(--btn-ink); }
.btn-gold:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--head); border-color: var(--line-2); }
.btn-danger { background: transparent; color: var(--ko); border-color: color-mix(in srgb, var(--ko) 45%, transparent); }
.btn-danger:hover { background: var(--ko-bg); color: var(--ko); border-color: var(--ko); }
.btn-sm { padding: .32rem .7rem; font-size: .88rem; }
.btn[disabled], .btn.disabled { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Badges */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.badge-open { background: var(--accent-bg); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-validated { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge-locked { background: var(--surface-2); color: var(--muted); }
.badge-gold { background: var(--mid-bg); color: var(--mid); border-color: color-mix(in srgb, var(--mid) 30%, transparent); }

/* Formulaires */
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .93rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: var(--surface-2); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
textarea { min-height: 110px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-group label { font-weight: 500; margin: .3rem 0; display: inline-flex; gap: .4rem; align-items: center; }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: .8rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); color: var(--ink); font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Scores */
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--ok); }
.score.mid { color: var(--mid); }
.score.low { color: var(--ko); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.good > span { background: var(--ok); }
.bar.low > span { background: var(--ko); }
.bar.mid > span { background: var(--mid); }

/* Parcours (modules) */
.path { display: grid; gap: .8rem; }
.module-card { display: grid; grid-template-columns: 52px 1fr auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.module-card.locked { opacity: .5; background: var(--surface-2); box-shadow: none; }
.module-num { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--accent-strong); display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.module-card.locked .module-num { color: var(--muted); }
.module-card.validated .module-num { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.module-title { font-weight: 700; color: var(--head); font-size: 1.05rem; }
.module-meta { color: var(--muted); font-size: .88rem; display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: .15rem; }
@media (max-width: 720px) { .module-card { grid-template-columns: 46px 1fr; } .module-actions { grid-column: 1 / -1; } }

.stat { text-align: center; }
.stat .v { font-size: 2rem; font-weight: 800; color: var(--head); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* Connexion */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 600px at 20% 0%, #ffffff 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; box-shadow: 0 20px 60px rgba(20, 28, 38, .12); }
.auth-card h1 { font-size: 1.45rem; margin-bottom: .2rem; }
.auth-card .brand-mark { margin-bottom: 1rem; width: 42px; height: 42px; font-size: 1.3rem; }

/* Cours */
.course-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .course-layout { grid-template-columns: 1fr; } .toc { position: static !important; } }
.toc { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-size: .93rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.toc h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: .5rem; }
.toc a { display: block; padding: .3rem .5rem; border-radius: 6px; text-decoration: none; color: var(--ink-2); border-left: 2px solid transparent; }
.toc a:hover, .toc a.on { background: var(--surface-3); color: var(--head); border-left-color: var(--accent); }
.lang-switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.lang-switch button { border: 0; background: transparent; color: var(--ink-2); padding: .4rem .9rem; font: inherit; font-weight: 700; cursor: pointer; }
.lang-switch button.on { background: var(--ink); color: var(--btn-ink); }
.course-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.course-section h2 { border-bottom: 1px solid var(--line-2); padding-bottom: .5rem; }
.course-section h4 { margin: 1.2rem 0 .4rem; color: var(--accent-strong); font-size: 1.02rem; }
.course-section p, .course-section li { max-width: 80ch; color: var(--ink-2); }
.course-section ul, .course-section ol { padding-left: 1.3rem; }
.course-section li { margin: .25rem 0; }
.course-section li::marker { color: var(--accent); }
.course-section code { background: var(--surface-3); padding: .05rem .35rem; border-radius: 4px; font-size: .9em; color: var(--ink); }
.course-section blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.course-section table td, .course-section table th { white-space: normal; }
.callout { display: flex; gap: .8rem; padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; border-left: 3px solid; color: var(--ink-2); }
.callout-label { font-weight: 800; font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; padding-top: .2rem; }
.callout-tip { background: var(--accent-bg); border-color: var(--accent); }
.callout-tip .callout-label { color: var(--accent-strong); }
.callout-exam { background: var(--mid-bg); border-color: var(--mid); }
.callout-exam .callout-label { color: var(--mid); }
.callout-example { background: var(--ok-bg); border-color: var(--ok); }
.callout-example .callout-label { color: var(--ok); }
@media (max-width: 620px) { .callout { flex-direction: column; gap: .2rem; } .course-section { padding: 1.1rem 1rem; } }
[data-lang] { display: none; }
body.lang-fr [data-lang="fr"], body.lang-en [data-lang="en"] { display: block; }
body.lang-fr span[data-lang="fr"], body.lang-en span[data-lang="en"], body.lang-fr li[data-lang="fr"], body.lang-en li[data-lang="en"] { display: inline; }
body.lang-fr li[data-lang="fr"], body.lang-en li[data-lang="en"] { display: list-item; }
body.lang-fr th[data-lang="fr"], body.lang-en th[data-lang="en"], body.lang-fr td[data-lang="fr"], body.lang-en td[data-lang="en"] { display: table-cell; }

/* Mode présentation */
body.present .topbar, body.present .subnav, body.present .toc, body.present .no-present { display: none !important; }
body.present .course-layout { grid-template-columns: 1fr; }
body.present .main { max-width: 1200px; }
body.present .course-section { display: none; font-size: 1.22rem; min-height: 78vh; border: 0; box-shadow: none; background: transparent; }
body.present .course-section.current { display: block; animation: slideIn .35s ease; }
body.present .course-section p, body.present .course-section li { max-width: none; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.present-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); color: var(--ink); padding: .6rem 1rem; align-items: center; justify-content: center; gap: 1rem; z-index: 50; }
body.present .present-bar { display: flex; }
.present-bar button { background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2); padding: .45rem 1rem; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; }
.present-bar button:hover { background: var(--line); }
.present-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 60; transition: width .3s; display: none; }
body.present .present-progress { display: block; }

/* Écran de passage d'un quiz / examen */
body.attempt { background: var(--bg); }
.attempt-top { position: sticky; top: 0; z-index: 30; background: var(--bar); border-bottom: 1px solid var(--line); color: var(--ink); box-shadow: 0 2px 10px rgba(20, 28, 38, .10); }
.attempt-top-inner { max-width: 1250px; margin: 0 auto; padding: .6rem 1.2rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.attempt-top .lang-switch { margin-left: 1rem; }
.attempt-title { font-weight: 700; }
.attempt-sub { color: var(--muted); font-size: .85rem; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 800; background: var(--surface-3); border: 1px solid var(--line-2); padding: .25rem .8rem; border-radius: 8px; }
.timer.warn { background: var(--mid-bg); color: var(--mid); border-color: var(--mid); }
.timer.crit { background: var(--ko-bg); color: var(--ko); border-color: var(--ko); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.attempt-layout { max-width: 1250px; margin: 0 auto; padding: 1.2rem; display: grid; grid-template-columns: 1fr 270px; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .attempt-layout { grid-template-columns: 1fr; } .qnav { order: -1; } }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.7rem; box-shadow: var(--shadow); }
.qcount { color: var(--muted); font-weight: 700; font-size: .9rem; margin-bottom: .6rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qstem { font-size: 1.12rem; font-weight: 600; margin-bottom: 1.1rem; white-space: pre-line; color: var(--head); }
.qopt { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 1rem; border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: .6rem; cursor: pointer; background: var(--surface-2); width: 100%; text-align: left; font: inherit; color: var(--ink-2); transition: border-color .12s, background .12s; }
.qopt:hover { border-color: var(--line-2); background: var(--surface-3); }
.qopt.sel { border-color: var(--accent); background: var(--accent-bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.qopt .letter { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--ink); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.qopt.sel .letter { background: var(--accent); border-color: var(--accent); color: var(--btn-ink); }
.qactions { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.qnav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; position: sticky; top: 76px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; margin: .6rem 0 1rem; }
.qgrid button { height: 36px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); font: inherit; font-weight: 700; cursor: pointer; color: var(--ink-2); position: relative; }
.qgrid button.done { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--ink); }
.qgrid button.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.qgrid button.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--mid); }
.legend { font-size: .8rem; color: var(--muted); display: grid; gap: .2rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .35rem; border: 1px solid var(--line-2); }
.legend i.l-done { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); }
.legend i.l-empty { background: var(--surface-2); }
.legend i.l-flag { background: var(--mid); border-radius: 50%; border-color: var(--mid); }
.btn-flag.on { background: var(--mid-bg); border-color: var(--mid); color: var(--mid); }
.savestate { font-size: .8rem; color: var(--muted); }
.savestate.err { color: var(--ko); font-weight: 700; }

/* Résultats / correction */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.6rem; align-items: center; }
@media (max-width: 620px) { .result-hero { grid-template-columns: 1fr; text-align: center; } }
.ring { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.ring > div { width: 112px; height: 112px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.ring .v { font-size: 1.9rem; font-weight: 800; line-height: 1; text-align: center; }
.ring .l { font-size: .75rem; color: var(--muted); text-align: center; }
.verdict { display: inline-block; padding: .3rem .8rem; border-radius: 99px; font-weight: 700; font-size: .92rem; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.ko { background: var(--ko-bg); color: var(--ko); }
.review-q { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: .9rem; }
.review-q.right { border-left-color: var(--ok); }
.review-q.wrong { border-left-color: var(--ko); }
.review-q.blank { border-left-color: var(--mid); }
.review-q .meta { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; flex-wrap: wrap; }
.ropt { padding: .5rem .8rem; border-radius: 8px; margin: .3rem 0; border: 1px solid var(--line); display: flex; gap: .6rem; align-items: flex-start; color: var(--ink-2); }
.ropt .letter { font-weight: 800; color: var(--ink); min-width: 1.2rem; }
.ropt.correct { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.ropt.chosen-wrong { background: var(--ko-bg); border-color: color-mix(in srgb, var(--ko) 45%, transparent); }
.ropt .tag { margin-left: auto; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.ropt .tag.t-ok { color: var(--ok); }
.ropt .tag.t-ko { color: var(--ko); }
.explain { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin-top: .7rem; font-size: .95rem; color: var(--ink-2); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Divers */
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.pill-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: .35rem 1rem; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.code-box { background: var(--bar); border: 1px solid var(--line); color: var(--ink); padding: .9rem 1rem; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; overflow-x: auto; }
.search { max-width: 420px; }
details summary { cursor: pointer; font-weight: 700; color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
@media print {
  .topbar, .subnav, .no-print, .present-bar { display: none !important; }
}

/* ================================================================== */
/* Schémas animés des cours (lib/diagram.php + assets/js/diagram.js)   */
/* ================================================================== */
.dg { margin: 1.6rem 0; padding: 1.2rem 1.2rem 1rem; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 12px; position: relative; }
.dg-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.dg-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); font-weight: 700; }
.dg-replay { white-space: nowrap; flex-shrink: 0; background: transparent; border: 1px solid var(--line-2); color: var(--muted); border-radius: 99px; padding: .15rem .65rem; font: inherit; font-size: .78rem; cursor: pointer; }
.dg-replay:hover { color: var(--ink); border-color: var(--accent); }
.dg-caption { margin-top: .9rem; font-size: .9rem; color: var(--muted); text-align: center; max-width: none !important; }
.dg-hint { font-size: .75rem; color: var(--muted); text-align: center; margin-top: .4rem; }
.dg-detail { margin-top: .9rem; padding: .75rem 1rem; border-radius: 8px; background: var(--surface-3); border-left: 3px solid var(--accent); color: var(--ink-2); font-size: .95rem; display: none; }
.dg-detail.on { display: block; animation: dgFade .25s ease; }
.dg-detail strong { display: block; margin-bottom: .15rem; }

/* éléments animés : invisibles avant lecture, puis apparition échelonnée */
.dg.ready .a { opacity: 0; }
.dg.play .a { animation: dgIn .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 140ms + 80ms); }
.dg.play .a.pop { animation-name: dgPop; }
.dg.play .a.grow { animation-name: dgGrow; transform-origin: left center; }
.dg.play .a.rise { animation-name: dgRise; transform-origin: center bottom; }
@keyframes dgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dgPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes dgGrow { from { opacity: 0; transform: scaleX(.2); } to { opacity: 1; transform: none; } }
@keyframes dgRise { from { opacity: 0; transform: translateY(18px) scaleY(.85); } to { opacity: 1; transform: none; } }
@keyframes dgFade { from { opacity: 0; } to { opacity: 1; } }
.dg.ready svg .draw { stroke-dasharray: 100; stroke-dashoffset: 100; }
.dg.play svg .a { animation-name: dgFade; }
.dg.play svg .draw { animation: dgDraw 1.1s ease forwards; animation-delay: calc(var(--i, 0) * 140ms); }
@keyframes dgDraw { to { stroke-dashoffset: 0; } }

/* nœud générique */
.dg-node { background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 10px; padding: .55rem .75rem; color: var(--ink); font-weight: 600; font-size: .92rem; line-height: 1.3; text-align: center; position: relative; }
.dg-node small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.dg-node[data-detail] { cursor: pointer; }
.dg-node[data-detail]:hover, .dg-node.sel { border-color: var(--tone, var(--accent)); box-shadow: 0 0 0 1px var(--tone, var(--accent)), 0 6px 18px rgba(20, 28, 38, .10); }
.dg-node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 10px 0 0 10px; background: var(--tone, var(--accent)); }
.dg [style*="--tone"] { }
.tone-1 { --tone: var(--t1); } .tone-2 { --tone: var(--t2); } .tone-3 { --tone: var(--t3); } .tone-4 { --tone: var(--t4); }
.tone-5 { --tone: var(--t5); } .tone-6 { --tone: var(--t6); } .tone-7 { --tone: var(--t7); } .tone-8 { --tone: var(--t8); }

/* --- radial : cycle, hub, wheel --- */
.dg-radial { position: relative; width: 100%; max-width: 620px; aspect-ratio: 1 / 1; margin: 0 auto; }
.dg-radial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dg-radial .dg-node { position: absolute; transform: translate(-50%, -50%); width: 25%; padding: .45rem .5rem; font-size: .84rem; }
.dg-radial .dg-node::before { display: none; }
.dg-radial .dg-node { border-top: 3px solid var(--tone, var(--accent)); }
.dg-radial .dg-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 27%; aspect-ratio: 1 / 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; text-align: center; background: radial-gradient(circle at 35% 30%, #ffffff, #e9edf1); border: 1px solid var(--line-2); font-weight: 800; color: var(--head); padding: .6rem; font-size: .95rem; line-height: 1.25; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 8%, transparent), 0 10px 30px rgba(20, 28, 38, .12); }
.dg-radial .dg-center small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.dg .orbit { fill: none; stroke: var(--line-2); stroke-width: .5; }
.dg .spoke { stroke: var(--line-2); stroke-width: .45; }
.dg .arrow { fill: none; stroke: var(--accent); stroke-width: .7; opacity: .75; }
.dg .arrowhead { fill: var(--accent); opacity: .8; }
.dg .runner { fill: var(--accent-strong); opacity: 0; }
.dg.play .runner { opacity: .9; }
.dg .seg { stroke: var(--bg); stroke-width: .6; cursor: pointer; transition: opacity .2s; opacity: .9; }
.dg .seg:hover, .dg .seg.sel { opacity: 1; filter: brightness(1.15); }
.dg-wheel .dg-wlabel { position: absolute; transform: translate(-50%, -50%); width: 19%; text-align: center; font-size: .74rem; font-weight: 700; color: #111418; line-height: 1.15; pointer-events: none; }
.dg-wheel .dg-center { width: 30%; }
@media (max-width: 640px) {
  .dg-radial:not(.dg-wheel) { aspect-ratio: auto; max-width: none; display: grid; gap: .5rem; }
  .dg-radial:not(.dg-wheel) svg { display: none; }
  .dg-radial:not(.dg-wheel) .dg-node, .dg-radial:not(.dg-wheel) .dg-center { position: static; transform: none !important; width: auto !important; left: auto !important; top: auto !important; }
  .dg-radial:not(.dg-wheel) .dg-center { aspect-ratio: auto; border-radius: 10px; order: -1; }
  .dg.play .dg-radial:not(.dg-wheel) .a.pop { animation-name: dgIn; }
  .dg-wheel .dg-wlabel { font-size: .56rem; }
  .dg-wheel .dg-center { font-size: .7rem; }
}

/* --- flow --- */
.dg-flow { display: flex; align-items: stretch; gap: 0; flex-wrap: nowrap; overflow-x: auto; padding: .3rem 0 .6rem; }
.dg-flow .dg-node { flex: 1 1 0; min-width: 110px; display: flex; flex-direction: column; justify-content: center; }
.dg-flow .dg-link { flex: 0 0 42px; position: relative; align-self: center; height: 2px; background: var(--line-2); margin: 0 2px; }
.dg-flow .dg-link::after { content: ""; position: absolute; right: -1px; top: -5px; border: 6px solid transparent; border-left: 8px solid var(--line-2); border-right: 0; }
.dg-flow .dg-link i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-strong); opacity: 0; }
.dg.play .dg-flow .dg-link i { animation: dgRun 2.2s linear infinite; animation-delay: calc(var(--i, 0) * 140ms + .8s); }
@keyframes dgRun { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
.dg-flow-loop { text-align: center; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.dg-flow-loop span { display: inline-block; padding: .1rem .7rem; border: 1px dashed var(--line-2); border-radius: 99px; }
@media (max-width: 760px) {
  .dg-flow { flex-direction: column; overflow: visible; }
  .dg-flow .dg-node { min-width: 0; }
  .dg-flow .dg-link { flex: 0 0 26px; width: 2px; height: 26px; align-self: center; margin: 2px 0; }
  .dg-flow .dg-link::after { right: auto; left: -5px; top: auto; bottom: -1px; border: 6px solid transparent; border-top: 8px solid var(--line-2); border-bottom: 0; }
  .dg.play .dg-flow .dg-link i { animation-name: dgRunV; left: -3px; }
  @keyframes dgRunV { 0% { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: calc(100% - 8px); opacity: 0; } }
}

/* --- layers --- */
.dg-layers { display: grid; gap: .45rem; max-width: 760px; margin: 0 auto; }
.dg-layers .dg-node { display: grid; grid-template-columns: 34% 1fr; gap: .8rem; text-align: left; align-items: center; padding: .7rem 1rem .7rem 1.1rem; }
.dg-layers .dg-node small { margin: 0; font-size: .85rem; }
.dg-layers .dg-node .lvl { font-weight: 700; }
@media (max-width: 620px) { .dg-layers .dg-node { grid-template-columns: 1fr; gap: .2rem; } }

/* --- pyramid --- */
.dg-pyramid { display: grid; gap: .35rem; justify-items: center; max-width: 720px; margin: 0 auto; }
.dg-pyramid .dg-node { width: var(--w); clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%); border-radius: 4px; padding: .65rem 1.4rem; background: color-mix(in srgb, var(--tone, var(--accent)) 22%, var(--surface-3)); border: 0; }
.dg-pyramid .dg-node::before { display: none; }


/* --- compare --- */
.dg-compare { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: .9rem; position: relative; }
.dg-col { background: var(--surface-3); border: 1px solid var(--line-2); border-top: 3px solid var(--tone, var(--accent)); border-radius: 10px; padding: .9rem 1rem; }
.dg-col h5 { margin: 0 0 .15rem; font-size: 1rem; color: var(--head); }
.dg-col .sub { color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.dg-col ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.dg-col li { font-size: .9rem; margin: .2rem 0; }
.dg-vs { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 38px; height: 38px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--accent-strong); z-index: 2; }
@media (max-width: 680px) { .dg-compare { grid-template-columns: 1fr; } .dg-vs { display: none; } }
.dg-col[data-detail], .dg-stat[data-detail], .dg-quad .q[data-detail] { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dg-col[data-detail]:hover, .dg-col.sel, .dg-stat[data-detail]:hover, .dg-stat.sel, .dg-quad .q[data-detail]:hover, .dg-quad .q.sel { border-color: var(--tone, var(--accent)); box-shadow: 0 0 0 1px var(--tone, var(--accent)); }

/* --- matrix --- */
.dg-matrix { display: grid; gap: 4px; grid-template-columns: minmax(110px, auto) repeat(var(--cols, 2), 1fr); overflow-x: auto; }
.dg-matrix .mh { font-size: .8rem; font-weight: 700; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .5px; padding: .5rem .6rem; background: var(--surface-2); border-radius: 6px; display: flex; align-items: center; }
.dg-matrix .mh.corner { background: transparent; }
.dg-matrix .mc { background: var(--surface-3); border: 1px solid var(--line); border-radius: 6px; padding: .55rem .65rem; font-size: .88rem; color: var(--ink-2); }
.dg-matrix .mc.hl { border-color: var(--accent); background: var(--accent-bg); color: var(--ink); }
.dg-axes { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: .4rem; }

/* --- quadrant (2x2) --- */
.dg-quad { display: grid; grid-template-columns: 26px 1fr 1fr; grid-template-rows: 1fr 1fr 26px; gap: 6px; max-width: 720px; margin: 0 auto; }
.dg-quad .q { background: var(--surface-3); border: 1px solid var(--line-2); border-top: 3px solid var(--tone, var(--accent)); border-radius: 10px; padding: .8rem .9rem; min-height: 110px; }
.dg-quad .q h5 { margin: 0 0 .2rem; font-size: .95rem; color: var(--head); }
.dg-quad .q p { margin: 0; font-size: .86rem; color: var(--muted); }
.dg-quad .ax-y { grid-row: 1 / 3; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: .78rem; color: var(--muted); }
.dg-quad .ax-x { grid-column: 2 / 4; text-align: center; font-size: .78rem; color: var(--muted); }

/* --- timeline --- */
.dg-timeline { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: .6rem; position: relative; padding-top: 2.2rem; }
.dg-timeline::before { content: ""; position: absolute; left: 4%; right: 4%; top: 1.05rem; height: 2px; background: var(--line-2); }
.dg-timeline .tl { position: relative; text-align: center; }
.dg-timeline .tl::before { content: ""; position: absolute; top: -1.55rem; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--bg); border: 3px solid var(--tone, var(--accent)); }
.dg-timeline .tl .when { font-size: .78rem; font-weight: 800; color: var(--tone, var(--accent)); letter-spacing: .4px; text-transform: uppercase; }
.dg-timeline .tl .what { font-weight: 700; color: var(--head); font-size: .92rem; margin-top: .15rem; }
.dg-timeline .tl .sub { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.dg-timeline .tl[data-detail] { cursor: pointer; }
.dg-timeline .tl.sel .what { text-decoration: underline; text-decoration-color: var(--accent); }
.dg-tl-progress { position: absolute; left: 4%; top: 1.05rem; height: 2px; width: 0; background: var(--accent); }
.dg.play .dg-tl-progress { animation: dgTl 1.6s ease forwards .2s; }
@keyframes dgTl { to { width: 92%; } }
@media (max-width: 760px) {
  .dg-timeline { grid-template-columns: 1fr; padding-top: 0; padding-left: 1.8rem; gap: 1rem; }
  .dg-timeline::before, .dg-tl-progress { left: .45rem; right: auto; top: .3rem; bottom: .3rem; width: 2px; height: auto; }
  .dg.play .dg-tl-progress { animation: none; background: transparent; }
  .dg-timeline .tl { text-align: left; }
  .dg-timeline .tl::before { top: .2rem; left: -1.75rem; margin-left: 0; }
}

/* --- tree (organigramme) --- */
.dg-tree { display: flex; flex-direction: column; align-items: center; gap: 0; overflow-x: auto; padding-bottom: .4rem; }
.dg-tree .root { min-width: 200px; }
.dg-tree .kids { display: flex; gap: .8rem; justify-content: center; position: relative; padding-top: 22px; margin-top: 0; }
.dg-tree .stem { width: 2px; height: 20px; background: var(--line-2); }
.dg-tree .kids::before { content: ""; position: absolute; top: 0; left: var(--l, 10%); right: var(--r, 10%); height: 2px; background: var(--line-2); }
.dg-tree .branch { display: flex; flex-direction: column; align-items: center; position: relative; flex: 1 1 0; min-width: 130px; }
.dg-tree .branch::before { content: ""; position: absolute; top: -22px; left: 50%; width: 2px; height: 22px; background: var(--line-2); }
.dg-tree .branch .dg-node { width: 100%; }
.dg-tree .leaves { margin-top: .45rem; display: grid; gap: .3rem; width: 100%; }
.dg-tree .leaf { font-size: .8rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; text-align: center; }

/* --- stats (chiffres clés) --- */
.dg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.dg-stat { background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px; padding: 1rem; text-align: center; border-bottom: 3px solid var(--tone, var(--accent)); }
.dg-stat .v { font-size: 1.75rem; font-weight: 800; color: var(--head); line-height: 1.15; font-variant-numeric: tabular-nums; }
.dg-stat .l { color: var(--muted); font-size: .85rem; margin-top: .3rem; line-height: 1.35; }

/* --- bars --- */
.dg-bars { display: grid; grid-template-columns: minmax(140px, 34%) 1fr 64px; gap: .45rem .8rem; align-items: center; }
.dg-bars .br-l { font-size: .88rem; color: var(--ink-2); text-align: right; }
.dg-bars .br-l[data-detail] { cursor: pointer; text-decoration: underline dotted var(--line-2); }
.dg-bars .br-t { height: 14px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.dg-bars .br-t span { display: block; height: 100%; border-radius: 99px; background: var(--tone, var(--accent)); }
.dg-bars .br-v { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--head); font-size: .9rem; }
@media (max-width: 620px) { .dg-bars { grid-template-columns: 1fr 48px; } .dg-bars .br-l { grid-column: 1 / -1; text-align: left; margin-top: .3rem; } }

/* --- profil formateur --- */
.dg-profile { display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center; }
.dg-avatar { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; color: var(--head); background: conic-gradient(from 210deg, var(--t1), var(--t2), var(--t3), var(--t4), var(--t1)); padding: 3px; }
.dg-avatar span { width: 100%; height: 100%; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.dg.play .dg-avatar { animation: dgSpin 1.2s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes dgSpin { from { transform: rotate(-90deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.dg-profile .name { font-size: 1.5rem; font-weight: 800; color: var(--head); margin: 0; }
.dg-profile .role { color: var(--accent-strong); font-weight: 700; margin-top: .1rem; }
.dg-profile .tag { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.dg-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.dg-chip { font-size: .78rem; font-weight: 700; padding: .2rem .65rem; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink); background: var(--surface-3); }
.dg-chip.strong { border-color: var(--accent); color: var(--head); background: var(--accent-bg); }
@media (max-width: 620px) { .dg-profile { grid-template-columns: 1fr; text-align: center; justify-items: center; } .dg-chips { justify-content: center; } }

/* --- mode présentation : schémas plus grands --- */
body.present .dg { font-size: 1rem; }
body.present .dg-radial { max-width: 700px; }

@media (prefers-reduced-motion: reduce) {
  .dg .a, .dg.play .a { opacity: 1 !important; animation: none !important; }
  .dg.play .a.pop { transform: translate(-50%, -50%); }
  .dg.ready svg .draw { stroke-dasharray: none; stroke-dashoffset: 0; animation: none !important; }
  .dg-flow .dg-link i, .dg .runner { display: none; }
  .dg.play .dg-tl-progress { animation: none !important; }
  .dg-tl-progress { width: 92%; }
}
.dg .seg:focus { outline: none; }
.dg .seg:focus-visible, .dg .seg.sel { stroke: var(--head); stroke-width: .8; }

/* Éditeur de contenu (espace formateur) */
.bi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 820px) { .bi-grid { grid-template-columns: 1fr; } }
textarea.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86rem; line-height: 1.5; }
label.inline { display: inline-flex; gap: .45rem; align-items: center; font-weight: 500; margin: .3rem 0; }
.opt-row { display: grid; grid-template-columns: 44px 1fr 1fr; gap: .6rem; align-items: center; padding: .4rem; border-radius: 8px; border: 1px solid transparent; margin-bottom: .3rem; }
.opt-row.is-answer { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.opt-pick { margin: 0; display: grid; place-items: center; cursor: pointer; }
.opt-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt-pick span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); }
.opt-pick input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) { .opt-row { grid-template-columns: 40px 1fr; } .opt-row input[name^="opt_en"] { grid-column: 2; } }
.sec-edit { scroll-margin-top: 1rem; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.sec-actions .spacer { flex: 1; }
details.help summary, details#meta summary { font-weight: 700; }
.filters input[type=text], .filters select { width: auto; }
.filters input[type=text] { min-width: min(320px, 100%); }
