/* =====================================================================
   LIMPIDE — Feuille de style
   Palette « brume et eucalyptus », en mode clair et en mode sombre.
   Le surligneur jaune est le seul élément vif : il marque les mots
   médicaux qu’on explique. Aucun rouge : rien ne doit alarmer.
   ===================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  color-scheme: light;
  --fond: #EDF1EE;
  --surface: #FFFFFF;
  --surface-2: #F6F8F7;
  --encre: #15313A;
  --encre-2: #445C65;
  --encre-3: #6A7F86;
  --ligne: #D3DDD8;
  --accent: #2C6A60;
  --accent-fort: #1F5249;
  --accent-texte: #FFFFFF;
  --lien: #1F5249;
  --accent-pale: #DCEAE4;
  --clair-texte: #15313A;
  --surligneur: #F6E7A1;
  --surligneur-fort: #EED970;
  --sur-encre: #15313A;
  --ciel: #E3EBF3;
  --ciel-bord: #B4C7D9;
  --sable: #F7EFDF;
  --sable-bord: #E2CFA8;
  --sable-accent: #9A6E1C;
  --focus: #1D5FA8;
  --voile: rgba(21, 49, 58, .42);
  --ombre-feuille: 0 -8px 30px rgba(21, 49, 58, .12);
  --fond-sommaire: rgba(237, 241, 238, .92);

  --sans: "Avenir Next", Avenir, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;

  --r-carte: 1.25rem;
  --r-petit: .6rem;
  --r-pilule: 999px;
  --largeur: 42rem;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --fond: #0F1B1F; --surface: #15252A; --surface-2: #1A2D33; --encre: #E4EDEA; --encre-2: #A9BDB8; --encre-3: #86A09A;
    --ligne: #2A4047; --accent: #79C2B3; --accent-fort: #9AD5C8; --accent-texte: #0C1D1A; --lien: #8FD0C2; --accent-pale: #1B3833; --clair-texte: #E4EDEA;
    --surligneur: #E9D77A; --surligneur-fort: #F3E393; --ciel: #172A3A; --ciel-bord: #2E4A66; --sable: #2A2417; --sable-bord: #5A4A2A; --sable-accent: #D8B26A;
    --focus: #8DBBF3; --voile: rgba(0, 0, 0, .6); --ombre-feuille: 0 -8px 30px rgba(0, 0, 0, .45); --fond-sommaire: rgba(15, 27, 31, .9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #0F1B1F; --surface: #15252A; --surface-2: #1A2D33; --encre: #E4EDEA; --encre-2: #A9BDB8; --encre-3: #86A09A;
  --ligne: #2A4047; --accent: #79C2B3; --accent-fort: #9AD5C8; --accent-texte: #0C1D1A; --lien: #8FD0C2; --accent-pale: #1B3833; --clair-texte: #E4EDEA;
  --surligneur: #E9D77A; --surligneur-fort: #F3E393; --ciel: #172A3A; --ciel-bord: #2E4A66; --sable: #2A2417; --sable-bord: #5A4A2A; --sable-accent: #D8B26A;
  --focus: #8DBBF3; --voile: rgba(0, 0, 0, .6); --ombre-feuille: 0 -8px 30px rgba(0, 0, 0, .45); --fond-sommaire: rgba(15, 27, 31, .9);
}

/* Taille du texte réglable */
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html[data-taille="2"] { font-size: 129%; }
html[data-taille="3"] { font-size: 146%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Langue : on affiche seulement les textes de la langue active */
html[lang^="fr"] [data-l="en"], html[lang^="en"] [data-l="fr"] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; overflow-x: hidden; min-height: 100vh; min-height: 100dvh;
  background: var(--fond); color: var(--encre);
  font-family: var(--sans); line-height: 1.6;
  font-feature-settings: "kern", "liga"; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.012em; font-weight: 650; text-wrap: balance; }
