/* =========================================================================
   Prépa ISPITS — Palette Ivoire · Sauge · Or
   Design premium, couleurs douces, aucune teinte sombre agressive
   ========================================================================= */

:root {
  /* Palette principale */
  --ivory:         #f7f3ea;   /* fond global */
  --ivory-deep:    #f0e9d8;   /* fond sidebar */
  --ivory-soft:    #fbf8f1;   /* cartes */
  --cream:         #ffffff;   /* surfaces élevées */

  --sage:          #8aa68f;   /* sauge principale */
  --sage-deep:     #6f8b75;   /* sauge foncée */
  --sage-soft:     #c4d4c7;   /* sauge claire */
  --sage-ghost:    #e8efe9;   /* sauge très claire */

  --gold:          #c8a85a;   /* or principal */
  --gold-deep:     #a68839;   /* or foncé */
  --gold-soft:     #e4d4a3;   /* or pâle */

  /* Typographie */
  --ink:           #3d3a33;   /* texte principal (brun doux) */
  --ink-soft:      #6b6659;   /* texte secondaire */
  --ink-mute:      #9a9589;   /* texte atténué */
  --line:          #e6dec9;   /* lignes fines */

  /* Sémantique */
  --success:       #7ba17f;
  --success-bg:    #e6efe7;
  --error:         #c97a6a;
  --error-bg:      #f4e4df;

  /* Typographie */
  --font-display:  "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --font-body:     "Inter", system-ui, -apple-system, sans-serif;

  /* Tailles et rythmes */
  --radius-sm:     10px;
  --radius-md:     16px;
  --radius-lg:     24px;

  --shadow-sm:     0 1px 2px rgba(61, 58, 51, 0.04);
  --shadow-md:     0 4px 14px rgba(61, 58, 51, 0.06);
  --shadow-lg:     0 10px 30px rgba(61, 58, 51, 0.08);

  --sidebar-w:     280px;
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================= RESET & BASE ============================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(138, 166, 143, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(200, 168, 90, 0.04) 0%, transparent 55%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Protection du contenu : empêche la sélection et la copie */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Les champs de saisie (recherche, etc.) restent sélectionnables pour rester utilisables */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================= SIDEBAR ============================= */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--ivory-deep);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  z-index: 100;
  transition: transform 0.35s var(--ease);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px 22px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.logo-mark {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sage-soft), var(--sage));
  color: var(--cream);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.logo-mark svg { width: 26px; height: 26px; }

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.3px;
  line-height: 1.1;
}
.logo-text p {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-deep);
  margin-top: 2px;
  font-weight: 500;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: left;
  transition: all 0.2s var(--ease);
  position: relative;
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--cream);
  color: var(--ink);
}

.nav-item.active {
  background: var(--cream);
  color: var(--sage-deep);
  box-shadow: var(--shadow-sm);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
  transform: translateX(-14px);
}

.sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.source-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--sage-ghost);
}
.source-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--sage-deep);
  font-weight: 600;
}
.source-desc {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}

/* ============================= BOUTON MOBILE ============================= */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--cream);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: 12px;
  flex-direction: column;
  justify-content: space-between;
}
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================= MAIN ============================= */
.main {
  margin-left: var(--sidebar-w);
  padding: 48px 56px 80px;
  min-height: 100vh;
}

.view { display: none; animation: fadeUp 0.45s var(--ease); }
.view.active { display: block; }

/* ============================= LAYOUT 2 VOLETS (browser + content) ============================= */
.view.has-browser {
  display: none;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
  min-height: calc(100vh - 128px);
}

.view.has-browser.active {
  display: grid;
}

/* Volet gauche : browser panel */
.browser-panel {
  position: sticky;
  top: 48px;
  background: var(--ivory-soft);
  border: 1px solid rgba(111, 139, 117, 0.16);
  border-radius: 14px;
  padding: 20px 14px 22px 18px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  box-shadow: 0 1px 2px rgba(90, 80, 50, 0.03);
}

.browser-panel::-webkit-scrollbar {
  width: 6px;
}

.browser-panel::-webkit-scrollbar-track {
  background: transparent;
}

.browser-panel::-webkit-scrollbar-thumb {
  background: rgba(200, 168, 90, 0.25);
  border-radius: 6px;
}

.browser-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 168, 90, 0.5);
}

.browser-header {
  padding: 4px 8px 16px 8px;
  border-bottom: 1px solid rgba(111, 139, 117, 0.15);
  margin-bottom: 14px;
}

.browser-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--sage-deep);
  margin: 0 0 4px 0;
  letter-spacing: 0.3px;
}

.browser-subtitle {
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  color: var(--ink-mute);
  margin: 0;
  letter-spacing: 0.4px;
  font-style: italic;
}

.browser-modules {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Module dépliable */
.br-module {
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  transition: background 0.2s ease;
}

.br-module.open {
  background: rgba(232, 239, 233, 0.55);
}

.br-module-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.br-module-toggle:hover {
  background: rgba(232, 239, 233, 0.7);
}

.br-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-mute);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.br-module.open .br-chevron {
  transform: rotate(90deg);
  color: var(--gold-deep);
}

.br-module-name {
  flex: 1;
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
  line-height: 1.35;
}

.br-module-count {
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-mute);
  background: rgba(200, 168, 90, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.br-module.open .br-module-count {
  background: rgba(200, 168, 90, 0.25);
  color: var(--gold-deep);
}

/* Liste des chapitres */
.br-chapters {
  list-style: none;
  padding: 0 8px 8px 8px;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.br-module.open .br-chapters {
  max-height: 1200px;
  padding-top: 4px;
}

.br-chap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px 9px 30px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
}

.br-chap::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 4px;
  height: 4px;
  background: var(--ink-mute);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
}

.br-chap:hover {
  background: rgba(255, 255, 255, 0.7);
}

.br-chap:hover::before {
  background: var(--gold-deep);
  opacity: 1;
}

.br-chap.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(90, 80, 50, 0.06);
}

.br-chap.active::before {
  background: var(--gold-deep);
  opacity: 1;
  width: 5px;
  height: 5px;
}

.br-chap-num {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold-deep);
  letter-spacing: 0.5px;
  flex-shrink: 0;
  min-width: 18px;
}

