body {
  touch-action: auto;
  margin: auto;
  overflow-x: hidden;
  font-family: var(--font-corps, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Trebuchet MS', Arial, sans-serif);
  font-weight: 400;
  padding-bottom: 5px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}



/* le titre : simple texte centré + filet d'accent, plus de « boîte » */
h1 {
  text-align: center;
  margin-top: 28px;
  margin-bottom: 44px;
  padding: 0 16px;
  font-family: var(--font-titres, 'Poppins', 'Segoe UI', sans-serif);
  font-size: clamp(1.9rem, 1.3rem + 2vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.2;
}


h2, h3 {
  font-family: var(--font-titres, 'Poppins', 'Segoe UI', sans-serif);
  letter-spacing: -0.2px;
}

h3 {
  font-weight: 600;
  font-style: normal;
  color: var(--accent-strong);
  margin-top: 1.2rem;
}

/* Le container */
.container {
  margin: 30px auto 0;
  width: 80%
}
@media screen and (max-width: 1200px) {
  .container {
    width: 95%;
  }
}


/* Les div dans container */

.container>div {
  overflow-x: auto;
  border-radius: var(--radius-carte, 20px);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}


.container>div h2 {
  display: flex;
  justify-content: left;
  align-items: center;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  border-radius: var(--radius-bloc, 12px);
  margin-top: 0;
}

.container>div h2 svg {
  margin-left: auto;
  /* Marge à gauche pour séparer le texte du bouton */
}




/* pour les introductions ayant des images */

.container > .introduction > .introtexteimage{
  display:flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-evenly;
  align-items: center;
}

.container > .introduction > .introtexteimage > *:first-child {
  max-width: 45%;
}

.container > .introduction > .introtexteimage > *:nth-child(2) {
  margin: auto;
  text-align: center;
  max-width: 45%;
}


@media screen and (max-width: 768px) {
  .container > .introduction > .introtexteimage{
    display:flex;
    flex-direction: column-reverse;
    flex-wrap: wrap;
    justify-content: space-evenly;
  
  }
  
  .container > .introduction > .introtexteimage > *:first-child {
    max-width: 100%;
  }
  
  .container > .introduction > .introtexteimage > *:nth-child(2) {
    margin: auto;
    text-align: center;
    max-width: 100%;
  }
}





/* Pour les videos */

.imagecentree video {
  max-width: 100%;
}



/* pour les introductions ayant des videos */






.container > .introduction > .introtextevideo{
  display:flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.container > .introduction > .introtextevideo > *:first-child {
  max-width: 35%;
}

.container > .introduction > .introtextevideo > *:nth-child(2) {
  margin: auto;
  text-align: center;
  max-width: 65%;
  padding:0;
  margin:0;
}


@media screen and (max-width: 1300px) {
  .container > .introduction > .introtextevideo{
    display:flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: space-evenly;
  
  }
  
  .container > .introduction > .introtextevideo > *:first-child {
    max-width: 100%;
  }
  
  .container > .introduction > .introtextevideo > *:nth-child(2) {
    /* margin: auto; */
    /* text-align: center; */
    padding:0;
    margin:0;
    max-width: 100%;
  }
}







.exemple,
.demonstration {
  font-style: italic;
}





.date {
  margin: auto;
  text-align: center;
  font-size: 30px;
  text-decoration: underline;
}













/* quelques outils de style */

.flex{
  display:flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-evenly;
}



.btn {
  display: inline-block;
  padding: 12px 26px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-bouton, 10px); /* Coins arrondis */
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px); /* Légère élévation au survol */
}

.imagecentree {
  margin: auto;
  text-align: center;
  width: 90%;
  max-width: 1000px;
}

img,
iframe{
  max-width: 100%;
  border-radius: 8px;
  margin-top: 5px;
  margin-bottom: 5px;
}

/* Schémas graphviz des cours, inlinés dans la page (templates <app>/svg/…).
   Tout y est tracé en currentColor et sans fond : le schéma prend la couleur
   du texte de la carte qui l'entoure, donc il suit les 6 thèmes — et tout
   thème futur — sans une seule règle par thème. */
.schema {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 5px auto;
  /* Couleur de texte principale du thème, et non celle de la carte : un schéma
     reste également lisible dans une leçon, un exemple ou un exercice. */
  color: var(--body-text);
}

/* Poids des arêtes d'un graphe pondéré : graphviz les pose au milieu de leur
   arête, parfois juste sur un croisement, et on ne sait plus à laquelle ils se
   rapportent. Un halo de la couleur de la carte interrompt le trait derrière
   le chiffre. paint-order le dessine sous le remplissage, donc le chiffre
   reste net. Cible les <g class="edge"> de graphviz, pas les <text> des nœuds. */
.schema .edge text {
  paint-order: stroke;
  stroke: var(--schema-halo);
  stroke-width: 4px;
  stroke-linejoin: round;
}

video {
  border-radius: 10px;           /* ↴ ajustez à votre goût (px, em, rem…) */
  overflow: hidden;
}

.milieu {
  text-align: center;
}

.italique {
  font-style: italic;
}

/* -- Note « À faire dans le cahier » (présentation des maquettes :
      crayon + filet d'accent à gauche ; remplace l'ancien .italique) -- */
.note-cahier {
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--note-cahier-text, var(--muted-text));
  border-left: 3px solid var(--note-cahier-accent, currentColor);
  padding-left: 12px;
  margin: 0 0 14px;
}

