/* ============================================================
   cours.css — Pages de cours interactifs
   Harmonisé avec la page exercices
   Version : 3.1
   Date : 26 avril 2026
   ============================================================ */

:root {
  --cours-def-color:    #1a6fbf;
  --cours-def-bg:       #eef5fc;
  --cours-def-border:   #5ba3e0;

  --cours-prop-color:   #1e8a4a;
  --cours-prop-bg:      #edfaf3;
  --cours-prop-border:  #5dc98a;

  --cours-meth-color:   #b85e18;
  --cours-meth-bg:      #fef3e8;
  --cours-meth-border:  #e07b2a;

  --cours-ex-color:     #7b3fa0;
  --cours-ex-bg:        #f8f0fc;
  --cours-ex-border:    #b07fd4;

  --cours-rem-color:    #5a6472;
  --cours-rem-bg:       #f4f5f7;
  --cours-rem-border:   #b0b8c4;

  --cours-thm-color:    #a01e3a;
  --cours-thm-bg:       #fdf0f3;
  --cours-thm-border:   #d46080;

  --cours-page-bg:      #f0f2f5;
  --cours-card-bg:      #ffffff;
  --cours-text:         #2c3e50;
  --cours-text-light:   #6c757d;
  --cours-border:       #e9ecef;
  --cours-radius:       20px;
  --cours-shadow:       0 4px 16px rgba(0,0,0,0.06);
  --cours-shadow-md:    0 8px 24px rgba(0,0,0,0.1);

  --cours-accent:       #1a6fbf;
}

/* ── Base body ── */
.cours-page { 
  background: var(--cours-page-bg); 
  min-height: 100vh; 
  padding-bottom: 4rem; 
}

/* ========================================
   HERO (harmonisé avec exercices)
   ======================================== */

.cours-hero {
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  color: #fff;
  padding: 2.5rem 2rem 3rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
}

.cours-hero::before {
  content: '';
  position: absolute;
  right: -3rem;
  top: -3rem;
  width: 12rem;
  height: 12rem;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}

.cours-hero::after {
  content: '';
  position: absolute;
  left: -2rem;
  bottom: -2rem;
  width: 8rem;
  height: 8rem;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.cours-hero-inner { 
  max-width: 1200px; 
  margin: 0 auto; 
  position: relative; 
  z-index: 1; 
  padding: 0 20px;
}

.cours-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 40px;
  padding: .3rem .9rem;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 1rem;
  backdrop-filter: blur(4px);
}

.cours-hero h1 { 
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  margin: 0 0 .5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cours-hero-desc { 
  font-size: 1rem;
  opacity: .9;
  max-width: 600px;
  margin: 0;
  line-height: 1.5;
}

/* Fil d'Ariane */
.cours-breadcrumb { 
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.cours-breadcrumb a { 
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: all 0.2s;
}

.cours-breadcrumb a:hover { 
  color: white;
  text-decoration: underline;
}

.cours-breadcrumb .sep { 
  opacity: .5;
}

.cours-breadcrumb .current { 
  color: #fff;
  font-weight: 600;
}

/* ========================================
   BARRE DE PROGRESSION (sticky améliorée)
   ======================================== */

.cours-progress-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cours-card-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(5px);
  background: rgba(255,255,255,0.97);
}

.cours-progress-label { 
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cours-text-light);
  white-space: nowrap;
}

.cours-progress-bar { 
  flex: 1;
  height: 6px;
  background: var(--cours-border);
  border-radius: 10px;
  overflow: hidden;
}

.cours-progress-fill { 
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #2ecc71);
  transition: width 0.4s ease;
  width: 0%;
  border-radius: 10px;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.cours-layout { 
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 20px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) { 
  .cours-layout { 
    grid-template-columns: 1fr;
    gap: 1.5rem;
  } 
}

/* ========================================
   SOMMAIRE (sticky amélioré)
   ======================================== */

.cours-toc {
  position: sticky;
  top: 80px;
  background: var(--cours-card-bg);
  border-radius: var(--cours-radius);
  box-shadow: var(--cours-shadow);
  padding: 1.2rem 0;
  border: 1px solid var(--cours-border);
  transition: box-shadow 0.2s;
}

.cours-toc:hover {
  box-shadow: var(--cours-shadow-md);
}

.cours-toc h3 { 
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cours-text-light);
  margin: 0 0 1rem;
  padding: 0 1.2rem;
}