.br-chap-title {
  flex: 1;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.br-chap.active .br-chap-title {
  color: var(--sage-deep);
  font-weight: 600;
}

.br-chap-badge {
  font-family: "Inter", sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--sage-deep);
  background: rgba(196, 212, 199, 0.5);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.br-chap.active .br-chap-badge {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

/* Volet droit : content panel */
.content-panel {
  min-width: 0;
}

/* Bouton retour mobile */
.browser-back-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  background: var(--ivory-soft);
  border: 1px solid rgba(111, 139, 117, 0.2);
  border-radius: 8px;
  color: var(--sage-deep);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.browser-back-btn svg {
  width: 16px;
  height: 16px;
}

.browser-back-btn:hover {
  background: var(--sage-ghost);
  border-color: rgba(111, 139, 117, 0.35);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-header {
  max-width: 860px;
  margin-bottom: 44px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 14px;
  padding: 5px 12px;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: rgba(228, 212, 163, 0.15);
}

.view-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 500;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.3px;
  margin-bottom: 14px;
}

.view-subtitle {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 680px;
}

.view-credit {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.2px;
}

.view-credit strong {
  color: var(--sage-700);
  font-weight: 600;
  font-style: normal;
}

.view-credit a {
  color: var(--gold-700);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold-500);
  transition: color 0.2s ease;
}

.view-credit a:hover {
  color: var(--gold-800);
}

/* ============================= HERO (ACCUEIL) ============================= */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
  margin-top: 10px;
}

.hero-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px 24px 24px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
}
.hero-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sage-soft);
}
.hero-card:hover .hero-arrow { transform: translateX(4px); color: var(--gold-deep); }

.hero-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.hero-icon svg { width: 24px; height: 24px; }
.hero-icon[data-tone="sage"]  { background: var(--sage-ghost); color: var(--sage-deep); }
.hero-icon[data-tone="gold"]  { background: rgba(228,212,163,0.25); color: var(--gold-deep); }
.hero-icon[data-tone="ivory"] { background: var(--ivory-deep); color: var(--ink-soft); }

.hero-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}
.hero-card p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.hero-arrow {
  position: absolute;
  right: 22px; bottom: 22px;
  font-size: 20px;
  color: var(--sage);
  transition: all 0.3s var(--ease);
}
.hero-note { background: var(--sage-ghost); border-color: var(--sage-soft); }
.badge-small {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--sage-deep);
  font-weight: 600;
  margin-bottom: 10px;
}
.hero-note em { font-style: italic; color: var(--sage-deep); font-weight: 500; }

/* ============================= LISTES DE COURS / QCM ============================= */
.cours-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.cours-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px 24px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  position: relative;
}
.cours-card:hover {
  border-color: var(--sage-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cours-card .ord {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}
.cours-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.25;
}
.cours-card .sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.cours-card .meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-mute);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.cours-card .meta span b { color: var(--sage-deep); font-weight: 600; }

/* ============================= DÉTAIL DU COURS ============================= */
.cours-detail { max-width: 860px; }
.cours-detail.hidden { display: none; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--line);
  margin-bottom: 24px;
  transition: all 0.2s var(--ease);
}
.back-btn:hover { background: var(--sage-ghost); color: var(--sage-deep); border-color: var(--sage-soft); }

.cours-detail h2 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: 8px;
}
.cours-detail .sub-title {
  font-size: 15px;
  color: var(--gold-deep);
  font-style: italic;
  margin-bottom: 6px;
}
.cours-detail .source {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 24px;
  padding: 8px 12px;
  background: var(--sage-ghost);
  border-radius: 6px;
  display: inline-block;
}

.intro-box {
  background: var(--ivory-soft);
  border-left: 3px solid var(--gold);
  padding: 18px 22px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 32px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
  font-style: italic;
}

.section-block {
  margin-bottom: 32px;
  padding: 24px 26px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.section-block h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-block p {
  margin-bottom: 10px;
  color: var(--ink);
  line-height: 1.75;
}
.section-block p:last-child { margin-bottom: 0; }

/* Schémas */
.schema-box {
  margin-top: 16px;
  padding: 22px;
  background: linear-gradient(135deg, var(--sage-ghost) 0%, var(--ivory-soft) 100%);
  border: 1px dashed var(--sage-soft);
  border-radius: var(--radius-md);
  text-align: center;
}
.schema-box .schema-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 12px;
}
.schema-formule {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  font-style: italic;
  line-height: 1.7;
}
.schema-cycle {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.schema-cycle .step {
  background: var(--cream);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--sage-soft);
  font-size: 13px;
  color: var(--sage-deep);
  font-weight: 500;
}
.schema-cycle .arrow { color: var(--gold); align-self: center; font-size: 14px; }

/* ============================= QCM ============================= */
.qcm-session { max-width: 780px; }
.qcm-session.hidden { display: none; }

.qcm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.qcm-progress-text {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}
.qcm-score {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-deep);
  font-weight: 600;
}

.progress-bar {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 28px;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transition: width 0.4s var(--ease);
  border-radius: 999px;
}

.qcm-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 30px 28px;
  box-shadow: var(--shadow-sm);
}

.qcm-question {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 24px;
  font-weight: 500;
}

.qcm-options { display: flex; flex-direction: column; gap: 10px; }

.qcm-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--ivory-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--ink);
  transition: all 0.2s var(--ease);
  text-align: left;
  width: 100%;
  line-height: 1.5;
}
.qcm-option:hover:not(:disabled) {
  border-color: var(--sage);
  background: var(--sage-ghost);
}
.qcm-option .letter {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.qcm-option.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--ink);
}
.qcm-option.correct .letter { background: var(--success); color: white; border-color: var(--success); }
.qcm-option.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}
.qcm-option.wrong .letter { background: var(--error); color: white; border-color: var(--error); }
.qcm-option:disabled { cursor: default; }

.explication {
  margin-top: 22px;
  padding: 18px 20px;
  background: linear-gradient(to right, var(--sage-ghost), var(--ivory-soft));
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.65;
}
.explication strong { color: var(--sage-deep); font-weight: 600; }