.note-cahier svg {
  flex: none;
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Moderniste assume ses notes en capitales, sans italique */
html[data-theme="moderniste"] .note-cahier {
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
  font-weight: 600;
  border-left-width: 4px;
}

.souligne {
  text-decoration: underline;
}

.gras,
.engras {
  font-weight: bold;
}








/* pour le code informatique dans les balises pre et code */

.conteneur_pre {
  position: relative;
}

pre {
  max-width: 100vw;
  border-radius: var(--radius-bloc, 12px);
  tab-size: 5;
  overflow: auto;
  box-shadow: inset 0 0 0 1px var(--code-border);
  /* cursor: pointer; */
  /* padding:20px; */
}

#copyMessage {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 14px;
  animation: fadeOut 1.5s ease-out;
  display: none;
}

.clipboard_svg {
  position: absolute;
  top: 5px;
  right: 5px;
  cursor: pointer;
  z-index: 10;
}



@media screen and (max-width: 500px) {
  .clipboard_svg {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    width: 20px;
    height: 20px;
  }
}


code {
  font-style: normal;
  padding: 2px 6px;
  border-radius: var(--radius-bouton, 6px);
  font-family: var(--font-mono);
  font-size: 0.95em;
  font-weight: 600;
  margin: 0 2px;
  cursor: pointer;
}

pre {
  font-family: var(--font-mono);
}

/* JetBrains Mono (thème flux) active ses ligatures de programmation :
   >= <= != -> == seraient fusionnés en un seul glyphe. En cours
   d'informatique le code doit se lire caractère par caractère. */
code,
pre,
.repl,
.repl-input {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

pre code {
  min-height: 65px;
  cursor: text;
  align-items: center;
  color: inherit;
  padding: 0;
  border: none;
  font-family: inherit;
  font-size: 1.1em;
  font-weight: 400;
}











/* les tables */

table {
  width: 100%; /* Adapte la table à la largeur du conteneur */
  border-collapse: collapse; /*Fusionne les bordures adjacentes*/
  margin-bottom: 1rem; /* Ajoute un espace en dessous de la table */
  font-size: 16px; /* Taille de police lisible */
}

/* Bordure et espacement des cellules */
table th, table td {
  padding: 8px; /* Espacement interne des cellules */
  text-align: center; /* Alignement du texte à gauche */
}

/* Style des en-têtes de colonne */
table th {
  font-weight: bold; /* Met en gras les en-têtes */
}

.donnees-table th,
.donnees-table td {
  text-align: left;
  vertical-align: top;
}

.donnees-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.site-footer {
  box-sizing: border-box;
  width: min(95%, 1200px);
  margin: 1.5rem auto;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted-text);
}

.site-footer a {
  color: var(--link-color);
}

.site-footer a:hover {
  color: var(--link-hover);
}

























/* Pour le menu !!! */

/* -- Groupe d'outils à droite de la navbar : thème, utilisateur, connexion -- */
.nav-outils {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 14px;
}

#boutonmodejournuit {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid color-mix(in srgb, var(--navbar-text) 35%, transparent);
  border-radius: var(--radius-bouton, 8px);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

#boutonmodejournuit:hover {
  background-color: var(--navbar-hover-bg);
}

#boutonmodejournuit .theme-icone {
  display: block;
}

/* Le padding natif du bouton rend sa zone intérieure plus étroite que le SVG.
   La boîte du soleil déborde alors d'un pixel à droite ; le croissant de lune,
   visuellement asymétrique, ne doit pas recevoir cette compensation. */
#boutonmodejournuit .theme-icone-soleil {
  transform: translateX(-1px);
}