.cours-toc-list { 
  list-style: none;
  margin: 0;
  padding: 0;
}

.cours-toc-list li { 
  margin-bottom: 0.2rem;
}

.cours-toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 1.2rem;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cours-text-light);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.cours-toc-list a:hover { 
  background: var(--cours-page-bg);
  color: var(--cours-accent);
}

.cours-toc-list a.active { 
  background: var(--cours-def-bg);
  color: var(--cours-def-color);
  border-left-color: var(--cours-def-color);
  font-weight: 600;
}

/* Badges de sommaire */
.toc-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  min-width: 48px;
  text-align: center;
}

.toc-def  .toc-badge { background: var(--cours-def-bg);  color: var(--cours-def-color); }
.toc-prop .toc-badge { background: var(--cours-prop-bg); color: var(--cours-prop-color); }
.toc-meth .toc-badge { background: var(--cours-meth-bg); color: var(--cours-meth-color); }
.toc-ex   .toc-badge { background: var(--cours-ex-bg);   color: var(--cours-ex-color); }
.toc-rem  .toc-badge { background: var(--cours-rem-bg);  color: var(--cours-rem-color); }
.toc-thm  .toc-badge { background: var(--cours-thm-bg);  color: var(--cours-thm-color); }

/* Couleurs par type dans le sommaire */
.cours-toc-list .toc-def  a.active  { color: var(--cours-def-color);  background: var(--cours-def-bg);  border-left-color: var(--cours-def-color); }
.cours-toc-list .toc-prop a.active  { color: var(--cours-prop-color); background: var(--cours-prop-bg); border-left-color: var(--cours-prop-color); }
.cours-toc-list .toc-meth a.active  { color: var(--cours-meth-color); background: var(--cours-meth-bg); border-left-color: var(--cours-meth-color); }
.cours-toc-list .toc-ex   a.active  { color: var(--cours-ex-color);   background: var(--cours-ex-bg);   border-left-color: var(--cours-ex-color); }

/* ========================================
   SECTIONS DE COURS (cartes modernes)
   ======================================== */

.cours-main { 
  min-width: 0;
}

.cours-section {
  background: var(--cours-card-bg);
  border-radius: var(--cours-radius);
  box-shadow: var(--cours-shadow);
  margin-bottom: 1.8rem;
  border-top: 4px solid var(--cours-border);
  scroll-margin-top: 90px;
  transition: all 0.25s ease;
  overflow: hidden;
}

.cours-section:hover { 
  box-shadow: var(--cours-shadow-md);
  transform: translateY(-2px);
}

/* Bordures colorées par type */
.cours-section.type-definition  { border-top-color: var(--cours-def-border); }
.cours-section.type-propriete   { border-top-color: var(--cours-prop-border); }
.cours-section.type-methode     { border-top-color: var(--cours-meth-border); }
.cours-section.type-exemple     { border-top-color: var(--cours-ex-border); }
.cours-section.type-remarque    { border-top-color: var(--cours-rem-border); }
.cours-section.type-theoreme    { border-top-color: var(--cours-thm-border); }
.cours-section.type-vocabulaire { border-top-color: var(--cours-def-border); }

/* En-tête de section */
.cours-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--cours-border);
  background: #fafbfc;
}