.qcm-nav {
  margin-top: 26px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s var(--ease);
  border: 1px solid transparent;
}
.btn-primary { background: var(--sage-deep); color: var(--cream); }
.btn-primary:hover { background: var(--sage); }
.btn-ghost {
  background: var(--cream);
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--sage); color: var(--sage-deep); }
.btn-gold { background: var(--gold); color: var(--cream); }
.btn-gold:hover { background: var(--gold-deep); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Écran final */
.qcm-end {
  text-align: center;
  padding: 50px 40px;
  background: var(--cream);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.qcm-end .score-big {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--gold-deep);
  font-weight: 500;
  line-height: 1;
}
.qcm-end .score-total { font-size: 20px; color: var(--ink-mute); }
.qcm-end h3 {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink);
  margin: 16px 0 8px;
}
.qcm-end p { color: var(--ink-soft); margin-bottom: 26px; }

/* ============================= JEUX ============================= */
.jeux-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
.jeu-category h3 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--sage-deep);
  margin-bottom: 6px;
}
.jeu-category p.sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 18px;
}
.jeu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.jeu-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
}
.jeu-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-soft);
  box-shadow: var(--shadow-md);
}
.jeu-card h4 {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 6px;
}
.jeu-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.jeu-card .tag {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-deep);
  margin-top: 10px;
}

/* ============================= FICHES ============================= */
.fiches-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 900px;
}
.fiche {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 34px;
  position: relative;
  overflow: hidden;
}
.fiche::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sage), var(--gold));
}
.fiche h3 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 22px;
  font-weight: 600;
}
.fiche-point {
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.fiche-point:last-child { border-bottom: none; }
.fiche-point .pt-title {
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.fiche-point .pt-text {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.7;
}

/* ============================= ISPITS ============================= */
.ispits-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.stat {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  text-align: center;
  transition: all 0.3s var(--ease);
}
.stat:hover { border-color: var(--gold-soft); box-shadow: var(--shadow-md); }
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 44px;
  color: var(--gold-deep);
  font-weight: 500;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-lbl {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  font-weight: 500;
}

.ispits-block { margin-bottom: 36px; }
.block-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--sage-deep);
  margin-bottom: 16px;
  font-weight: 600;
}
.table-wrap {
  overflow-x: auto;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.ispits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.ispits-table thead th {
  background: var(--sage-ghost);
  color: var(--sage-deep);
  font-weight: 600;
  text-align: left;
  padding: 14px 20px;
  font-size: 13px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--sage-soft);
}
.ispits-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.ispits-table tbody tr:last-child td { border-bottom: none; }
.ispits-table tbody tr:hover { background: var(--ivory-soft); }
.ispits-table td b { color: var(--ink); font-weight: 600; }
.ispits-table td em {
  font-style: normal;
  color: var(--ink-mute);
  font-size: 13px;
}
.annexe-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--sage-ghost);
  color: var(--sage-deep);
  border-radius: 999px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
  font-weight: 500;
}
.opt-count {
  display: inline-block;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--cream);
  line-height: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* ============================= UTILITAIRES ============================= */
.hidden { display: none !important; }

/* ============================= PRÉPARATION RAPIDE ============================= */

/* Carte accueil spéciale */
.hero-icon[data-tone="flash"] {
  color: #c8a85a;
  background: linear-gradient(135deg, #f7e8c3 0%, #eed9a0 100%);
}

.hero-card.hero-flash {
  position: relative;
  border: 1px solid rgba(200, 168, 90, 0.35);
  background: linear-gradient(180deg, #fcfaf3 0%, #f9f5e7 100%);
}

.hero-card.hero-flash::after {
  content: "éclair";
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #a88a44;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(200, 168, 90, 0.15);
  border: 1px solid rgba(200, 168, 90, 0.3);
}

/* Bouton sidebar spécial */
.nav-item.nav-flash {
  position: relative;
}

.nav-item.nav-flash svg {
  color: #c8a85a;
}

/* Onglets Glossaire / Synthèse */
.prepa-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 26px;
  border-bottom: 1px solid rgba(139, 152, 133, 0.18);
  padding-bottom: 2px;
}

.prepa-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  border-radius: 6px 6px 0 0;
}

.prepa-tab svg {
  width: 18px;
  height: 18px;
}

.prepa-tab:hover {
  color: var(--sage-700);
  background: rgba(139, 152, 133, 0.06);
}

.prepa-tab.active {
  color: var(--sage-800);
  border-bottom-color: #c8a85a;
  font-weight: 600;
}

.prepa-count {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(200, 168, 90, 0.12);
  color: #a88a44;
  font-weight: 600;
}

/* Panneau */
.prepa-panel {
  display: none;
  animation: fadeUp 0.3s ease;
}

.prepa-panel.active {
  display: block;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Champ de recherche */
.prepa-search-wrap {
  position: relative;
  margin-bottom: 16px;
  max-width: 640px;
}

.prepa-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  opacity: 0.7;
}

.prepa-search {
  width: 100%;
  padding: 13px 44px 13px 44px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #fdfaf2;
  border: 1px solid rgba(139, 152, 133, 0.25);
  border-radius: 10px;
  transition: all 0.2s ease;
  outline: none;
}

.prepa-search::placeholder {
  color: var(--ink-soft);
  opacity: 0.55;
  font-style: italic;
}

.prepa-search:focus {
  border-color: #c8a85a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.12);
}

.prepa-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  background: rgba(139, 152, 133, 0.12);
  color: var(--ink-soft);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

.prepa-search-clear:hover {
  background: rgba(139, 152, 133, 0.2);
  color: var(--ink);
}

.prepa-search-clear.visible {
  display: inline-flex;
}

/* Filtres par catégorie */
.prepa-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.prepa-filter {
  padding: 7px 14px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(139, 152, 133, 0.3);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.prepa-filter:hover {
  background: rgba(139, 152, 133, 0.06);
  color: var(--sage-700);
}

.prepa-filter.active {
  background: var(--sage-700);
  color: #fff;
  border-color: var(--sage-700);
}

/* Liste du glossaire — scrollable */
.prepa-glossary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 420px);
  min-height: 400px;
  overflow-y: auto;
  padding: 4px 18px 30px 4px;
  scroll-behavior: smooth;
}

.prepa-glossary::-webkit-scrollbar {
  width: 8px;
}

.prepa-glossary::-webkit-scrollbar-track {
  background: rgba(139, 152, 133, 0.05);
  border-radius: 8px;
}

.prepa-glossary::-webkit-scrollbar-thumb {
  background: rgba(200, 168, 90, 0.4);
  border-radius: 8px;
}