/* Bouton Connexion / Déconnexion, façon btn-primary des maquettes.
   Il se pose sur la navbar et non sur le fond de page : ses couleurs
   viennent des --navbar-btn-* (qui reprennent les --btn-* dans les
   thèmes où navbar et corps s'accordent), sans quoi un thème à navbar
   contrastée le rendrait invisible. Les --btn-* servent de secours. */
.btn-connexion {
  display: inline-block;
  padding: 7px 16px;
  font-size: var(--navbar-liens-taille, 14px);
  font-weight: 600;
  font-family: var(--font-titres, 'Poppins', sans-serif);
  text-decoration: none;
  border: none;
  cursor: pointer;
  color: var(--navbar-btn-text, var(--btn-text));
  background: var(--navbar-btn-bg, var(--btn-bg));
  border-radius: var(--radius-bouton, 10px);
  box-shadow: var(--navbar-btn-shadow, var(--btn-shadow));
  white-space: nowrap;
  transition: background 0.2s ease;
}

.btn-connexion:hover {
  background: var(--navbar-btn-bg-hover, var(--btn-bg-hover));
}

/* Repli petits écrans : la marque et le bouton connexion deviennent des icônes
   (sinon la navbar déborde et décale toute la page). Icônes cachées par défaut. */
.brand-icone,
.btn-connexion-icone {
  display: none;
}

@media screen and (max-width: 500px) {
  .navbar {
    padding: 10px 12px;
  }

  .nav-outils {
    gap: 8px;
    margin-left: 8px;
  }

  .navbar .brand {
    display: grid;
    place-items: center;
  }

  .brand-texte {
    display: none;
  }

  .brand-icone {
    display: block;
    width: 26px;
    height: 26px;
  }

  .btn-connexion-texte {
    display: none;
  }

  .btn-connexion {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
  }

  .btn-connexion-icone {
    display: block;
    width: 18px;
    height: 18px;
  }
}

/* -- Menu déroulant de choix du thème (construit par theme.js) -- */
.theme-menu {
  position: relative;
  display: inline-flex;
}

.theme-menu-panneau {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: var(--radius-bloc, 14px);
  background-color: var(--dropdown-bg);
  backdrop-filter: var(--dropdown-blur);
  -webkit-backdrop-filter: var(--dropdown-blur);
  box-shadow: 0 12px 32px rgba(20, 35, 50, 0.22);
  z-index: 20;

  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.theme-menu.open .theme-menu-panneau {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.theme-menu-titre {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-titres, 'Poppins', sans-serif);
  color: var(--muted-text);
  padding: 8px 10px 4px;
}

.theme-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-bouton, 8px);
  color: var(--dropdown-link-color);
  font-family: var(--font-titres, 'Poppins', sans-serif);
  font-size: 0.92rem;
  transition: background-color 0.18s ease;
}

.theme-menu-item:hover {
  background-color: var(--dropdown-link-hover-bg);
}

.theme-coche {
  opacity: 0;
  font-weight: 700;
}

.theme-menu-item.actif .theme-coche {
  opacity: 1;
  color: var(--accent);
}

/* Pastille d'aperçu : les couleurs propres à chaque thème */
.theme-pastille {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-left: auto;
  border: 1px solid rgba(127, 127, 127, 0.45);
}