h1 { font-size: 2rem; letter-spacing: -.022em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: .75em; }
a { color: var(--lien); text-underline-offset: .18em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: .35rem; }
h1:focus, h2:focus { outline: none; }
svg { flex: none; }
.vc {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.lien-evitement { position: absolute; left: 1rem; top: -4rem; z-index: 50; background: var(--encre); color: var(--fond); padding: .6rem 1rem; border-radius: var(--r-petit); }
.lien-evitement:focus { top: 1rem; }
.enveloppe { max-width: var(--largeur); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- 2. En-tête ---------- */
.entete { padding: max(1rem, env(safe-area-inset-top)) 0 .5rem; }
.entete .enveloppe { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.marque {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 2.75rem;
  color: var(--encre); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em;
  background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer;
}
.marque svg { width: 2rem; height: 2rem; }
.outils-entete { display: flex; align-items: center; gap: .4rem; }
.btn-icone {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-width: 2.75rem; height: 2.75rem; padding: 0 .85rem;
  background: var(--surface); color: var(--encre); border: 1px solid var(--ligne); border-radius: var(--r-pilule);
  font-family: inherit; font-size: .9rem; font-weight: 650; cursor: pointer;
}
.btn-icone:hover { border-color: var(--encre-2); }
.btn-icone svg { width: 1.2rem; height: 1.2rem; }

/* ---------- 3. Composants ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 3.25rem; padding: .7rem 1.5rem;
  font-family: inherit; font-size: 1rem; font-weight: 650; line-height: 1.25; text-align: center;
  border-radius: var(--r-pilule); border: 2px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn svg { width: 1.2em; height: 1.2em; }
.btn-principal { background: var(--accent); color: var(--accent-texte); }
.btn-principal:hover { background: var(--accent-fort); }
.btn-secondaire { background: var(--surface); color: var(--encre); border-color: var(--ligne); }
.btn-secondaire:hover { border-color: var(--encre-2); }
.btn-texte {
  background: none; border: 0; color: var(--lien); font-family: inherit; font-size: .95rem;
  font-weight: 650; padding: .5rem .2rem; min-height: 2.75rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px;
}
.btn-texte svg { width: 1.1em; height: 1.1em; }
.btn[aria-busy="true"] { opacity: .8; cursor: progress; }
.pleine-largeur { width: 100%; }

.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1.35rem 1.25rem; }
.carte + .carte { margin-top: .85rem; }
.carte > h3 { margin-bottom: .6rem; }
.retour { margin: .25rem 0 .5rem -.2rem; }

/* Le surligneur : signature visuelle */
.surligne, .terme {
  background-image: linear-gradient(100deg, transparent .15em, var(--surligneur) .15em, var(--surligneur) calc(100% - .1em), transparent calc(100% - .1em));
  background-repeat: no-repeat; background-size: 100% 78%; background-position: 0 70%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 .12em; border-radius: .15em; color: var(--sur-encre);
}
.terme {
  font: inherit; border: 0; margin: 0; cursor: pointer; background-color: transparent;
  text-decoration: underline dotted rgba(21, 49, 58, .55); text-decoration-thickness: 1px; text-underline-offset: .28em;
}
.terme:hover { --surligneur: var(--surligneur-fort); }

.encadre { border-radius: var(--r-carte); padding: 1.1rem 1.2rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .85rem; align-items: start; }
.encadre > svg { width: 1.5rem; height: 1.5rem; margin-top: .1rem; grid-row: span 3; }
.encadre .titre { font-size: 1rem; font-weight: 650; }
.encadre > :not(svg) { grid-column: 2; }
.encadre-sable { background: var(--sable); border: 1px solid var(--sable-bord); }
.encadre-ciel { background: var(--ciel); border: 1px solid var(--ciel-bord); }
.encadre ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.encadre li + li { margin-top: .15rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 650; background: var(--surligneur); color: var(--sur-encre); border-radius: var(--r-petit); padding: .2rem .6rem; }
.voix { display: block; font-size: .78rem; font-weight: 650; color: var(--encre-2); margin-bottom: .2rem; }

/* ---------- 4. Accueil ---------- */
.vue { padding-bottom: 3rem; }
.accroche { padding: 1.25rem 0 .5rem; }
.accroche h1 { font-size: 2.15rem; max-width: 18ch; }
.accroche .intro { font-size: 1.1rem; color: var(--encre-2); margin-top: .9rem; max-width: 36ch; }

.demo { margin: 1.75rem 0 0; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); overflow: hidden; }
.demo .jargon { padding: 1.25rem 1.25rem 1.1rem; font-family: var(--serif); font-size: 1.3rem; line-height: 1.55; }
.demo .clair { padding: 1.1rem 1.25rem 1.25rem; background: var(--accent-pale); font-size: 1.08rem; line-height: 1.55; color: var(--clair-texte); }
.demo figcaption { padding: .6rem 1.25rem; font-size: .8rem; color: var(--encre-2); border-top: 1px solid var(--ligne); }
.demo .d1 { --d: .5s; } .demo .d2 { --d: .8s; } .demo .d3 { --d: 1.1s; } .demo .d4 { --d: 1.4s; }
@media (prefers-reduced-motion: no-preference) {
  .demo .surligne { background-size: 0% 78%; animation: surligner .55s cubic-bezier(.3,.7,.3,1) forwards; animation-delay: var(--d, .4s); }
  .demo .clair p { opacity: 0; transform: translateY(.35rem); animation: apparaitre .6s ease forwards; animation-delay: 2.1s; }
}
@keyframes surligner { to { background-size: 100% 78%; } }
@keyframes apparaitre { to { opacity: 1; transform: none; } }

.actions-accroche { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-top: 1.5rem; }
.confiance { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .45rem; font-size: .95rem; color: var(--encre-2); }
.confiance li { display: flex; gap: .55rem; align-items: flex-start; }
.confiance svg { width: 1.15rem; height: 1.15rem; color: var(--accent); margin-top: .2rem; }

.bloc { margin-top: 2.75rem; }
.bloc > h2 { margin-bottom: .4rem; }
.bloc > .sous { color: var(--encre-2); margin-bottom: 1rem; }

.exemples { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.exemple {
  width: 100%; height: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1rem 1.1rem;
  font-family: inherit; color: var(--encre); cursor: pointer; min-height: 4.5rem;
}
.exemple:hover { border-color: var(--accent); }
.exemple .icone { width: 3rem; height: 3rem; border-radius: .9rem; background: var(--accent-pale); display: grid; place-items: center; color: var(--accent-fort); }
:root[data-theme="dark"] .exemple .icone { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .exemple .icone { color: var(--accent); } }
.exemple .icone svg { width: 1.7rem; height: 1.7rem; }
.exemple strong { display: block; font-size: 1.02rem; line-height: 1.3; }
.exemple .desc { display: block; font-size: .9rem; color: var(--encre-2); line-height: 1.4; margin-top: .15rem; }
.exemple .chevron { width: 1.25rem; height: 1.25rem; color: var(--encre-2); }

.etapes { list-style: none; counter-reset: etape; margin: 0; padding: 0; display: grid; gap: 1rem; }
.etapes li { counter-increment: etape; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: .9rem; align-items: start; }
.etapes li::before { content: counter(etape); width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--encre); font-weight: 700; font-size: .95rem; }
.etapes strong { display: block; }
.etapes span { color: var(--encre-2); font-size: .95rem; }

.limites { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.limites li { display: flex; gap: .65rem; align-items: flex-start; }
.limites svg { width: 1.25rem; height: 1.25rem; margin-top: .2rem; color: var(--encre-2); }

.lien-projet { display: flex; align-items: center; justify-content: space-between; gap: 1rem; text-decoration: none; color: var(--encre); }
.lien-projet:hover { border-color: var(--accent); }
.lien-projet strong { display: block; }
.lien-projet span { color: var(--encre-2); font-size: .95rem; }
.lien-projet svg { width: 1.25rem; height: 1.25rem; color: var(--encre-2); }

/* ---------- 5. Saisie ---------- */
.saisie h1 { margin-bottom: 1rem; }
.champ { margin-top: 1.5rem; }
.champ label { display: block; font-weight: 650; margin-bottom: .2rem; }
.champ .aide { font-size: .92rem; color: var(--encre-2); margin-bottom: .6rem; }
textarea {
  width: 100%; min-height: 15rem; resize: vertical; display: block;
  font-family: var(--serif); font-size: max(1rem, 16px); line-height: 1.6; color: var(--encre);
  background: var(--surface); border: 2px solid var(--ligne); border-radius: var(--r-carte); padding: 1rem 1.1rem;
}
textarea:focus, .ajout-question input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea::placeholder, input::placeholder { color: var(--encre-3); }
.outils-saisie { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .25rem 1rem; margin-top: .3rem; }
.outils-saisie > div { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1rem; }
.compteur { font-size: .85rem; color: var(--encre-2); }
.message-erreur { margin-top: 1rem; padding: .9rem 1.1rem; border-radius: var(--r-petit); background: var(--sable); border-left: 4px solid var(--sable-accent); font-size: .95rem; }
.alerte-perso { margin-top: 1rem; }
.alerte-perso .boutons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.alerte-perso .boutons .btn { min-height: 2.9rem; padding: .5rem 1.1rem; font-size: .95rem; }
.saisie .btn-principal.pleine-largeur { margin-top: 1.25rem; }
.puces { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.puce { font-family: inherit; font-size: .92rem; color: var(--encre); background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-pilule); padding: .5rem 1rem; min-height: 2.75rem; cursor: pointer; }
.puce:hover { border-color: var(--accent); }
.essai { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--ligne); }
.essai p { font-size: .95rem; color: var(--encre-2); }

/* ---------- 6. Résultat ---------- */
.resultat-tete { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.resultat-tete h1 { font-size: 1.85rem; flex: 1 1 100%; }
.note-securite { margin-top: 1rem; font-size: .95rem; }

.sommaire {
  position: sticky; top: 0; z-index: 10; margin: 1.25rem -1.25rem 0; padding: .6rem 1.25rem;
  padding-top: max(.6rem, env(safe-area-inset-top));
  background: var(--fond-sommaire); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ligne);
}
.sommaire ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.sommaire ul::-webkit-scrollbar { display: none; }
.sommaire a {
  display: inline-flex; align-items: center; white-space: nowrap; min-height: 2.5rem; padding: .3rem .95rem;
  border-radius: var(--r-pilule); background: var(--surface); border: 1px solid var(--ligne);
  color: var(--encre); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.sommaire a[aria-current="true"], .sommaire a[aria-current="true"]:visited { background: var(--encre); color: var(--fond); border-color: var(--encre); }

.partie { margin-top: 2.25rem; scroll-margin-top: 4.75rem; }
.partie > h2 { margin-bottom: .35rem; }
.partie > .sous { color: var(--encre-2); margin-bottom: 1rem; font-size: .98rem; }
.resume { font-size: 1.12rem; line-height: 1.65; }
.resume p + p { margin-top: .6em; }
.entete-carte { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }

.lignes { list-style: none; margin: 0; padding: 0; }
.lignes > li { padding: 1.1rem 0; border-top: 1px solid var(--ligne); }
.lignes > li:first-child { border-top: 0; padding-top: .2rem; }
.lignes > li:last-child { padding-bottom: 0; }
.texte-rapport { font-family: var(--serif); font-size: 1rem; line-height: 1.7; color: var(--encre); overflow-wrap: anywhere; }
.texte-clair { margin-top: .7rem; padding: .8rem 1rem; border-radius: var(--r-petit); background: var(--accent-pale); font-size: 1.04rem; color: var(--clair-texte); }
.texte-clair p + p { margin-top: .5em; }
.texte-clair .inconnu { background: var(--sable); margin: .6rem -1rem -.8rem; padding: .7rem 1rem; border-radius: 0 0 var(--r-petit) var(--r-petit); }
.texte-clair .note { color: var(--encre-2); font-size: .95rem; }
.encadre[data-marge] { margin-top: .85rem; }
.zone-ecouter { margin-top: .9rem; }
.zone-ecouter:empty { display: none; }
.examen-phrase { font-size: 1.12rem; font-weight: 600; }

.ecouter {
  display: inline-flex; align-items: center; gap: .35rem; flex: none;
  min-height: 2.5rem; padding: 0 .8rem; border-radius: var(--r-pilule);
  background: var(--surface); color: var(--encre); border: 1px solid var(--ligne);
  font-family: inherit; font-size: .85rem; font-weight: 650; cursor: pointer;
}
.ecouter svg { width: 1.1rem; height: 1.1rem; }
.ecouter[aria-pressed="true"] { background: var(--encre); color: var(--fond); border-color: var(--encre); }

details.original { margin-top: .85rem; }
details.original summary {
  cursor: pointer; font-weight: 650; color: var(--lien); min-height: 2.75rem; display: flex; align-items: center; gap: .4rem; list-style: none;
}
details.original summary::-webkit-details-marker { display: none; }
details.original summary::before { content: ""; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: .3rem; }
details.original[open] summary::before { transform: rotate(45deg); }
details.original pre {
  white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--serif); font-size: .95rem; line-height: 1.65; color: var(--encre);
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-petit); padding: 1rem; margin: .4rem 0 0;
}

.glossaire { margin: 0; }
.glossaire > div { padding: .9rem 0; border-top: 1px solid var(--ligne); }
.glossaire > div:first-child { border-top: 0; padding-top: 0; }
.glossaire > div:last-child { padding-bottom: 0; }
.glossaire dt { font-weight: 650; }
.glossaire dt span, .definition h2 span { background-image: linear-gradient(transparent 22%, var(--surligneur) 22%, var(--surligneur) 92%, transparent 92%); padding: 0 .12em; color: var(--sur-encre); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.glossaire dd { margin: .2rem 0 0; }
.glossaire dd .court { display: block; font-weight: 600; }
.glossaire dd .long { display: block; color: var(--encre-2); font-size: .95rem; }

.questions { list-style: none; counter-reset: q; margin: 0; padding: 0; }
.questions li { counter-increment: q; display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .75rem; padding: .95rem 0; border-top: 1px solid var(--ligne); align-items: start; }
.questions li:first-child { border-top: 0; padding-top: .1rem; }
.questions li::before { content: counter(q); width: 2rem; height: 2rem; border-radius: 50%; background: var(--encre); color: var(--fond); display: grid; place-items: center; font-weight: 700; font-size: .9rem; margin-top: .05rem; }
.questions li.perso::before { background: var(--accent); color: var(--accent-texte); }
.questions .retirer { background: none; border: 0; color: var(--encre-2); cursor: pointer; font-family: inherit; font-size: .85rem; text-decoration: underline; min-height: 2.5rem; padding: 0 .25rem; }
.ajout-question { margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.ajout-question label { font-weight: 650; font-size: .95rem; }
.ajout-question .rangee { display: flex; gap: .5rem; }
.ajout-question input {
  flex: 1; min-width: 0; min-height: 3rem; font-family: inherit; font-size: max(1rem, 16px); color: var(--encre);
  border: 2px solid var(--ligne); border-radius: var(--r-petit); padding: .5rem .8rem; background: var(--surface);
}
.ajout-question .btn { min-height: 3rem; padding: .5rem 1.1rem; }

.securite-complete { margin-top: 2.25rem; }
.actions-resultat { display: grid; gap: .6rem; margin-top: 1.75rem; }
@media (min-width: 34rem) { .actions-resultat { grid-template-columns: 1fr 1fr; } .actions-resultat .btn:last-child { grid-column: span 2; } }
.fin { margin-top: 1.25rem; display: flex; gap: .6rem; align-items: center; justify-content: center; text-align: center; font-size: .9rem; color: var(--encre-2); }
.fin svg { width: 1.1rem; height: 1.1rem; }

/* ---------- 7. Feuilles (définition, affichage) ---------- */
dialog.feuille {
  border: 0; padding: 0; color: var(--encre); background: var(--surface);
  width: min(32rem, calc(100% - 2rem)); max-width: 100%; max-height: 90dvh; border-radius: var(--r-carte);
  box-shadow: var(--ombre-feuille);
}
dialog.feuille::backdrop { background: var(--voile); }
.feuille .contenu { padding: 1.5rem 1.35rem 1.35rem; }
.feuille h2 { font-size: 1.4rem; }
.feuille .court { font-size: 1.1rem; font-weight: 600; margin-top: .6rem; }
.feuille .long { color: var(--encre-2); margin-top: .5rem; }
.feuille .fermer { margin-top: 1.25rem; width: 100%; }
.poignee { display: none; width: 2.5rem; height: .3rem; border-radius: 1rem; background: var(--ligne); margin: .6rem auto 0; }
@media (max-width: 40rem) {
  dialog.feuille[open] { margin: auto 0 0; width: 100%; border-radius: var(--r-carte) var(--r-carte) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .poignee { display: block; }
}
@media (prefers-reduced-motion: no-preference) { dialog.feuille[open] { animation: monter .24s ease-out; } }
@keyframes monter { from { transform: translateY(1.5rem); opacity: .4; } }

.reglages fieldset { border: 0; margin: 1.25rem 0 0; padding: 0; min-width: 0; }
.reglages legend { font-weight: 650; font-size: .95rem; margin-bottom: .5rem; padding: 0; }
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; background: var(--surface-2); border: 1px solid var(--ligne); border-radius: var(--r-pilule); padding: .25rem; }
.segment label { position: relative; display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 2.75rem; border-radius: var(--r-pilule); cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--encre-2); text-align: center; padding: 0 .4rem; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment label:has(input:checked) { background: var(--encre); color: var(--fond); }
.segment label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.segment svg { width: 1.05rem; height: 1.05rem; }
.segment .a1 { font-size: .85rem; } .segment .a2 { font-size: 1.05rem; } .segment .a3 { font-size: 1.3rem; }
.reglages .note { font-size: .85rem; color: var(--encre-2); margin-top: 1rem; }

/* Message éphémère */
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--encre); color: var(--fond); padding: .8rem 1.25rem; border-radius: var(--r-pilule);
  font-size: .95rem; font-weight: 600; z-index: 60; max-width: calc(100% - 2rem); text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}

/* ---------- 8. Pied de page ---------- */
.pied { border-top: 1px solid var(--ligne); padding: 1.5rem 0 calc(2.5rem + env(safe-area-inset-bottom)); font-size: .85rem; color: var(--encre-2); }
.pied p + p { margin-top: .5rem; }
.pied nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-bottom: .9rem; font-size: .92rem; font-weight: 600; }
.pied nav a { min-height: 2.5rem; display: inline-flex; align-items: center; }