.prepa-glossary::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 168, 90, 0.6);
}

/* Carte de terme */
.glo-card {
  position: relative;
  padding: 20px 22px 20px 22px;
  background: #fdfbf3;
  border: 1px solid rgba(139, 152, 133, 0.2);
  border-left: 4px solid #c8a85a;
  border-radius: 10px;
  transition: all 0.25s ease;
}

.glo-card:hover {
  border-color: rgba(200, 168, 90, 0.5);
  background: #fffcf1;
  box-shadow: 0 4px 18px rgba(120, 100, 50, 0.08);
}

.glo-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.glo-terme {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--sage-800);
  letter-spacing: 0.2px;
}

.glo-cat {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #a88a44;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(200, 168, 90, 0.1);
  border: 1px solid rgba(200, 168, 90, 0.25);
  white-space: nowrap;
}

.glo-def {
  font-family: "Inter", sans-serif;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 10px;
}

.glo-repere {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
  padding-top: 10px;
  border-top: 1px dashed rgba(139, 152, 133, 0.2);
}

.glo-repere::before {
  content: "💡";
  font-style: normal;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Mise en évidence de la recherche */
.glo-highlight {
  background: rgba(200, 168, 90, 0.25);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
  color: var(--sage-800);
}

.prepa-empty {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  padding: 40px 20px;
}

/* Synthèse */
.prepa-syn-source {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(139, 152, 133, 0.08);
  border-left: 3px solid var(--sage-700);
  border-radius: 6px;
  margin-bottom: 20px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
}

.prepa-syn-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sage-800);
  padding: 3px 10px;
  background: rgba(139, 152, 133, 0.15);
  border-radius: 20px;
  flex-shrink: 0;
}

.prepa-syn-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  padding: 14px 16px;
  background: #fdfaf2;
  border: 1px solid rgba(200, 168, 90, 0.2);
  border-radius: 10px;
}

.prepa-syn-toc-item {
  padding: 8px 14px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prepa-syn-toc-item:hover {
  background: rgba(139, 152, 133, 0.1);
  color: var(--sage-800);
}

.prepa-syn-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.syn-part {
  scroll-margin-top: 20px;
  padding: 26px 28px;
  background: #fdfbf3;
  border: 1px solid rgba(139, 152, 133, 0.18);
  border-radius: 12px;
}

.syn-part-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(200, 168, 90, 0.2);
}

.syn-part-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 42px;
  font-weight: 300;
  color: #c8a85a;
  line-height: 1;
  font-style: italic;
}

.syn-part-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--sage-800);
  flex: 1;
}

.syn-part-intro {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: rgba(200, 168, 90, 0.06);
  border-left: 2px solid rgba(200, 168, 90, 0.4);
  border-radius: 0 6px 6px 0;
}

.syn-section {
  padding: 16px 0;
  border-top: 1px dashed rgba(139, 152, 133, 0.15);
}

.syn-section:first-of-type {
  border-top: none;
}

.syn-section-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--sage-700);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.syn-section-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #c8a85a;
  border-radius: 50%;
  flex-shrink: 0;
}

.syn-section-content {
  font-family: "Inter", sans-serif;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
}

.syn-section-content p {
  margin: 0 0 10px 0;
}

.syn-section-content p:last-child {
  margin-bottom: 0;
}

/* ============================= RESPONSIVE ============================= */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.1); }
  .main { margin-left: 0; padding: 80px 24px 60px; }
  .view-header { margin-bottom: 32px; }
  .hero-grid { grid-template-columns: 1fr; gap: 14px; }
  .cours-list { grid-template-columns: 1fr; }
  .section-block { padding: 20px; }
  .cours-detail h2 { font-size: 30px; }
  .fiche { padding: 24px 22px; }
}

@media (max-width: 500px) {
  .main { padding: 72px 18px 50px; }
  .view-title { font-size: 26px; }
  .qcm-card { padding: 22px 20px; }
  .qcm-question { font-size: 18px; }
  .stat-num { font-size: 34px; }
}

/* Scrollbar discrète */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ivory); }
::-webkit-scrollbar-thumb { background: var(--sage-soft); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--sage); }

/* ============================= MODULES & CHAPITRES ============================= */

/* Cartes de modules (grands titres) */
.module-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  transition: all 0.35s var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
}
.module-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  opacity: 0.9;
}
.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--sage-soft);
}
.module-card[data-tone="gold"]::before {
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
}

.module-icon {
  width: 58px; height: 58px;
  border-radius: 14px;
  background: var(--sage-ghost);
  color: var(--sage-deep);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}
.module-card[data-tone="gold"] .module-icon {
  background: rgba(228,212,163,0.35);
  color: var(--gold-deep);
}
.module-icon svg { width: 30px; height: 30px; }

.module-card h3 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.15;
  letter-spacing: -0.2px;
}
.module-sub {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 22px;
}
.module-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-mute);
}
.module-meta b { color: var(--sage-deep); font-weight: 600; }
.module-arrow {
  color: var(--gold-deep);
  font-weight: 500;
  transition: transform 0.3s var(--ease);
}
.module-card:hover .module-arrow { transform: translateX(4px); }

/* En-tête de module (après clic) */
.module-header {
  margin: 14px 0 32px;
  max-width: 800px;
}
.module-titre {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.15;
  margin: 10px 0 8px;
}
.module-subtitle {
  color: var(--ink-soft);
  font-size: 16px;
}

/* Zone scrollable des chapitres */
.chapitres-scroll {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 900px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 4px 8px 12px 4px;
  scroll-behavior: smooth;
}
.chapitres-scroll::-webkit-scrollbar { width: 6px; }
.chapitres-scroll::-webkit-scrollbar-thumb { background: var(--sage-soft); border-radius: 3px; }

.chapitre-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
}
.chapitre-card::before {
  content: "";
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 3px;
  background: var(--gold-soft);
  border-radius: 0 2px 2px 0;
  transition: background 0.3s var(--ease);
}
.chapitre-card:hover {
  border-color: var(--sage-soft);
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
}
.chapitre-card:hover::before { background: var(--gold); }

.chap-num {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
.chapitre-card h4 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 5px;
}
.chap-sub {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.chap-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-mute);
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.chap-meta b { color: var(--sage-deep); font-weight: 600; }
.chap-arrow { color: var(--gold-deep); font-weight: 500; }

