/* =========================================================================
   C# Academy — feuille de style
   Thèmes clair/sombre via [data-theme], variables CSS, aucune dépendance.
   ========================================================================= */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 256px;
  --ce-lh: 21px;
  --ce-pad: 12px;
}
[data-theme="light"] {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f3f4f8; --border: #e4e6ef; --border-strong: #d2d5e1;
  --text: #171a26; --text-2: #3d4255; --muted: #6b7086;
  --primary: #6d28d9; --primary-2: #7c3aed; --primary-soft: #f1ebff; --on-primary: #ffffff;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff4e0; --ko: #c2410c; --ko-soft: #fdeee6;
  --info: #1d4ed8; --info-soft: #e8efff; --quant: #0f766e; --quant-soft: #e3f6f3;
  --code-bg: #f7f7fb; --console-bg: #0f1220; --console-text: #e6e8f0;
  --shadow: 0 1px 2px rgba(20, 23, 40, .04), 0 2px 8px rgba(20, 23, 40, .05);
  --tk-kw: #7c3aed; --tk-type: #0369a1; --tk-str: #b45309; --tk-num: #0f766e; --tk-com: #8a8fa5; --tk-fn: #1d4ed8; --tk-cls: #047857;
}
[data-theme="dark"] {
  --bg: #0d0f16; --surface: #151824; --surface-2: #1b1f2e; --border: #262b3d; --border-strong: #343a50;
  --text: #e7e9f2; --text-2: #c3c7d6; --muted: #8f95ac;
  --primary: #a78bfa; --primary-2: #8b5cf6; --primary-soft: #241c3d; --on-primary: #0d0f16;
  --ok: #4ade80; --ok-soft: #12291c; --warn: #fbbf24; --warn-soft: #2d2410; --ko: #fb923c; --ko-soft: #2f1a10;
  --info: #93b4ff; --info-soft: #172241; --quant: #5eead4; --quant-soft: #10292a;
  --code-bg: #10131d; --console-bg: #090b12; --console-text: #e6e8f0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --tk-kw: #c4a5ff; --tk-type: #7dd3fc; --tk-str: #fdba74; --tk-num: #5eead4; --tk-com: #6b7290; --tk-fn: #93b4ff; --tk-cls: #6ee7b7;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code, kbd, pre { font-family: var(--mono); }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .85em; background: var(--surface); }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.icon-xl { width: 48px; height: 48px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mt { margin-top: .75rem; } .mt-lg { margin-top: 1.75rem; }
.row { display: flex; align-items: center; } .gap { gap: .5rem; } .wrap { flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.grow { flex: 1; } .spacer { flex: 1; }
.stack > * + * { margin-top: 1.25rem; }
.prewrap { white-space: pre-wrap; }
.ok-text { color: var(--ok); } .ko-text { color: var(--ko); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- mise en page */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1rem .75rem; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .25rem .5rem 1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.brand strong { display: block; font-size: 1rem; } .brand small { display: block; color: var(--muted); font-size: .75rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: .93rem; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
.mini-progress { font-size: .82rem; margin-bottom: .75rem; padding: 0 .3rem; }
.theme-toggle { width: 100%; justify-content: flex-start; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); } .crumbs span:last-child { color: var(--text); font-weight: 500; }
.topbar-right { margin-left: auto; }
.menu-btn { display: none; }
.content { padding: 1.75rem 2rem 4rem; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 1.5rem; }
.lead { font-size: 1.05rem; color: var(--text-2); max-width: 75ch; }
.section-title { margin: 2rem 0 1rem; display: flex; align-items: center; gap: .5rem; }

/* ------------------------------------------------------------- composants */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); }
a.card { color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.card:hover { text-decoration: none; border-color: var(--primary); }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }

.btn { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid transparent; border-radius: var(--radius-sm); padding: .55rem 1rem; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; line-height: 1.2; color: var(--text); background: transparent; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .84rem; }
.btn-lg { padding: .75rem 1.25rem; font-size: 1rem; }
.btn-icon { padding: .45rem; }
.input { width: 100%; font: inherit; font-size: .93rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); border-color: var(--primary); }
textarea.input { resize: vertical; line-height: 1.5; }
.mono { font-family: var(--mono); font-size: .9rem; }
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin: .6rem 0 .3rem; }
select.input { width: auto; }

.badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }
.badge-accent { background: var(--primary); color: var(--on-primary); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; padding: .2rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .35rem; }
.tag { font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 6px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tag-accent { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.tag-link:hover { text-decoration: none; border-color: var(--primary); }
.tag-level-facile { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-level-intermediaire { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag-level-difficile { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-level-expert { background: var(--ko-soft); color: var(--ko); border-color: transparent; }

.status { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status .icon { width: 13px; height: 13px; }
.status-not_started { background: var(--surface-2); color: var(--muted); }
.status-in_progress { background: var(--info-soft); color: var(--info); }
.status-a_reviser { background: var(--warn-soft); color: var(--warn); }
.status-compris { background: var(--ok-soft); color: var(--ok); }
.status-maitrise { background: var(--primary-soft); color: var(--primary); }
.status-planned, .status-locked { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-strong); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: .4rem 0; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 999px; }
.bar-sm { height: 6px; }

.callout { border-radius: var(--radius-sm); padding: .85rem 1rem; border: 1px solid var(--border); background: var(--surface-2); }
.callout > :last-child { margin-bottom: 0; }
.callout-info { background: var(--info-soft); border-color: transparent; }
.callout-warn { background: var(--warn-soft); border-color: transparent; }
.callout-goal { background: var(--primary-soft); border-color: transparent; }
.callout-key { background: var(--ok-soft); border-color: transparent; }
.callout-quant { background: var(--quant-soft); border-color: transparent; }
.callout.small { margin-top: .75rem; }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.plain-list li:last-child { border-bottom: 0; }
.checklist { list-style: none; padding: 0; margin: 0 0 .5rem; font-size: .86rem; }
.checklist li { padding: .2rem 0 .2rem 1.5rem; position: relative; color: var(--text-2); }
.checklist li::before { content: ""; position: absolute; left: 0; top: .45rem; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-strong); }
.checklist li.done { color: var(--ok); }
.checklist li.done::before { background: var(--ok); border-color: var(--ok); }

.table-wrap { overflow-x: auto; }
.table, .prose table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td, .prose th, .prose td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th, .prose th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); }
.ex-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 1rem; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 150%); background: var(--text); color: var(--bg); padding: .7rem 1.1rem; border-radius: 10px; font-weight: 500; z-index: 100; transition: transform .25s; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: #b91c1c; color: #fff; }

.empty { text-align: center; padding: 3rem 1.5rem; max-width: 640px; margin: 2rem auto; }
.empty-inline { padding: 1.5rem; }

/* ------------------------------------------------------------- accueil & tableau de bord */
.hero { display: flex; justify-content: space-between; gap: 2rem; align-items: center; margin-bottom: 1.5rem; background: linear-gradient(120deg, var(--primary-soft), var(--surface) 70%); }
.hero h1 { font-size: 1.9rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.hero-stat { text-align: center; flex-shrink: 0; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; margin: 0 auto .4rem; }
.ring span { width: 94px; height: 94px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; }
.ring small { font-size: .9rem; }
.essential h3 { display: flex; align-items: center; gap: .55rem; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-size: .8rem; font-weight: 800; flex-shrink: 0; }
.essential.highlight { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.how summary { cursor: pointer; }
.stats .stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.stat-value small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.module-progress { list-style: none; padding: 0; margin: 0; }
.module-progress li { padding: .45rem 0; }
.module-progress li.is-locked a { color: var(--muted); }
.histo { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: .5rem; }
.histo-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.histo-bar { width: 100%; min-height: 2px; background: var(--primary); border-radius: 4px 4px 0 0; opacity: .85; }
.histo-col small { font-size: .7rem; color: var(--muted); }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }

/* ------------------------------------------------------------- roadmap & modules */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 58px; margin-bottom: 1rem; }
.timeline-dot { position: absolute; left: 0; top: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); }
.timeline-item.is-current .timeline-dot { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.timeline-item.is-done .timeline-dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.timeline-item.is-locked .timeline-card { opacity: .8; }
.timeline-progress { min-width: 180px; }
.timeline-card details summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; }
.module-card h3 { margin-top: .6rem; }
.module-card.is-locked, .project-card.is-locked { opacity: .65; }
.module-card.is-done { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.module-num { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.module-card-foot { margin-top: .75rem; }
.project-card.is-planned { opacity: .6; border-style: dashed; }
.project-card h3 { margin-top: .6rem; }
.lesson-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.lesson-row { display: flex; align-items: center; gap: .85rem; padding: .65rem .2rem; border-bottom: 1px solid var(--border); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-num { font-family: var(--mono); font-size: .82rem; color: var(--muted); min-width: 2.6rem; }
.lesson-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lesson-title { font-weight: 600; color: var(--text); }
a.lesson-title:hover { color: var(--primary); }
.lesson-row.is-locked .lesson-title { color: var(--muted); font-weight: 500; }
.lesson-list.compact .lesson-row { padding: .4rem .2rem; }

/* ------------------------------------------------------------- leçon */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; }
.lesson { min-width: 0; max-width: 860px; }
.lesson-head { margin-bottom: 1.5rem; }
.lesson-head h1 { display: flex; align-items: flex-start; gap: .6rem; }
.lesson-section { margin: 2.25rem 0; }
.lesson-section > h2 { display: flex; align-items: center; gap: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.sec-num { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-size: .82rem; font-weight: 800; flex-shrink: 0; }
.sec-num.big { width: 34px; height: 34px; font-size: .95rem; margin-top: 3px; }
.sec-num .icon { width: 16px; height: 16px; }
.lesson-aside .sticky { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; }
.toc { padding-left: 1.2rem; margin: 0; font-size: .87rem; }
.toc li { padding: .1rem 0; }
.toc a { color: var(--text-2); }
.read-done { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-color: var(--primary); }
.read-done p { margin: 0; }
.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.note-field span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.note-field:last-child { grid-column: 1 / -1; }
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }

/* Contenu Markdown */
.prose { color: var(--text); }
.prose > :last-child { margin-bottom: 0; }
.prose h3 { margin-top: 1.4rem; }
.prose h4 { margin-top: 1.1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 .9em; }
.prose li { margin: .25rem 0; }
.prose code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em; font-size: .88em; }
.prose pre code, .hl code { background: none; border: 0; padding: 0; }
.prose blockquote { margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { max-width: 100%; }
.prose .admonition { padding: .75rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0; background: var(--surface-2); border-left: 4px solid var(--muted); }
.prose .admonition-title { font-weight: 700; margin-bottom: .3rem; }
.prose .admonition.tip { background: var(--ok-soft); border-color: var(--ok); }
.prose .admonition.warning { background: var(--warn-soft); border-color: var(--warn); }
.prose .admonition.danger { background: var(--ko-soft); border-color: var(--ko); }
.prose .admonition.note { background: var(--info-soft); border-color: var(--info); }
.pitfalls h3 { color: var(--ko); }

/* Code coloré (Pygments) */
.hl, .code-block .hl { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: .9rem 0; overflow-x: auto; }
.hl pre { margin: 0; padding: .9rem 1rem; font-size: .88rem; line-height: 1.6; }
.hl table { border-collapse: collapse; width: auto; margin: 0; }
.hl table td { padding: 0; border: 0; background: none; }
.hl .linenos { user-select: none; color: var(--muted); border-right: 1px solid var(--border); padding-right: 0 !important; }
.hl .linenos pre { padding-right: .7rem; text-align: right; color: var(--muted); }
.hl .linenodiv pre { color: var(--muted); }
.hl td.code { width: 100%; }
.console { background: var(--console-bg); color: var(--console-text); border-radius: var(--radius-sm); padding: .8rem 1rem; margin: .4rem 0 .8rem; font-size: .86rem; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.console-err { color: #fca5a5; }
.console-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: .5rem; }

/* ------------------------------------------------------------- exercices */
.exercise { margin: 1.1rem 0; border-left: 4px solid var(--border-strong); scroll-margin-top: 76px; }
.exercise.level-facile { border-left-color: var(--ok); }
.exercise.level-intermediaire { border-left-color: var(--info); }
.exercise.level-difficile { border-left-color: var(--warn); }
.exercise.level-expert { border-left-color: var(--ko); }
.exercise.targeted { box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.exercise-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.exercise-head h4 { margin: 0 0 .5rem; font-size: 1.02rem; }
.ex-status { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.ex-todo { background: var(--surface-2); color: var(--muted); }
.ex-failed { background: var(--ko-soft); color: var(--ko); }
.ex-success { background: var(--ok-soft); color: var(--ok); }
.ex-success_clean { background: var(--ok); color: #fff; }
.choices { display: flex; flex-direction: column; gap: .45rem; margin: .8rem 0; }
.choice { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--primary); }
.choice input { margin-top: .3rem; accent-color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice .prose p { margin: 0; }
.exercise-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; }
.feedback { display: none; margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--radius-sm); }
.feedback.show { display: block; }
.feedback-ok { background: var(--ok-soft); color: var(--ok); }
.feedback-ko { background: var(--ko-soft); color: var(--ko); }
.hints .hint { margin-top: .7rem; padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.hint .prose p:last-child { margin: 0; }
.solution { margin-top: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-strong); }
.solution h5 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); }
.sol-part { margin-top: .8rem; }
.sol-part > strong { display: block; margin-bottom: .2rem; }
.selfassess { margin-top: .8rem; padding: .8rem; border-radius: var(--radius-sm); background: var(--info-soft); }
.selfassess p { margin-bottom: .5rem; }
.selfassess-inline { display: inline-flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.output { margin-top: .9rem; border-top: 1px dashed var(--border); padding-top: .6rem; }
.run-head { font-weight: 700; margin-bottom: .4rem; }
.run-head.ok { color: var(--ok); } .run-head.ko { color: var(--ko); }
.run-error { padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.diag { font-family: var(--mono); font-size: .83rem; padding: .35rem .6rem; border-radius: 6px; margin: .25rem 0; }
.diag-error { background: var(--ko-soft); color: var(--ko); }
.diag-warning { background: var(--warn-soft); color: var(--warn); }
.diag-pos { font-weight: 700; } .diag-code { opacity: .8; }
.test { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .8rem; margin: .4rem 0; }
.test summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.test-ok summary { color: var(--ok); } .test-ko summary { color: var(--ko); }
.stdin-box { margin-top: .6rem; font-size: .88rem; }
.stdin-box summary { cursor: pointer; color: var(--text-2); }
.stdin-box textarea { margin-top: .4rem; }
.warnings summary { cursor: pointer; font-size: .85rem; color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--muted); gap: .25rem; }
.quiz-num { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-top: 1.5rem; }
.quiz-submit { margin-top: 1.5rem; text-align: center; }

/* Éditeur de code */
.ce { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--code-bg); margin-top: .8rem; overflow: hidden; }
.ce:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ce-scroll { display: flex; max-height: 460px; min-height: 120px; overflow: auto; }
.code-editor.tall .ce-scroll { max-height: 70vh; min-height: 320px; }
.ce-gutter { position: sticky; left: 0; z-index: 2; flex-shrink: 0; padding: var(--ce-pad) 0; background: var(--surface-2); border-right: 1px solid var(--border); text-align: right; user-select: none; min-height: 100%; }
.ce-ln { font-family: var(--mono); font-size: 13px; line-height: var(--ce-lh); height: var(--ce-lh); padding: 0 .6rem 0 .8rem; color: var(--muted); }
.ce-ln-error { background: #dc2626; color: #fff; cursor: help; }
.ce-ln-warning { background: #d97706; color: #fff; cursor: help; }
.ce-body { position: relative; flex: 1; min-width: max-content; }
.ce-hl, .ce-input { font-family: var(--mono); font-size: 14px; line-height: var(--ce-lh); tab-size: 4; padding: var(--ce-pad) 1rem; margin: 0; white-space: pre; letter-spacing: 0; word-spacing: 0; font-variant-ligatures: none; }
.ce-hl { color: var(--text); pointer-events: none; min-width: 100%; min-height: 100%; }
.ce-input { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: 0; background: transparent; color: transparent; caret-color: var(--text); overflow: hidden; z-index: 1; }
.ce-input::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); color: transparent; }
.ce-marks { position: absolute; inset: 0; pointer-events: none; }
.ce-mark { position: absolute; left: 0; right: 0; height: var(--ce-lh); }
.ce-mark-error { background: color-mix(in srgb, #dc2626 16%, transparent); }
.ce-mark-warning { background: color-mix(in srgb, #d97706 12%, transparent); }
.tk-kw { color: var(--tk-kw); font-weight: 600; } .tk-type { color: var(--tk-type); } .tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); } .tk-com { color: var(--tk-com); font-style: italic; } .tk-fn { color: var(--tk-fn); } .tk-cls { color: var(--tk-cls); }

/* ------------------------------------------------------------- séance, révisions, projets, notes */
.session-head { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.session-head > div:first-child { flex: 1; min-width: 260px; }
.session-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.session-step-head { display: flex; align-items: center; gap: 1rem; }
.session-step h3 { margin: 0; }
.session-step p { margin: 0; }
.session-step.is-done { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.step-check { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.session-step.is-done .step-check { background: var(--ok); color: #fff; }
.session-ex { margin-top: .6rem; padding-left: 50px; }
.session-choice { display: flex; flex-direction: column; gap: .75rem; }
.session-choice .btn { align-self: flex-start; margin-top: auto; }
.review-block { margin-bottom: 1.5rem; }
.review-block.review-ok { border-color: var(--ok); }
.review-block.review-ko { border-color: var(--ko); }
.reminder { margin: .5rem 0 1rem; }
.reminder summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.review-finish { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.steps { padding-left: 0; list-style: none; counter-reset: step; }
.steps li { margin: .4rem 0; }
.check-line { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; }
.check-line input { margin-top: .35rem; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.check-line .prose p { margin: 0; }
.check-line:has(input:checked) .prose { color: var(--muted); text-decoration: line-through; }
.note-card { margin-bottom: 1rem; }
.note-card h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: .5rem; }
.search { margin-bottom: 1rem; max-width: 420px; }
.resource h4 { margin: 0; }
.sources li { margin: .35rem 0; }
.danger-zone { border-color: color-mix(in srgb, #dc2626 35%, var(--border)); }
.danger-zone .input { max-width: 180px; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  .lesson-aside { order: -1; }
  .lesson-aside .sticky { position: static; max-height: none; }
  .lesson-aside .toc { columns: 2; }
}
@media (max-width: 980px) {
  .grid-3, .grid-5, .grid-3-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid-3-1 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 1.25rem 1rem 3rem; }
  .topbar { padding: 0 1rem; }
}
@media (max-width: 680px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .hero { flex-direction: column; align-items: flex-start; }
  .notes-grid { grid-template-columns: 1fr; }
  h1, .hero h1 { font-size: 1.5rem; }
  .exercise-actions .spacer { display: none; }
  .ex-table td:nth-child(2), .ex-table th:nth-child(2), .ex-table td:nth-child(4), .ex-table th:nth-child(4) { display: none; }
  .timeline-item { padding-left: 50px; }
}

/* ---------- connexion aux profils ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-box { width: 100%; max-width: 420px; }
.auth-brand { justify-content: center; margin-bottom: 1.25rem; }
.auth-title { font-size: 1.35rem; margin: 0 0 1rem; }
.auth-note { text-align: center; margin-top: 1rem; }
.auth-profils { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.auth-profil { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.auth-profil:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.auth-profil input { accent-color: var(--primary); }
.auth-initiale { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary); }
.auth-reprendre { align-items: flex-start; }
.profil-box { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; font-size: .9rem; }
.profil-box form { margin-left: auto; }
.flash { margin-bottom: 1rem; }
.auth-form { display: grid; gap: .45rem; }
.auth-form .field-label { margin-top: .5rem; }
.auth-form .btn { margin-top: .75rem; justify-content: center; }