.cours-section-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.type-definition  .cours-section-icon { background: var(--cours-def-bg);  color: var(--cours-def-color); }
.type-propriete   .cours-section-icon { background: var(--cours-prop-bg); color: var(--cours-prop-color); }
.type-methode     .cours-section-icon { background: var(--cours-meth-bg); color: var(--cours-meth-color); }
.type-exemple     .cours-section-icon { background: var(--cours-ex-bg);   color: var(--cours-ex-color); }
.type-remarque    .cours-section-icon { background: var(--cours-rem-bg);  color: var(--cours-rem-color); }
.type-theoreme    .cours-section-icon { background: var(--cours-thm-bg);  color: var(--cours-thm-color); }
.type-vocabulaire .cours-section-icon { background: var(--cours-def-bg);  color: var(--cours-def-color); }

.cours-type-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.type-definition  .cours-type-label { color: var(--cours-def-color); }
.type-propriete   .cours-type-label { color: var(--cours-prop-color); }
.type-methode     .cours-type-label { color: var(--cours-meth-color); }
.type-exemple     .cours-type-label { color: var(--cours-ex-color); }
.type-remarque    .cours-type-label { color: var(--cours-rem-color); }
.type-theoreme    .cours-type-label { color: var(--cours-thm-color); }
.type-vocabulaire .cours-type-label { color: var(--cours-def-color); }

.cours-section-titre { 
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cours-text);
  margin: 0;
}

/* Corps de section */
.cours-section-body { 
  padding: 1.5rem;
}

.cours-contenu { 
  font-size: 1rem;
  line-height: 1.7;
  color: var(--cours-text);
}

.cours-contenu p  { 
  margin: 0 0 0.8rem;
}

.cours-contenu p:last-child { 
  margin-bottom: 0;
}

.cours-contenu ul, 
.cours-contenu ol { 
  margin: 0.5rem 0 0.8rem 1.5rem;
}

.cours-contenu li { 
  margin-bottom: 0.4rem;
}

.cours-contenu strong { 
  color: var(--cours-text);
  font-weight: 700;
}

/* ========================================
   ENCADRÉS (mise en valeur)
   ======================================== */

.cours-encadre {
  background: linear-gradient(to right, var(--cours-def-bg), #fff);
  border-left: 4px solid var(--cours-def-color);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cours-text);
}