/* Signature développeur dans la sidebar */
.developer-credit {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--sage-ghost);
  margin-top: 10px;
  text-align: center;
}
.developer-credit .dev-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 3px;
}
.developer-credit .dev-name {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.developer-credit .dev-email {
  display: block;
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  word-break: break-all;
}

/* Responsive modules */
@media (max-width: 900px) {
  .module-card { padding: 28px 24px; }
  .module-card h3 { font-size: 24px; }
  .chapitre-card { padding: 18px 20px; }
  .chapitre-card h4 { font-size: 18px; }
  .chapitres-scroll { max-height: 70vh; }
}

/* ============================= JEUX — style enrichi ============================= */
.jeu-cat-header {
  margin-bottom: 20px;
  padding: 18px 22px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--sage);
}
.jeu-category[data-tone="gold"] .jeu-cat-header { border-left-color: var(--gold); }
.jeu-category[data-tone="ivory"] .jeu-cat-header { border-left-color: var(--gold-soft); }
.jeu-cat-header h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.jeu-cat-header .sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 0;
}

.jeu-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.jeu-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sage-ghost);
  color: var(--sage-deep);
}
.jeu-card[data-tone="gold"] .jeu-badge {
  background: rgba(228,212,163,0.3);
  color: var(--gold-deep);
}
.jeu-card[data-tone="ivory"] .jeu-badge {
  background: var(--ivory-deep);
  color: var(--ink-soft);
}
.jeu-count {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 500;
}
.jeu-arrow {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--gold-deep);
  font-weight: 500;
  transition: transform 0.3s var(--ease);
}
.jeu-card:hover .jeu-arrow { transform: translateX(4px); }

.jeu-empty {
  color: var(--ink-mute);
  font-style: italic;
  padding: 16px 20px;
  background: var(--ivory-soft);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
}

/* Correction layout : quand .cours-list ou #qcm-list affiche un module, on désactive la grille */
.cours-list.is-chapitres-view,
#qcm-list.is-chapitres-view {
  display: block !important;
  grid-template-columns: none !important;
}

/* ============================= SIDEBAR ARBORESCENCE ============================= */
.sidebar {
  width: 320px;
  overflow-y: auto;
  overflow-x: hidden;
}

.main { margin-left: 320px; }

@media (max-width: 900px) {
  .sidebar { width: 300px; }
  .main { margin-left: 0; }
}

/* Section contenant un header + arborescence */
.nav-section {
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
}

.nav-section-header {
  font-weight: 600;
}

/* Arborescence */
.nav-tree {
  padding: 2px 0 8px 0;
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-tree::-webkit-scrollbar { width: 4px; }
.nav-tree::-webkit-scrollbar-thumb { background: var(--sage-soft); border-radius: 2px; }

.nav-module {
  margin: 2px 0;
}

.nav-module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px 8px 28px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s var(--ease);
  border-radius: var(--radius-sm);
}
.nav-module-toggle:hover {
  background: var(--ivory-soft);
  color: var(--gold-deep);
}
.nav-module-toggle .chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
  transform: rotate(90deg);
  color: var(--gold-deep);
}
.nav-module.collapsed .chevron {
  transform: rotate(0deg);
}

.nav-chapters {
  list-style: none;
  padding: 2px 0 4px 0;
  margin: 0;
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.3s var(--ease);
}
.nav-module.collapsed .nav-chapters {
  max-height: 0;
}

.nav-chap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px 8px 42px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  transition: all 0.2s var(--ease);
  border-radius: var(--radius-sm);
  margin: 1px 8px 1px 14px;
  width: calc(100% - 22px);
  line-height: 1.35;
  position: relative;
}
.nav-chap::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--line);
}
.nav-chap:hover {
  background: var(--cream);
  color: var(--ink);
}
.nav-chap.active {
  background: var(--sage-ghost);
  color: var(--sage-deep);
  font-weight: 600;
}
.nav-chap.active::before { background: var(--sage); width: 12px; }

.nav-chap-num {
  font-size: 10.5px;
  color: var(--gold-deep);
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.nav-chap-titre {
  flex: 1;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-chap-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--ivory-deep);
  color: var(--ink-mute);
  font-weight: 600;
  flex-shrink: 0;
}
.nav-chap.active .nav-chap-badge {
  background: var(--sage);
  color: white;
}

/* Modules grid sur la page Cours/QCM */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 22px;
}

.modules-intro {
  margin-bottom: 22px;
}
.intro-lede {
  color: var(--ink-soft);
  font-size: 15px;
  padding: 14px 18px;
  background: var(--sage-ghost);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0;
}

/* Aperçu des chapitres dans les cartes de modules */
.module-chapters-preview {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.module-chapters-preview li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  margin-bottom: 2px;
}
.module-chapters-preview li:hover {
  background: var(--sage-ghost);
  transform: translateX(3px);
}
.module-chapters-preview .mc-num {
  font-size: 10.5px;
  color: var(--gold-deep);
  font-weight: 700;
  letter-spacing: 0.5px;
  min-width: 22px;
}
.module-chapters-preview .mc-titre {
  flex: 1;
  line-height: 1.35;
}
.module-chapters-preview .mc-count {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ivory-deep);
  color: var(--ink-mute);
  font-weight: 600;
}
.module-chapters-preview .mc-more {
  color: var(--ink-mute);
  font-style: italic;
  font-size: 12px;
  cursor: default;
}
.module-chapters-preview .mc-more:hover { background: none; transform: none; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--ink-mute);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--sage-deep);
  font-weight: 500;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--gold-deep); }
.breadcrumb .sep { color: var(--line); }
.breadcrumb .bc-current {
  color: var(--ink);
  font-weight: 500;
}