.theme-menu-item[data-theme="historique-clair"] .theme-pastille {
  background: linear-gradient(135deg, #f7fafc 50%, #456177 50%);
}

.theme-menu-item[data-theme="historique-sombre"] .theme-pastille {
  background: linear-gradient(135deg, #0f2438 50%, #6e94b3 50%);
}

.theme-menu-item[data-theme="nocturne"] .theme-pastille {
  background: conic-gradient(from 40deg, #151725, #4f5577, #70669d, #c2bbe8, #151725);
}

.theme-menu-item[data-theme="aquarelle"] .theme-pastille {
  background: conic-gradient(from 40deg, #f5cfc0, #c5dadd, #f7edda, #f5cfc0);
}

.theme-menu-item[data-theme="moderniste"] .theme-pastille {
  background: linear-gradient(135deg, #f3f2f2 50%, #ec3013 50%);
}

.theme-menu-item[data-theme="flux"] .theme-pastille {
  background: conic-gradient(from 35deg, #0d1219, #ff7a21, #3d9cff, #49e3c1, #0d1219);
}

/* Sur petit écran le bouton thème est trop à gauche : ancré au bouton
   (right: 0), le panneau sortirait de l'écran. On l'ancre donc au viewport,
   sous la navbar (comme le panneau de navigation).
   ⚠️ Ce bloc doit rester APRÈS la règle .theme-menu-panneau ci-dessus :
   à spécificité égale, c'est la dernière règle qui gagne. */
@media screen and (max-width: 500px) {
  .theme-menu-panneau {
    position: fixed;
    top: calc(var(--navbar-h, 64px) + 8px);
    right: 12px;
    left: auto;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - var(--navbar-h, 64px) - 24px);
    overflow-y: auto;
  }
}





.navbar {
  background: var(--navbar-bg);
  position: sticky;
  top: 0;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.left-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.navbar .brand {
  cursor: pointer;
  font-size: 24px;
  font-family: var(--font-titres, 'Poppins', sans-serif);
  font-weight: 600;
  letter-spacing: -0.5px;
  color: white;
  text-decoration: none;
}

/* Pastille « Bonjour prénom » quand l'utilisateur est connecté */
.pastille-utilisateur {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--navbar-text, #fff);
  font-family: var(--font-titres, 'Poppins', sans-serif);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

@media screen and (max-width: 700px) {
  .pastille-utilisateur {
    display: none;
  }
}


.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  /* touche moderne : les catégories regroupées à droite, en plus petit */
  justify-content: flex-end;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.titres_menu {
  padding: 8px 12px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: var(--navbar-liens-taille, 14px);
  font-family: var(--font-titres, 'Poppins', sans-serif);
  background-color: rgba(0, 0, 0, 0);
  color: white;
  border-radius: var(--radius-bouton, 10px);
  transition: background-color 0.2s ease;
}

.titres_menu:hover {
  background-color: var(--navbar-hover-bg);
}

.dropdown-content {
  position: absolute;
  min-width: 200px;
  max-width: 250px;
  z-index: 1;
  border-radius: var(--radius-bloc, 14px);
  padding: 10px;
  max-height: 80vh;
  overflow-y: auto;

  /* fermé par défaut, apparition en fondu + translation */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.dropdown.open .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}



.dropdown-content a {
  padding: 10px 14px;
  text-decoration: none;
  display: block;
  border-radius: var(--radius-bouton, 8px);
  transition: background-color 0.18s ease;

  white-space: nowrap;       /* Empêche le texte de s'étendre sur plusieurs lignes */
  overflow: hidden;          /* Cache l'excès de texte */
  text-overflow: ellipsis;   /* Ajoute des points de suspension (...) */
  /* width: 300px; */
  max-width: 80vw;

}




.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 10px;
  position: relative;
  z-index: 1001; /* Pour rester au-dessus des autres éléments */
}

.hamburger-line {
  display: block;
  width: 30px;
  height: 3px;
  margin: 5px auto;
  background-color: var(--navbar-text, white);
  transition: all 0.3s ease-in-out;
}

/* L'état actif où le menu est ouvert */
.hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}





@media screen and (max-width: 1300px) {



  #boutonmodejournuit {
    margin-left: 0px;
  }

  /* Panneau latéral coulissant (remplace l'ancien menu pleine page) */
  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    position: fixed;
    right: 0;
    top: var(--navbar-h, 64px);
    width: min(420px, 100vw);
    height: calc(100dvh - var(--navbar-h, 64px));
    padding: 18px 20px 40px;
    overflow-y: auto;
    border-radius: 0;
    box-sizing: border-box;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s ease;
    z-index: 3;
  }

  .nav-links.show {
    transform: none;
    visibility: visible;
  }


  .dropdown {
    width: 100%;
    text-align: right;
  }

  .titres_menu {
    width: 100%;
    text-align: right;
    padding: 12px 14px;
  }


  /* En mobile les sous-menus se déplient dans le flux du panneau */
  .dropdown-content {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    max-height: none;
  }

  .dropdown.open .dropdown-content {
    display: block;
  }

  .dropdown-content a{
    max-width: 100%;
  }

  .hamburger {
    display: block;
  }
}




/* =============================================================
   Aides de navigation des cours (injectées par ux_cours.js)
   ============================================================= */

html {
  scroll-behavior: smooth;
}

/* les ancres du sommaire ne doivent pas passer sous la navbar sticky */
h1[id], h2[id], h3[id] {
  scroll-margin-top: calc(var(--navbar-h, 64px) + 20px);
}


/* -- Fil d'Ariane -- */
.fil-ariane {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted-text);
  margin: 0 4px 18px;
}

.fil-ariane a {
  color: var(--muted-text);
  text-decoration: none;
}

.fil-ariane a:hover {
  text-decoration: underline;
}

.fil-ariane strong {
  font-weight: 600;
  color: var(--body-text);
}


/* -- Liens chapitre précédent / suivant -- */
.nav-chapitres {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 30px 0 40px;
}

.nav-chapitres a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  max-width: 48%;
  padding: 14px 18px;
  border-radius: var(--radius-bloc, 14px);
  text-decoration: none;
  background-color: var(--container-bg);
  border: var(--container-border);
  box-shadow: var(--container-shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.nav-chapitres a:hover {
  box-shadow: var(--container-shadow-hover);
  transform: translateY(-2px);
}

.nav-chapitres .chapitre-suivant {
  margin-left: auto;
  text-align: right;
}

.nav-chapitres small {
  color: var(--muted-text);
  font-weight: 600;
}

.nav-chapitres span {
  color: var(--body-text);
  font-weight: 500;
}

@media screen and (max-width: 700px) {
  .nav-chapitres {
    flex-direction: column;
  }

  .nav-chapitres a,
  .nav-chapitres .chapitre-suivant {
    max-width: 100%;
    margin-left: 0;
  }
}


/* -- Sommaire flottant -- */
.sommaire-flottant {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  font-family: var(--font-titres, 'Poppins', 'Segoe UI', sans-serif);
}

.sommaire-bouton {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--btn-text);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
}

.sommaire-bouton:hover {
  background: var(--btn-bg-hover);
}

.sommaire-panneau {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 36px));
  max-height: min(60vh, 480px);
  overflow-y: auto;
  padding: 10px;
  border-radius: var(--radius-bloc, 14px);
  background-color: var(--dropdown-bg);
  backdrop-filter: var(--dropdown-blur);
  -webkit-backdrop-filter: var(--dropdown-blur);
  box-shadow: 0 12px 32px rgba(20, 35, 50, 0.22);
}