/* ---------- 9. Page « À propos » (étude de cas) ---------- */
.etude h1 { font-size: 2.1rem; max-width: 20ch; }
.etude .chapeau { font-size: 1.15rem; color: var(--encre-2); margin-top: .9rem; }
.etude section { margin-top: 2.5rem; }
.etude section > h2 { margin-bottom: .75rem; }
.etude ul.liste { margin: .5rem 0 0; padding-left: 1.2rem; }
.etude ul.liste li + li { margin-top: .4rem; }
.principes { display: grid; gap: .75rem; margin-top: .5rem; }
.principes .carte h3 { margin-bottom: .35rem; }
.principes .carte p { color: var(--encre-2); }
.chiffres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.chiffres div { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-carte); padding: 1rem 1.1rem; }
.chiffres strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.chiffres span { color: var(--encre-2); font-size: .9rem; }
.flux { list-style: none; counter-reset: f; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.flux li { counter-increment: f; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .75rem; align-items: start; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--r-petit); padding: .75rem .9rem; }
.flux li::before { content: counter(f); width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-pale); font-weight: 700; font-size: .9rem; }
.flux code, .etude code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: .05em .35em; border-radius: .3rem; }
.tableau { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tableau th, .tableau td { text-align: left; padding: .6rem .5rem; border-top: 1px solid var(--ligne); vertical-align: top; }
.tableau th { font-weight: 650; width: 40%; }

/* ---------- 10. Écrans plus larges ---------- */
@media (min-width: 48rem) {
  .enveloppe { padding: 0 2rem; }
  .accroche { padding-top: 2.75rem; }
  .accroche h1 { font-size: 3rem; }
  .demo .jargon { font-size: 1.5rem; padding: 1.5rem 1.75rem 1.3rem; }
  .demo .clair, .demo figcaption { padding-left: 1.75rem; padding-right: 1.75rem; }
  .carte { padding: 1.6rem 1.75rem; }
  .sommaire { margin-left: -2rem; margin-right: -2rem; padding-left: 2rem; padding-right: 2rem; }
  .exemples { grid-template-columns: 1fr 1fr; }
  .principes { grid-template-columns: 1fr 1fr; }
  .chiffres { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .etude h1 { font-size: 2.75rem; }
}
@media (max-width: 22rem) {
  .enveloppe { padding: 0 1rem; }
  .sommaire { margin-left: -1rem; margin-right: -1rem; padding-left: 1rem; padding-right: 1rem; }
  .accroche h1 { font-size: 1.85rem; }
  .carte { padding: 1.15rem 1rem; }
  .outils-entete .btn-icone .etiq { display: none; }
}

/* ---------- 11. Impression : une fiche pour le rendez-vous ---------- */
.entete-impression, .notes-impression { display: none; }
@media print {
  :root, :root[data-theme] {
    color-scheme: light; --fond: #fff; --surface: #fff; --surface-2: #fff; --encre: #111; --encre-2: #444; --ligne: #ccc;
    --accent-pale: #F1F5F3; --clair-texte: #111; --sur-encre: #111; --ciel: #F2F5F8; --ciel-bord: #ccc; --sable: #FAF6EE; --sable-bord: #ddd;
  }
  @page { margin: 1.5cm; }
  html, html[data-taille] { font-size: 10.5pt; }
  body { background: #fff; }
  .entete, .pied, .sommaire, .actions-resultat, .fin, .retour, .ajout-question, .questions .retirer, .note-securite, details.original, .lien-evitement, .ecouter, .toast, .partie > .sous { display: none !important; }
  .entete-impression { display: block; border-bottom: 1.5pt solid #111; padding-bottom: .5rem; margin-bottom: 1rem; }
  .entete-impression strong { font-size: 13pt; }
  .carte { border: 1px solid #ccc; padding: .8rem 1rem; break-inside: auto; }
  .carte + .carte { margin-top: .5rem; }
  .partie { margin-top: 1.25rem; }
  .lignes > li, .glossaire > div, .questions li { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .texte-clair, .terme, .surligne, .badge, .questions li::before, .glossaire dt span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .questions li { grid-template-columns: 2rem minmax(0, 1fr); }
  .notes-impression { display: block; margin-top: 1.25rem; break-inside: avoid; }
  .notes-impression .ligne-note { border-bottom: 1px solid #aaa; height: 1.9rem; }
  .securite-complete { break-inside: avoid; }
}
.etude .sous-texte { color: var(--encre-2); margin-top: .9rem; font-size: .95rem; }