/* Navigation chapitre précédent / suivant */
.chap-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.chap-nav .btn {
  max-width: 48%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================= MINI-JEUX — STYLES ============================= */

/* Liste des types de jeux */
.jeux-types {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.jeu-type-section {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  position: relative;
}
.jeu-type-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.jeu-type-section[data-tone="gold"]::before {
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
}

.jeu-type-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.jeu-type-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--sage-ghost);
  color: var(--sage-deep);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.jeu-type-section[data-tone="gold"] .jeu-type-icon {
  background: rgba(228, 212, 163, 0.35);
  color: var(--gold-deep);
}
.jeu-type-icon svg { width: 28px; height: 28px; }
.jeu-type-header h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.jeu-type-header p {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 2px;
}
.jeu-type-count {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ivory-deep);
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

.jeu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.jeu-card-v2 {
  padding: 20px 22px;
  background: var(--ivory-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
}
.jeu-card-v2:hover {
  border-color: var(--sage-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.jeu-card-module {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-deep);
  margin-bottom: 10px;
}
.jeu-card-v2 h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 6px;
}
.jeu-card-v2 p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 12px;
}
.jeu-card-v2 .jeu-arrow {
  font-size: 13px;
  color: var(--sage-deep);
  font-weight: 500;
  transition: transform 0.3s var(--ease);
}
.jeu-card-v2:hover .jeu-arrow {
  transform: translateX(4px);
  color: var(--gold-deep);
}

/* ============================= En-tête commun session jeu ============================= */
.jeu-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.jeu-titre {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  flex: 1;
  min-width: 0;
}
.jeu-progress {
  font-size: 13px;
  color: var(--gold-deep);
  font-weight: 600;
  padding: 6px 14px;
  background: var(--ivory-deep);
  border-radius: 999px;
}
.jeu-consigne {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--sage-ghost);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--sage);
}
.jeu-end-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}
.jeu-end-card h3 {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink);
  margin-bottom: 24px;
}
.jeu-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
  flex-wrap: wrap;
}
.jeu-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--gold-deep);
  font-weight: 600;
  line-height: 1;
}
.stat-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  font-weight: 500;
}
.jeu-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn.small { padding: 8px 16px; font-size: 13px; }

/* ============================= FLASHCARDS ============================= */
.flashcard-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 560px;
  margin: 0 auto;
}
.flashcard {
  width: 100%;
  height: 300px;
  perspective: 1500px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s var(--ease);
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.flashcard-front {
  background: linear-gradient(135deg, var(--cream), var(--ivory-soft));
}
.flashcard-back {
  background: linear-gradient(135deg, var(--sage-ghost), var(--cream));
  transform: rotateY(180deg);
}
.fc-label {
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 14px;
}
.flashcard-front h3 {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
}
.flashcard-back p {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.55;
  max-width: 460px;
}
.fc-hint {
  position: absolute;
  bottom: 20px;
  font-size: 11.5px;
  color: var(--ink-mute);
  font-style: italic;
}
.flashcard-controls {
  display: flex;
  gap: 12px;
}
.flashcard-nav {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* ============================= ASSOCIATIONS ============================= */
.assoc-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}
.assoc-col h4 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--sage-deep);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.assoc-item {
  display: block;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.assoc-item:hover:not(:disabled):not(.matched) {
  border-color: var(--sage);
  background: var(--sage-ghost);
  transform: translateX(2px);
}
.assoc-item.selected {
  background: linear-gradient(135deg, var(--gold-soft), var(--ivory-deep));
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 168, 90, 0.15);
}
.assoc-item.matched {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--ink-mute);
  opacity: 0.65;
  cursor: default;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--success);
}
.assoc-item.wrong-pulse {
  animation: wrongShake 0.5s;
  background: var(--error-bg);
  border-color: var(--error);
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.assoc-end {
  text-align: center;
  padding: 30px;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  margin-top: 20px;
}
.assoc-end h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--sage-deep);
  margin-bottom: 6px;
}
.assoc-end p {
  color: var(--ink-soft);
  margin-bottom: 18px;
}

/* ============================= REMISE EN ORDRE ============================= */
.ordre-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-width: 640px;
}
.ordre-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: all 0.2s var(--ease);
  user-select: none;
}
.ordre-item:hover { border-color: var(--sage-soft); box-shadow: var(--shadow-sm); }
.ordre-item:active { cursor: grabbing; }
.ordre-item.dragging { opacity: 0.4; transform: scale(0.98); }
.ordre-item.drag-over {
  border-color: var(--gold);
  background: var(--ivory-deep);
  transform: translateY(-2px);
}
.ordre-item.correct {
  background: var(--success-bg);
  border-color: var(--success);
}
.ordre-item.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}
.ordre-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--cream);
  font-weight: 600;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ordre-text {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}
.ordre-moves {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ordre-btn {
  width: 26px;
  height: 22px;
  border-radius: 5px;
  background: var(--ivory-deep);
  color: var(--ink-soft);
  font-size: 14px;
  transition: all 0.15s var(--ease);
  display: grid;
  place-items: center;
}
.ordre-btn:hover:not(:disabled) {
  background: var(--sage);
  color: var(--cream);
}
.ordre-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ordre-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}
.ordre-success {
  margin-top: 24px;
  padding: 26px;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  text-align: center;
}
.ordre-success h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--sage-deep);
  margin-bottom: 6px;
}
.ordre-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--ivory-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ============================= MOTS CACHÉS ============================= */
.mc-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 24px;
}
@media (max-width: 900px) {
  .mc-layout { grid-template-columns: 1fr; }
}
.mc-grid {
  display: grid;
  gap: 2px;
  padding: 14px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  aspect-ratio: 1;
  max-width: 520px;
}
.mc-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(10px, 1.6vw, 14px);
  background: var(--ivory-soft);
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.mc-cell:hover:not(.found) {
  background: var(--sage-ghost);
  transform: scale(1.05);
}
.mc-cell.sel-start {
  background: var(--gold);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(200,168,90,0.25);
}
.mc-cell.found {
  background: var(--success-bg);
  color: var(--sage-deep);
  font-weight: 700;
  cursor: default;
}
.mc-words {
  padding: 20px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  height: fit-content;
}
.mc-words h4 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--sage-deep);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.mc-words ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mc-words li {
  padding: 8px 10px;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: 4px;
  margin-bottom: 3px;
  transition: all 0.25s var(--ease);
}
.mc-words li.found {
  background: var(--success-bg);
  color: var(--sage-deep);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.mc-success {
  margin-top: 16px;
  padding: 14px;
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  text-align: center;
}
.mc-success p {
  color: var(--sage-deep);
  font-weight: 600;
  margin-bottom: 10px;
}

/* =========================================================================
   BOUTON D'AIDE FLOTTANT (FAB)
   ========================================================================= */
.help-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: var(--cream);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(166, 136, 57, 0.35), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 900;
}
.help-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 24px rgba(166, 136, 57, 0.45), 0 4px 12px rgba(0, 0, 0, 0.1);
}
.help-fab:active {
  transform: translateY(0) scale(1);
}
.help-fab svg {
  width: 28px;
  height: 28px;
}