.sommaire-panneau a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-bouton, 8px);
  color: var(--dropdown-link-color);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sommaire-panneau a:hover {
  background-color: var(--dropdown-link-hover-bg);
}

/* entrées correspondant à une leçon : même rouge que les titres .h2-lecon */
.sommaire-panneau a.lien-lecon {
  color: var(--lecon-h2-text);
}

.sommaire-panneau a.actif {
  background-color: var(--dropdown-link-hover-bg);
  font-weight: 600;
}


/* -- Bouton retour en haut -- */
.retour-haut {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--btn-text);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.retour-haut.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.retour-haut:hover {
  background: var(--btn-bg-hover);
}




/* =============================================================
   Apparition en fondu des cartes (effet_fondu_scroll.js)
   ============================================================= */

/* spécificité > .container > div pour que transform/opacity s'animent
   en plus des transitions de thème définies dans couleur.css */
.container > .carte-fondu {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out,
              background-color 0.35s ease, color 0.35s ease,
              border-color 0.35s ease, box-shadow 0.35s ease;
}

.container > .carte-fondu.carte-visible {
  opacity: 1;
  transform: none;
}




/* =============================================================
   Accessibilité
   ============================================================= */

:focus-visible {
  outline: 3px solid var(--accent-blue, #2f5d8a);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}


/* =============================================================
   Tableau de bord de l'élève
   ============================================================= */

.tableau-bord {
  width: min(100%, 1080px);
  box-sizing: border-box;
  margin: 24px auto 48px;
  padding: 1.5rem;
  perspective: 1200px;
}

.tableau-bord-entete {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: center;
  gap: 34px;
  min-height: 210px;
  margin-bottom: 28px;
  padding: 8px 34px;
}

.tableau-bord-entete h1 {
  margin: 6px 0 12px;
  font-size: clamp(2.1rem, 5vw, 3.7rem);
  line-height: 1.04;
}

.tableau-bord-entete-texte > p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted-text);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.tableau-bord-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-family: var(--font-titres);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tableau-bord-embleme {
  position: relative;
  width: 180px;
  height: 180px;
  justify-self: end;
  color: var(--accent-strong);
}

.tableau-bord-orbite,
.tableau-bord-embleme-centre,
.tableau-bord-astre {
  position: absolute;
  display: block;
  box-sizing: border-box;
  border-radius: 50%;
}

.tableau-bord-orbite {
  border: 1px solid var(--table-border);
}

.tableau-bord-orbite-exterieure {
  inset: 4px;
}

.tableau-bord-orbite-exterieure::before,
.tableau-bord-orbite-exterieure::after {
  position: absolute;
  width: 11px;
  height: 11px;
  content: "";
  background: var(--accent);
  border: 3px solid var(--body-bg-solid);
  border-radius: 50%;
  box-shadow: var(--container-shadow);
}

.tableau-bord-orbite-exterieure::before {
  top: 12px;
  left: 23px;
}

.tableau-bord-orbite-exterieure::after {
  right: 9px;
  bottom: 42px;
}

.tableau-bord-orbite-interieure {
  inset: 28px;
  border-style: dashed;
}

.tableau-bord-embleme-centre {
  inset: 48px;
  display: grid;
  place-items: center;
  color: var(--btn-text);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
}

.tableau-bord-embleme-centre svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tableau-bord-astre {
  background: var(--accent-soft);
}

.tableau-bord-astre-un {
  top: 15px;
  right: 37px;
  width: 20px;
  height: 20px;
}

.tableau-bord-astre-deux {
  bottom: 11px;
  left: 47px;
  width: 13px;
  height: 13px;
}

.tableau-bord-reprise-carte {
  --inclinaison-x: 0deg;
  --inclinaison-y: 0deg;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  gap: 38px;
  overflow: hidden;
  padding: clamp(26px, 5vw, 52px);
  background: var(--lecon-bg);
  border: var(--lecon-border);
  border-left: var(--lecon-border-left);
  border-radius: var(--radius-carte);
  box-shadow: var(--container-shadow);
  transform: rotateX(var(--inclinaison-x)) rotateY(var(--inclinaison-y));
  transform-style: preserve-3d;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tableau-bord-reprise-carte:hover {
  box-shadow: var(--container-shadow-hover);
}

.tableau-bord-reprise-carte::after {
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  bottom: -130px;
  content: "";
  background: var(--accent-soft);
  border-radius: 50%;
  opacity: 0.48;
  pointer-events: none;
}

.tableau-bord-reprise-contenu,
.tableau-bord-livre-reprise {
  position: relative;
  z-index: 1;
}

.tableau-bord-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-bouton);
  font-size: 0.78rem;
  font-weight: 700;
}