.type-propriete .cours-encadre  { background: linear-gradient(to right, var(--cours-prop-bg), #fff); border-left-color: var(--cours-prop-color); }
.type-methode   .cours-encadre  { background: linear-gradient(to right, var(--cours-meth-bg), #fff); border-left-color: var(--cours-meth-color); }
.type-theoreme  .cours-encadre  { background: linear-gradient(to right, var(--cours-thm-bg),  #fff); border-left-color: var(--cours-thm-color); }

/* ========================================
   BLANCS INTERACTIFS (améliorés)
   ======================================== */

.c-blank {
  display: inline-block;
  min-width: 100px;
  padding: 0.3rem 0.6rem;
  border: none;
  border-bottom: 2px solid var(--cours-accent);
  background: rgba(26,111,191,0.06);
  border-radius: 6px 6px 0 0;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--cours-text);
  text-align: center;
  transition: all 0.2s;
  vertical-align: baseline;
}

.c-blank:focus { 
  outline: none;
  border-bottom-color: #0a3a7a;
  background: rgba(26,111,191,0.12);
}

.c-blank.valid { 
  border-bottom-color: #27ae60;
  background: rgba(39,174,96,0.08);
  color: #1e8449;
}

.c-blank.invalid { 
  border-bottom-color: #e74c3c;
  background: rgba(231,76,60,0.06);
  color: #c0392b;
}

/* Boutons d'action */
.blancs-actions { 
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.btn-verifier-blancs {
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, #27ae60, #219a52);
  color: #fff;
  border: none;
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-verifier-blancs:hover { 
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39,174,96,0.3);
}

.btn-voir-reponses {
  padding: 0.5rem 1.2rem;
  background: #fff;
  color: var(--cours-text-light);
  border: 2px solid var(--cours-border);
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-voir-reponses:hover { 
  border-color: var(--cours-ex-color);
  color: var(--cours-ex-color);
  transform: translateY(-2px);
}

/* ========================================
   FIGURES ET ILLUSTRATIONS
   ======================================== */

.cours-figure {
  margin: 1rem auto;
  text-align: center;
  background: var(--cours-page-bg);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid var(--cours-border);
  display: inline-block;
  max-width: 100%;
}

.cours-figure-caption {
  font-size: 0.8rem;
  color: var(--cours-text-light);
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

.cours-figure-wrap { 
  text-align: center;
  margin: 1rem 0 1.2rem;
}

/* ========================================
   ÉTAPES MÉTHODE (numérotées)
   ======================================== */

.methode-etapes { 
  counter-reset: etape;
  margin: 0.8rem 0;
  padding: 0;
  list-style: none;
}

.methode-etapes li {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--cours-meth-bg);
  border-radius: 12px;
  font-size: 0.95rem;
  counter-increment: etape;
  transition: all 0.2s;
}

.methode-etapes li:hover {
  transform: translateX(5px);
}

.methode-etapes li::before {
  content: counter(etape);
  min-width: 1.6rem;
  height: 1.6rem;
  background: var(--cours-meth-color);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* ========================================
   FORMULES MATHÉMATIQUES
   ======================================== */

.MathJax, .math {
  font-size: 1rem;
}

.cours-contenu .MathJax {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* ========================================
   CHARGEMENT
   ======================================== */

.cours-loading { 
  text-align: center;
  padding: 4rem 2rem;
  color: var(--cours-text-light);
}

.cours-loading .spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--cours-border);
  border-top-color: var(--cours-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { 
  to { transform: rotate(360deg); }
}

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

.cours-section { 
  animation: fadeInUp 0.3s ease backwards;
}

.cours-section:nth-child(1) { animation-delay: 0.05s; }
.cours-section:nth-child(2) { animation-delay: 0.1s; }
.cours-section:nth-child(3) { animation-delay: 0.15s; }
.cours-section:nth-child(4) { animation-delay: 0.2s; }
.cours-section:nth-child(5) { animation-delay: 0.25s; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 900px) {
  .cours-toc {
    position: static;
    margin-bottom: 1rem;
  }
  
  .cours-toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem;
  }
  
  .cours-toc-list li {
    margin: 0;
  }
  
  .cours-toc-list a {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 40px;
    background: #f1f3f5;
  }
  
  .cours-toc-list a.active {
    border-left-color: transparent;
    border-bottom-color: var(--cours-def-color);
  }
}

@media (max-width: 640px) {
  .cours-hero { 
    padding: 1.8rem 1.2rem 2.2rem;
  }
  
  .cours-layout { 
    padding: 1rem 16px 2rem;
  }
  
  .cours-section-header {
    padding: 1rem;
  }
  
  .cours-section-body { 
    padding: 1rem;
  }
  
  .cours-section-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
  
  .cours-section-titre {
    font-size: 1rem;
  }
  
  .blancs-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-verifier-blancs,
  .btn-voir-reponses {
    width: 100%;
    text-align: center;
  }
  
  .cours-progress-wrap {
    flex-wrap: wrap;
  }
  
  .cours-progress-label {
    font-size: 0.7rem;
  }
}

/* ========================================
   SCROLLBAR PERSONNALISÉE
   ======================================== */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

/* ========================================
   IMPRESSION
   ======================================== */

@media print {
  .cours-toc, 
  .cours-progress-wrap, 
  .blancs-actions,
  .cours-hero::before,
  .cours-hero::after {
    display: none !important;
  }
  
  .cours-layout { 
    grid-template-columns: 1fr;
    padding: 0;
  }
  
  .cours-hero {
    background: #2c3e50;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 1rem;
  }
  
  .cours-section { 
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .c-blank { 
    border: 1px solid #999;
    min-width: 80px;
    background: transparent;
  }
  
  .c-blank.valid {
    border-color: #999;
  }
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .cours-section,
  .cours-toc-list a,
  .btn-verifier-blancs,
  .btn-voir-reponses {
    animation: none;
    transition: none;
    transform: none;
  }
  
  .cours-section:hover {
    transform: none;
  }
}

.cours-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ── Liens outils en bas de page cours ── */
.cours-outils {
  margin: 40px auto 20px;
  max-width: 860px;
  padding: 0 16px;
}
.cours-outils h3 {
  font-size: 14px;
  color: #5587b7;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #d8e4f0;
}
.cours-outils .grid-3 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cours-outils .card {
  background: #f6faff;
  border: 1px solid #d0e2f4;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  text-align: center;
}
.cours-outils .card:hover {
  box-shadow: 0 4px 14px rgba(85,135,183,.15);
  transform: translateY(-2px);
}
.cours-outils .card-icon {
  font-size: 22px;
  margin-bottom: 6px;
}
.cours-outils .card h3 {
  font-size: 13px;
  color: #1a2040;
  margin: 0 0 4px;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}
.cours-outils .card p {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
  margin: 0 0 8px;
}
.cours-outils .card a {
  font-size: 11px;
  font-weight: 600;
  color: #5587b7;
  text-decoration: none;
}
.cours-outils .card a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .cours-outils .grid-3 { grid-template-columns: 1fr; }
}


/* ============================================================
   AJOUTS cours.css — navigation héros + bouton haut de page
   À COLLER À LA FIN DE /styles/cours.css
   ============================================================ */


/* ── Texte blanc dans tout le bandeau héros ── */
.cours-hero,
.cours-hero h1,
.cours-hero .cours-hero-desc,
.cours-hero .cours-hero-badge,
.cours-breadcrumb,
.cours-breadcrumb a,
.cours-breadcrumb .sep,
.cours-breadcrumb .current {
  color: #fff;
}

.cours-breadcrumb a:hover {
  text-decoration: underline;
  color: rgba(255, 255, 255, 0.85);
}


/* ── Barre de navigation 2 colonnes ── */
.cours-hero-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  flex-wrap: wrap;
}

/* Colonne gauche : liens de navigation */
.cours-hero-nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Colonne droite : outils */
.cours-hero-nav-tools {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Label "Outils :" */
.hero-tools-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  white-space: nowrap;
  margin-right: 0.1rem;
}

/* Liens communs nav + outils */
.cours-hero-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.cours-hero-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Lien actif (page courante) */
.cours-hero-nav a.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  pointer-events: none; /* pas cliquable sur la page courante */
}

/* Séparateur visuel entre navigation et outils */
.cours-hero-nav-tools {
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 0.75rem;
}

/* Responsive : empilé sur mobile */
@media (max-width: 600px) {
  .cours-hero-nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .cours-hero-nav-tools {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    padding-left: 0;
    padding-top: 0.5rem;
    width: 100%;
  }
}


/* ── Bouton "Haut de page" dans le sommaire ── */
#toc-top-btn {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-muted, #777);
  font-size: 0.83rem;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  /* Toujours visible au bas de la sidebar sticky */
  position: sticky;
  bottom: 1rem;
}

#toc-top-btn:hover {
  background: var(--color-bg-alt, #f4f4f4);
  color: var(--color-text, #333);
}

/* Masqué quand l'avatar est actif (via hidden attribute en JS) */
#toc-top-btn[hidden] {
  display: none;
}

/* ============================================================
   AJOUTS cours.css — navigation héros + bouton haut de page
   À COLLER À LA FIN DE /styles/cours.css
   ============================================================ */


/* ── Texte blanc dans tout le bandeau héros ── */
.cours-hero,
.cours-hero h1,
.cours-hero .cours-hero-desc,
.cours-hero .cours-hero-badge,
.cours-breadcrumb,
.cours-breadcrumb a,
.cours-breadcrumb .sep,
.cours-breadcrumb .current {
  color: #fff;
}

.cours-breadcrumb a:hover {
  text-decoration: underline;
  color: rgba(255, 255, 255, 0.85);
}


/* ── Barre de navigation 2 colonnes ── */
.cours-hero-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  flex-wrap: wrap;
}

/* Colonne gauche : liens de navigation */
.cours-hero-nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Colonne droite : outils */
.cours-hero-nav-tools {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 0.75rem;
}

/* Label "Outils :" */
.hero-tools-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Liens communs nav + outils */
.cours-hero-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.cours-hero-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Lien page courante */
.cours-hero-nav a.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  pointer-events: none;
  cursor: default;
}

/* Responsive mobile */
@media (max-width: 600px) {
  .cours-hero-nav {
    flex-direction: column;
    align-items: flex-start;
  }
  .cours-hero-nav-tools {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    padding-left: 0;
    padding-top: 0.5rem;
    width: 100%;
  }
}


/* ── Bouton "Haut de page" dans le sommaire ── */
#toc-top-btn {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-muted, #777);
  font-size: 0.83rem;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  position: sticky;
  bottom: 1rem;
}

#toc-top-btn:hover {
  background: var(--color-bg-alt, #f4f4f4);
  color: var(--color-text, #333);
}

#toc-top-btn[hidden] {
  display: none;
}

/* ============================================================
   AJOUTS — À coller à la fin de /styles/cours.css
   Navigation héros 2 colonnes + bouton haut de page
   ============================================================ */

/* Texte blanc dans tout le bandeau héros */
.cours-hero,
.cours-hero h1,
.cours-hero .cours-hero-desc {
  color: #fff;
}

/* Barre de navigation 2 colonnes */
.cours-hero-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  flex-wrap: wrap;
}

.cours-hero-nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.cours-hero-nav-tools {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 0.75rem;
}

.hero-tools-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  white-space: nowrap;
}

