/* ==========================================================================
   USRS45 – design system
   Rouge CNAM, Geist / Geist Mono, icônes Phosphor, style « plan technique »
   ========================================================================== */

:root {
  --red: #c1002a;
  --red-ink: #8f001f;
  --red-soft: #fbe9ed;
  --red-line: rgba(193, 0, 42, .18);
  --ink: #0f1115;
  --ink-2: #3a3f4b;
  --muted: #7a8190;
  --line: #e4e5e9;
  --line-2: #eff0f2;
  --bg: #eceef1;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --ok: #0f9f6e;
  --ok-soft: #e3f6ee;
  --ko: #d92d4b;
  --warn: #b26a00;
  --warn-soft: #fdf1dc;
  --code: #0d0f14;
  --code-2: #151821;
  --code-line: #1d212c;
  --code-txt: #e7e9ee;
  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --red: #ff3d5e;
  --red-ink: #ff7088;
  --red-soft: #2a0d14;
  --red-line: rgba(255, 61, 94, .24);
  --ink: #f1f2f5;
  --ink-2: #c4c8d2;
  --muted: #878e9d;
  --line: #232733;
  --line-2: #1b1f29;
  --bg: #08090c;
  --panel: #111319;
  --panel-2: #161922;
  --ok: #3ddc97;
  --ok-soft: #0f2a20;
  --warn: #f2c14e;
  --warn-soft: #2a2410;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font: inherit; }
i.ph, i.ph-bold, i.ph-fill { line-height: 1; }

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.sq { display: inline-block; width: 6px; height: 6px; background: var(--red); margin-right: 8px; vertical-align: 1px; }

/* --------------------------------------------------------------------------
   Coque : sommaire + contenu
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 316px minmax(0, 1fr); gap: 14px; padding: 14px; min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--panel); border-radius: var(--r-xl); border: 1px solid var(--line-2); }

/* Sommaire */
.side {
  position: sticky; top: 14px; height: calc(100vh - 28px);
  background: var(--panel); border-radius: var(--r-xl); border: 1px solid var(--line-2);
  display: flex; flex-direction: column; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 16px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--red); display: grid; place-items: center; color: #fff; font-size: 20px; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: -4px; border: 1px dashed var(--red-line); border-radius: 15px; }
.brand b { display: block; font-weight: 600; font-size: 17px; letter-spacing: -.01em; line-height: 1.3; }
.brand .mono { color: var(--muted); }
.brand .side-close { margin-left: auto; }

.overview { margin: 0 16px 14px; padding: 16px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line-2); }
.ov-top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.ov-top .mono { color: var(--muted); }
.ov-top strong { font-size: 28px; font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.ov-top strong small { font-size: 14px; color: var(--muted); margin-left: 2px; }
.segs, .seg-lbl { display: grid; gap: 4px; }
.seg { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.seg i { display: block; height: 100%; background: var(--red); transition: width .6s ease; }
.seg-lbl { margin-top: 6px; font: 500 10px var(--mono); color: var(--muted); letter-spacing: .06em; }
.seg-lbl b { color: var(--ink); font-weight: 500; }
.ov-foot { display: flex; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ov-foot div { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.ov-foot i { font-size: 16px; color: var(--red); }
.ov-foot small { display: block; color: var(--muted); font-size: 11px; }

.grades { margin: -4px 16px 14px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line-2); }
.grades-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: var(--r-md); text-align: left; }
.grades-head > .ph-exam { font-size: 16px; color: var(--red); }
.grades-head .mono { color: var(--muted); }
.grades-head .count { margin-left: auto; color: var(--muted); font: 500 11px var(--mono); }
.grades-head .ph-caret-down { color: var(--muted); transition: transform .25s; }
.grades.closed .ph-caret-down { transform: rotate(-90deg); }
.grades-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
.grades.closed .grades-body { grid-template-rows: 0fr; }
.grades-body > div { overflow: hidden; padding: 0 16px; }
.grade { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: 13px; line-height: 1.3; color: var(--ink-2); }
.grade:last-child { margin-bottom: 6px; }
.grade:hover { color: var(--ink); }
.grade .st { font-size: 17px; color: var(--muted); flex: none; }
.grade .lbl { min-width: 0; }
.grade .n { font: 500 11px var(--mono); color: var(--muted); margin-right: 6px; }
.grade small { display: block; color: var(--muted); font-size: 11px; }
.grade .score { margin-left: auto; flex: none; font: 500 12px var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }
.grade .score small { display: inline; color: inherit; opacity: .7; margin-left: 1px; }
.grade .score.wait { background: var(--line-2); color: var(--muted); }
.grade.ok .st { color: var(--ok); }
.grade.mid .st { color: var(--warn); }
.grade.mid .score { background: var(--warn-soft); color: var(--warn); }
.grade.ko .st { color: var(--ko); }
.grade.ko .score { background: var(--red-soft); color: var(--ko); }

.search { margin: 0 16px 8px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--muted); transition: border-color .15s; }
.search:focus-within { border-color: var(--red); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: 400 14px var(--sans); padding: 10px 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.search kbd { font: 500 11px var(--mono); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.toc-scroll { flex: 1; overflow: auto; padding: 8px 10px 16px; }
.home-link { margin: 0 2px 4px; }
.mod { margin-top: 6px; }
.mod-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; color: var(--ink); font: 500 14px var(--sans); cursor: pointer; border-radius: var(--r-sm); text-align: left; }
.mod-head:hover { background: var(--panel-2); }
.mod-head .mono { color: var(--red); font-size: 10px; }
.mod-head .count { margin-left: auto; color: var(--muted); font: 500 11px var(--mono); }
.mod-head .ph-caret-down { color: var(--muted); transition: transform .25s; }
.mod.closed .ph-caret-down { transform: rotate(-90deg); }
.mod-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
.mod.closed .mod-body { grid-template-rows: 0fr; }
.mod-body > div { overflow: hidden; margin-left: 23px; border-left: 1px solid var(--line); }
.les { display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 16px; font-size: 14px; line-height: 1.35; color: var(--ink-2); position: relative; border-radius: 0 var(--r-sm) var(--r-sm) 0; transition: background .15s, color .15s; }
.les:hover { background: var(--panel-2); color: var(--ink); }
.les .n { font: 500 11px var(--mono); color: var(--muted); width: 18px; flex: none; }
.les .st { margin-left: auto; font-size: 16px; color: var(--line); flex: none; }
.les.done .st { color: var(--ok); }
.les.cur { color: var(--red); font-weight: 500; background: var(--red-soft); }
.les.cur::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px; background: var(--red); }
.les.cur .n, .les.cur .st { color: var(--red); }
.les.hidden { display: none; }
.home-link.les { border-radius: var(--r-sm); padding-left: 12px; }
.home-link .st { color: var(--muted); }
.pill { font: 500 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--red-line); color: var(--red); flex: none; }
.no-result { display: none; padding: 12px; color: var(--muted); font-size: 14px; }

.side-foot { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.ava { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--red), #ff7a59); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; text-transform: uppercase; }
.side-foot b { font-weight: 500; font-size: 14px; display: block; line-height: 1.2; }
.side-foot .mono { color: var(--muted); }

.ibtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; font-size: 17px; transition: border-color .15s, color .15s; flex: none; }
.ibtn:hover { border-color: var(--red); color: var(--red); }
.side-foot .ibtn { margin-left: auto; }
.only-mobile { display: none; }

.scrim { position: fixed; inset: 0; background: rgba(8, 9, 12, .4); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 35; }