.tableau-bord-reprise-carte h2 {
  display: block;
  max-width: 700px;
  margin: 0 0 14px;
  padding: 0;
  color: var(--h1-text);
  background: transparent;
  border: 0;
  font-size: clamp(1.65rem, 3.6vw, 2.65rem);
  line-height: 1.12;
}

.tableau-bord-reprise-carte p {
  max-width: 580px;
  margin: 0;
  color: var(--muted-text);
}

.tableau-bord-reprise,
.tableau-bord-refaire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
}

.tableau-bord-reprise {
  margin-top: 28px;
  color: var(--btn-text);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
}

.tableau-bord-reprise:hover,
.tableau-bord-deconnexion:hover {
  color: var(--btn-text);
  background: var(--btn-bg-hover);
}

.tableau-bord-reprise svg,
.tableau-bord-refaire svg,
.tableau-bord-deconnexion svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tableau-bord-livre-reprise {
  display: block;
  width: min(100%, 240px);
  justify-self: end;
  color: var(--h1-text);
  text-decoration: none;
  transform: translateY(0);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.tableau-bord-livre-reprise:hover {
  color: var(--h1-text);
  transform: translateY(-4px);
  filter: drop-shadow(0 10px 18px var(--accent-soft));
}

.tableau-bord-livre-reprise:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: var(--radius-bouton);
}

.tableau-bord-livre-scene {
  position: relative;
  display: block;
  width: 100%;
  height: 170px;
  perspective: 900px;
}

.tableau-bord-livre-ombre {
  position: absolute;
  right: 20px;
  bottom: 5px;
  width: 200px;
  height: 15px;
  background: var(--accent-soft);
  border-radius: 50%;
  filter: blur(5px);
  opacity: 0.72;
  transform: scaleX(0.5);
  transform-origin: right center;
}

.tableau-bord-livre-corps {
  position: absolute;
  top: 17px;
  left: 20px;
  width: 200px;
  height: 130px;
  transform: rotateX(7deg) rotateZ(-1deg);
  transform-style: preserve-3d;
}

.tableau-bord-livre-plat-dessous,
.tableau-bord-livre-page-droite,
.tableau-bord-livre-feuillet,
.tableau-bord-livre-couverture {
  position: absolute;
  top: 0;
  left: 100px;
  width: 100px;
  height: 130px;
  box-sizing: border-box;
}

.tableau-bord-livre-plat-dessous {
  z-index: 0;
  background: var(--accent);
  border: 2px solid var(--accent-strong);
  border-radius: 0 var(--radius-bloc) var(--radius-bloc) 0;
  transform: translate3d(4px, 5px, -7px);
}