/* Animation d'attention périodique pour signaler le bouton aux nouveaux utilisateurs */
.help-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: help-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes help-pulse {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* =========================================================================
   PANNEAU D'AIDE CONTEXTUEL
   ========================================================================= */
.help-panel[hidden] { display: none; }
.help-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}
.help-overlay {
  position: absolute;
  inset: 0;
  background: rgba(61, 58, 51, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.help-panel.open .help-overlay { opacity: 1; }

.help-content {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: var(--ivory-soft);
  box-shadow: -8px 0 32px rgba(61, 58, 51, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  overflow-y: auto;
}
.help-panel.open .help-content { transform: translateX(0); }

.help-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.help-close:hover {
  background: var(--sage-ghost);
  color: var(--sage-deep);
}
.help-close svg { width: 20px; height: 20px; }

.help-head {
  padding: 32px 32px 20px;
  border-bottom: 1px solid var(--line);
}
.help-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 600;
}
.help-head h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-top: 6px;
  line-height: 1.25;
}

.help-body {
  flex: 1;
  padding: 24px 32px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.65;
}
.help-body p { margin-bottom: 14px; }
.help-body strong { color: var(--sage-deep); font-weight: 600; }
.help-list, .help-steps {
  margin: 12px 0 18px 0;
  padding-left: 0;
  list-style: none;
}
.help-list li, .help-steps li {
  position: relative;
  padding: 10px 14px 10px 40px;
  margin-bottom: 6px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
}
.help-list li::before {
  content: "•";
  position: absolute;
  left: 16px;
  top: 8px;
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
}
.help-steps {
  counter-reset: helpstep;
}
.help-steps li {
  counter-increment: helpstep;
}
.help-steps li::before {
  content: counter(helpstep);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-tip {
  margin-top: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fdf8e8, #f7edcf);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
}
.help-tip strong { color: var(--gold-deep); }

.help-footer {
  padding: 18px 32px 24px;
  border-top: 1px solid var(--line);
  background: var(--ivory-deep);
}
.help-footer .btn {
  width: 100%;
  text-align: center;
}

/* Sur mobile : panneau qui prend tout l'écran */
@media (max-width: 640px) {
  .help-content { max-width: 100%; }
  .help-head { padding: 28px 22px 16px; }
  .help-body { padding: 20px 22px; }
  .help-footer { padding: 16px 22px 20px; }
  .help-fab { bottom: 16px; right: 16px; width: 52px; height: 52px; }
  .help-fab svg { width: 26px; height: 26px; }
}

/* =========================================================================
   TUTORIEL D'ACCUEIL (VISITE GUIDÉE)
   ========================================================================= */
.tour[hidden] { display: none; }
.tour {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
}
.tour-overlay {
  position: absolute;
  inset: 0;
  background: rgba(61, 58, 51, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: tour-fade-in 0.3s ease;
}
@keyframes tour-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(61, 58, 51, 0.55),
              0 0 0 3px var(--gold),
              0 0 24px rgba(200, 168, 90, 0.5);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  display: none;
}

.tour-card {
  position: absolute;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--cream);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(61, 58, 51, 0.25), 0 8px 20px rgba(61, 58, 51, 0.1);
  padding: 24px;
  pointer-events: auto;
  transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  border: 1px solid var(--line);
}

.tour-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.tour-step-num {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-deep);
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.tour-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--sage-ghost);
  border-radius: 2px;
  overflow: hidden;
}
.tour-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--gold));
  transition: width 0.3s ease;
  border-radius: 2px;
}

.tour-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 10px;
  line-height: 1.25;
}
.tour-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 20px;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.tour-btn-skip {
  font-size: 0.85rem;
  padding: 6px 10px;
  color: var(--ink-mute);
}
.tour-btn-skip:hover { color: var(--ink-soft); }
.tour-nav {
  display: flex;
  gap: 8px;
}
.tour-nav .btn {
  padding: 8px 14px;
  font-size: 0.88rem;
}
.tour-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Mobile : carte en bas, pleine largeur */
@media (max-width: 900px) {
  .tour-card {
    width: calc(100vw - 24px);
    max-width: 420px;
    padding: 20px;
  }
  .tour-card h3 { font-size: 1.25rem; }
  .tour-card p { font-size: 0.9rem; }
}

/* =========================================================================
   PAGE À PROPOS
   ========================================================================= */
.about-wrap {
  display: grid;
  gap: 22px;
  max-width: 820px;
}

.about-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(61, 58, 51, 0.04);
}

/* --- Carte profil : avatar + identité --- */
.about-profile {
  display: flex;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, var(--ivory-soft), var(--cream));
  border-left: 4px solid var(--gold);
}
.about-avatar {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-deep), var(--gold-deep));
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 16px rgba(166, 136, 57, 0.25);
}
.about-identity {
  flex: 1;
  min-width: 0;
}
.about-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 4px;
  line-height: 1.2;
}
.about-role {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 10px;
}
.about-role sup {
  font-size: 0.7em;
  vertical-align: super;
}
.about-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--gold-deep);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.about-email:hover {
  background: var(--ivory-deep);
  text-decoration: underline;
}
.about-email svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Bio --- */
.about-section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.about-bio p {
  font-size: 0.96rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 14px;
}
.about-bio p:last-child { margin-bottom: 0; }
.about-bio strong {
  color: var(--gold-deep);
  font-weight: 600;
}

/* --- Bloc soutien --- */
.about-support {
  background: linear-gradient(135deg, #fdf8e8 0%, var(--cream) 60%);
  border-left: 4px solid var(--sage);
}
.about-support-intro {
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 20px;
  line-height: 1.6;
}

.about-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.about-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.about-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(61, 58, 51, 0.1);
  border-color: var(--gold-soft);
}
.about-btn svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 6px;
  border-radius: 8px;
}
.about-btn-share svg {
  background: var(--sage-ghost);
  color: var(--sage-deep);
}
.about-btn-contact svg {
  background: rgba(228, 212, 163, 0.35);
  color: var(--gold-deep);
}
.about-btn-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.about-btn-label strong {
  font-size: 0.95rem;
  color: var(--sage-deep);
  font-weight: 600;
}
.about-btn-label small {
  font-size: 0.8rem;
  color: var(--ink-mute);
  font-weight: 400;
  line-height: 1.35;
}

