*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 312px;
  --sidebar-bg: #0D1117;
  --sidebar-hover: #1C2432;
  --sidebar-active: #241356;
  --accent: #7C3AED;
  --accent-light: #EDE9FE;
  --accent-mid: #8B5CF6;
  --accent-dark: #5B21B6;
  --bg: #F4F4F9;
  --card-bg: #FFFFFF;
  --card: #FFFFFF;
  --surface: #F3F4F8;
  --text: #111827;
  --text-muted: #6B7280;
  --text-sidebar: #8B949E;
  --text-sidebar-section: #C9D1D9;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --green: #16A34A;
  --amber: #D97706;
  --red: #DC2626;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-md: 0 4px 12px rgba(16,24,40,0.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,0.12);
}

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════ SIDEBAR ══════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
#sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid #1C2432;
  cursor: pointer;
  transition: background 0.15s;
}
#sidebar-header:hover { background: #11161f; }
#sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  color: #fff; letter-spacing: -0.3px; line-height: 1.3;
}
#sidebar-header p {
  font-size: 11px; color: var(--text-sidebar);
  margin-top: 5px; font-family: var(--font-mono);
}
#search-box { padding: 14px 16px; border-bottom: 1px solid #1C2432; position: relative; }
#search-box::before {
  content: "🔍"; position: absolute; left: 26px; top: 50%;
  transform: translateY(-50%); font-size: 11px; opacity: 0.5; pointer-events: none;
}
#search-box input {
  width: 100%; background: #161b22; border: 1px solid #30363d;
  border-radius: 7px; color: #c9d1d9; font-size: 12.5px;
  font-family: var(--font-body); padding: 8px 10px 8px 30px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