.tableau-bord-livre-page-droite {
  z-index: 1;
  overflow: hidden;
  background: var(--body-bg-solid);
  border: 2px solid currentColor;
  border-left-width: 1px;
  border-radius: 0 var(--radius-bloc) var(--radius-bloc) 0;
  box-shadow: inset 12px 0 20px var(--accent-soft);
}

.tableau-bord-livre-feuillet {
  transform-origin: left center;
  transform-style: preserve-3d;
}

.tableau-bord-livre-feuillet-marque {
  z-index: 3;
  transform: translateZ(3px) rotateY(0deg);
}

.tableau-bord-livre-feuillet-deux {
  z-index: 5;
  transform: translateZ(5px) rotateY(0deg);
}

.tableau-bord-livre-feuillet-un {
  z-index: 7;
  transform: translateZ(7px) rotateY(0deg);
}

.tableau-bord-livre-marque-page {
  position: absolute;
  z-index: 4;
  top: -12px;
  left: 14px;
  width: 18px;
  height: 88px;
  background: var(--lecon-accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  filter: drop-shadow(0 3px 3px var(--accent-soft));
  transform: translateZ(-4px);
  transform-origin: top center;
}

.tableau-bord-livre-couverture {
  z-index: 9;
  transform: translateZ(9px) rotateY(0deg);
  transform-origin: left center;
  transform-style: preserve-3d;
}

.tableau-bord-livre-face {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
  overflow: hidden;
  backface-visibility: hidden;
  border-radius: 0 var(--radius-bloc) var(--radius-bloc) 0;
}

.tableau-bord-livre-face-avant {
  background: var(--accent);
  border: 2px solid var(--accent-strong);
  box-shadow: inset 8px 0 16px var(--accent-soft), var(--container-shadow);
}

.tableau-bord-livre-face-avant::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
  content: "";
  background: var(--accent-strong);
  opacity: 0.7;
}

.tableau-bord-livre-titre,
.tableau-bord-livre-sous-titre {
  position: absolute;
  left: 28px;
  display: block;
  height: 3px;
  background: var(--body-bg-solid);
  border-radius: var(--radius-bouton);
}

.tableau-bord-livre-titre {
  top: 45px;
  width: 48px;
}

.tableau-bord-livre-sous-titre {
  top: 58px;
  width: 34px;
  opacity: 0.75;
}

.tableau-bord-livre-face-interieure {
  background: var(--body-bg-solid);
  border: 2px solid currentColor;
  border-right-width: 1px;
  border-radius: var(--radius-bloc) 0 0 var(--radius-bloc);
  box-shadow: inset -12px 0 20px var(--accent-soft);
  transform: rotateY(180deg);
}

.tableau-bord-livre-page-recto,
.tableau-bord-livre-page-verso {
  background: var(--body-bg-solid);
  border: 1px solid currentColor;
  box-shadow: inset 10px 0 18px var(--accent-soft);
}

.tableau-bord-livre-page-recto {
  border-radius: 0 var(--radius-bloc) var(--radius-bloc) 0;
}

.tableau-bord-livre-page-verso {
  border-radius: var(--radius-bloc) 0 0 var(--radius-bloc);
  box-shadow: inset -10px 0 18px var(--accent-soft);
  transform: rotateY(180deg);
}

.tableau-bord-livre-page-droite > span,
.tableau-bord-livre-face-interieure > span,
.tableau-bord-livre-page-recto > span,
.tableau-bord-livre-page-verso > span {
  position: absolute;
  left: 21px;
  width: 58px;
  height: 2px;
  background: var(--muted-text);
  border-radius: var(--radius-bouton);
  opacity: 0.68;
}

.tableau-bord-livre-page-droite > span:nth-child(1),
.tableau-bord-livre-face-interieure > span:nth-child(1),
.tableau-bord-livre-page-recto > span:nth-child(1),
.tableau-bord-livre-page-verso > span:nth-child(1) {
  top: 38px;
}

.tableau-bord-livre-page-droite > span:nth-child(2),
.tableau-bord-livre-face-interieure > span:nth-child(2),
.tableau-bord-livre-page-recto > span:nth-child(2),
.tableau-bord-livre-page-verso > span:nth-child(2) {
  top: 54px;
}

