@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   ÉCOLE DE TRAMELAN — Plateforme de quiz
   Feuille de style de l'application (v3)
   --------------------------------------------------------------------------
   Direction : clair et éditorial. Papier blanc, gris chauds, bleu profond.
   Titres en serif, corps en sans-serif, grandes respirations, peu d'ornement.

   Conventions
   · Un seul fichier, chargé par toutes les pages.
   · Aucun !important hors impression et prefers-reduced-motion.
   · Aucune couleur en dur dans les composants : tout passe par les jetons.
   · Pas de dépendance à Bootstrap : ce fichier est autonome.
   ========================================================================== */

/* ==========================================================================
   1. JETONS
   ========================================================================== */

:root {
  /* --- Encres (textes) --------------------------------------------------- */
  --ink:      #17181C;
  --ink-2:    #565B66;
  --ink-3:    #868C97;
  --ink-on-dark: #FFFFFF;

  /* --- Papiers (fonds) -------------------------------------------------- */
  --paper:    #FFFFFF;
  --paper-2:  #FAF9F7;
  --paper-3:  #F2F0EC;
  --paper-4:  #E9E6E0;

  /* --- Filets ----------------------------------------------------------- */
  --rule:        #E4E1DB;
  --rule-strong: #CFCBC3;

  /* --- Bleu profond (couleur de marque) --------------------------------- */
  --blue:       #0F4C81;
  --blue-hover: #0C3D68;
  --blue-press: #092F51;
  --blue-soft:  #EDF3F9;
  --blue-ring:  rgba(15, 76, 129, 0.22);

  /* --- Couleurs de sens ------------------------------------------------- */
  --green:      #17694A;
  --green-soft: #EDF5F1;
  --red:        #A32B23;
  --red-soft:   #FBF0EF;
  --amber:      #A8681B;
  --amber-soft: #FBF5EC;

  /* --- Couleurs de matière (reprises de l'horaire) ----------------------- */
  --mat-maths:    #C77C2E;
  --mat-bio:      #2F7A52;
  --mat-physique: #B4443C;
  --mat-info:     #2A6199;
  --mat-autre:    #6B5E8A;

  /* --- Typographie ------------------------------------------------------ */
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;

  /* Échelle typographique — rapport 1.25, base 16 px */
  --t-xs:   0.75rem;
  --t-sm:   0.875rem;
  --t-base: 1rem;
  --t-md:   1.125rem;
  --t-lg:   1.375rem;
  --t-xl:   1.75rem;
  --t-2xl:  2.25rem;
  --t-3xl:  3rem;

  --leading-tight: 1.2;
  --leading-snug:  1.4;
  --leading-body:  1.65;

  /* --- Espacement (échelle 4 px) ---------------------------------------- */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;
  --s9: 6rem;

  /* --- Rayons ----------------------------------------------------------- */
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   14px;
  --radius-pill: 999px;

  /* --- Élévations (discrètes : l'éditorial préfère les filets) ----------- */
  --shadow-1: 0 1px 2px rgba(23, 24, 28, 0.05);
  --shadow-2: 0 2px 8px rgba(23, 24, 28, 0.07);
  --shadow-3: 0 8px 24px rgba(23, 24, 28, 0.10);
  --shadow-4: 0 20px 48px rgba(23, 24, 28, 0.16);

  /* --- Mouvement -------------------------------------------------------- */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --fast:      140ms var(--ease);
  --normal:    220ms var(--ease);
  --slow:      340ms var(--ease);

  /* --- Plans ------------------------------------------------------------ */
  --z-sticky: 100;
  --z-header: 200;
  --z-menu:   400;
  --z-scrim:  900;
  --z-dialog: 1000;
  --z-toast:  1100;

  /* --- Gabarit ---------------------------------------------------------- */
  --measure:    68ch;    /* longueur de ligne confortable */
  --page-max:   1140px;
  --page-wide:  1400px;
  --header-h:   68px;
}

/* ==========================================================================
   2. RÉINITIALISATION
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s3);
  font-family: var(--serif);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink);
  letter-spacing: -0.011em;
  text-wrap: balance;
}

h1 { font-size: var(--t-2xl); font-weight: 700; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }
h5, h6 { font-size: var(--t-base); font-family: var(--sans); font-weight: 600; }

p { margin: 0 0 var(--s4); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--s4); padding-left: var(--s5); }
li { margin-bottom: var(--s2); }

a {
  color: var(--blue);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--rule-strong);
  transition: color var(--fast), text-decoration-color var(--fast);
}

a:hover { color: var(--blue-hover); text-decoration-color: currentColor; }

strong, b { font-weight: 600; }
em, i { font-style: italic; }

small { font-size: var(--t-sm); }

code, kbd, samp, pre { font-family: var(--mono); font-size: 0.9em; }

code {
  padding: 0.15em 0.35em;
  background: var(--paper-3);
  border-radius: var(--radius-sm);
}

pre {
  overflow-x: auto;
  padding: var(--s4);
  background: var(--paper-3);
  border-radius: var(--radius);
}

hr {
  height: 0;
  margin: var(--s6) 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

img, svg, video, iframe { max-width: 100%; }
img, svg, video { height: auto; display: block; }

button { font: inherit; color: inherit; }

fieldset { margin: 0 0 var(--s5); padding: 0; border: 0; }

legend {
  padding: 0;
  margin-bottom: var(--s3);
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

::selection { background: var(--blue-soft); color: var(--blue-press); }

/* Focus : un seul traitement, partout, bien visible */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button, [role="button"], summary, label[for], select { cursor: pointer; }

/* ==========================================================================
   3. UTILITAIRES (jeu minimal, nommé en français)
   ========================================================================== */

.page       { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--s5); }
.page--large { max-width: var(--page-wide); }
.page--texte { max-width: 76ch; }

.pile       { display: flex; flex-direction: column; }
.pile--2 > * + * { margin-top: var(--s2); }
.pile--3 > * + * { margin-top: var(--s3); }
.pile--4 > * + * { margin-top: var(--s4); }
.pile--5 > * + * { margin-top: var(--s5); }
.pile--6 > * + * { margin-top: var(--s6); }

.ligne      { display: flex; align-items: center; gap: var(--s3); }
.ligne--haut { align-items: flex-start; }
.ligne--entre { justify-content: space-between; }
.ligne--fin  { justify-content: flex-end; }
.ligne--centre { justify-content: center; }
.ligne--souple { flex-wrap: wrap; }
.pousse     { margin-left: auto; }