.about-thanks {
  text-align: center;
  padding: 14px 18px;
  background: var(--sage-ghost);
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--sage-deep);
  font-weight: 500;
  font-style: italic;
}

/* Responsive */
@media (max-width: 640px) {
  .about-card { padding: 20px; }
  .about-profile {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .about-actions { grid-template-columns: 1fr; }
  .about-name { font-size: 1.45rem; }
}

/* Bouton crédit dans la sidebar (maintenant cliquable) */
button.developer-credit {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  text-align: inherit;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease;
}
button.developer-credit:hover { opacity: 0.75; }

/* --- Toast de confirmation pour le partage --- */
.about-toast {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(61, 58, 51, 0.2);
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1200;
  max-width: calc(100vw - 48px);
}
.about-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 640px) {
  .about-toast {
    bottom: 88px;
    right: 16px;
    left: 16px;
    text-align: center;
  }
}

/* =========================================================================
   MODALE PARTAGE / CONTACT
   ========================================================================= */
.share-modal[hidden] { display: none; }
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.share-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(61, 58, 51, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.share-modal.open .share-modal-overlay { opacity: 1; }

.share-modal-card {
  position: relative;
  background: var(--cream);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(61, 58, 51, 0.25), 0 8px 20px rgba(61, 58, 51, 0.12);
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 32px;
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s ease;
}
.share-modal.open .share-modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.share-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.share-modal-close:hover {
  background: var(--sage-ghost);
  color: var(--sage-deep);
}
.share-modal-close svg { width: 18px; height: 18px; }

.share-modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 8px;
  line-height: 1.25;
  padding-right: 30px;
}
.share-modal-text {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.6;
  margin-bottom: 20px;
}

.share-modal-field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  font-weight: 600;
  margin-bottom: 6px;
}
.share-modal-input-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.share-modal-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ivory-soft);
  color: var(--ink);
  font-family: inherit;
}
.share-modal-input-wrap input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--cream);
}
.share-modal-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--sage-deep);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.share-modal-copy:hover {
  background: var(--sage);
  transform: translateY(-1px);
}
.share-modal-copy.copied {
  background: var(--success);
}
.share-modal-copy svg {
  width: 16px;
  height: 16px;
}

.share-modal-alt {
  margin-top: 20px;
}
.share-modal-hint {
  background: linear-gradient(135deg, #fdf8e8, var(--ivory-soft));
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
}
.share-modal-hint strong {
  color: var(--gold-deep);
}
.share-modal-linkbtn {
  display: block;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--sage-deep);
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.share-modal-linkbtn:hover {
  border-color: var(--gold);
  background: var(--ivory-deep);
}
.share-modal-fullmsg {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--cream);
  color: var(--ink);
  resize: vertical;
  min-height: 80px;
}

@media (max-width: 500px) {
  .share-modal-card { padding: 24px 20px; }
  .share-modal-title { font-size: 1.25rem; }
  .share-modal-input-wrap { flex-direction: column; }
  .share-modal-copy { justify-content: center; }
}

/* ============================= RESPONSIVE PRÉPARATION RAPIDE ============================= */
@media (max-width: 900px) {
  .prepa-tabs {
    flex-direction: column;
    border-bottom: none;
    gap: 6px;
  }
  .prepa-tab {
    border: 1px solid rgba(139, 152, 133, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    justify-content: flex-start;
  }
  .prepa-tab.active {
    background: rgba(200, 168, 90, 0.08);
    border-color: rgba(200, 168, 90, 0.4);
  }
  .prepa-glossary {
    max-height: none;
    min-height: 0;
    padding-right: 0;
  }
  .syn-part {
    padding: 20px 18px;
  }
  .syn-part-head {
    gap: 10px;
  }
  .syn-part-num {
    font-size: 34px;
  }
  .syn-part-title {
    font-size: 22px;
  }
  .prepa-syn-toc {
    padding: 10px 12px;
  }
  .prepa-syn-toc-item {
    font-size: 12px;
    padding: 6px 10px;
  }
  .glo-card {
    padding: 16px 18px;
  }
  .glo-terme {
    font-size: 19px;
  }
  .prepa-search {
    font-size: 13.5px;
    padding: 12px 40px;
  }
}

@media (max-width: 500px) {
  .hero-card.hero-flash::after {
    top: 10px;
    right: 10px;
    font-size: 9px;
    padding: 3px 8px;
  }
  .glo-card-head {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
  .prepa-syn-source {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ============================= RESPONSIVE BROWSER 2 VOLETS ============================= */
@media (max-width: 1024px) {
  .view.has-browser {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Sur tablette/mobile, le panneau devient plein largeur et se cache quand on affiche le contenu */
  .browser-panel {
    position: static;
    max-height: none;
    margin-bottom: 0;
  }

  /* Par défaut on affiche le browser et on cache le contenu */
  .view.has-browser .content-panel {
    display: none;
  }

  /* Quand un chapitre est ouvert : cacher le browser et afficher le contenu */
  .view.has-browser.showing-content .browser-panel {
    display: none;
  }
  .view.has-browser.showing-content .content-panel {
    display: block;
  }

  /* Bouton retour visible sur mobile quand contenu affiché */
  .view.has-browser.showing-content .browser-back-btn {
    display: inline-flex;
  }
  .view.has-browser.showing-content .browser-back-btn.hidden {
    display: inline-flex !important;
  }
}

@media (max-width: 640px) {
  .browser-panel {
    padding: 16px 10px 18px 14px;
    border-radius: 10px;
  }

  .browser-title {
    font-size: 19px;
  }

  .br-module-name {
    font-size: 12px;
  }

  .br-chap-title {
    font-size: 11.5px;
  }
}

/* ============================= AJUSTEMENTS HEADERS DANS VIEWS 2 VOLETS ============================= */
.view.has-browser .view-header {
  margin-bottom: 28px;
}

.view.has-browser .view-title {
  font-size: 32px;
}