.tableau-bord-livre-page-droite > span:nth-child(3),
.tableau-bord-livre-face-interieure > span:nth-child(3),
.tableau-bord-livre-page-recto > span:nth-child(3),
.tableau-bord-livre-page-verso > span:nth-child(3) {
  top: 70px;
  width: 43px;
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-couverture {
  transform: translateZ(9px) rotateY(-179deg);
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-feuillet-un {
  transform: translateZ(7px) rotateY(-175deg);
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-feuillet-deux {
  transform: translateZ(5px) rotateY(-171deg);
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-feuillet-marque {
  transform: translateZ(3px) rotateY(-166deg);
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-marque-page {
  transform: translate3d(0, -7px, -10px) rotate(2deg);
}

.tableau-bord-livre-reprise.est-ouvert .tableau-bord-livre-ombre {
  transform: scaleX(1);
}

.tableau-bord-consolidation {
  margin-top: 48px;
}

.tableau-bord-section-entete {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin: 0 4px 20px;
}

.tableau-bord-section-entete h2 {
  display: block;
  margin: 5px 0 0;
  padding: 0;
  color: var(--h1-text);
  background: transparent;
  border: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.tableau-bord-section-entete > p {
  max-width: 420px;
  margin: 0;
  color: var(--muted-text);
  text-align: right;
}

.tableau-bord-liste {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tableau-bord-liste-unique {
  grid-template-columns: minmax(0, 400px);
}

.tableau-bord-automatisme {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  min-height: 205px;
  padding: 22px;
  color: var(--texte-lecon-exemple);
  background: var(--exercice-bg);
  border: var(--exercice-border);
  border-radius: var(--radius-carte);
  box-shadow: var(--container-shadow);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tableau-bord-automatisme:hover {
  color: var(--texte-lecon-exemple);
  border-color: var(--accent);
  box-shadow: var(--container-shadow-hover);
  transform: translateY(-4px);
}

.tableau-bord-score {
  align-self: flex-start;
  color: var(--exercice-h2-text);
  background: var(--exercice-h2-bg);
  border: var(--exercice-h2-border-left);
}

.tableau-bord-automatisme > strong {
  margin: 19px 0 auto;
  font-family: var(--font-titres);
  font-size: 1.02rem;
  line-height: 1.35;
}

.tableau-bord-jauge {
  display: block;
  height: 7px;
  margin: 22px 0 13px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-bouton);
}

.tableau-bord-jauge > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.8s cubic-bezier(.2,.8,.2,1);
}

.tableau-bord-automatisme-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tableau-bord-automatisme small {
  color: var(--muted-text);
}

.tableau-bord-refaire {
  color: var(--link-color);
  font-weight: 600;
  white-space: nowrap;
}

.tableau-bord-deconnexion-zone {
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--table-border);
}

.tableau-bord-deconnexion-zone form {
  margin: 0;
}

.tableau-bord-deconnexion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  color: var(--body-text);
  background: var(--container-bg);
  border: 1px solid var(--table-border);
  box-shadow: var(--container-shadow);
  font-size: 1.05rem;
}

.tableau-bord-deconnexion:hover {
  color: var(--body-text);
  background: var(--code-bg);
}

@media screen and (max-width: 700px) {
  .tableau-bord {
    margin-top: 12px;
    padding: 1rem;
  }

  .tableau-bord-entete {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 10px;
    min-height: 155px;
    padding: 4px 8px 18px;
  }

  .tableau-bord-embleme {
    width: 88px;
    height: 88px;
  }

  .tableau-bord-orbite-interieure {
    inset: 17px;
  }

  .tableau-bord-embleme-centre {
    inset: 25px;
  }

  .tableau-bord-embleme-centre svg {
    width: 24px;
    height: 24px;
  }

  .tableau-bord-astre-un {
    top: 5px;
    right: 18px;
    width: 12px;
    height: 12px;
  }

  .tableau-bord-astre-deux {
    bottom: 4px;
    left: 24px;
    width: 8px;
    height: 8px;
  }

  .tableau-bord-orbite-exterieure::before,
  .tableau-bord-orbite-exterieure::after {
    width: 7px;
    height: 7px;
    border-width: 2px;
  }

  .tableau-bord-orbite-exterieure::before {
    top: 4px;
    left: 13px;
  }

  .tableau-bord-orbite-exterieure::after {
    right: 2px;
    bottom: 19px;
  }

  .tableau-bord-reprise-carte {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 25px 22px;
  }

  .tableau-bord-reprise {
    width: 100%;
    box-sizing: border-box;
  }

  .tableau-bord-livre-reprise {
    width: min(78%, 230px);
    justify-self: center;
    margin-top: 8px;
  }

  .tableau-bord-section-entete {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .tableau-bord-section-entete > p {
    text-align: left;
  }

  .tableau-bord-liste {
    grid-template-columns: 1fr;
  }

  .tableau-bord-automatisme {
    min-height: 185px;
  }
}

@media screen and (min-width: 701px) and (max-width: 920px) {
  .tableau-bord-liste {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