.grille     { display: grid; gap: var(--s4); }
.grille--auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grille--2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grille--3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grille--4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.centre-texte { text-align: center; }
.discret    { color: var(--ink-2); }
.tres-discret { color: var(--ink-3); }
.chiffres   { font-variant-numeric: tabular-nums; }
.serif      { font-family: var(--serif); }
.nowrap     { white-space: nowrap; }
.pleine-largeur { width: 100%; }

.caché      { display: none; }

.pour-lecteur-ecran {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Lien d'évitement */
.lien-evitement {
  position: absolute;
  top: -100px;
  left: var(--s4);
  z-index: var(--z-toast);
  padding: var(--s3) var(--s5);
  background: var(--blue);
  color: var(--ink-on-dark);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--fast);
}

.lien-evitement:focus { top: 0; color: var(--ink-on-dark); }

/* ==========================================================================
   4. EN-TÊTE ET NAVIGATION
   ========================================================================== */

.entete {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.entete__interieur {
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: var(--header-h);
  width: 100%;
  max-width: var(--page-wide);
  margin-inline: auto;
  padding: var(--s2) var(--s5);
}

/* Marque : écusson + nom sur deux lignes serrées */
.marque {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  color: inherit;
  flex: none;
}

.marque:hover { color: inherit; text-decoration: none; }

.marque__ecusson {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: var(--ink-on-dark);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.marque__nom {
  display: block;
  font-family: var(--serif);
  font-size: var(--t-md);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.marque__sous {
  display: block;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Navigation : liens texte soulignés à l'état actif, sans pilules */
.nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
}

.nav__lien {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}

.nav__lien:hover {
  background: var(--paper-3);
  color: var(--ink);
  text-decoration: none;
}

.nav__lien[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--blue);
  border-radius: var(--radius) var(--radius) 0 0;
}

.nav__lien .ico { font-size: 0.95em; opacity: 0.75; }
.nav__lien[aria-current="page"] .ico { opacity: 1; color: var(--blue); }

/* Bloc de session à droite : classe connectée + sortie */
.session {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding-left: var(--s4);
  margin-left: var(--s2);
  border-left: 1px solid var(--rule);
  flex: none;
}

.session__classe {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: right;
}

.session__nom { font-size: var(--t-sm); font-weight: 600; }

.session__role {
  font-size: var(--t-xs);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bouton du menu sur petit écran */
.entete__bascule {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.entete__bascule:hover { background: var(--paper-3); }

/* ==========================================================================
   5. CONTENU ET PIED DE PAGE
   ========================================================================== */

.contenu {
  flex: 1 0 auto;
  width: 100%;
  padding: var(--s7) 0 var(--s8);
}

/* Titre de page : ligne de surtitre, titre serif, chapeau */
.titre-page { margin-bottom: var(--s6); }

.titre-page__sur {
  display: block;
  margin-bottom: var(--s2);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue);
}

.titre-page__titre {
  margin: 0 0 var(--s3);
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.titre-page__chapeau {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--t-md);
  color: var(--ink-2);
}

/* Titre de section : filet horizontal qui court jusqu'au bord */
.titre-section {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  margin: 0 0 var(--s5);
}

.titre-section__texte {
  margin: 0;
  font-size: var(--t-lg);
  font-weight: 600;
  white-space: nowrap;
}

.titre-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.titre-section__compte {
  flex: none;
  font-family: var(--sans);
  font-size: var(--t-sm);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.pied {
  flex: none;
  margin-top: auto;
  padding: var(--s6) 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.pied__interieur {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
  justify-content: space-between;
}

.pied__mentions { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; }

.pied__version {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--ink-3);
}

/* ==========================================================================
   6. BOUTONS
   ========================================================================== */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: var(--s3) var(--s5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), box-shadow var(--fast);
}

.bouton:hover { text-decoration: none; }

.bouton:disabled,
.bouton[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Principal — bleu plein */
.bouton--principal {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--ink-on-dark);
}

.bouton--principal:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: var(--ink-on-dark); }
.bouton--principal:active { background: var(--blue-press); border-color: var(--blue-press); }

/* Secondaire — contour */
.bouton--secondaire {
  background: var(--paper);
  border-color: var(--rule-strong);
  color: var(--ink);
}

.bouton--secondaire:hover { background: var(--paper-3); border-color: var(--ink-3); color: var(--ink); }

/* Discret — sans bordure */
.bouton--discret {
  color: var(--ink-2);
  padding-inline: var(--s3);
}

.bouton--discret:hover { background: var(--paper-3); color: var(--ink); }

/* Danger */
.bouton--danger {
  background: var(--paper);
  border-color: rgba(163, 43, 35, 0.35);
  color: var(--red);
}

.bouton--danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.bouton--danger-plein {
  background: var(--red);
  border-color: var(--red);
  color: var(--ink-on-dark);
}

.bouton--danger-plein:hover { background: #8C231C; border-color: #8C231C; color: var(--ink-on-dark); }

/* Tailles */
.bouton--petit { min-height: 36px; padding: var(--s2) var(--s3); font-size: var(--t-xs); }
.bouton--grand { min-height: 52px; padding: var(--s4) var(--s6); font-size: var(--t-base); }

.bouton--icone { padding: var(--s2); width: 44px; min-height: 44px; }
.bouton--icone.bouton--petit { width: 36px; min-height: 36px; }

.bouton--bloc { width: 100%; }

/* Groupe de boutons segmentés (filtres de période, etc.) */
.segments {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-3);
  border-radius: var(--radius);
}

.segments__bouton {
  min-height: 34px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 500;
  transition: background var(--fast), color var(--fast);
}

.segments__bouton:hover { color: var(--ink); }

.segments__bouton[aria-pressed="true"],
.segments__bouton.actif {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

/* ==========================================================================
   7. SURFACES
   ========================================================================== */

.carte {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.carte--capitonnee { padding: var(--s5); }
.carte--serree     { padding: var(--s4); }
.carte--aeree      { padding: var(--s6); }

.carte--cliquable {
  transition: border-color var(--normal), box-shadow var(--normal), transform var(--normal);
}

.carte--cliquable:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.carte__entete {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
}

.carte__titre { margin: 0; font-size: var(--t-md); font-weight: 600; }
.carte__corps { padding: var(--s5); }
.carte__pied  { padding: var(--s4) var(--s5); border-top: 1px solid var(--rule); background: var(--paper-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Encart : bloc mis en avant sur fond teinté */
.encart {
  padding: var(--s5);
  background: var(--blue-soft);
  border: 1px solid rgba(15, 76, 129, 0.16);
  border-radius: var(--radius-lg);
}

.encart--attention { background: var(--amber-soft); border-color: rgba(168, 104, 27, 0.22); }
.encart--succes    { background: var(--green-soft); border-color: rgba(23, 105, 74, 0.20); }
.encart--erreur    { background: var(--red-soft);   border-color: rgba(163, 43, 35, 0.20); }

/* ==========================================================================
   8. FORMULAIRES
   ========================================================================== */

.champ { margin-bottom: var(--s5); }

.champ__label {
  display: block;
  margin-bottom: var(--s2);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
}

.champ__label .requis { color: var(--red); }

.champ__aide {
  display: block;
  margin-top: var(--s2);
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.champ__erreur {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  margin-top: var(--s2);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--red);
}

.saisie,
.selection,
.zone-texte {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--s3) var(--s4);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.5;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.saisie:hover, .selection:hover, .zone-texte:hover { border-color: var(--ink-3); }

.saisie:focus, .selection:focus, .zone-texte:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.saisie::placeholder, .zone-texte::placeholder { color: var(--ink-3); opacity: 1; }

.zone-texte { min-height: 120px; resize: vertical; }

.selection {
  padding-right: var(--s7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23565B66' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s4) center;
  background-size: 16px;
  appearance: none;
}

.saisie:disabled, .selection:disabled, .zone-texte:disabled {
  background: var(--paper-3);
  border-color: var(--rule);
  color: var(--ink-3);
  cursor: not-allowed;
}

.saisie[readonly] { background: var(--paper-2); border-style: dashed; color: var(--ink-2); }

.saisie[aria-invalid="true"], .selection[aria-invalid="true"], .zone-texte[aria-invalid="true"] {
  border-color: var(--red);
}

.saisie[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(163, 43, 35, 0.20); }

/* Champ avec icône ou bouton accolé */
.champ-orne { position: relative; }

.champ-orne__ico {
  position: absolute;
  left: var(--s4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.champ-orne__ico ~ .saisie { padding-left: calc(var(--s7) + var(--s1)); }

.champ-orne__action {
  position: absolute;
  right: var(--s2);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  transition: background var(--fast), color var(--fast);
}

.champ-orne__action:hover { background: var(--paper-3); color: var(--ink); }
.champ-orne__action ~ .saisie { padding-right: calc(var(--s7) + var(--s2)); }

/* Cases à cocher et boutons radio */
.case {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  min-height: 44px;
  padding-block: var(--s2);
  cursor: pointer;
}

.case__entree {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.case__texte { font-size: var(--t-base); line-height: 1.45; }
.case__aide { display: block; font-size: var(--t-sm); color: var(--ink-2); }

/* Compteur de caractères */
.compteur {
  display: block;
  margin-top: var(--s1);
  text-align: right;
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.compteur--limite { color: var(--amber); font-weight: 600; }

/* Barre de filtres */
.filtres {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s5);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.filtres > .champ { flex: 1 1 190px; margin-bottom: 0; min-width: 0; }
.filtres__actions { display: flex; gap: var(--s2); margin-left: auto; }

/* ==========================================================================
   9. ÉTIQUETTES ET PASTILLES
   ========================================================================== */

.etiquette {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0.25em 0.65em;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.etiquette--bleue    { background: var(--blue-soft);  border-color: rgba(15, 76, 129, 0.20); color: var(--blue); }
.etiquette--verte    { background: var(--green-soft); border-color: rgba(23, 105, 74, 0.20); color: var(--green); }
.etiquette--rouge    { background: var(--red-soft);   border-color: rgba(163, 43, 35, 0.20); color: var(--red); }
.etiquette--ambre    { background: var(--amber-soft); border-color: rgba(168, 104, 27, 0.22); color: var(--amber); }
.etiquette--pleine   { background: var(--blue); border-color: var(--blue); color: var(--ink-on-dark); }

/* Point d'état, toujours accompagné d'un texte */
.point {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   10. TABLEAUX
   ========================================================================== */

.tableau-cadre {
  width: 100%;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.tableau {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-sm);
}

.tableau th,
.tableau td {
  padding: var(--s3) var(--s4);
  text-align: left;
  vertical-align: middle;
}

.tableau thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
}

.tableau tbody td { border-bottom: 1px solid var(--rule); }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr { transition: background var(--fast); }
.tableau tbody tr:hover { background: var(--paper-2); }

.tableau .col-nombre { text-align: right; font-variant-numeric: tabular-nums; }

/* En-tête triable */
.tri {
  padding-right: var(--s6);
  position: relative;
  cursor: pointer;
  user-select: none;
}

.tri:hover { background: var(--paper-3); color: var(--ink); }

.tri::after {
  content: '';
  position: absolute;
  right: var(--s3);
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  background: currentColor;
  opacity: 0.3;
  clip-path: polygon(50% 0, 100% 45%, 0 45%, 50% 0, 50% 100%, 100% 55%, 0 55%);
}

.tri[aria-sort="ascending"]::after  { opacity: 1; clip-path: polygon(50% 10%, 100% 80%, 0 80%); color: var(--blue); }
.tri[aria-sort="descending"]::after { opacity: 1; clip-path: polygon(50% 90%, 100% 20%, 0 20%); color: var(--blue); }

/* Colonne numérique : le libellé est aligné à droite, l'indicateur passe
   donc à gauche pour ne pas se superposer au texte. */
.tri.col-nombre {
  padding-right: var(--s4);
  padding-left: var(--s6);
}

.tri.col-nombre::after { right: auto; left: var(--s3); }

/* ==========================================================================
   11. ÉTATS : VIDE, CHARGEMENT, ERREUR
   ========================================================================== */

.etat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s8) var(--s5);
  text-align: center;
}

.etat__ico {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--s2);
  border-radius: 50%;
  background: var(--paper-3);
  color: var(--ink-3);
  font-size: 1.4rem;
}

.etat__titre { margin: 0; font-size: var(--t-md); font-weight: 600; }
.etat__texte { margin: 0; max-width: 46ch; color: var(--ink-2); font-size: var(--t-sm); }
.etat__actions { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; }

/* Rouet */
.rouet {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--rule);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: rotation 700ms linear infinite;
}

.rouet--petit { width: 18px; height: 18px; border-width: 2px; }
.rouet--grand { width: 44px; height: 44px; border-width: 3px; }

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

/* Fantômes de chargement */
.fantome {
  background: linear-gradient(90deg, var(--paper-3) 25%, var(--paper-4) 37%, var(--paper-3) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: chatoiement 1.4s ease infinite;
}

@keyframes chatoiement {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}

.fantome--ligne  { height: 12px; }
.fantome--titre  { height: 22px; width: 55%; }
.fantome--carte  { height: 140px; border-radius: var(--radius-lg); }

/* Barre de progression */
.progression {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--paper-4);
  overflow: hidden;
}

.progression__jauge {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--blue);
  transition: width var(--slow) var(--ease-out);
}

.progression--fine { height: 5px; }

/* ==========================================================================
   11 bis. CATALOGUE DE QUIZ
   ========================================================================== */

.section-categorie + .section-categorie { margin-top: var(--s7); }

.section-categorie__intro {
  margin: calc(-1 * var(--s3)) 0 var(--s5);
  max-width: var(--measure);
  font-size: var(--t-sm);
}

/* Pastille de matière : carré teinté devant le titre de section.
   La teinte est portée par la couleur de la catégorie (--teinte). */
.pastille-matiere {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--teinte, var(--blue)) 35%, white);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--teinte, var(--blue)) 14%, white);
  color: color-mix(in srgb, var(--teinte, var(--blue)) 88%, black);
  font-size: 0.9375rem;
}

/* Carte de quiz : filet de couleur en tête, contenu, pied séparé */
.carte-quiz {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 3px solid var(--teinte, var(--blue));
}

.carte-quiz__corps {
  flex: 1;
  padding: var(--s5) var(--s5) var(--s4);
}

.carte-quiz__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.carte-quiz__titre {
  margin: 0 0 var(--s1);
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1.3;
  /* Les titres de carte sont courts : on évite l'équilibrage, qui produit
     des coupures maladroites sur deux lignes. */
  text-wrap: pretty;
}

.carte-quiz__lien {
  color: inherit;
  text-decoration: none;
}

/* Toute la carte devient cliquable, sans piéger le clavier :
   le lien reste le seul élément focalisable. */
.carte-quiz__lien::after {
  content: '';
  position: absolute;
  inset: 0;
}

.carte-quiz { position: relative; }

.carte-quiz__lien:hover { color: var(--blue); text-decoration: none; }

.carte-quiz__chiffres {
  margin: 0 0 var(--s3);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.carte-quiz__description {
  margin: 0;
  max-width: none;
  color: var(--ink-2);
  font-size: var(--t-sm);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carte-quiz__pied {
  padding: var(--s3) var(--s5) var(--s4);
}

/* Le bouton doit rester au-dessus de la zone cliquable de la carte */
.carte-quiz__pied > .bouton { position: relative; z-index: 1; }

/* ==========================================================================
   11 ter. PASSATION D'UN QUIZ
   ========================================================================== */

.quiz-entete { margin-bottom: var(--s5); }

.quiz-entete__faits {
  margin-top: var(--s4);
  gap: var(--s2);
}

/* Barre de progression collante : toujours visible pendant la passation */
.quiz-barre {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  margin-bottom: var(--s6);
  padding: var(--s3) 0;
  background: color-mix(in srgb, var(--paper-2) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}

.quiz-barre__interieur {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.quiz-barre__infos {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  flex: none;
  font-size: var(--t-sm);
}

.quiz-barre__etiquette {
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.quiz-barre__jauge { flex: 1; min-width: 0; }

.minuteur {
  flex: none;
  padding: var(--s1) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.minuteur--bientot { border-color: rgba(168, 104, 27, 0.4); background: var(--amber-soft); color: var(--amber); }
.minuteur--fini    { border-color: rgba(163, 43, 35, 0.4);  background: var(--red-soft);   color: var(--red); }

/* Une question */
.question {
  padding: var(--s5);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
  border-radius: var(--radius-lg);
  scroll-margin-top: 6rem;
  transition: border-color var(--normal), box-shadow var(--normal);
}

.question--repondue { border-left-color: var(--green); }

.question--signalee {
  border-color: var(--amber);
  border-left-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(168, 104, 27, 0.18);
}

.question__entete {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.question__numero {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-on-dark);
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 700;
}

.question--repondue .question__numero { background: var(--green); }

.question__meta {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-left: auto;
}

.question__points {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.question__enonce {
  margin: 0 0 var(--s4);
  max-width: var(--measure);
  font-family: var(--serif);
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1.45;
}

.question__image {
  margin-bottom: var(--s4);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.question__indice { margin: var(--s3) 0 0; font-size: var(--t-xs); }

.figure-geogebra {
  margin-bottom: var(--s4);
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}

/* Options de réponse */
.options {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: var(--measure);
}

.option {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  min-height: 52px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.option:hover { border-color: var(--blue); background: var(--blue-soft); }

/* La case reste dans le flux pour le clavier, mais discrète visuellement */
.option__entree {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.option__lettre {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--paper);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-2);
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}

.option__texte { flex: 1; min-width: 0; line-height: 1.45; }

/* État choisi : couleur, épaisseur et pastille pleine — pas la couleur seule */
.option:has(.option__entree:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.option:has(.option__entree:checked) .option__lettre {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--ink-on-dark);
}

.option:has(.option__entree:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Pied d'envoi */
.quiz-envoi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-top: var(--s6);
  padding: var(--s5);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.quiz-envoi__titre {
  margin: 0 0 var(--s1);
  font-family: var(--serif);
  font-size: var(--t-md);
  font-weight: 600;
}

.quiz-envoi__texte p { margin: 0; }

/* Écran de résultat */
.resultat { text-align: center; }

.resultat__sceau {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto var(--s5);
  border-radius: 50%;
  font-size: 2rem;
}

.resultat__sceau--reussi { background: var(--green-soft); color: var(--green); }
.resultat__sceau--echec  { background: var(--amber-soft); color: var(--amber); }

.resultat__titre { margin-bottom: var(--s2); font-size: var(--t-2xl); }
.resultat__intro { margin: 0 auto var(--s5); }

.resultat__note {
  margin: 0 0 var(--s2);
  font-family: var(--serif);
  font-size: var(--t-3xl);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.resultat__note-detail {
  display: block;
  margin-top: var(--s2);
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0;
}

.resultat__seuil { margin-bottom: var(--s5); font-size: var(--t-sm); }

.resultat__faits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s4);
  margin: var(--s5) 0;
  padding: var(--s4) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.resultat__fait dt {
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.resultat__fait dd {
  margin: var(--s1) 0 0;
  font-family: var(--serif);
  font-size: var(--t-lg);
  font-weight: 600;
}

.resultat__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: center;
  margin-top: var(--s5);
}

@media (max-width: 768px) {
  .quiz-barre__interieur { flex-wrap: wrap; }
  .quiz-barre__jauge { order: 3; flex-basis: 100%; }
  .quiz-envoi { flex-direction: column; align-items: stretch; }
  .quiz-envoi > .bouton { width: 100%; }
  .question { padding: var(--s4); }
}

/* ==========================================================================
   11 quater. CORRECTIONS ET RÉSULTATS
   ========================================================================== */

/* --- Recherche d'une correction ---------------------------------------- */

.recherche-correction { margin-bottom: var(--s7); align-items: start; }

.recherche-correction .carte { display: flex; flex-direction: column; }
.recherche-correction__aide { margin: 0 0 var(--s4); font-size: var(--t-sm); }
.recherche-correction .champ { margin-bottom: var(--s4); }
.recherche-correction .bouton { margin-top: auto; align-self: flex-start; }

/* Champ de code : lettres espacées, comme un code à recopier */
.saisie--code {
  font-family: var(--mono);
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

/* --- Ligne de copie ---------------------------------------------------- */

.copie { overflow: hidden; }

.copie__entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
}

.copie__identite { flex: 1; min-width: 12rem; }

.copie__titre {
  margin: 0 0 var(--s1);
  font-size: var(--t-md);
  font-weight: 600;
}

.copie__meta { margin: 0; font-size: var(--t-xs); }

.copie__note {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: none;
}

.copie__points { font-size: var(--t-xs); }

.copie__detail {
  padding: var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}

.copie__duree { margin: 0 0 var(--s4); font-size: var(--t-xs); }

/* --- Une question corrigée -------------------------------------------- */

.corrige {
  padding: var(--s4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: var(--radius);
}

.corrige--juste   { border-left-color: var(--green); }
.corrige--faux    { border-left-color: var(--red); }
.corrige--vide    { border-left-color: var(--rule-strong); }
.corrige--attente { border-left-color: var(--amber); }

.corrige__entete {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.corrige__numero {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: 700;
}

.corrige__enonce {
  flex: 1;
  margin: 0;
  max-width: none;
  font-family: var(--serif);
  font-size: var(--t-base);
  font-weight: 600;
  line-height: 1.4;
}

.corrige__verdict {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  flex: none;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-pill);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}

.corrige__verdict--juste   { background: var(--green-soft); color: var(--green); }
.corrige__verdict--faux    { background: var(--red-soft);   color: var(--red); }
.corrige__verdict--vide    { background: var(--paper-3);    color: var(--ink-2); }
.corrige__verdict--attente { background: var(--amber-soft); color: var(--amber); }

/* Options avec marquage de la bonne réponse */
.corrige__options {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.corrige__option {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin: 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  font-size: var(--t-sm);
}

.corrige__option--attendue { background: var(--green-soft); border-color: rgba(23, 105, 74, 0.25); }
.corrige__option--erreur   { background: var(--red-soft);   border-color: rgba(163, 43, 35, 0.25); }

.corrige__lettre {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--paper);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ink-2);
}

.corrige__option--attendue .corrige__lettre { background: var(--green); border-color: var(--green); color: #fff; }
.corrige__option--erreur   .corrige__lettre { background: var(--red);   border-color: var(--red);   color: #fff; }

.corrige__texte { flex: 1; min-width: 0; }

.corrige__marques { display: flex; flex-wrap: wrap; gap: var(--s2); flex: none; }

.corrige__marque {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}

.corrige__marque--attendue      { color: var(--green); }
.corrige__marque--choisie       { color: var(--red); }
.corrige__marque--choisie-juste { color: var(--green); }

/* Réponses libres : deux lignes libellé / valeur */
.corrige__reponses { display: flex; flex-direction: column; gap: var(--s2); }

.corrige__ligne {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  font-size: var(--t-sm);
}

.corrige__ligne--juste    { background: var(--green-soft); border-color: rgba(23, 105, 74, 0.22); }
.corrige__ligne--faux     { background: var(--red-soft);   border-color: rgba(163, 43, 35, 0.22); }
.corrige__ligne--attendue { background: var(--blue-soft);  border-color: rgba(15, 76, 129, 0.18); }

.corrige__ligne-libelle {
  flex: none;
  min-width: 9rem;
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.corrige__ligne-valeur { flex: 1; min-width: 0; font-weight: 500; }

.corrige__explication {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px dashed var(--rule);
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.corrige__explication p { margin: var(--s1) 0 0; max-width: var(--measure); }

.corrige__explication-titre {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber);
}

/* --- Tuiles de statistiques ------------------------------------------- */

.stats { margin-bottom: var(--s6); }

.tuile {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
}

.tuile__ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius);
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 1.05rem;
}

.tuile--bleue  .tuile__ico { background: var(--blue-soft);  color: var(--blue); }
.tuile--verte  .tuile__ico { background: var(--green-soft); color: var(--green); }
.tuile--ambre  .tuile__ico { background: var(--amber-soft); color: var(--amber); }
.tuile--rouge  .tuile__ico { background: var(--red-soft);   color: var(--red); }

.tuile__libelle {
  display: block;
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.tuile__valeur {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* --- Détail d'une copie dans un dialogue ------------------------------ */

.copie-detail__resume {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--rule);
}

.copie-detail__libelle {
  display: block;
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.copie-detail__valeur {
  display: block;
  margin-top: 2px;
  font-family: var(--serif);
  font-size: var(--t-lg);
  font-weight: 600;
}

.col-actions { width: 1%; white-space: nowrap; }

@media (max-width: 768px) {
  .copie__entete { flex-direction: column; align-items: stretch; }
  .copie__note { justify-content: space-between; }
  .corrige__entete { flex-wrap: wrap; }
  .corrige__ligne-libelle { min-width: 0; flex-basis: 100%; }
}

/* ==========================================================================
   11 quinquies. ÉDITEUR DE QUIZ
   ========================================================================== */

.editeur-entete { align-items: start; }

.champ--serre { max-width: 10rem; margin-bottom: 0; }

.saisie--points { width: 5rem; text-align: center; }
.selection--type { width: auto; min-width: 12rem; }

.zone-texte--code {
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

/* Bloc « Réglages », replié par défaut */
.reglages {
  margin-bottom: var(--s5);
  padding: var(--s4);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.reglages__titre {
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
}

.reglages__titre::marker { color: var(--ink-3); }

.reglages__corps { margin-top: var(--s4); align-items: start; }

/* Une question en cours d'édition */
.edition-question {
  padding: var(--s4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: var(--radius);
}

.edition-question:focus-within { border-left-color: var(--blue); }

/* Question qu'il reste a completer : le filet de gauche l'annonce de loin,
   sans transformer la carte en alerte — c'est un travail en cours, pas une
   erreur. La couleur ne porte pas seule l'information : le badge « A
   completer » de l'en-tete dit la meme chose en mots. */
.edition-question--incomplete { border-left-color: var(--amber); }

/* Question vers laquelle on vient d'etre conduit : un bref halo pour dire
   « c'est ici », puis on n'en parle plus. */
.edition-question--pointee {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.etat-question { margin-left: var(--s2); }

/* Point a corriger, cliquable : conduit a la question concernee. */
.lien-probleme {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.lien-probleme:hover,
.lien-probleme:focus-visible { text-decoration-style: solid; }

@media (prefers-reduced-motion: reduce) {
  .edition-question--pointee { box-shadow: none; }
}

.edition-question__entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.edition-question__numero {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%
;  background: var(--ink);
  color: var(--ink-on-dark);
  font-family: var(--sans);
  font-size: var(--t-xs);
  font-weight: 700;
}

.edition-question__points {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.edition-question__explication { margin: var(--s3) 0 0; }

/* Réponses proposées */
.edition-options {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s3);
  padding: var(--s3);
  background: var(--paper-2);
  border-radius: var(--radius);
}

.edition-options__titre {
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.edition-option {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.edition-option__coche {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--rule);
  cursor: pointer;
}

.edition-option__coche:hover { border-color: var(--blue); }
.edition-option__coche .case__entree { margin: 0; }

.edition-option .saisie { flex: 1; min-width: 0; }

.editeur-ajout { margin-top: var(--s4); }

/* Zone de dépôt de fichier */
.depot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s6);
  margin-bottom: var(--s5);
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  text-align: center;
  transition: border-color var(--fast), background var(--fast);
}

.depot--actif { border-color: var(--blue); background: var(--blue-soft); }

.depot__ico { font-size: 1.75rem; color: var(--ink-3); }
.depot__texte { margin: 0; color: var(--ink-2); font-size: var(--t-sm); }

/* Document joint à une ressource : la zone de dépôt vit ici dans un champ de
   formulaire, elle n'a donc pas la marge basse de la version pleine page. */
.champ__fichier .depot { margin-bottom: 0; padding: var(--s5); }

.fichier-joint {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
}

.fichier-joint__ico { flex: none; font-size: 1.5rem; color: var(--blue); }

.fichier-joint__corps {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fichier-joint__nom { overflow-wrap: anywhere; }
.fichier-joint__meta { font-size: var(--t-sm); color: var(--ink-2); }

@media (max-width: 560px) {
  .fichier-joint { flex-wrap: wrap; }
  .fichier-joint__corps { flex-basis: 100%; }
}

/* -------------------------------------------------------- assistant guidé */

/* Fil des étapes : dit où l'on en est et combien il reste. Les étapes déjà
   franchies sont des boutons — on doit pouvoir revenir corriger sans tout
   reprendre. */
.fil-etapes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin: 0 0 var(--s5);
  padding: 0 0 var(--s4);
  border-bottom: 1px solid var(--rule);
  list-style: none;
  counter-reset: none;
}

.fil-etapes__pas { flex: 1 1 auto; min-width: 8rem; }

.fil-etapes__bouton {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font: inherit;
  text-align: left;
}

.fil-etapes__pas--faite .fil-etapes__bouton { color: var(--ink-2); cursor: pointer; }
.fil-etapes__pas--courante .fil-etapes__bouton { color: var(--ink); font-weight: 600; }

.fil-etapes__numero {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.fil-etapes__pas--courante .fil-etapes__numero {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--paper);
}

.fil-etapes__pas--faite .fil-etapes__numero {
  border-color: var(--green);
  color: var(--green);
}

.fil-etapes__texte { font-size: var(--t-sm); }

.assistant__intro { margin: 0; color: var(--ink-2); }

/* Une voie possible parmi deux : chacune est un bloc à part entière, pour
   qu'on choisisse sans les confondre. */
.voie {
  padding: var(--s5);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.voie + .voie { margin-top: var(--s4); }

/* La voie conseillée se distingue par un filet, pas par un fond criard :
   l'autre reste un choix légitime. */
.voie--conseillee { border-left: 3px solid var(--blue); }

.voie__entete {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.voie__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
}

.voie__entete > div { flex: 1; min-width: 12rem; }
.voie__titre { margin: 0; font-size: var(--t-md); }
.voie__sous { margin: var(--s1) 0 0; color: var(--ink-2); font-size: var(--t-sm); }

/* Séparateur « ou » entre deux moyens équivalents. */
.assistant__ou {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0;
  color: var(--ink-3);
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.assistant__ou::before,
.assistant__ou::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.depot--compact { padding: var(--s4); margin-bottom: 0; }

/* Aide repliable : discrète tant qu'on n'en a pas besoin. */
.aide {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.aide__titre {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  color: var(--ink-2);
  font-size: var(--t-sm);
  cursor: pointer;
}

.aide__titre::-webkit-details-marker { display: none; }
.aide[open] .aide__titre { color: var(--ink); }

.aide__corps {
  padding: 0 var(--s4) var(--s4);
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.aide__corps > * + * { margin-top: var(--s2); }
.aide__corps p { margin: 0; }
.aide__corps ul { margin: 0; padding-left: var(--s5); }
.aide__corps li + li { margin-top: var(--s1); }

.assistant__retour {
  margin: var(--s2) 0 0;
  color: var(--green);
  font-size: var(--t-sm);
}

.assistant__retour:empty { display: none; }

/* Icône en tête de phrase : l'espace d'un nœud texte est réduit à néant par
   HTML, il faut donc l'écarter en CSS. */
.encart p > .ico:first-child,
.assistant__intro > .ico:first-child { margin-right: 0.4em; }

/* Les marches à suivre : numérotées, une action par marche. */
.liste-marches {
  margin: 0;
  padding-left: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.liste-marches li { padding-left: var(--s2); }
.liste-marches li::marker { color: var(--blue); font-weight: 600; }
.liste-marches p { margin: var(--s1) 0 var(--s2); color: var(--ink-2); font-size: var(--t-sm); }

/* Écran de fin : on annonce le résultat, on propose la suite. */
.assistant__fin { padding: var(--s5) 0; text-align: center; }

.assistant__fin-ico {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto var(--s4);
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green);
  font-size: 1.5rem;
}

.assistant__fin-titre { margin: 0 0 var(--s2); }
.assistant__fin p { margin: 0 0 var(--s5); color: var(--ink-2); }

.ligne--centre { justify-content: center; }

@media (max-width: 640px) {
  .fil-etapes { gap: var(--s2); }
  .fil-etapes__pas { min-width: 0; flex: 0 0 auto; }
  /* Sur petit écran, les libellés prendraient toute la place : les numéros
     suffisent à situer la progression. */
  .fil-etapes__pas:not(.fil-etapes__pas--courante) .fil-etapes__texte { display: none; }
}

/* Aperçu des questions importées */
.apercu-questions {
  margin: var(--s4) 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.apercu-questions li {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  margin: 0;
  padding: var(--s2) var(--s3);
  background: var(--paper-2);
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
}

/* Codes de correction à usage unique */
.codes-resume { margin-bottom: var(--s4); }

.grille-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin: 0;
  padding: var(--s3);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: var(--t-base);
  font-weight: 600;
  letter-spacing: 0.14em;
}

.code--utilise {
  background: var(--paper-3);
  border-style: dashed;
  color: var(--ink-3);
  text-decoration: line-through;
  letter-spacing: 0.08em;
}

.code__marque { color: var(--green); }

.case--encadree {
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}

.case--encadree:hover { border-color: var(--rule-strong); background: var(--paper-2); }

/* ==========================================================================
   11 sexies. RESSOURCES
   ========================================================================== */

.ressources-barre { margin-bottom: var(--s6); gap: var(--s4); }
.ressources-barre__recherche { min-width: 15rem; flex: 1; max-width: 22rem; }

.segments__compte {
  margin-left: var(--s2);
  padding: 0 0.4em;
  border-radius: var(--radius-pill);
  background: var(--paper-4);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.segments__bouton[aria-pressed="true"] .segments__compte { background: var(--blue-soft); color: var(--blue); }

.ressource { display: flex; flex-direction: column; }

.ressource__corps { flex: 1; padding: var(--s5) var(--s5) var(--s4); }

.ressource__entete {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.ressource__ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius);
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 1rem;
}

.ressource__ico--video    { background: var(--red-soft);   color: var(--red); }
.ressource__ico--document { background: var(--blue-soft);  color: var(--blue); }
.ressource__ico--lien     { background: var(--green-soft); color: var(--green); }
.ressource__ico--autre    { background: var(--amber-soft); color: var(--amber); }

.ressource__meta { display: flex; flex-wrap: wrap; gap: var(--s2); }

.ressource__titre {
  margin: 0 0 var(--s2);
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1.3;
}

.ressource__description {
  margin: 0;
  max-width: none;
  color: var(--ink-2);
  font-size: var(--t-sm);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ressource__pied {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s5) var(--s4);
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}

.ressource__date { font-size: var(--t-xs); }

/* Cadre vidéo à ratio conservé */
.video-cadre {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--ink);
}

.video-cadre iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 768px) {
  .edition-question__entete { flex-wrap: wrap; }
  .selection--type { min-width: 0; width: 100%; }
  .reglages__corps { grid-template-columns: 1fr; }
  .ressources-barre { flex-direction: column; align-items: stretch; }
  .ressources-barre__recherche { max-width: none; }
  .segments { overflow-x: auto; }
}

/* ==========================================================================
   11 septies. ADMINISTRATION
   ========================================================================== */

.admin-barre { margin-bottom: var(--s6); }
.admin-comptes { margin-top: var(--s7); }

/* Le sélecteur de couleur natif reste petit et carré */
.saisie--couleur {
  width: 4.5rem;
  height: 44px;
  padding: var(--s1);
  cursor: pointer;
}

/* Liste des accès d'une classe */
.liste-acces {
  margin: var(--s4) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.liste-acces__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0;
  padding: var(--s2) var(--s3);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
}

.liste-acces__item .ico { color: var(--ink-3); }

@media (max-width: 768px) {
  .liste-acces__item { flex-wrap: wrap; }
}

/* ==========================================================================
   12. DIALOGUES
   ========================================================================== */

.voile {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  background: rgba(23, 24, 28, 0.45);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.voile.ouvert { display: flex; }

.dialogue {
  position: relative;
  z-index: var(--z-dialog);
  width: min(520px, 100%);
  margin: auto;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-4);
  animation: apparition var(--normal) var(--ease-out);
}

.dialogue--large { width: min(880px, 100%); }
.dialogue--pleine { width: min(1200px, 100%); }

@keyframes apparition {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.dialogue__entete {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--rule);
}

.dialogue__titre { margin: 0; font-size: var(--t-lg); font-weight: 600; }
.dialogue__sous  { margin: var(--s1) 0 0; font-size: var(--t-sm); color: var(--ink-2); }

.dialogue__fermer {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-2);
  transition: background var(--fast), color var(--fast);
}

.dialogue__fermer:hover { background: var(--paper-3); color: var(--ink); }

.dialogue__corps { padding: var(--s5); }

.dialogue__pied {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: flex-end;
  padding: var(--s4) var(--s5) var(--s5);
  border-top: 1px solid var(--rule);

  /* L'éditeur de quiz fait plusieurs écrans de haut : « Enregistrer » doit
     rester sous la main sans avoir à redescendre toute la liste. */
  position: sticky;
  bottom: 0;
  background: var(--paper);
  z-index: 1;
}

/* ==========================================================================
   12 bis. CONNEXION
   ========================================================================== */

/* Écran d'invitation, avant toute session */
.accueil-connexion {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding-block: var(--s7);
}

.accueil-connexion > .carte { max-width: 34rem; }

.accueil-connexion__ecusson {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--s5);
  font-size: 1.75rem;
}

.accueil-connexion__titre {
  margin-bottom: var(--s3);
  font-size: var(--t-2xl);
  font-weight: 700;
}

.accueil-connexion__chapeau {
  margin: 0 auto var(--s6);
  max-width: 42ch;
  font-size: var(--t-md);
}

/* Liste de choix de la classe */
.liste-classes {
  max-height: 15rem;
  margin-top: var(--s2);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.liste-classes__item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 48px;
  padding: var(--s3) var(--s4);
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font-size: var(--t-sm);
  text-align: left;
  transition: background var(--fast);
}

.liste-classes__item:last-child { border-bottom: 0; }
.liste-classes__item:hover { background: var(--paper-2); }

.liste-classes__item.actif {
  background: var(--blue-soft);
  color: var(--blue-press);
  font-weight: 600;
}

.liste-classes__puce {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 3px;
}

.liste-classes__nom { flex: 1; min-width: 0; }
.liste-classes__coche { color: var(--blue); }

.liste-classes__vide {
  margin: 0;
  padding: var(--s5);
  color: var(--ink-2);
  font-size: var(--t-sm);
  text-align: center;
}

/* ==========================================================================
   13. NOTIFICATIONS
   ========================================================================== */

.notifications {
  position: fixed;
  bottom: var(--s5);
  right: var(--s5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(380px, calc(100vw - var(--s6)));
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  font-size: var(--t-sm);
  pointer-events: auto;
  animation: glissement var(--normal) var(--ease-out);
}

@keyframes glissement {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: none; }
}

.notification--sortante {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity var(--fast), transform var(--fast);
}

.notification--succes { border-left-color: var(--green); }
.notification--erreur { border-left-color: var(--red); }
.notification--attention { border-left-color: var(--amber); }

.notification__ico { flex: none; margin-top: 1px; }
.notification--succes .notification__ico { color: var(--green); }
.notification--erreur .notification__ico { color: var(--red); }
.notification--attention .notification__ico { color: var(--amber); }
.notification--info .notification__ico { color: var(--blue); }

.notification__corps { flex: 1; min-width: 0; }
.notification__titre { margin: 0 0 var(--s1); font-family: var(--sans); font-size: var(--t-sm); font-weight: 600; }
.notification__texte { margin: 0; color: var(--ink-2); }

.notification__fermer {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-3);
}

.notification__fermer:hover { background: var(--paper-3); color: var(--ink); }

/* ==========================================================================
   14. ADAPTATION AUX ÉCRANS
   ========================================================================== */

@media (max-width: 1024px) {
  :root { --t-2xl: 2rem; --t-3xl: 2.5rem; }
  .grille--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grille--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  :root {
    --t-2xl: 1.75rem;
    --t-xl:  1.375rem;
    --t-lg:  1.1875rem;
    --header-h: auto;
  }

  .page, .page--large { padding-inline: var(--s4); }

  .entete { position: static; }

  .entete__interieur { flex-wrap: wrap; padding: var(--s3) var(--s4); }

  .entete__bascule { display: grid; }

  /* La navigation se replie et s'ouvre par le bouton */
  .nav {
    order: 3;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    gap: 0;
    display: none;
    padding-top: var(--s3);
    border-top: 1px solid var(--rule);
  }

  .nav.ouverte { display: flex; }

  .nav__lien { justify-content: flex-start; border-radius: var(--radius); }

  .nav__lien[aria-current="page"] {
    background: var(--blue-soft);
    box-shadow: none;
    color: var(--blue-press);
  }

  .session {
    order: 2;
    padding-left: 0;
    margin-left: auto;
    border-left: 0;
  }

  .session__classe { text-align: right; }

  .contenu { padding: var(--s5) 0 var(--s7); }

  .grille--2, .grille--3, .grille--4, .grille--auto { grid-template-columns: 1fr; }

  .carte--aeree { padding: var(--s5); }
  .carte--capitonnee { padding: var(--s4); }

  .filtres { flex-direction: column; align-items: stretch; }
  .filtres__actions { margin-left: 0; }

  .titre-section { flex-wrap: wrap; }
  .titre-section::after { display: none; }

  .dialogue__pied { flex-direction: column-reverse; }
  .dialogue__pied > .bouton { width: 100%; }

  .notifications { left: var(--s3); right: var(--s3); bottom: var(--s3); width: auto; }

  .pied__interieur { flex-direction: column; align-items: flex-start; }

  .tableau { font-size: var(--t-xs); }
  .tableau th, .tableau td { padding: var(--s2) var(--s3); }
}

@media (max-width: 420px) {
  .page, .page--large { padding-inline: var(--s3); }
  .marque__sous { display: none; }
}

/* ==========================================================================
   15. PRÉFÉRENCES SYSTÈME
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .carte--cliquable:hover { transform: none; }
}

@media (prefers-contrast: more) {
  :root {
    --ink-2: #3A3F49;
    --ink-3: #565B66;
    --rule: #A8A49C;
    --rule-strong: #7C7871;
  }
  .carte, .saisie, .selection, .zone-texte, .bouton { border-width: 2px; }
}

/* ==========================================================================
   16. IMPRESSION
   ========================================================================== */

/* ==========================================================================
   UTILITAIRES DE FIN — déclarés ici pour l'emporter sur les composants
   ========================================================================== */

/* `.caché` est déclarée en tête de feuille, avant les composants : à
   spécificité égale, `.bouton { display: inline-flex }` la battait et un
   bouton masqué restait visible. La même règle, énoncée en dernier, tranche. */
.caché,
[hidden] { display: none; }

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }

  .entete, .pied, .nav, .session, .notifications, .voile,
  .filtres, .bouton, .lien-evitement, .segments { display: none !important; }

  .contenu { padding: 0; }

  .carte, .encart, .tableau-cadre {
    border: 1px solid #999;
    box-shadow: none !important;
    break-inside: avoid;
  }

  a { color: #000; }
  a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 0.85em; color: #555; }
}