/* Barre du haut */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 24px; }
.crumb { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumb i { font-size: 12px; }
.crumb b { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar .grow { flex: 1; }

/* --------------------------------------------------------------------------
   En-tête de leçon
   -------------------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); min-height: 340px; }
.hero-txt { padding: 52px 48px 40px; display: flex; flex-direction: column; }
.hero-txt > .mono { color: var(--ink-2); }
.hero h1 { font-size: clamp(38px, 4.6vw, 64px); line-height: 1.02; letter-spacing: -.045em; font-weight: 500; margin: 18px 0 18px; color: var(--ink); text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero .lead { color: var(--ink-2); max-width: 52ch; margin: 0 0 26px; font-size: 17px; }
.cta-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.meta { display: flex; border-top: 1px solid var(--line); margin-top: 32px; }
.meta div { flex: 1; padding: 16px 16px 0 0; margin-right: 16px; border-right: 1px solid var(--line); }
.meta div:last-child { border: 0; margin: 0; }
.meta b { display: block; font-size: 22px; font-weight: 500; letter-spacing: -.03em; white-space: nowrap; }
.meta .mono { color: var(--muted); }
.meta .ok { color: var(--ok); }

/* Panneau « plan technique » */
.bp {
  position: relative; border-left: 1px solid var(--line-2); background-color: var(--panel-2); overflow: hidden;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: -1px -1px;
}
.bp .tag { position: absolute; font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--panel); padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; z-index: 1; }
.bp .big-n { position: absolute; inset: 0; display: grid; place-items: center; font: 500 clamp(140px, 17vw, 240px)/1 var(--sans); letter-spacing: -.08em; color: transparent; -webkit-text-stroke: 1.5px var(--red); opacity: .9; }
.bp .big-n span { position: relative; }
.bp .big-n span::after { content: ""; position: absolute; left: -12%; right: -12%; top: 50%; border-top: 1px dashed var(--red-line); }
.bp .cross { position: absolute; width: 16px; height: 16px; }
.bp .cross::before, .bp .cross::after { content: ""; position: absolute; background: var(--red); }
.bp .cross::before { left: 7px; top: 0; bottom: 0; width: 1.5px; }
.bp .cross::after { top: 7px; left: 0; right: 0; height: 1.5px; }
.bp .dim { position: absolute; left: 15%; right: 15%; top: 18%; border-top: 1px solid var(--muted); opacity: .45; }
.bp .dim::before, .bp .dim::after { content: ""; position: absolute; top: -6px; height: 12px; border-left: 1px solid var(--muted); }
.bp .dim::before { left: 0; }
.bp .dim::after { right: 0; }
.bp img.bp-img { position: absolute; inset: 56px 40px 56px; width: calc(100% - 80px); height: calc(100% - 112px); object-fit: contain; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .18)); border-radius: var(--r-md); }

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 999px; padding: 12px 14px 12px 22px; font: 500 15px var(--sans); cursor: pointer; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap; }
.btn .arr { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); transition: transform .25s; }
.btn:hover .arr { transform: translateX(3px); }
.btn:active { transform: scale(.97); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 8px 24px -12px var(--red); }
.btn-red:hover { background: var(--red-ink); }
.btn-line { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 11px 20px; }
.btn-line:hover { border-color: var(--ink); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; color: var(--red); font-weight: 500; font-size: 15px; }
.link-arrow i { width: 24px; height: 24px; border: 1px solid var(--red-line); border-radius: 50%; display: grid; place-items: center; font-size: 12px; }

/* --------------------------------------------------------------------------
   Contenu de leçon
   -------------------------------------------------------------------------- */