.cours-hero-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.cours-hero-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

.cours-hero-nav a.active {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  pointer-events: none;
  cursor: default;
}

@media (max-width: 600px) {
  .cours-hero-nav { flex-direction: column; align-items: flex-start; }
  .cours-hero-nav-tools {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    padding-left: 0;
    padding-top: 0.5rem;
    width: 100%;
  }
}

/* Bouton "Haut de page" dans le sommaire */
#toc-top-btn {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-muted, #777);
  font-size: 0.83rem;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  position: sticky;
  bottom: 1rem;
}

#toc-top-btn:hover {
  background: var(--color-bg-alt, #f4f4f4);
  color: var(--color-text, #333);
}

#toc-top-btn[hidden] { display: none; }

/* ============================================================
   Division posée — À coller à la fin de /styles/cours.css
   ============================================================ */

/* Conteneur global */
.division-posee {
  display: inline-flex;
  align-items: stretch;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  background: var(--color-bg-alt, #f8f8f8);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.75rem 0;
  gap: 0;
}

/* Colonne gauche : dividende, soustractions, restes intermédiaires */
.dp-gauche {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 0.6rem;
  min-width: 4rem;
}

.dp-dividende {
  font-weight: 700;
  padding-bottom: 0.15rem;
  border-bottom: 1.5px solid var(--color-text, #333);
  margin-bottom: 0.15rem;
  width: 100%;
  text-align: right;
}

.dp-sous {
  color: var(--color-text-muted, #555);
  font-size: 0.95em;
}

.dp-inter {
  border-bottom: 1px solid var(--color-border, #bbb);
  margin-bottom: 0.1rem;
  width: 100%;
  text-align: right;
  padding-bottom: 0.1rem;
}

.dp-reste {
  font-weight: 700;
  color: var(--color-primary, #1a6fb5);
}

/* Séparateur vertical */
.division-posee .dp-gauche {
  border-right: 2px solid var(--color-text, #333);
}

/* Colonne droite : diviseur (haut) et quotient (bas, après ligne) */
.dp-droite {
  display: flex;
  flex-direction: column;
  padding-left: 0.6rem;
  min-width: 3rem;
}

.dp-diviseur {
  font-weight: 700;
  padding-bottom: 0.15rem;
  border-bottom: 1.5px solid var(--color-text, #333);
  margin-bottom: 0.15rem;
}

.dp-quotient {
  font-weight: 700;
  color: var(--color-primary, #1a6fb5);
}

/* Inputs c-blank dans une division posée */
.division-posee .c-blank {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1em;
  border: none;
  border-bottom: 1.5px dashed var(--color-primary, #1a6fb5);
  background: transparent;
  text-align: center;
  padding: 0 0.1rem;
  min-width: 2rem;
}

/* Bloc cours-calcul (additions/soustractions posées) */
.cours-calcul pre {
  background: var(--color-bg-alt, #f8f8f8);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1em;
  display: inline-block;
  margin: 0.5rem 0;
}

.cours-calcul .c-blank {
  font-family: 'Courier New', Courier, monospace;
}
/* ═══════════════════════════════════════════════════════════
   PATCH cours.css
   1. Figures SVG : permettre le redimensionnement
   2. Symbole angle ∠ : espacement correct
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Figures SVG générées par JS ─────────────────────────
   Les fonctions SVG doivent utiliser :
     class="cours-svg"
   et NE PAS avoir de max-width en style inline.
   La règle ci-dessous prend le relais.
   ─────────────────────────────────────────────────────────── */
.cours-figure svg,
svg.cours-svg {
  display: block;
  width: 100%;        /* s'adapte au conteneur */
  height: auto;       /* conserve le ratio du viewBox */
  max-width: 100%;    /* jamais plus large que le parent */
}

/* Wrapper centré pour les figures SVG */
.cours-figure {
  text-align: center;
  margin: 1rem 0 0.5rem;
}

.cours-figure figcaption,
.cours-figure .figure-caption {
  font-size: 0.82rem;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   PATCH cours.css — à coller à la fin du fichier
   ═══════════════════════════════════════════════════════════ */

/* ── SVG redimensionnables (fix zoom + / -) ─────────────────
   Les fonctions SVG utilisent class="cours-svg" sans max-width
   inline → le mécanisme de zoom du cours fonctionne à nouveau.
   ─────────────────────────────────────────────────────────── */
.cours-figure svg,
svg.cours-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.cours-figure {
  text-align: center;
  margin: 1rem 0 0.5rem;
}

.cours-figure figcaption,
.cours-figure .figure-caption {
  font-size: 0.82rem;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}
/* ══════════════════════════════════════════════════════════════
   IMAGES PERSONNALISÉES ZOOMABLES + BOUTON AUDIO MOA
   (figures PNG/SVG exportées depuis GeoGebra, MathGraph32, etc.)
   ══════════════════════════════════════════════════════════════ */

.cours-figure-zoomable {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.2rem auto;
  max-width: 480px;          /* ← contrôle la taille à l'écran (ajuster si besoin) */
}

.cours-img-custom {
  width: 100%;               /* remplit le conteneur max-width:480px */
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.25s ease;
  background: #fff;
}

.cours-img-custom.zoomed {
  cursor: zoom-out;
  transform: scale(1.85);
  transform-origin: center center;
  z-index: 10;
  position: relative;
}

.cours-figure-zoomable figcaption {
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.4rem;
  text-align: center;
  font-style: italic;
}

/* ── Ligne dédiée au bouton audio sous une figure ────────────── */
.cours-audio-line {
  text-align: center;
  margin: 0.4rem 0 0.8rem 0;
}

.cours-img-audio {
  padding: 5px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #2980b9;
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.cours-img-audio:hover  { background: #1f6391; }
.cours-img-audio:active { transform: translateY(1px); }
.cours-img-audio:focus  { outline: 2px solid #5dade2; outline-offset: 2px; }
/* ============================================================
   jeux-liens.css — Liens vers les jeux depuis les pages pédagogiques
   Ajouter dans /styles/ et référencer dans chapitre.html,
   cours.html, activite.html, exercices.html, index.html
   ============================================================ */

/* --- Bandeau haut (cours-nav) : section Jeux sur la même ligne que Outils --- */
.hero-tools-sep {
    display: inline-block;
    width: 1px;
    height: 1em;
    background: rgba(255,255,255,.35);
    margin: 0 10px;
    vertical-align: middle;
}

.hero-jeu-link {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,.15);
    color: inherit;
    font-size: inherit;
    font-weight: 600;
    text-decoration: none;
    transition: background .16s;
}
.hero-jeu-link:hover { background: rgba(255,255,255,.28); }

/* --- Bloc archipel + jeux sous les cartes de chapitre.html --- */
.chap-game-bloc {
    background: #1e3038;
    border-radius: 14px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.chap-archipel-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: #f5f0e1;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    transition: background .16s;
}
.chap-archipel-link:hover { background: rgba(255,255,255,.07); }
.chap-archipel-icon { font-size: 1.6rem; flex-shrink: 0; }
.chap-archipel-link div { flex: 1; display: flex; flex-direction: column; }
.chap-archipel-link strong { font-size: .95rem; color: #f5f0e1; }
.chap-archipel-link span { font-size: .8rem; opacity: .7; margin-top: 2px; color: #f5f0e1; }
.chap-archipel-arrow { color: #9fc4d0; font-size: 1.2rem; flex-shrink: 0; }

.chap-jeux-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.chap-jeux-label {
    font-size: .82rem;
    font-weight: 700;
    color: #9fc4d0;
    white-space: nowrap;
    margin-right: 4px;
}

.chap-jeu-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.12);
    color: #f5f0e1;
    font-size: .86rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.2);
    transition: background .15s;
    white-space: nowrap;
}
.chap-jeu-btn:hover { background: rgba(255,255,255,.24); }

/* --- Index niveau : bouton Jeux par domaine --- */
.theme-title-wrap {
    display: flex;
    align-items: baseline;        /* était center → aligne sur le texte */
    gap: 12px;
    flex-wrap: wrap;
}

.theme-jeux-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 20px;
    background: #1a3a5c;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s;
    white-space: nowrap;
}
.theme-jeux-btn:hover { background: #142d48; }

/* --- Index niveau : bannière Archipel --- */
.archipel-banner { margin-bottom: 18px; }

.archipel-banner-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #1e3038, #2e4750);
    border-radius: 12px;
    color: #f5f0e1;
    text-decoration: none;
    transition: opacity .16s;
}
.archipel-banner-link:hover { opacity: .9; }
.archipel-banner-icon { font-size: 1.8rem; flex-shrink: 0; }
.archipel-banner-link div {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.archipel-banner-link strong { font-size: .97rem; }
.archipel-banner-link span { font-size: .82rem; opacity: .75; margin-top: 2px; }
.archipel-banner-arrow { font-size: 1.3rem; flex-shrink: 0; }

@media (max-width: 600px) {
    .chap-jeux-row { padding: 10px 14px; gap: 6px; }
    .chap-jeu-btn { font-size: .8rem; padding: 5px 9px; }
    .hero-tools-sep { display: none; }
}

/* --- Modale choix de jeu --- */
.jeux-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.jeux-modal[hidden] { display: none; }

.jeux-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
}

.jeux-modal-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 28px 28px 22px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
    text-align: center;
    animation: jmFadeIn .2s ease;
}
@keyframes jmFadeIn { from { opacity: 0; transform: scale(.95); } }

.jeux-modal-close {
    position: absolute;
    top: 10px; right: 14px;
    background: none; border: none;
    font-size: 24px; color: #999;
    cursor: pointer; line-height: 1;
}
.jeux-modal-close:hover { color: #333; }

.jeux-modal-box h3 {
    font-size: 1.15rem;
    margin: 0 0 6px;
    color: #1e3038;
}

.jeux-modal-scope {
    font-size: .85rem;
    color: #6b8a95;
    margin: 0 0 16px;
}

.jeux-modal-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jeux-modal-btn {
    display: block;
    padding: 12px 18px;
    border-radius: 10px;
    background: #1e3038;
    color: #f5f0e1;
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    transition: background .15s;
}
.jeux-modal-btn:hover { background: #2e4750; }