#search-box input::placeholder { color: #484f58; }
#nav-tree {
  overflow-y: auto; flex: 1; padding: 8px 0 24px;
  scrollbar-width: thin; scrollbar-color: #30363d transparent;
}
#nav-tree::-webkit-scrollbar { width: 8px; }
#nav-tree::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.nav-theme-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; background: none; border: none; cursor: pointer;
  text-align: left; color: var(--text-sidebar-section);
  font-family: var(--font-display); font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.2px; transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.nav-theme-btn:hover { background: var(--sidebar-hover); color: #fff; }
.nav-theme-btn.active { border-left-color: var(--accent); background: var(--sidebar-active); color: #fff; }
.nav-theme-btn.open .nav-arrow { transform: rotate(90deg); }
.nav-theme-num {
  font-family: var(--font-mono); font-size: 10px; color: var(--accent-mid);
  background: rgba(139,92,246,0.12); width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; flex-shrink: 0;
}
.nav-theme-label { flex: 1; line-height: 1.3; }
.nav-arrow { font-size: 8px; color: var(--text-sidebar); transition: transform 0.2s; flex-shrink: 0; }

.nav-sections, .nav-subsections, .nav-topics { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.nav-sections.open { max-height: 5000px; }
.nav-subsections.open { max-height: 4000px; }
.nav-topics.open { max-height: 3000px; }

.nav-section-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 16px 7px 30px; background: none; border: none; cursor: pointer;
  text-align: left; color: var(--text-sidebar); font-family: var(--font-body);
  font-size: 12px; font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav-section-btn:hover { background: var(--sidebar-hover); color: #e6edf3; }
.nav-section-btn.active { color: var(--accent-mid); font-weight: 600; }
.nav-section-btn.open .nav-arrow { transform: rotate(90deg); }
.nav-section-id { font-family: var(--font-mono); font-size: 10px; color: var(--accent-mid); flex-shrink: 0; }
.nav-section-btn span:nth-child(2), .nav-subsection-btn span:nth-child(2) { flex: 1; line-height: 1.3; }

.nav-subsection-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 16px 6px 44px; background: none; border: none; cursor: pointer;
  text-align: left; color: var(--text-sidebar); font-family: var(--font-body);
  font-size: 11.5px; transition: background 0.15s, color 0.15s;
}
.nav-subsection-btn:hover { background: var(--sidebar-hover); color: #e6edf3; }
.nav-subsection-btn.active { color: var(--accent-mid); font-weight: 600; }
.nav-subsection-btn.open .nav-arrow { transform: rotate(90deg); }

.nav-topic-btn {
  display: block; width: 100%; padding: 5px 16px 5px 58px; background: none;
  border: none; cursor: pointer; text-align: left; color: #6e7681;
  font-family: var(--font-body); font-size: 11px; line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}
.nav-topic-btn:hover { background: var(--sidebar-hover); color: #c9d1d9; }
.nav-topic-btn.active { color: #fff; background: rgba(124,58,237,0.18); font-weight: 500; }

.search-results { padding: 6px 8px 18px; }
.search-result-btn {
  display: block; width: 100%; background: none; border: none; border-radius: 7px;
  cursor: pointer; text-align: left; padding: 9px 10px; color: #c9d1d9;
  font-family: var(--font-body); transition: background 0.15s, color 0.15s;
}
.search-result-btn:hover { background: var(--sidebar-hover); color: #fff; }
.search-result-type {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  color: var(--accent-mid); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.search-result-title { display: block; font-size: 11.5px; line-height: 1.35; }
.search-result-snippet {
  display: block; font-size: 10.5px; line-height: 1.4; color: #8b949e;
  margin-top: 4px; padding-left: 8px; border-left: 2px solid #30363d;
}
.search-result-snippet .sr-in {
  display: block; color: var(--accent-mid); font-weight: 600; margin-bottom: 1px;
}
.search-result-snippet .sr-frag { display: block; }
.search-result-snippet mark {
  background: rgba(124,58,237,0.35); color: #fff; border-radius: 3px; padding: 0 2px;
}

/* ══════════════ MAIN ══════════════ */
#main { flex: 1; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }

#topbar {
  background: rgba(255,255,255,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 0 28px; min-height: 54px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
#breadcrumb { display: flex; align-items: center; gap: 3px; flex: 1; flex-wrap: wrap; padding: 9px 0; }
.bc-item { font-size: 12.5px; white-space: nowrap; }
.bc-link {
  background: none; border: none; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; color: var(--text-muted); font-size: 12.5px; font-family: inherit;
  transition: background 0.12s, color 0.12s; white-space: nowrap; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle;
}
.bc-link:hover { background: var(--accent-light); color: var(--accent-dark); }
.bc-current {
  color: var(--text); font-weight: 600; padding: 4px 8px; max-width: 360px;
  overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; font-size: 12.5px;
}
.bc-sep { color: var(--border-strong); font-size: 13px; user-select: none; }

#content { flex: 1; padding: 38px 44px 80px; max-width: 1080px; width: 100%; margin: 0 auto; }

/* ══════════════ HOME ══════════════ */
.home-hero {
  margin-bottom: 44px; padding: 36px 38px;
  background: linear-gradient(135deg, #1a1040 0%, #2E1065 50%, #4C1D95 100%);
  border-radius: 18px; color: #fff; position: relative; overflow: hidden;
}
.home-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(139,92,246,0.4), transparent 70%); border-radius: 50%;
}
.home-hero-accent {
  display: inline-block; font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em; color: #C4B5FD;
  background: rgba(255,255,255,0.1); padding: 5px 12px; border-radius: 20px; margin-bottom: 16px;
}
.home-hero h2 { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.8px; margin-bottom: 12px; position: relative; }
.home-hero p { font-size: 15px; line-height: 1.6; color: #DDD6FE; max-width: 620px; position: relative; }

.themes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.theme-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative; overflow: hidden;
}
.theme-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent); transform: scaleY(0); transition: transform 0.2s; transform-origin: top;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent-light); }
.theme-card:hover::before { transform: scaleY(1); }
.theme-card-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 500; margin-bottom: 10px; }
.theme-card h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.35; margin-bottom: 14px; letter-spacing: -0.3px; }
.theme-card-meta { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* ══════════════ PAGE HEADER ══════════════ */
.page-header { margin-bottom: 30px; padding-bottom: 22px; border-bottom: 2px solid var(--border); }
.page-id {
  display: inline-block; font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  background: var(--accent-light); padding: 4px 12px; border-radius: 6px; margin-bottom: 14px; font-weight: 500;
}
.page-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.25; margin-bottom: 10px; }
.page-subtitle { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.section-heading {
  font-family: var(--font-display); font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin: 32px 0 16px;
}

/* ══════════════ CHILDREN GRID ══════════════ */
.children-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.child-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 11px;
  padding: 16px 18px; cursor: pointer; transition: transform 0.13s, box-shadow 0.13s, border-color 0.13s;
  display: flex; flex-direction: column; gap: 7px;
}
.child-card:hover { transform: translateX(3px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.child-card-id { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 500; }
.child-card-title { font-size: 13.5px; font-weight: 500; line-height: 1.4; color: var(--text); }
.tag-new {
  display: inline-block; font-family: var(--font-body); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: #fff; background: var(--accent);
  padding: 2px 7px; border-radius: 10px; margin-left: 4px; vertical-align: middle;
}

/* ══════════════ TOPIC EMPTY ══════════════ */
.topic-empty { text-align: center; padding: 60px 20px; background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: 14px; }
.topic-empty-icon { font-size: 44px; margin-bottom: 16px; }
.topic-empty h3 { font-family: var(--font-display); font-size: 19px; margin-bottom: 10px; }
.topic-empty p { color: var(--text-muted); font-size: 14px; max-width: 440px; margin: 0 auto 18px; line-height: 1.6; }
.topic-empty-badge { display: inline-block; font-family: var(--font-mono); font-size: 12px; color: var(--amber); background: #FEF3C7; padding: 6px 14px; border-radius: 20px; }

/* ══════════════ COURSE BODY ══════════════ */
.course-body { font-size: 15px; line-height: 1.7; color: var(--text); }
.course-body > *:first-child { margin-top: 0; }
.course-body p { margin: 14px 0; }
.course-body h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.3px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.course-body h4 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 22px 0 10px; color: var(--accent-dark); }
.course-body ul, .course-body ol { margin: 14px 0 14px 8px; padding-left: 22px; }
.course-body li { margin: 7px 0; line-height: 1.65; }
.course-body strong { font-weight: 600; color: var(--text); }
.course-body code { font-family: var(--font-mono); font-size: 13px; background: var(--accent-light); color: var(--accent-dark); padding: 2px 6px; border-radius: 4px; }

.course-intro { background: linear-gradient(135deg, #F5F3FF, #EDE9FE); border: 1px solid #DDD6FE; border-left: 4px solid var(--accent); border-radius: 10px; padding: 18px 20px; margin-bottom: 24px; }
.course-intro p { margin: 0; font-size: 14.5px; }

.course-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13.5px; background: var(--card-bg); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.course-table thead { background: linear-gradient(135deg, #2E1065, #4C1D95); }
.course-table th { color: #fff; font-family: var(--font-display); font-weight: 600; text-align: left; padding: 11px 14px; font-size: 13px; }
.course-table td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: top; line-height: 1.55; }
.course-table tbody tr:nth-child(even) { background: #FAFAFE; }
.course-table tbody tr:hover { background: var(--accent-light); }

.course-example { background: #1a1040; border-radius: 10px; margin: 18px 0; overflow: hidden; }
.example-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #C4B5FD; padding: 9px 16px; background: rgba(124,58,237,0.2); border-bottom: 1px solid rgba(255,255,255,0.08); }
.course-example p { color: #DDD6FE; padding: 14px 16px; margin: 0; font-size: 13.5px; }
.course-example pre { margin: 0; }
.course-example .course-table { margin: 14px; width: calc(100% - 28px); }

.course-note { background: #FFFBEB; border: 1px solid #FDE68A; border-left: 4px solid var(--amber); border-radius: 10px; padding: 14px 18px; margin: 18px 0; font-size: 14px; line-height: 1.6; }
.course-note ul { margin: 6px 0 0; }

.related-box {
  margin: 24px 0; background: #F8FAFC; border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 10px; overflow: hidden;
}
.related-box-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.related-box-kicker {
  display: block; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--accent); font-weight: 600; margin-bottom: 5px;
}
.related-box h3 {
  margin: 0 0 6px; padding: 0; border: 0; font-family: var(--font-display);
  font-size: 16px; letter-spacing: 0; color: var(--text);
}
.related-box p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.related-list { display: grid; gap: 8px; padding: 12px; }
.related-link {
  display: grid; gap: 4px; width: 100%; border: 1px solid var(--border);
  background: #fff; border-radius: 8px; padding: 12px 13px; text-align: left;
  cursor: pointer; font-family: var(--font-body); transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.related-link:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.related-link-kind {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent); font-weight: 600;
}
.related-link-title { font-size: 13.5px; line-height: 1.4; color: var(--text); font-weight: 600; }
.related-link-note { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }

.course-body pre { background: #0D1117; border-radius: 10px; padding: 16px 18px; overflow-x: auto; margin: 16px 0; border: 1px solid #21262d; }
.course-body pre code { font-family: var(--font-mono); font-size: 12.5px; color: #c9d1d9; background: none; padding: 0; line-height: 1.6; display: block; }

/* ══════════════ FIGURE / SVG ══════════════ */
.course-figure { margin: 22px 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px 14px; box-shadow: var(--shadow-sm); }
.course-figure svg { width: 100%; height: auto; display: block; }
.course-figure figcaption { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-top: 12px; font-style: italic; line-height: 1.5; }

/* ══════════════ OUTILS LATERAUX : QUESTIONS + NOTIONS ══════════════ */
.learning-dock {
  position: fixed; right: 20px; bottom: 22px; top: auto; transform: none; z-index: 85;
  width: auto; pointer-events: none; outline: none;
}
.learning-dock-rail {
  position: static; transform: none;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  background: none; border: none; box-shadow: none; padding: 0; width: auto;
}
.learning-dock-bubble {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; color: #fff; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; cursor: pointer;
  font-family: var(--font-display); font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(17,24,39,0.28);
  transition: box-shadow 0.16s ease, transform 0.16s ease, filter 0.16s ease;
}
.learning-dock-bubble:hover,
.learning-dock-bubble:focus {
  filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 9px 22px rgba(17,24,39,0.34);
}
.learning-dock-bubble .bubble-icon { font-size: 15px; line-height: 1; }
.bubble-questions { background: linear-gradient(160deg, var(--accent), var(--accent-dark)); }
.bubble-sources { background: linear-gradient(160deg, #2563EB, #1E3A8A); }
.learning-dock-panel {
  position: fixed; top: 76px; right: 16px; bottom: 24px; width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 20px 46px rgba(17,24,39,0.22);
  opacity: 0; transform: translateX(calc(100% + 32px)); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.learning-dock.learning-dock-open .learning-dock-panel {
  opacity: 1; transform: translateX(0); pointer-events: auto;
}
.learning-dock.learning-dock-open .learning-dock-rail { opacity: 0; pointer-events: none; }
.learning-dock-head {
  padding: 14px 20px 0; background: #F8FAFC; border-bottom: 1px solid var(--border);
}
.dock-tabs {
  display: flex; gap: 0; margin-top: 12px;
}
.dock-tab-btn {
  flex: 1; padding: 9px 12px; background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-family: var(--font-display); font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: color 0.15s, border-color 0.15s;
}
.dock-tab-btn:hover { color: var(--text); }
.dock-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.learning-dock-kicker {
  display: block; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--accent); font-weight: 600; margin-bottom: 5px;
}
.learning-dock-head h3 {
  font-family: var(--font-display); font-size: 18px; margin: 0 0 6px;
  letter-spacing: 0; color: var(--text);
}
.learning-dock-head p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.learning-dock-close {
  position: absolute; top: 18px; right: 18px; border: none; background: transparent;
  color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px;
}
.learning-dock-close:hover { color: var(--text); }
.learning-dock-body { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 14px; align-content: start; }
.dock-section {
  border: 1px solid var(--border); border-radius: 10px; background: #fff; overflow: hidden;
}
.dock-section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 13px 14px 10px; border-bottom: 1px solid var(--border); background: #FAFAFE;
}
.dock-section-head h4 {
  margin: 0; font-family: var(--font-display); font-size: 15px; color: var(--text);
  letter-spacing: 0;
}
.dock-section-head span {
  font-family: var(--font-mono); color: var(--accent); font-size: 10.5px; white-space: nowrap;
}
.dock-section-intro {
  margin: 0; padding: 11px 14px 0; color: var(--text-muted); font-size: 12.8px; line-height: 1.5;
}
.learning-dock .related-list { padding: 0; }
.learning-dock .related-link { padding: 10px 11px; }
.learning-dock .related-link-note { font-size: 12px; }

/* ── Groupes de sources : comprendre vs utiliser ── */
.sources-group {
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  overflow: hidden; margin-bottom: 14px;
}
.sources-group:last-child { margin-bottom: 0; }
.sources-group-head {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px 10px;
  background: #FAFAFE; border-bottom: 1px solid var(--border);
}
.sources-group-icon { font-size: 16px; line-height: 1; }
.sources-group-title {
  flex: 1; font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text);
}
.sources-group-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 600;
  background: var(--accent-light); padding: 2px 8px; border-radius: 20px;
}
.sources-group-desc {
  margin: 0; padding: 9px 14px 4px; color: var(--text-muted); font-size: 12.5px; line-height: 1.5;
}
.sources-group .related-list { padding: 10px 14px 14px; display: grid; gap: 8px; }
html[data-theme="dark"] .sources-group,
html[data-theme="dark"] .sources-group .related-link { background: var(--card-bg); }
html[data-theme="dark"] .sources-group-head { background: var(--surface); }
.quiz-check-btn {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  border-radius: 7px; padding: 8px 12px; cursor: pointer; font-family: var(--font-body);
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.quiz-check-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.quiz-body { padding: 4px 14px 14px; }
.quiz-question { padding: 14px 0; border-bottom: 1px solid var(--border); }
.quiz-question:first-child { padding-top: 0; }
.quiz-question-title { font-weight: 600; font-size: 14.5px; line-height: 1.5; margin-bottom: 10px; }
.quiz-choices { display: grid; gap: 8px; }
.quiz-choice {
  width: 100%; border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 10px 12px; text-align: left; cursor: pointer; font-family: var(--font-body);
  font-size: 13.5px; line-height: 1.45; color: var(--text);
}
.quiz-choice:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-light); }
.quiz-choice:disabled { cursor: default; }
.quiz-choice.is-correct { border-color: #16A34A; background: #DCFCE7; color: #14532D; }
.quiz-choice.is-wrong { border-color: #DC2626; background: #FEE2E2; color: #7F1D1D; }
.quiz-feedback { margin-top: 9px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.quiz-result { padding-top: 16px; display: grid; gap: 12px; }
.quiz-result-text { display: grid; gap: 8px; font-size: 13.5px; color: var(--text-muted); }
.quiz-topic-links { display: grid; gap: 6px; }
.quiz-topic-links button {
  text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 7px;
  padding: 8px 10px; cursor: pointer; color: var(--accent-dark); font-family: var(--font-body);
}
.quiz-topic-links button:hover { background: var(--accent-light); }

/* ══════════════ PREV / NEXT ══════════════ */
.prev-next-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 14px; margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--border); }
.prev-next-side { display: flex; }
.prev-next-right { justify-content: flex-end; }
.prev-next-btn { display: flex; align-items: center; gap: 14px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; cursor: pointer; font-family: inherit; text-align: left; transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s; width: 100%; max-width: 320px; }
.prev-next-btn:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(124,58,237,0.14); transform: translateY(-2px); }
.next-btn { flex-direction: row; text-align: right; justify-content: flex-end; }
.next-btn .pn-content { align-items: flex-end; }
.pn-arrow { font-size: 20px; color: var(--accent); flex-shrink: 0; line-height: 1; }
.pn-content { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pn-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); font-weight: 600; }
.pn-title { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.pn-counter { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); white-space: nowrap; background: var(--surface); padding: 0 14px; border-radius: 20px; border: 1px solid var(--border); font-family: var(--font-mono); }

/* ══════════════ RESPONSIVE ══════════════ */
#mobile-menu-btn { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); background: var(--card-bg); border-radius: 8px; cursor: pointer; font-size: 16px; flex-shrink: 0; }
@media (max-width: 860px) {
  #sidebar { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); transition: transform 0.25s; box-shadow: var(--shadow-lg); }
  #sidebar.mobile-open { transform: translateX(0); }
  #content { padding: 24px 18px 60px; }
  .home-hero { padding: 26px 22px; }
  .home-hero h2 { font-size: 26px; }
  .learning-dock { left: 0; right: 0; top: auto; bottom: 12px; width: auto; height: auto; transform: none; display: flex; justify-content: center; }
  .learning-dock-rail { flex-direction: row; align-items: center; gap: 10px; }
  .learning-dock-bubble:hover,
  .learning-dock-bubble:focus { transform: none; }
  .learning-dock-panel {
    left: 10px; right: 10px; top: auto; bottom: 64px; width: auto; max-height: 74vh;
    transform: translateY(24px);
  }
  .learning-dock.learning-dock-open .learning-dock-panel { transform: translateY(0); }
  .prev-next-bar { grid-template-columns: 1fr; }
  .prev-next-right { justify-content: flex-start; }
  .pn-counter { order: -1; justify-self: center; padding: 6px 14px; }
  #mobile-menu-btn { display: inline-flex; }
}

/* ══════════════ ACCESSIBILITÉ ══════════════ */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.search-empty { color: var(--text-sidebar); font-size: 12px; padding: 16px; }

/* ══════════════ TOPBAR ACTIONS ══════════════ */
#topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.topbar-btn {
  width: 36px; height: 36px; border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 8px; cursor: pointer; font-size: 15px; display: inline-flex;
  align-items: center; justify-content: center;
}
.topbar-btn:hover, .topbar-btn.active { border-color: var(--accent); background: var(--accent-light); }

/* ══════════════ PROGRESSION ══════════════ */
.progress-block { margin: 0 0 28px; }
.progress-meta {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted);
  margin-bottom: 8px; font-family: var(--font-mono);
}
.progress-track {
  height: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-mid)); border-radius: 999px; }
.theme-card-progress { margin-top: 10px; font-size: 11px; color: var(--accent-dark); font-family: var(--font-mono); }
.tag-read {
  display: inline-block; font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  color: var(--green); background: var(--accent-light); padding: 2px 7px; border-radius: 10px; margin-left: 4px;
}
.nav-topic-btn.is-read { color: #86efac; }

/* ══════════════ FIGURES INLINE ══════════════ */
.course-figure-inline { margin: 12px 0 16px; }
.course-figure-inline svg { width: 100%; max-width: 460px; display: block; }

/* ══════════════ TEACHER MODE ══════════════ */
.teacher-table { margin-bottom: 24px; }
.teacher-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ══════════════ MODE SOMBRE ══════════════ */
html[data-theme="dark"] {
  --bg: #0B1020;
  --card-bg: #121826;
  --card: #121826;
  --surface: #1A2233;
  --text: #E5E7EB;
  --text-muted: #9CA3AF;
  --border: #273244;
  --border-strong: #334155;
  --accent-light: #2E1065;
}
html[data-theme="dark"] #topbar { background: rgba(18,24,38,0.92); }
html[data-theme="dark"] .home-hero { background: linear-gradient(135deg, #120826 0%, #2E1065 50%, #4C1D95 100%); }
html[data-theme="dark"] .dock-section,
html[data-theme="dark"] .child-card,
html[data-theme="dark"] .theme-card,
html[data-theme="dark"] .prev-next-btn,
html[data-theme="dark"] .quiz-choice,
html[data-theme="dark"] .quiz-check-btn { background: var(--card-bg); }
html[data-theme="dark"] .learning-dock-head,
html[data-theme="dark"] .dock-section-head { background: var(--surface); }
html[data-theme="dark"] .dock-tab-btn.active { color: var(--accent-mid); }
html[data-theme="dark"] .quiz-choice.is-correct { background: #14532D; color: #DCFCE7; }
html[data-theme="dark"] .quiz-choice.is-wrong { background: #7F1D1D; color: #FEE2E2; }

/* Encadrés de contenu : fonds clairs codés en dur -> adaptés au mode sombre */
html[data-theme="dark"] .course-intro {
  background: linear-gradient(135deg, #1A1040, #2E1065); border-color: #4C1D95;
}
html[data-theme="dark"] .course-note {
  background: #2A2410; border-color: #4D3F12; color: var(--text);
}
html[data-theme="dark"] .related-box { background: var(--surface); }
html[data-theme="dark"] .related-box-head { border-bottom-color: var(--border); }
html[data-theme="dark"] .related-link,
html[data-theme="dark"] .sources-group,
html[data-theme="dark"] .sources-group .related-link { background: var(--card-bg); }
html[data-theme="dark"] .course-table tbody tr:nth-child(even) { background: #161E2E; }
html[data-theme="dark"] .course-table tbody tr:hover { background: #1F2A3D; }
html[data-theme="dark"] .course-body code { color: #C4B5FD; background: rgba(124,58,237,0.18); }
html[data-theme="dark"] .topic-empty { background: var(--card-bg); }
html[data-theme="dark"] .topic-empty-badge { background: #3A2E0A; }

/* ══════════════ EXERCICES INTERACTIFS ══════════════ */
.ix-card {
  margin: 22px 0; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(135deg, #FBFAFF, #F4F2FE); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .ix-card { background: linear-gradient(135deg, #15182A, #191534); border-color: #2E2A52; }
.ix-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-family: var(--font-display); font-size: 15px; color: var(--text); }
.ix-tag {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #fff; background: var(--accent); padding: 3px 9px; border-radius: 20px; flex-shrink: 0;
}
.ix-accent { color: var(--accent); font-weight: 700; }
.ix-hint { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }

/* Bits cliquables */
.ix-bits { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ix-bit {
  flex: 1 1 0; min-width: 54px; border: 2px solid var(--border-strong); background: var(--card-bg);
  border-radius: 10px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; transition: border-color 0.12s, background 0.12s, transform 0.08s;
  font-family: var(--font-mono);
}
.ix-bit:hover { border-color: var(--accent-mid); transform: translateY(-2px); }
.ix-bit-val { font-size: 11px; color: var(--text-muted); }
.ix-bit-digit { font-size: 22px; font-weight: 700; color: var(--text-muted); line-height: 1; }
.ix-bit.on { border-color: var(--accent); background: var(--accent-light); }
.ix-bit.on .ix-bit-digit { color: var(--accent); }
html[data-theme="dark"] .ix-bit.on .ix-bit-digit { color: #C4B5FD; }

.ix-readout { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--text); align-items: baseline; }
.ix-sum strong { color: var(--accent); font-size: 17px; }
.ix-bin code { font-family: var(--font-mono); font-size: 13px; }
.ix-feedback { margin-top: 12px; font-size: 14px; font-weight: 600; }
.ix-ok { color: var(--green); }
.ix-todo { color: var(--amber); }

/* Champ texte / nombre */
.ix-input, .ix-fields input {
  font-family: var(--font-mono); font-size: 15px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--card-bg); color: var(--text); outline: none;
}
.ix-input { width: 100%; margin-bottom: 14px; }
.ix-input:focus, .ix-fields input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }

/* ASCII */
.ix-ascii-out { display: flex; flex-wrap: wrap; gap: 8px; }
.ix-ascii-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; background: var(--card-bg); min-width: 64px; }
.ix-ascii-char { font-size: 20px; font-weight: 700; color: var(--text); }
.ix-ascii-code { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.ix-ascii-bin { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* RGB */
.ix-rgb { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ix-swatch { width: 96px; height: 96px; border-radius: 14px; border: 1px solid var(--border-strong); flex-shrink: 0; box-shadow: var(--shadow-sm); }
.ix-sliders { flex: 1; min-width: 220px; display: grid; gap: 10px; }
.ix-slider-row { display: grid; grid-template-columns: 24px 1fr 38px auto; align-items: center; gap: 10px; }
.ix-slider-label { font-family: var(--font-display); font-weight: 700; text-align: center; border-radius: 6px; color: #fff; }
.ix-ch-R { background: #EF4444; } .ix-ch-G { background: #22C55E; } .ix-ch-B { background: #3B82F6; }
.ix-slider-row input[type=range] { width: 100%; accent-color: var(--accent); }
.ix-slider-val { font-family: var(--font-mono); font-size: 13px; color: var(--text); text-align: right; }
.ix-slider-bin { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.ix-rgb-out { display: flex; gap: 16px; margin-top: 14px; font-family: var(--font-mono); font-size: 14px; color: var(--text); }
.ix-hex { color: var(--accent); font-weight: 600; }

/* Stockage */
.ix-fields { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.ix-fields label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.ix-fields input { width: 90px; }
.ix-storage-out, .ix-calc-line { font-size: 14px; color: var(--text); line-height: 1.7; }
.ix-empty { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ══════════════ TITRES DE SECTION FUSIONNÉE ══════════════ */
.course-body h2.merged-topic {
  margin: 38px 0 14px;
  padding: 10px 0 8px 16px;
  border-left: 4px solid var(--accent);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.course-body h2.merged-topic:first-child { margin-top: 4px; }

/* ══════════════ QUIZ : types, rechargement, test final ══════════════ */
.quiz-type-tag {
  font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); background: var(--accent-light); padding: 2px 6px; border-radius: 10px;
  vertical-align: middle; white-space: nowrap;
}
.quiz-filter-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px dashed var(--border);
}
.quiz-filter-label { font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.quiz-topic-filter {
  flex: 1; font-family: var(--font-body); font-size: 12.5px; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 9px; cursor: pointer; outline: none;
}
.quiz-topic-filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }

/* ── Boutons génériques des widgets ── */
.ix-btn {
  border: 1px solid var(--accent); background: var(--accent-light); color: var(--accent-dark);
  border-radius: 7px; padding: 7px 14px; cursor: pointer; font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
}
.ix-btn:hover { background: var(--accent); color: #fff; }

/* ── Widget : onde sonore ── */
.ix-wave-svg { width: 100%; height: 150px; background: var(--surface); border-radius: 10px; margin: 4px 0 10px; }
.ix-wave-path { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0.45; }
.ix-wave-stair { fill: none; stroke: var(--accent-dark); stroke-width: 2; }
.ix-wave-dot { fill: var(--accent); stroke: #fff; stroke-width: 1; }
.ix-wave-out { font-size: 13px; margin-top: 8px; }
.ix-wrows { display: grid; gap: 10px; margin-top: 4px; }
.ix-wrow { display: grid; grid-template-columns: 112px 1fr 44px; align-items: center; gap: 12px; }
.ix-wrow label { font-size: 13px; font-weight: 600; color: var(--text); }
.ix-wrow input[type=range] { width: 100%; accent-color: var(--accent); }
.ix-wrow span { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--accent-dark); text-align: right; }

/* ── Tableau dépliable (widget accordion) ── */
.ix-xt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ix-xt thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 6px 10px; border-bottom: 2px solid var(--border-strong); }
.ix-xt-row { cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border); }
.ix-xt-row:hover { background: var(--surface); }
.ix-xt-row.open { background: var(--accent-light); }
.ix-xt-row td { padding: 11px 10px; vertical-align: middle; }
.ix-xt-first { font-weight: 600; color: var(--text); }
.ix-xt-arrow { width: 22px; text-align: center; color: var(--text-muted); font-size: 9px; transition: transform 0.2s; }
.ix-xt-row.open .ix-xt-arrow { transform: rotate(90deg); color: var(--accent); }
.ix-xt-detail > td { padding: 0 12px 16px; background: var(--accent-light); border-bottom: 1px solid var(--border); }
.ix-xt-inner { padding: 8px 4px 2px; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.ix-xt-inner p { margin: 8px 0; }
.ix-xt-schema { width: 100%; max-width: 340px; height: auto; display: block; background: #ffffff; border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; padding: 4px; }

/* ── Widget : décomposition d'un flottant ── */
.ix-fl-field { margin: 4px 0 12px; font-size: 14px; }
.ix-fl-field input { font-family: var(--font-mono); font-size: 15px; padding: 6px 10px; width: 120px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card-bg); color: var(--text); }
.ix-fl-boxes { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.ix-fl-box { border-radius: 10px; padding: 10px; color: #fff; text-align: center; }
.ix-fl-box span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.9; }
.ix-fl-box strong { display: block; font-family: var(--font-mono); font-size: 18px; margin: 4px 0 2px; }
.ix-fl-box em { font-size: 10px; opacity: 0.85; font-style: normal; }
.ix-fl-bsign { background: #DC2626; }
.ix-fl-bmant { background: #7C3AED; }
.ix-fl-bexp { background: #D97706; }
.ix-fl-sci { text-align: center; font-size: 15px; margin: 12px 0; color: var(--text); }
.ix-fl-sci code { font-family: var(--font-mono); background: var(--surface); padding: 2px 6px; border-radius: 5px; }
.ix-fl-slider { background: var(--surface); border-radius: 10px; padding: 12px; margin: 8px 0 14px; }
.ix-fl-slider label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.ix-fl-slider input[type=range] { width: 100%; accent-color: var(--accent); }
.ix-fl-moved { margin-top: 8px; font-size: 14px; color: var(--text); }
.ix-fl-demo:empty { display: none; }
.ix-fl-demo { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--text); background: var(--accent-light); padding: 10px 12px; border-radius: 8px; }
.ix-fl-demo code { font-family: var(--font-mono); }

/* ── Widget : accordéon ── */
.ix-acc { display: grid; gap: 8px; }
.ix-acc-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card-bg); }
.ix-acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: none; border: none; cursor: pointer; text-align: left; font-family: var(--font-body); color: var(--text);
}
.ix-acc-head:hover { background: var(--surface); }
.ix-acc-tagv {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--accent-dark);
  background: var(--accent-light); padding: 2px 7px; border-radius: 20px; flex-shrink: 0; min-width: 52px; text-align: center;
}
.ix-acc-title { font-weight: 600; font-size: 14px; flex: 1; }
.ix-acc-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.ix-acc-arrow { font-size: 9px; color: var(--text-muted); transition: transform 0.2s; }
.ix-acc-item.open .ix-acc-arrow { transform: rotate(90deg); }
.ix-acc-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.ix-acc-item.open .ix-acc-body { max-height: 400px; }
.ix-acc-inner { padding: 2px 14px 14px; font-size: 13.5px; line-height: 1.6; color: var(--text); }

/* ── Widget : flux RAM → CPU ── */
.ix-flow-svg { width: 100%; height: 150px; margin: 4px 0; }
.ix-flow-svg rect { fill: var(--card-bg); stroke: var(--border-strong); stroke-width: 1.5; transition: fill 0.25s, stroke 0.25s; }
.ix-flow-svg text { fill: var(--text); font-size: 12px; font-weight: 600; text-anchor: middle; font-family: var(--font-body); }
.ix-flow-svg .ix-flow-sub { fill: var(--text-muted); font-size: 9px; font-weight: 400; }
.ix-flow-cpu > rect { fill: var(--surface); }
.ix-flow-bus { stroke: var(--border-strong); stroke-width: 3; transition: stroke 0.25s; }
.ix-flow-svg[data-active="fetch"] .ix-flow-ram rect,
.ix-flow-svg[data-active="store"] .ix-flow-ram rect { fill: var(--accent-light); stroke: var(--accent); }
.ix-flow-svg[data-active="fetch"] .ix-flow-bus,
.ix-flow-svg[data-active="store"] .ix-flow-bus { stroke: var(--accent); }
.ix-flow-svg[data-active="decode"] .ix-flow-reg rect { fill: var(--accent-light); stroke: var(--accent); }
.ix-flow-svg[data-active="execute"] .ix-flow-alu rect { fill: var(--accent-light); stroke: var(--accent); }
.ix-flow-bar { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.ix-flow-step { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); padding: 3px 8px; border-radius: 20px; background: var(--surface); }
.ix-flow-step.on { background: var(--accent); color: #fff; }
.ix-flow-desc { font-size: 13.5px; line-height: 1.5; margin-bottom: 10px; min-height: 40px; }

/* ── Widget : saturation mémoire ── */
.ix-mem-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ix-mem-controls label { font-size: 13px; }
.ix-mem-bits { font-family: var(--font-body); padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card-bg); color: var(--text); }
.ix-mem-bar { height: 16px; background: var(--surface); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.ix-mem-fill { height: 100%; background: linear-gradient(90deg, var(--accent-mid), var(--accent)); transition: width 0.2s; }
.ix-mem-read { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.ix-mem-read code { font-family: var(--font-mono); background: var(--surface); padding: 3px 8px; border-radius: 6px; }
.quiz-free-input {
  width: 100%; margin: 4px 0 8px; font-family: var(--font-body); font-size: 13.5px;
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--card-bg); color: var(--text); resize: vertical; outline: none;
}
.quiz-free-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.quiz-free-check {
  border: 1px solid var(--accent); background: var(--accent-light); color: var(--accent-dark);
  border-radius: 7px; padding: 6px 14px; cursor: pointer; font-family: var(--font-body);
  font-size: 12.5px; font-weight: 600;
}
.quiz-free-check:hover:not(:disabled) { background: var(--accent); color: #fff; }
.quiz-free-check:disabled { opacity: 0.55; cursor: default; }
.quiz-feedback.fb-ok { color: var(--green); }
.quiz-feedback.fb-no { color: var(--red); }
.quiz-model { display: block; margin-top: 4px; color: var(--text-muted); font-weight: 500; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.quiz-reload-btn {
  border: 1px dashed var(--border-strong); background: transparent; color: var(--text-muted);
  border-radius: 7px; padding: 8px 12px; cursor: pointer; font-family: var(--font-body);
  font-size: 12.5px; font-weight: 600;
}
.quiz-reload-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

/* Bandeau d'appel vers le test final, sur la page module */
.final-test-cta {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 28px 0 8px;
  padding: 20px 22px; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #2E1065, #5B21B6);
}
.final-test-cta-text { flex: 1; min-width: 220px; }
.final-test-cta-text h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 4px; color: #fff; border: 0; padding: 0; }
.final-test-cta-text p { margin: 0; font-size: 13px; line-height: 1.5; color: #DDD6FE; }
.final-test-cta-btn {
  border: none; background: #fff; color: var(--accent-dark); border-radius: 10px;
  padding: 12px 22px; cursor: pointer; font-family: var(--font-display); font-size: 14px; font-weight: 700;
  flex-shrink: 0; box-shadow: var(--shadow-md);
}
.final-test-cta-btn:hover { transform: translateY(-2px); }

/* Test final plein écran */
.final-test { display: grid; gap: 6px; }
.final-test .quiz-question { padding: 16px 0; border-bottom: 1px solid var(--border); }
.final-test .quiz-question-title { font-size: 15.5px; }
.final-test-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.quiz-back-btn {
  border: 1px solid var(--border-strong); background: var(--card-bg); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
}
.quiz-back-btn:hover { border-color: var(--accent); }
.final-test-result:empty { display: none; }
.final-test-result {
  margin-top: 24px; padding: 22px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--card-bg); text-align: center;
}
.final-score { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--accent); }
.final-score span { font-size: 18px; color: var(--text-muted); }
.final-verdict { font-size: 16px; font-weight: 600; margin: 4px 0 10px; color: var(--text); }
.final-warn { font-size: 13px; color: var(--amber); margin-bottom: 12px; }
.final-review { font-size: 13.5px; color: var(--text-muted); }
.final-review .quiz-topic-links { display: grid; gap: 6px; max-width: 460px; margin: 10px auto 0; }

/* ══════════════ IMPRESSION ══════════════ */
@media print {
  #sidebar, #topbar, .learning-dock, .skip-link, .prev-next-bar { display: none !important; }
  #main, #content { overflow: visible; height: auto; max-width: none; padding: 0; }
  body { overflow: visible; display: block; background: #fff; color: #000; }
  .course-table, .child-card, .theme-card { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; }
}