.content { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 48px; padding: 52px 48px; }
.content.single { grid-template-columns: minmax(0, 1fr); }
.prose { max-width: 74ch; min-width: 0; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 18px; }
.prose h1, .prose h2 { color: var(--ink); font-weight: 500; letter-spacing: -.035em; scroll-margin-top: 24px; }
.prose h1 { font-size: 38px; line-height: 1.1; margin: 56px 0 18px; }
.prose h2 { font-size: 30px; line-height: 1.15; margin: 56px 0 16px; padding-top: 22px; border-top: 1px solid var(--line); position: relative; }
.prose h2::before { content: ""; position: absolute; top: -1px; left: 0; width: 40px; height: 2px; background: var(--red); }
.prose h3 { color: var(--ink); font-size: 19px; font-weight: 500; letter-spacing: -.015em; margin: 32px 0 10px; scroll-margin-top: 24px; }
.prose ul, .prose ol { padding-left: 0; margin: 0 0 22px; list-style: none; }
.prose ul > li { position: relative; padding-left: 22px; margin: 6px 0; }
.prose ul > li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 6px; height: 6px; background: var(--red); }
.prose ol { counter-reset: ol; }
.prose ol > li { counter-increment: ol; position: relative; padding-left: 32px; margin: 6px 0; }
.prose ol > li::before { content: counter(ol, decimal-leading-zero); position: absolute; left: 0; top: .2em; font: 500 11px var(--mono); color: var(--red); }
.prose b, .prose strong { color: var(--ink); font-weight: 600; }
.prose a:not(.btn):not(.link-arrow) { color: var(--red); text-decoration: underline; text-decoration-color: var(--red-line); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.prose a:not(.btn):not(.link-arrow):hover { text-decoration-color: var(--red); }
.prose a[download]::before { content: "\2193"; display: inline-block; margin-right: 6px; font: 600 12px var(--mono); }
.prose iframe { display: block; max-width: 100%; margin: 24px auto 8px; border-radius: var(--r-md); border: 0; aspect-ratio: 16 / 9; width: 100%; height: auto; }

/* Tableau d'équivalence à compléter (page 5), réponses enregistrées sur le compte */
.eq { margin: 28px 0 4px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.eq-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.eq-title { display: flex; align-items: center; gap: 8px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.eq-title i { font-size: 16px; color: var(--red); }
.eq-count { padding: 3px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red); font: 500 11px var(--mono); font-variant-numeric: tabular-nums; }
.eq.complete .eq-count { background: var(--ok-soft); color: var(--ok); }
.eq-status { margin-left: auto; display: flex; align-items: center; gap: 6px; font: 500 11px var(--mono); color: var(--muted); }
.eq-status.ok { color: var(--ok); }
.eq-status.ko { color: var(--ko); }
.eq-status.busy i { animation: eq-spin 1s linear infinite; }
@keyframes eq-spin { to { transform: rotate(360deg); } }
.prose .eq-table { margin: 0; border: 0; border-radius: 0; table-layout: fixed; }
.prose .eq-table th:first-child, .prose .eq-table td:first-child { width: 40%; }
.prose .eq-table td { vertical-align: middle; transition: background .2s; }
.prose .eq-table td:first-child { position: relative; padding-left: 36px; }
.eq-table td:first-child::before { content: ""; position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border: 1.5px solid var(--line); border-radius: 50%; transition: background .2s, border-color .2s; }
.eq-table tr.filled td:first-child::before { border-color: var(--ok); background: var(--ok); }
.prose .eq-table td:last-child { padding: 6px 8px; background: var(--code); border-left-color: var(--code-line); border-bottom-color: var(--code-line); }
.eq-table tr:last-child td:last-child { border-bottom: 0; }
.eq-table textarea { display: block; width: 100%; min-height: 36px; resize: none; overflow: hidden; padding: 7px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--code-txt); font: 13.5px/1.55 var(--mono); outline: none; transition: border-color .15s, background .15s; }
.eq-table textarea::placeholder { color: #5f6779; }
.eq-table textarea:hover { background: rgba(255, 255, 255, .03); }
.eq-table textarea:focus { border-color: #ff3d5e; background: var(--code-2); }
@media (max-width: 760px) {
  .prose .eq-table thead { display: none; }
  .prose .eq-table, .prose .eq-table tbody, .prose .eq-table tr, .prose .eq-table td { display: block; width: 100% !important; }
  .prose .eq-table td:first-child { border-bottom: 0; padding-bottom: 6px; }
  .prose .eq-table td:last-child { border-left: 0; }
  .eq-status { margin-left: 0; width: 100%; }
}

/* Vidéo : cadre type lecteur, largeur bornée pour tenir dans la hauteur de l'écran */
.video { width: min(100%, 820px, calc((100vh - 220px) * 16 / 9)); margin: 28px auto 4px; border-radius: var(--r-lg); overflow: hidden; background: var(--code); border: 1px solid var(--code-line); }
.video-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--code-2); border-bottom: 1px solid var(--code-line); color: #8b93a7; font: 500 11.5px var(--mono); }
.video-bar > i { font-size: 18px; color: #ff3d5e; }
.video-out { margin-left: auto; display: flex; align-items: center; gap: 4px; color: #8b93a7; transition: color .2s; }
.video-out:hover { color: #fff; }
.prose .video iframe { margin: 0; border-radius: 0; background: #000; }

code { font: 500 .86em var(--mono); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--red); }

/* Classes historiques des pages de cours */
.imp { color: var(--ink); font-weight: 500; background: linear-gradient(transparent 62%, var(--red-soft) 62%); }
.prose p.imp { background: none; font-weight: 600; margin-top: 26px; }
.color { color: inherit; }
.bold { font-weight: 600; color: var(--ink); }
.white { color: #fff; }
.center { display: block; margin-left: auto; margin-right: auto; }
.text_center { text-align: center; }
.prose img.center, .prose img.image { border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; margin-top: 28px; margin-bottom: 4px; }
.prose img.plain, .prose img.center.plain { border: 0; border-radius: 0; background: none; margin-bottom: 0; }
.prose img.center.plain:first-of-type { margin-top: 28px; }
.prose .caption, .caption { display: block; max-width: 60ch; margin: 10px auto 30px; text-align: center; color: var(--muted); font: 500 11px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.prose .footnote { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; }
.prose p.footnote a.link { color: var(--muted); text-decoration: none; }
a.exponent { color: var(--ink) !important; text-decoration: none !important; font-weight: 500; border-bottom: 1px dashed var(--red); }
sup { font: 500 10px var(--mono); color: var(--red); margin-left: 1px; }
.prose .title_code { display: flex; width: fit-content; align-items: center; gap: 8px; margin: 22px 0 -1px; padding: 8px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--code-2); color: #c9cdd6; font: 500 12.5px var(--mono); }
.title_code::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #a179ff; }

/* « Exemple en langage humain » */
.prose p.link { padding: 16px 20px; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--panel-2); color: var(--ink); }
p.link .bold { display: block; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-bottom: 4px; }

/* À faire / Important */
.prose .todo, .prose .important, .todo, .important {
  position: relative; display: block; padding: 18px 22px 18px 74px; margin: 28px 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--ink-2);
}
.todo::before, .todo::after { content: ""; position: absolute; width: 12px; height: 12px; border: 1.5px solid var(--red); }
.todo::before { top: -7px; left: -7px; border-right: 0; border-bottom: 0; }
.todo::after { bottom: -7px; right: -7px; border-left: 0; border-top: 0; }
.todo-label { display: flex; align-items: center; margin-bottom: 4px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.todo-label i { position: absolute; left: 20px; top: 18px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 20px; }
.important { background: var(--panel-2); }
.important .todo-label { color: var(--ink); }
.important .todo-label i { background: var(--line-2); color: var(--ink); }

/* Encadrés « pour aller plus loin » (ex-annexe) */
.annexe, .deep {
  margin: 36px 0; border-radius: var(--r-xl); background-color: var(--red); color: #fff; overflow: hidden; position: relative;
  background-image: linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px);
  background-size: 32px 32px;
}
.annexe { padding: 26px 28px 10px; }
.annexe h2, .prose .annexe h2 { color: #fff; border: 0; padding: 0; margin: 0 0 14px; font-size: 26px; }
.annexe h2::before { display: none; }
.annexe p, .annexe li { color: rgba(255, 255, 255, .92); }
.annexe ul > li::before { background: #fff; }
.deep header { padding: 26px 28px 14px; }
.deep header .mono { opacity: .75; }
.prose .deep header h3 { margin: 4px 0 0; font-size: 26px; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; color: #fff; }
.deep .body { padding: 0 28px 14px; }
.deep .body p, .deep .body li { color: rgba(255, 255, 255, .92); }
.deep .body b, .deep .body .bold { color: #fff; }
.deep .body ul > li::before { background: #fff; }

/* Tableaux */
.prose table, table.grid { border-collapse: separate; border-spacing: 0; width: 100%; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; font-size: 15px; }
.prose th, .prose td, table.grid th, table.grid td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th, table.grid th { background: var(--panel-2); color: var(--ink); font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.prose tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   Exercices glisser-déposer
   -------------------------------------------------------------------------- */
.algo { margin: 32px 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--panel); padding: 0 22px 22px; }
.algo::before { content: "Exercice · remettez les instructions dans l'ordre"; display: block; margin: 0 -22px 18px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.algo > br { display: none; }
.algo > div[id^="dragndrop"] { counter-reset: slot; display: grid; gap: 8px; }
.drop { counter-increment: slot; display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 48px; border-radius: var(--r-md); transition: background .15s; }
.drop::before { content: counter(slot, decimal-leading-zero); font: 500 11px var(--mono); color: var(--red); text-align: right; }
.drop.over { background: var(--red-soft); }
.drag {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 48px; padding: 11px 16px 11px 40px; position: relative;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); font-size: 15px; line-height: 1.45; cursor: grab;
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.drag::before { content: ""; position: absolute; left: 16px; top: 50%; width: 8px; height: 14px; margin-top: -7px; background-image: radial-gradient(var(--muted) 1.2px, transparent 1.3px); background-size: 4px 4.67px; opacity: .8; }
.drag:hover { border-color: var(--ink-2); box-shadow: 0 6px 18px -12px rgba(0, 0, 0, .35); }
.drag.dragging { opacity: .4; }
.drag:active { cursor: grabbing; }
.drag p { margin: 0; display: inline; }
.drag input, .prose input[type="text"] { font: 500 14px var(--mono); padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--ink); outline: none; transition: border-color .15s; max-width: 100%; }
.drag input:focus, .prose input[type="text"]:focus { border-color: var(--red); }

.execute_button { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 11px 22px; border-radius: 999px; background: var(--red); color: #fff; font: 500 15px var(--sans); cursor: pointer; user-select: none; transition: background .2s, transform .15s; box-shadow: 0 8px 24px -12px var(--red); }
.execute_button:hover { background: var(--red-ink); }
.execute_button:active { transform: scale(.97); }

.console_display, .code {
  margin-top: 16px; border-radius: var(--r-md); background: var(--code); color: var(--code-txt);
  font: 13.5px/1.75 var(--mono); padding: 40px 16px 14px; min-height: 92px; position: relative; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.console_display::before, .code::before { content: "Console"; position: absolute; left: 0; right: 0; top: 0; padding: 7px 16px; background: var(--code-2); color: #8b93a7; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.console_display:empty::after { content: "// La sortie de l'algorithme s'affichera ici"; color: #5f6779; }

/* Schéma « humain → programmation → machine » page 1 */
.lang-chain { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.45fr) auto minmax(0, .85fr); align-items: stretch; gap: 0; margin: 32px 0 4px; padding: 26px 22px 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background-color: var(--panel);
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px); background-size: 24px 24px; }
.lc-step { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lc-head { display: flex; align-items: center; gap: 8px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.lc-head i { font-size: 16px; color: var(--red); }
.lc-num { color: var(--red); }
.lc-card { flex: 1; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.lc-card pre { margin: 0; font: 12px/1.7 var(--mono); white-space: pre; overflow: hidden; }
.lc-human { position: relative; padding: 16px 18px; border-left: 3px solid var(--red); background: var(--panel-2); }
.lc-human p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.lc-code { background: var(--code); border-color: var(--code-line); }
.lc-bar { display: flex; align-items: center; gap: 8px; padding: 7px 14px; background: var(--code-2); color: #8b93a7; font: 500 11px var(--mono); }
.lc-bar::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #a179ff; }
.lc-code pre { padding: 12px 14px; color: var(--code-txt); }
.lc-code .k { color: #ff7088; }
.lc-code .t { color: #8fd6ff; }
.lc-code .s { color: #3ddc97; }
.lc-machine { display: flex; flex-direction: column; background: var(--code); border-color: var(--code-line); }
.lc-asm { padding: 12px 14px 10px; color: var(--code-txt); border-bottom: 1px dashed var(--code-line); }
.lc-bin { flex: 1; padding: 10px 14px 12px; color: #3ddc97; opacity: .55; letter-spacing: .08em; }
.lc-tag { align-self: flex-start; white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red); font: 500 10.5px var(--mono); letter-spacing: .06em; }
.lc-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 26px 8px 0; color: var(--red); }
.lc-arrow i { font-size: 20px; }
.lc-arrow span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) {
  .lang-chain { grid-template-columns: 1fr; padding: 20px 16px; }
  .lc-arrow { flex-direction: row; padding: 12px 0; }
  .lc-arrow i { transform: rotate(90deg); }
}

/* « Hello World » dans six langages, page 1 */
.lx { margin: 30px 0 0; border-radius: var(--r-lg); overflow: hidden; background: var(--code); border: 1px solid var(--code-line); color: var(--code-txt); position: relative; }
.lx-tabs { display: flex; gap: 4px; padding: 8px; background: var(--code-2); border-bottom: 1px solid var(--code-line); overflow-x: auto; scrollbar-width: none; }
.lx-tabs::-webkit-scrollbar { display: none; }
.lx-tab { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 13px; border: 0; border-radius: 8px; background: none; color: #8b93a7; font: 500 12.5px var(--mono); cursor: pointer; transition: background .25s, color .25s; }
.lx-tab i { font-size: 16px; transition: color .25s; }
.lx-tab:hover { color: #e7e9ee; background: rgba(255, 255, 255, .04); }
.lx-tab[aria-selected="true"] { background: var(--code); color: #fff; box-shadow: inset 0 0 0 1px var(--code-line); }
.lx-tab[aria-selected="true"] i { color: #ff3d5e; }
.lx-tab:focus-visible { outline: 2px solid #ff3d5e; outline-offset: -2px; }

.lx-body { display: grid; grid-template-columns: minmax(0, 1fr) 236px; }
.lx-editor { min-width: 0; border-right: 1px solid var(--code-line); }
.lx-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--code-line); color: #8b93a7; font: 500 11.5px var(--mono); }
.lx-dots { display: flex; gap: 6px; }
.lx-dots i { width: 9px; height: 9px; border-radius: 50%; background: #262b38; }
.lx-dots i:first-child { background: #ff3d5e; }

.lx-panels { display: grid; padding: 18px 0 20px; }
.prose .lx-src { grid-area: 1 / 1; margin: 0; padding: 0; background: none; font: 13.5px/1.8 var(--mono); white-space: pre; overflow-x: auto; opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s; counter-reset: lx; scrollbar-width: thin; scrollbar-color: #2b3040 transparent; }
.prose .lx-src.active { opacity: 1; visibility: visible; transition: opacity .35s; }
.lx-src code { display: grid; font: inherit; color: inherit; background: none; border: 0; padding: 0; border-radius: 0; }
.lx-src code > span { display: block; padding-right: 18px; counter-increment: lx; }
.lx-src code > span::before { content: counter(lx); display: inline-block; width: 44px; padding-right: 16px; text-align: right; color: #3d4454; }
.lx-src i { font-style: normal; }
.lx-src .k { color: #ff7ab2; }
.lx-src .t { color: #7cc7ff; }
.lx-src .f { color: #c39bff; }
.lx-src .s { color: #ffc27a; }
.lx-src .n { color: #9df0c0; }
.lx-src .c { color: #5f6779; }
.prose .lx-bf { white-space: pre-wrap; word-break: break-all; }
.lx-bf code > span { padding-left: 44px; text-indent: -44px; }

.lx-side { display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--code-2); }
.lx-label, .lx-stats dt { font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #8b93a7; }
.lx-console { padding: 12px 14px; border-radius: var(--r-sm); background: var(--code); border: 1px solid var(--code-line); }
.lx-out { margin-top: 6px; font: 500 14px var(--mono); color: #3ddc97; white-space: nowrap; }
.lx-prompt { color: #5f6779; }
.lx-hello { display: inline-block; vertical-align: bottom; width: 13ch; overflow: hidden; }
.lx-caret { display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: #3ddc97; animation: lx-blink 1s steps(1) infinite; }
.lx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.lx-stats div { padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--code-line); }
.lx-stats dd { margin: 2px 0 0; font: 500 24px/1.1 var(--sans); letter-spacing: -.03em; color: #fff; font-variant-numeric: tabular-nums; }
.prose .lx-note { margin: 0; font-size: 13.5px; line-height: 1.6; color: #c4c8d2; }

.lx-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.lx-progress i { display: block; height: 100%; width: 0; background: #ff3d5e; }
.lx-progress.run i { animation: lx-progress 6.5s linear forwards; }
.lx:hover .lx-progress i, .lx:focus-within .lx-progress i, .lx.offscreen .lx-progress i { animation-play-state: paused; }

/* Apparition : lignes une à une, puis la sortie console se tape */
.lx.play .lx-src.active code > span { animation: lx-line .5s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * 80ms + 80ms) both; }
.lx.play .lx-note { animation: lx-fade .5s ease both; }
.lx.play .lx-hello { animation: lx-type .7s steps(13) calc(var(--n) * 80ms + 380ms) both; }
@keyframes lx-line { from { opacity: 0; transform: translateX(-8px); } }
@keyframes lx-fade { from { opacity: 0; transform: translateY(4px); } }
@keyframes lx-type { from { width: 0; } }
@keyframes lx-blink { 50% { opacity: 0; } }
@keyframes lx-progress { to { width: 100%; } }

@media (max-width: 760px) {
  .lx-body { grid-template-columns: minmax(0, 1fr); }
  .lx-editor { border-right: 0; border-bottom: 1px solid var(--code-line); }
  .lx-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lx-console, .lx-note { grid-column: 1 / -1; }
  .lx-stats { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .lx.play .lx-src.active code > span, .lx.play .lx-note, .lx.play .lx-hello, .lx-caret { animation: none; }
}

/* Schéma « vie d'une variable en mémoire » page 4 */
.mem { margin: 32px 0 4px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.mem-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mem-tab { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border: 0; border-right: 1px solid var(--line-2); background: none; color: var(--muted); font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; position: relative; transition: color .25s, background .25s; }
.mem-tab:last-child { border-right: 0; }
.mem-tab i { font-size: 16px; }
.mem-tab:hover { color: var(--ink); background: var(--panel-2); }
.mem-tab[aria-selected="true"] { color: var(--ink); }
.mem-tab[aria-selected="true"] i, .mem-tab[aria-selected="true"] .mem-num { color: var(--red); }
.mem-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.mem-tab[aria-selected="true"]::after { transform: scaleX(1); }
.mem-tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.mem-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mem-prog { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-right: 1px solid var(--line-2); }
.mem-code { border-radius: var(--r-md); background: var(--code); border: 1px solid var(--code-line); overflow: hidden; }
.prose .mem-code pre { margin: 0; padding: 12px 0; background: none; font: 12.5px/1.9 var(--mono); color: var(--code-txt); white-space: pre; overflow-x: auto; }
.mem-code code { display: grid; font: inherit; color: inherit; background: none; border: 0; padding: 0; border-radius: 0; counter-reset: mem; }
.mem-code code > span { display: block; padding: 0 16px 0 0; counter-increment: mem; opacity: .4; border-left: 2px solid transparent; transition: opacity .3s, background .3s, border-color .3s; }
.mem-code code > span::before { content: counter(mem); display: inline-block; width: 36px; padding-right: 14px; text-align: right; color: #3d4454; }
.mem-code code > span.on { opacity: 1; background: rgba(255, 61, 94, .1); border-left-color: #ff3d5e; }
.mem-code i { font-style: normal; }
.mem-code .t { color: #7cc7ff; }
.mem-code .f { color: #c39bff; }
.mem-code .s { color: #ffc27a; }

.mem-console { flex: 1; padding: 12px 14px; border-radius: var(--r-md); background: var(--code); border: 1px solid var(--code-line); }
.mem-out { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; min-height: 66px; font: 500 13.5px/1.55 var(--mono); color: var(--code-txt); }
.mem-out > span { opacity: 0; transform: translateY(4px); transition: opacity .3s, transform .3s; }
.mem-out b { font-weight: 500; color: #ffc27a; }
.mem-show { color: #3ddc97; }
.mem[data-step="0"] .mem-out::before { content: "// Rien à afficher pour l'instant"; color: #5f6779; }

.mem-ram { display: flex; flex-direction: column; gap: 16px; padding: 20px; background-color: var(--panel-2);
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px); background-size: 24px 24px; }
.mem-head { display: flex; align-items: center; gap: 8px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.mem-head i { font-size: 16px; color: var(--red); }
.mem-grid { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)); align-items: center; gap: 8px; width: 100%; max-width: 340px; margin: auto; }
.mem-row-label { grid-column: 1; font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; }
.mem-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); transition: border-color .3s, background .3s, box-shadow .3s; }
.mem-cell b { font: 500 14px var(--mono); color: var(--ink); }
.mem-cell small { position: absolute; bottom: 6px; font: 500 10px var(--mono); color: var(--muted); letter-spacing: .04em; }
.mem-cell em { position: absolute; top: -9px; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: var(--panel); font: 500 10.5px var(--mono); font-style: normal; white-space: nowrap; }
.mem-more { border-style: dashed; background: none; }
.mem-more b { color: var(--muted); }
.mem-link { grid-column: 4; justify-self: center; color: var(--muted); font-size: 18px; transition: color .3s; }
.mem-val b { opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }

.mem-cell.hot { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 4px var(--red-line); }
.mem-cell.wait { border: 1px dashed var(--red); }
.mem-link.hot { color: var(--red); }

/* États par étape */
.mem[data-step="1"] .mem-ask, .mem[data-step="2"] .mem-ask, .mem[data-step="3"] .mem-ask,
.mem[data-step="2"] .mem-in, .mem[data-step="3"] .mem-in,
.mem[data-step="3"] .mem-show { opacity: 1; transform: none; }
.mem[data-step="2"] .mem-val b, .mem[data-step="3"] .mem-val b { opacity: 1; transform: none; }

.mem-foot { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); }
.prose .mem-notes { flex: 1; margin: 0; padding: 0; list-style: none; display: grid; }
.prose .mem-notes li { grid-area: 1 / 1; margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
.prose .mem-notes li.on { opacity: 1; visibility: visible; transition: opacity .3s; }
.mem-nav { display: flex; gap: 6px; }
.mem-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); cursor: pointer; transition: border-color .2s, color .2s, opacity .2s; }
.mem-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.mem-btn:disabled { opacity: .35; cursor: default; }
.mem-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

@media (max-width: 760px) {
  .mem-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mem-tab:nth-child(2) { border-right: 0; }
  .mem-tab:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .mem-body { grid-template-columns: minmax(0, 1fr); }
  .mem-prog { border-right: 0; border-bottom: 1px solid var(--line-2); padding: 16px; }
  .mem-ram { padding: 16px; }
  .mem-foot { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mem-out > span, .mem-val b, .mem-cell, .mem-tab::after { transition: none; }
}

/* Trois programmes de calcul page 2 : une couleur et une icône par instruction */
.a3, .a3-res { --op-set: var(--red); --op-mul: #2f6fed; --op-sub: #0f9f6e; --op-div: #9b5de5; }
:root[data-theme="dark"] .a3 { --op-mul: #6ea0ff; --op-sub: #3ddc97; --op-div: #c39bff; }
.a3 { margin: 32px 0 4px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.prose .a3-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.prose .a3-key { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px; margin: 0; padding: 14px 16px; border-right: 1px solid var(--line-2); cursor: default; transition: background .2s; }
.a3-key:last-child { border-right: 0; }
.a3-key i { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--op); background: color-mix(in srgb, var(--op) 14%, transparent); font-size: 14px; }
.prose .a3-key code { padding: 0; border: 0; background: none; color: var(--ink); font: 500 12.5px var(--mono); }
.a3-key span { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.a3-key:hover { background: var(--panel-2); }
[data-op="set"] { --op: var(--op-set); }
[data-op="mul"] { --op: var(--op-mul); }
[data-op="sub"] { --op: var(--op-sub); }
[data-op="div"] { --op: var(--op-div); }

.a3-progs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 22px; background-color: var(--panel-2);
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px); background-size: 24px 24px; }
.prose .a3-prog { position: relative; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.a3-prog::before { content: ""; position: absolute; left: 50%; top: 30px; bottom: 20px; width: 2px; margin-left: -1px; background: var(--line); }
.prose .a3-prog > li, .prose .a3-keys > li { position: relative; margin: 0; counter-increment: none; }
.prose .a3-prog > li { padding-left: 12px; }
.prose .a3-prog > li.a3-head { padding-left: 0; }
.prose .a3-prog > li::before, .prose .a3-keys > li::before { content: none; }
.a3-head { display: flex; align-items: center; justify-content: center; gap: 8px; padding-bottom: 4px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.a3-num { color: var(--red); font: 500 10.5px var(--mono); letter-spacing: .12em; }
.a3-step { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--op); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); font: 500 13.5px var(--mono); transition: opacity .25s, box-shadow .25s, transform .25s; }
.a3-step i { color: var(--op); font-size: 14px; }
.a3-end { align-self: center; padding: 6px 16px; border: 1px dashed var(--ink-2); border-radius: 999px; background: var(--panel); color: var(--ink); font: 500 13px var(--mono); }

/* Survol d'une instruction de la légende : on la retrouve dans les trois programmes */
.a3:has(.a3-key:hover) .a3-step { opacity: .35; }
.a3:has(.a3-key[data-op="set"]:hover) .a3-step[data-op="set"],
.a3:has(.a3-key[data-op="mul"]:hover) .a3-step[data-op="mul"],
.a3:has(.a3-key[data-op="sub"]:hover) .a3-step[data-op="sub"],
.a3:has(.a3-key[data-op="div"]:hover) .a3-step[data-op="div"] { opacity: 1; transform: translateX(3px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--op) 22%, transparent); }

/* Résultats à compléter page 2 */
.a3-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 28px 0 0; }
.a3-ans { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); cursor: text; transition: border-color .2s, background .2s, box-shadow .2s; }
.a3-n { font: 500 14px var(--mono); color: var(--ink); white-space: nowrap; }
.prose .a3-ans input[type="text"] { flex: 1; min-width: 0; width: 100%; text-align: center; font-size: 15px; }
.a3-ans > i { display: none; font-size: 16px; }
.a3-ans.good { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.a3-ans.good .a3-ok { display: block; color: var(--ok); }
.a3-ans.bad { border-color: var(--ko); background: var(--red-soft); }
.a3-ans.bad .a3-ko { display: block; color: var(--ko); }

@media (max-width: 760px) {
  .prose .a3-keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a3-key:nth-child(2) { border-right: 0; }
  .a3-key:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
  .a3-progs { padding: 16px 12px; gap: 8px; }
  .a3-step { padding: 8px; gap: 6px; font-size: 12px; }
  .a3-step i { display: none; }
  .a3-res { grid-template-columns: minmax(0, 1fr); }
}

/* Variante quatre étapes page 2 : humain → algorithme sur la 1re ligne, programmation → machine sur la 2de */
.lang-chain.lc-algo-chain { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); row-gap: 6px; }
.lc-turn { grid-column: 1 / -1; flex-direction: row; gap: 10px; padding: 8px 0; }
.lc-turn .lc-straight { display: none; }
.lc-focus .lc-card { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-line); }
.lc-algo { padding: 14px 16px; background: var(--panel); }
.prose .lc-algo ol { margin: 0; font: 500 13.5px/1.6 var(--mono); color: var(--ink); }
.prose .lc-algo ol > li { margin: 0; }
.lc-focus .lc-tag { background: var(--red); color: #fff; }
@media (max-width: 760px) {
  .lang-chain.lc-algo-chain { grid-template-columns: 1fr; }
  .lc-turn .lc-elbow { display: none; }
  .lc-turn .lc-straight { display: block; }
}

.algo-nested { margin-left: auto; margin-right: auto; }

/* --------------------------------------------------------------------------
   Éditeur de code (CodeMirror 5, thème monokai réécrit)
   -------------------------------------------------------------------------- */
.ide { border-radius: var(--r-xl); overflow: hidden; background: var(--code); margin: 28px 0 36px; border: 1px solid var(--code-line); }
.ide-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--code-2); border-bottom: 1px solid var(--code-line); flex-wrap: wrap; }
.ide .tab { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; background: var(--code); color: #e7e9ee; font: 500 12.5px var(--mono); }
.ide .tab i { color: #a179ff; }
.ide-title { color: #8b93a7; font-size: 13.5px; }
.ide .sc { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #8b93a7; font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.ring { --p: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--red) calc(var(--p) * 1%), #262b38 0); transition: background .6s; }
.ring span { width: 32px; height: 32px; border-radius: 50%; background: var(--code-2); display: grid; place-items: center; color: #e7e9ee; font: 600 10px var(--mono); letter-spacing: 0; }
.ring.full { background: conic-gradient(#3ddc97 100%, #262b38 0); }
.ide .code { margin: 0; border-radius: 0; border-top: 1px solid var(--code-line); min-height: 110px; max-height: 420px; }
.ide .code::before { content: "Sortie"; }
.ide .code .ok { color: #3ddc97; }
.ide .code .ko { color: #ff6b84; }
.ide-foot { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-top: 1px solid var(--code-line); background: var(--code-2); color: #8b93a7; flex-wrap: wrap; }
.ide-foot .btn-red { padding: 9px 12px 9px 18px; font-size: 14px; box-shadow: none; }
.ide-foot .btn-red .arr { width: 24px; height: 24px; }
.ide-foot .hint { margin-left: auto; }
.ide-foot kbd { font: 500 10px var(--mono); border: 1px solid #2b3040; border-radius: 5px; padding: 1px 5px; color: #c9cdd6; }

.CodeMirror { font: 13.5px/1.7 var(--mono); height: auto; }
.copy-btn { position: absolute; top: 10px; right: 12px; z-index: 10; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--code-line); border-radius: 8px; background: var(--code-2); color: #8b93a7; font: 500 11.5px var(--mono); cursor: pointer; opacity: .75; transition: opacity .2s, color .2s, border-color .2s; }
.copy-btn i { font-size: 14px; }
.CodeMirror:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: #fff; border-color: #3d4454; }
.copy-btn.done { color: #3ddc97; border-color: rgba(61, 220, 151, .4); opacity: 1; }
.copy-btn:focus-visible { outline: 2px solid #ff3d5e; outline-offset: 2px; }
.prose .CodeMirror { border-radius: 0 var(--r-md) var(--r-md) var(--r-md); margin-bottom: 8px; }
.ide .CodeMirror { border-radius: 0; margin: 0; }
.cm-s-monokai.CodeMirror { background: var(--code); color: var(--code-txt); }
.cm-s-monokai .CodeMirror-gutters { background: var(--code); border-right: 1px solid var(--code-line); }
.cm-s-monokai .CodeMirror-linenumber { color: #3d4454; }
.cm-s-monokai .CodeMirror-cursor { border-left-color: #fff; }
.cm-s-monokai div.CodeMirror-selected { background: #263052; }
.cm-s-monokai .CodeMirror-activeline-background { background: rgba(255, 255, 255, .035); }
.cm-s-monokai span.cm-keyword { color: #ff7ab2; }
.cm-s-monokai span.cm-type, .cm-s-monokai span.cm-variable-3 { color: #7cc7ff; }
.cm-s-monokai span.cm-def { color: #c39bff; }
.cm-s-monokai span.cm-string { color: #ffc27a; }
.cm-s-monokai span.cm-number, .cm-s-monokai span.cm-atom { color: #9df0c0; }
.cm-s-monokai span.cm-comment { color: #5f6779; font-style: italic; }
.cm-s-monokai span.cm-variable { color: #e7e9ee; }
.cm-s-monokai span.cm-operator { color: #c9cdd6; }
.cm-s-monokai span.cm-meta { color: #c39bff; }
.cm-s-monokai .CodeMirror-matchingbracket { color: #fff !important; text-decoration: none; background: #2b3a5c; }

/* --------------------------------------------------------------------------
   Sommaire de droite, fin de leçon, pagination
   -------------------------------------------------------------------------- */
.aside { position: sticky; top: 28px; align-self: start; }
.aside > .mono { color: var(--muted); display: block; margin-bottom: 12px; }
.aside a { display: flex; gap: 10px; padding: 6px 0; color: var(--muted); font-size: 14px; line-height: 1.4; transition: color .15s; }
.aside a .mono { font-size: 10px; padding-top: 3px; flex: none; }
.aside a.sub { padding-left: 28px; font-size: 13px; }
.aside a.on, .aside a:hover { color: var(--ink); }
.aside a.on .mono { color: var(--red); }
.aside-status { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.aside-status b { font-size: 28px; font-weight: 500; letter-spacing: -.04em; display: block; line-height: 1.1; }
.aside-status span { color: var(--muted); font-size: 13px; }
.aside-status .bar { height: 6px; border-radius: 6px; background: var(--line-2); margin-top: 8px; overflow: hidden; }
.aside-status .bar i { display: block; height: 100%; background: var(--red); border-radius: 6px; }

.finish { display: flex; align-items: center; gap: 22px; padding: 26px 30px; background: var(--ink); color: var(--panel); border-radius: var(--r-xl); position: relative; overflow: hidden; }
.finish::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(127, 127, 127, .22) 1px, transparent 1px); background-size: 14px 14px; pointer-events: none; }
.finish > * { position: relative; }
.finish .mono { opacity: .6; }
.finish h3 { margin: 2px 0 0; font-weight: 500; font-size: 24px; letter-spacing: -.03em; line-height: 1.2; }
.finish p { margin: 2px 0 0; opacity: .6; font-size: 14px; }
.finish form, .finish > .btn { margin-left: auto; }
.finish .done-mark { width: 48px; height: 48px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 22px; flex: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pg { display: flex; align-items: center; gap: 18px; padding: 22px 26px; transition: border-color .2s; min-width: 0; }
.pg:hover { border-color: var(--red); }
.pg .circ { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; flex: none; transition: background .2s, color .2s, border-color .2s; }
.pg:hover .circ { background: var(--red); border-color: var(--red); color: #fff; }
.pg .mono { color: var(--muted); display: block; }
.pg b { font-weight: 500; font-size: 18px; letter-spacing: -.02em; line-height: 1.3; display: block; }
.pg.next { justify-content: flex-end; text-align: right; grid-column: 2; }

/* --------------------------------------------------------------------------
   Accueil : plan du cours
   -------------------------------------------------------------------------- */
.modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 24px 0 8px; }
.module-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 20px 12px; background: var(--panel); display: flex; flex-direction: column; }
.module-card .mono { color: var(--red); }
.module-card h3 { margin: 6px 0 12px !important; font-size: 18px !important; line-height: 1.25; }
.module-card .les { padding-left: 4px; margin: 0 -8px; border-radius: var(--r-sm); }
.module-card .bar { height: 4px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-top: auto; }
.module-card .bar i { display: block; height: 100%; background: var(--red); }
.module-card .foot { display: flex; justify-content: space-between; color: var(--muted); padding: 14px 0 4px; }
.prose .modules ul, .prose .module-card ul { margin: 0 0 14px; }
.prose .module-card ul > li { padding: 0; margin: 0; }
.prose .module-card ul > li::before { display: none; }
.prose .module-card a { text-decoration: none; color: inherit; }

/* --------------------------------------------------------------------------
   Messages flash, notifications
   -------------------------------------------------------------------------- */
.alert { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); font-size: 15px; }
.alert i { font-size: 20px; color: var(--red); }
.alert-success i { color: var(--ok); }

.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 12px; min-width: 260px; max-width: 380px; background: var(--ink); color: var(--panel); border-radius: var(--r-lg); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .5); transform: translateY(20px); opacity: 0; transition: transform .4s cubic-bezier(.2, .9, .2, 1.15), opacity .3s; }
.toast.show { transform: none; opacity: 1; }
.toast .ic { width: 38px; height: 38px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; }
.toast.success .ic { background: var(--ok); }
.toast b { display: block; font-weight: 500; font-size: 14px; line-height: 1.3; }
.toast span { opacity: .6; font-size: 13px; }

/* --------------------------------------------------------------------------
   Connexion
   -------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 14px; }
.auth-art { border-radius: var(--r-xl); padding: 40px; display: flex; flex-direction: column; color: #fff; position: relative; overflow: hidden; background-color: var(--red);
  background-image: linear-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px); background-size: 40px 40px; }
.auth-art .brand { padding: 0; }
.auth-art .brand-mark { background: #fff; color: var(--red); }
.auth-art .brand-mark::after { border-color: rgba(255, 255, 255, .5); }
.auth-art .brand .mono { color: rgba(255, 255, 255, .7); }
.auth-art h1 { margin: auto 0 18px; font-size: clamp(40px, 5vw, 68px); line-height: 1; letter-spacing: -.045em; font-weight: 500; }
.auth-art p { margin: 0; max-width: 42ch; opacity: .85; }
.auth-art .specs { display: flex; gap: 0; margin-top: 32px; border-top: 1px solid rgba(255, 255, 255, .35); }
.auth-art .specs div { flex: 1; padding: 14px 14px 0 0; }
.auth-art .specs b { display: block; font-size: 22px; font-weight: 500; }
.auth-art .specs .mono { opacity: .7; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 34px; letter-spacing: -.035em; font-weight: 500; margin: 12px 0 6px; }
.auth-form .sub { color: var(--muted); margin: 0 0 28px; }
.field { display: block; margin-bottom: 14px; }
.field .mono { display: block; color: var(--muted); margin-bottom: 6px; }
.field .inp { display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.field .inp:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.field .inp i { color: var(--muted); font-size: 18px; }
.field input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--ink); font: 400 15px var(--sans); padding: 13px 0; }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; margin: 6px 0 24px; cursor: pointer; }
.check input { accent-color: var(--red); width: 16px; height: 16px; }
.auth-form .btn { width: 100%; justify-content: space-between; }
.auth-form .alert { margin-bottom: 20px; }
.auth-form .back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); margin-top: 22px; font-size: 14px; }
.auth-form .back:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Tableau des notes
   -------------------------------------------------------------------------- */
.grades-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); max-height: 70vh; }
.grades-wrap table.grid { margin: 0; border: 0; border-radius: 0; font: 500 13px var(--mono); }
.grades-wrap th { position: sticky; top: 0; z-index: 1; text-align: center; white-space: nowrap; }
.grades-wrap tr + tr th { top: 41px; }
.grades-wrap td { text-align: center; white-space: nowrap; }
.grades-wrap td:first-child { text-align: left; font-family: var(--sans); font-size: 14px; position: sticky; left: 0; background: var(--panel); }
.grades-wrap .dark-color { background: var(--panel-2); }
.grades-wrap .light-color { background: var(--panel); }
.grades-wrap tbody tr:hover td { background: var(--red-soft); }
.grades-wrap .total { color: var(--red); font-weight: 600; }
.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 10px 0 0 !important; }
.page-head .btn { margin-left: auto; }

/* Connexion : lien mot de passe oublié, encart première connexion */
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 24px; }
.auth-row .check { margin: 0; }
.link-muted { color: var(--muted); font-size: 14px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link-muted:hover { color: var(--red); text-decoration-color: var(--red); }
.first-login { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); color: var(--ink-2); font-size: 14px; line-height: 1.4; transition: border-color .15s; }
.first-login:hover { border-color: var(--red); }
.first-login b { color: var(--ink); font-weight: 500; }
.first-login > i:first-child { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 18px; flex: none; }
.first-login > i:last-child { color: var(--muted); margin-left: auto; }
.auth-form .form { width: 100%; max-width: 380px; }
.auth-form .form .alert { margin-bottom: 18px; }
.auth-form .form .btn-line { width: 100%; justify-content: center; }

/* Espace enseignant : liste des étudiants */
.admin-count { color: var(--muted); margin-left: auto; }
.admin-add { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); margin-bottom: 24px; }
.admin-add textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); font: 400 14px var(--mono); padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.admin-add textarea:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.admin-add-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-add-foot .check { margin: 0; }
.admin-search { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.admin-search .field { flex: 1; max-width: 420px; margin: 0; }
.admin-search input::-webkit-search-cancel-button { cursor: pointer; }
.admin-list td, .admin-list td:first-child { text-align: left; vertical-align: middle; }
.admin-list .status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.admin-list .status.ok { color: var(--ok); }
.admin-actions { display: flex; gap: 8px; justify-content: flex-end; }
.admin-actions form { margin: 0; }
.admin-actions .ibtn { width: 32px; height: 32px; font-size: 15px; }
.admin-reset { margin-top: 32px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.admin-reset summary { display: flex; align-items: center; gap: 10px; padding: 14px 20px; cursor: pointer; color: var(--muted); font-size: 15px; list-style: none; }
.admin-reset summary::-webkit-details-marker { display: none; }
.admin-reset summary i { font-size: 18px; color: var(--red); }
.admin-reset[open] summary { color: var(--ink); border-bottom: 1px solid var(--line); }
.admin-reset form { padding: 16px 20px 20px; }
.admin-reset p { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.admin-reset-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-reset-foot .field { flex: 1; min-width: 220px; max-width: 360px; margin: 0; }

/* --------------------------------------------------------------------------
   Énoncé du projet (templates/projet.html, static/js/projet.js)
   -------------------------------------------------------------------------- */
.pj { counter-reset: part; }
.pj > h2 { counter-increment: part; }
.pj > h2::after { content: "Partie " counter(part, decimal-leading-zero); position: absolute; right: 0; top: 30px; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pj .lbl { display: block; font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Niveau d'exemple dessiné dans le bandeau */
.bp .pj-art { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font: 500 clamp(22px, 2.6vw, 34px)/1.25 var(--mono); letter-spacing: .3em; color: var(--muted); }
.pj-art b { color: var(--red); font-weight: 600; }
.pj-art i { font-style: normal; color: var(--ok); font-weight: 600; }

/* Sommaire en tête d'énoncé */
.pj-summary { margin-bottom: 8px; scroll-margin-top: 24px; }
.pj-summary > .mono { color: var(--muted); display: block; margin-bottom: 12px; }
.prose .pj-summary ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; counter-reset: none; }
.prose .pj-summary li { padding: 0; margin: 0; }
.prose .pj-summary li::before { display: none; }
.prose .pj-summary a { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; column-gap: 12px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink-2); text-decoration: none; transition: border-color .2s, background .2s, transform .2s; }
.prose .pj-summary a:hover { border-color: var(--red); background: var(--panel-2); transform: translateY(-1px); }
.pj-summary .pj-sn { font: 500 11px var(--mono); color: var(--red); }
.pj-summary a > i { font-size: 20px; color: var(--ink); }
.pj-summary a b { font-weight: 500; color: var(--ink); line-height: 1.3; }
.pj-summary a > span:last-child { grid-column: 3; font-size: 13px; line-height: 1.45; color: var(--muted); }

/* Cartes (particularités, rôles) */
.pj-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 24px; }
.pj-roles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pj-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.pj-card i { width: 36px; height: 36px; margin-bottom: 8px; border-radius: 10px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 18px; }
.pj-card b { color: var(--ink); font-weight: 500; line-height: 1.3; }
.pj-card span { font-size: 14px; line-height: 1.5; color: var(--ink-2); }

/* Symboles du donjon */
.prose .pj-symbols td:first-child { width: 110px; }
.pj-sym { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--code); color: var(--code-txt); font: 600 15px var(--mono); }
.pj-sym.hero { color: #7cc7ff; }
.pj-sym.exit { color: #3ddc97; }
.pj-sym.mob { color: #ff3d5e; }

/* Niveau jouable */
.dj { margin: 24px 0 8px; border-radius: var(--r-lg); overflow: hidden; background: var(--code); border: 1px solid var(--code-line); color: var(--code-txt); outline: none; }
.dj:focus-visible { box-shadow: 0 0 0 3px var(--red-line); }
.dj .lbl { color: #8b93a7; margin-bottom: 8px; }
.dj-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; background: var(--code-2); border-bottom: 1px solid var(--code-line); color: #8b93a7; font: 500 11.5px var(--mono); }
.dj-bar > i { font-size: 18px; color: #ff3d5e; }
.dj-mode { padding: 2px 8px; border-radius: 6px; background: rgba(255, 61, 94, .14); color: #ff7088; }
.dj-restart { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--code-line); border-radius: 999px; background: none; color: #c4c8d2; font: 500 11.5px var(--mono); cursor: pointer; transition: border-color .2s, color .2s; }
.dj-restart:hover { border-color: #ff3d5e; color: #fff; }
.dj-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); }
.dj-stage { display: flex; flex-direction: column; gap: 18px; padding: 22px; border-right: 1px solid var(--code-line); }
.dj-grid { display: grid; gap: 3px; width: 100%; max-width: 360px; margin: 0 auto; }
.dj-grid span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 5px; font: 600 15px var(--mono); transition: background .2s, color .2s; }
.dj-grid .wall { background: #1d212c; color: #3d4454; }
.dj-grid .floor { background: #151821; color: #3d4454; }
.dj-grid .hero { background: rgba(124, 199, 255, .16); color: #7cc7ff; box-shadow: inset 0 0 0 1px rgba(124, 199, 255, .5); }
.dj-grid .hero.fight { background: rgba(255, 61, 94, .2); color: #ff7088; box-shadow: inset 0 0 0 1px #ff3d5e; animation: dj-pulse 1s ease-in-out infinite; }
.dj-grid .mob { background: rgba(255, 61, 94, .1); color: #ff3d5e; }
.dj-grid .exit { background: rgba(61, 220, 151, .12); color: #3ddc97; }
@keyframes dj-pulse { 50% { box-shadow: inset 0 0 0 1px #ff3d5e, 0 0 0 4px rgba(255, 61, 94, .2); } }
.dj-hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dj-hud div { padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--code-line); }
.dj-hud .lbl { margin-bottom: 2px; }
.dj-hud b { font: 500 18px/1.2 var(--sans); color: #fff; letter-spacing: -.02em; }
.dj-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dj button[data-in] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--code-line); border-radius: 10px; background: var(--code-2); color: #e7e9ee; font: 500 14px var(--sans); cursor: pointer; transition: border-color .15s, background .15s; }
.dj button[data-in]:hover { border-color: #ff3d5e; background: rgba(255, 61, 94, .08); }
.dj button[data-in]:active { transform: scale(.97); }
.dj kbd { font: 500 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid #2b3040; color: #8b93a7; }
.dj-pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 44px); gap: 6px; }
.dj-pad .up { grid-area: 1 / 2; }
.dj-pad .left { grid-area: 2 / 1; }
.dj-pad .down { grid-area: 2 / 2; }
.dj-pad .right { grid-area: 2 / 3; }
.dj .dj-pad button[data-in] { padding: 0; gap: 6px; }
.dj-side { display: flex; flex-direction: column; padding: 18px; background: var(--code-2); min-height: 0; }
.dj-console { flex: 1; min-height: 200px; max-height: 300px; overflow: auto; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--code); border: 1px solid var(--code-line); font: 12.5px/1.65 var(--mono); scrollbar-width: thin; scrollbar-color: #2b3040 transparent; }
.dj-console .in { color: #ffc27a; }
.dj-console .muted { color: #5f6779; }
.dj-console .warn { color: #ff7088; }
.dj-console .fin { margin-top: 6px; color: #3ddc97; font-weight: 600; }
.dj-inputs { display: flex; flex-wrap: wrap; gap: 4px; min-height: 30px; }
.dj-inputs:empty::after { content: "// aucune saisie"; color: #5f6779; font: 12px var(--mono); }
.dj-inputs span { min-width: 24px; padding: 2px 7px; border-radius: 6px; background: var(--code); border: 1px solid var(--code-line); color: #ffc27a; font: 500 12px var(--mono); text-align: center; }

/* Contrat technique */
.pj-rules { display: grid; gap: 10px; margin: 20px 0 28px; }
.pj-rule { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.pj-rn { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font: 500 11px var(--mono); }
.pj-rule b { color: var(--ink); font-weight: 500; }
.prose .pj-rule p, .prose .pj-rule ul { margin: 2px 0 0; }
.prose .pj-rule ul > li { margin: 2px 0; }

/* Fichiers d'exemple */
.pj-file-pair { display: grid; grid-template-columns: minmax(0, .6fr) minmax(0, 1.4fr); gap: 10px; margin: 18px 0 24px; }
.pj-file { margin: 18px 0 24px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel-2); }
.pj-file-pair .pj-file { margin: 0; }
.pj-file-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); font: 500 11.5px var(--mono); color: var(--muted); }
.pj-file-bar i { font-size: 15px; color: var(--red); }
.pj-file pre { margin: 0; padding: 14px 16px; font: 13px/1.7 var(--mono); color: var(--ink); white-space: pre; overflow-x: auto; }
.pj-file .c { color: var(--muted); }
.pj-file.dark { background: var(--code); border-color: var(--code-line); }
.pj-file.dark .pj-file-bar { background: var(--code-2); border-color: var(--code-line); color: #8b93a7; }
.pj-file.dark pre { color: var(--code-txt); }
.pj-file.dark .c { color: #5f6779; }
.pj-file.dark .ok { color: #3ddc97; }

/* Frise des jalons */
.jl { margin: 24px 0 8px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; scroll-margin-top: 24px; }
.jl-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--panel-2); position: relative; }
.jl-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 14px 12px; border: 0; border-right: 1px solid var(--line-2); background: none; color: var(--muted); text-align: left; cursor: pointer; position: relative; transition: background .2s, color .2s; min-width: 0; }
.jl-tab:last-child { border-right: 0; }
.jl-tab:hover { background: var(--panel); color: var(--ink); }
.jl-tab[aria-selected="true"] { background: var(--panel); color: var(--ink); }
.jl-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.jl-tab[aria-selected="true"]::after { transform: scaleX(1); }
.jl-tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.jl-code { font: 600 13px var(--mono); color: var(--red); }
.jl-t { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.jl-when { font: 500 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.jl-dot { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 10px; color: transparent; transition: background .2s, border-color .2s, color .2s; }
.jl-tab.done .jl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.jl-panel { padding: 24px 26px 22px; }
.jl-head { display: flex; align-items: center; gap: 14px; }
.jl-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 22px; flex: none; }
.jl-head .mono { color: var(--muted); }
.prose .jl-head h3 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.jl-pts { margin-left: auto; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--red-line); color: var(--red); font: 500 11px var(--mono); white-space: nowrap; }
.prose .jl-goal { margin: 16px 0 20px; color: var(--ink); font-size: 16.5px; }
.jl-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.jl-cols .lbl { margin-bottom: 10px; }
.prose .jl-cols ol { margin-bottom: 12px; }
.prose .jl-note { display: flex; gap: 10px; margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--panel-2); font-size: 14px; line-height: 1.55; }
.jl-note i { color: var(--red); font-size: 17px; margin-top: 2px; flex: none; }
.jl-deliver { padding: 16px; border-radius: var(--r-md); border: 1px dashed var(--line); align-self: start; }
.jl-count { float: right; color: var(--red); font-weight: 500; }
.jl-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 14.5px; line-height: 1.45; cursor: pointer; }
.jl-item input { position: absolute; opacity: 0; pointer-events: none; }
.jl-item .box { width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; font-size: 11px; flex: none; transition: background .15s, border-color .15s, color .15s; }
.jl-item:hover .box { border-color: var(--red); }
.jl-item input:checked + .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.jl-item input:checked ~ span:last-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.jl-item input:focus-visible + .box { outline: 2px solid var(--red); outline-offset: 2px; }
.jl-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.jl-nav .btn-red { margin-left: auto; }
.jl-nav .btn-line { gap: 8px; }
.jl:not(.js) .jl-tabs, .jl:not(.js) .jl-nav { display: none; }
.jl:not(.js) .jl-panel + .jl-panel { border-top: 1px solid var(--line); }

/* Répartition des points et grille d'auto-évaluation */
.ev-split { margin: 20px 0 28px; }
.ev-bar { display: flex; gap: 3px; height: 14px; }
.ev-bar span { border-radius: 4px; background: var(--red); }
.ev-bar span:nth-child(2) { opacity: .75; }
.ev-bar span:nth-child(3) { opacity: .55; }
.ev-bar span:nth-child(4) { opacity: .4; }
.ev-bar span.ind { opacity: 1; background: var(--ink); }
.prose .ev-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 18px; margin: 14px 0 0; }
.prose .ev-legend li { padding: 0; margin: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); font-size: 14px; line-height: 1.35; color: var(--ink); }
.prose .ev-legend li::before { display: none; }
.ev-legend b { grid-row: span 2; font: 500 20px/1.1 var(--sans); letter-spacing: -.03em; color: var(--red); }
.ev-legend li.ind b { color: var(--ink); }
.ev-legend span { font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.ev { margin: 18px 0 8px; display: grid; gap: 14px; }
.ev-part { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.ev-part-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.ev-part-head b { color: var(--ink); font-weight: 500; }
.ev-tag { padding: 2px 8px; border-radius: 6px; background: var(--red-soft); color: var(--red); font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.ev-tag.ind { background: var(--ink); color: var(--panel); }
.ev-sum { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }
.ev-crit + .ev-crit { border-top: 1px solid var(--line-2); }
.ev-crit summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; color: var(--ink); transition: background .15s; }
.ev-crit summary::-webkit-details-marker { display: none; }
.ev-crit summary:hover { background: var(--panel-2); }
.ev-crit summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.ev-title { flex: 1; min-width: 0; font-size: 15px; line-height: 1.4; }
.ev-score { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }
.ev-score b { font-weight: 600; color: var(--ink); }
.ev-crit.rated .ev-score b { color: var(--ok); }
.ev-crit summary .ph-caret-down { color: var(--muted); transition: transform .25s; }
.ev-crit[open] summary .ph-caret-down { transform: rotate(180deg); }
.ev-levels { display: grid; gap: 6px; padding: 2px 18px 16px; }
.ev-lvl { display: grid; grid-template-columns: 34px 64px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.ev-lvl:hover { border-color: var(--line); background: var(--panel-2); }
.ev-lvl input { position: absolute; opacity: 0; pointer-events: none; }
.ev-lvl:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.ev-lvl:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.ev-pts { font: 600 15px var(--mono); color: var(--ink); text-align: center; }
.ev-meter { height: 5px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.ev-meter i { display: block; height: 100%; background: var(--red); border-radius: 5px; }
.ev-desc { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ev-total { position: sticky; bottom: 14px; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 22px; border-radius: var(--r-lg); background: var(--ink); color: var(--panel); box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .5); }
.ev-total > div { display: flex; align-items: baseline; gap: 6px; padding-right: 18px; margin-right: 8px; border-right: 1px solid rgba(127, 127, 127, .35); }
.ev-total .lbl { color: inherit; opacity: .6; margin-right: 4px; }
.ev-total b { font: 500 24px/1 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ev-total small { opacity: .6; font-size: 13px; }
.ev-total .ev-all { border: 0; }
.ev-total .ev-all b { color: var(--red); }
.ev-total .ev-reset { margin-left: auto; color: inherit; border-color: rgba(127, 127, 127, .45); gap: 8px; padding: 8px 16px; font-size: 14px; }
.ev-total .ev-reset:hover { border-color: currentColor; }

@media (max-width: 980px) {
  .pj-cards, .pj-roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dj-body { grid-template-columns: minmax(0, 1fr); }
  .dj-stage { border-right: 0; border-bottom: 1px solid var(--code-line); }
  .jl-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jl-tab:nth-child(3) { border-right: 0; }
  .jl-tab:nth-child(-n+3) { border-bottom: 1px solid var(--line-2); }
  .jl-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .pj > h2::after { display: none; }
  .prose .pj-summary ol, .pj-cards, .pj-roles, .pj-file-pair { grid-template-columns: minmax(0, 1fr); }
  .jl-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jl-tab:nth-child(3) { border-right: 1px solid var(--line-2); }
  .jl-tab:nth-child(even) { border-right: 0; }
  .jl-tab:nth-child(-n+4) { border-bottom: 1px solid var(--line-2); }
  .jl-panel { padding: 20px 18px; }
  .jl-pts { display: none; }
  .ev-lvl { grid-template-columns: 34px minmax(0, 1fr); }
  .ev-meter { display: none; }
  .ev-total { flex-wrap: wrap; padding: 12px 14px; }
  .ev-total > div { padding-right: 10px; margin-right: 0; }
  .ev-total .ev-reset { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dj-grid .hero.fight { animation: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1240px) {
  .content { grid-template-columns: minmax(0, 1fr); }
  .aside { display: none; }
  .modules { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .side { position: fixed; z-index: 40; top: 10px; left: 10px; bottom: 10px; height: auto; width: min(316px, calc(100% - 20px)); transform: translateX(calc(-100% - 20px)); transition: transform .35s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35); }
  body.side-open .side { transform: none; }
  body.side-open .scrim { opacity: 1; pointer-events: auto; }
  .only-mobile { display: grid; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .bp { min-height: 220px; border-left: 0; border-top: 1px solid var(--line-2); }
  .hero-txt, .content { padding: 32px 22px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pg.next { grid-column: auto; }
  .finish { flex-direction: column; align-items: flex-start; }
  .finish form, .finish > .btn { margin-left: 0; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 300px; }
}
@media (max-width: 600px) {
  .crumb > span, .crumb > i { display: none; }
  .meta b { font-size: 17px; white-space: normal; }
  .meta div { min-width: 0; padding-right: 10px; margin-right: 10px; }
  .meta .mono { font-size: 9.5px; letter-spacing: .08em; }
  .ide-foot .hint { display: none; }
  .todo, .important { padding: 70px 18px 16px; }
  .todo-label i { top: 16px; left: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
