/* =========================================================================
   Académie — base : jetons, thème, typographie, en-tête, composants communs
   ========================================================================= */

:root {
  --bg: #ffffff;
  --bg-rgb: 255, 255, 255;
  --surface: #f5f5f7;
  --surface-2: #ececf0;
  --texte: #1d1d1f;
  --texte-rgb: 29, 29, 31;
  --texte-2: #6e6e73;
  --texte-3: #a1a1a6;
  --filet: rgba(0, 0, 0, .08);
  --filet-2: rgba(0, 0, 0, .14);
  --verre: rgba(255, 255, 255, .72);
  --verre-fort: rgba(255, 255, 255, .84);
  --voile: rgba(0, 0, 0, .18);
  --ok: #1a7f37;
  --ok-fond: rgba(52, 199, 89, .12);
  --ko: #d70015;
  --ko-fond: rgba(255, 59, 48, .09);
  --orange: #b25000;
  --orange-filet: #ff9f0a;
  --code-fond: #1c1c1e;
  --code-texte: #f5f5f7;
  --ombre-flottant: 0 18px 50px rgba(0, 0, 0, .10), 0 2px 6px rgba(0, 0, 0, .04);

  --accent: #0a84ff;
  --accent-rgb: 10, 132, 255;
  --accent-fond: #0974df;   /* accent sous un texte blanc (4,5:1 au moins), recalculé par domaine (app.js) */
  --accent-texte: var(--accent-texte-clair, #0066cc);

  --courbe: cubic-bezier(.2, .8, .2, 1);
  --courbe-sortie: cubic-bezier(.4, 0, .6, 1);
  --police: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* en-tête : 52 px + la zone de la barre d'état quand l'appli installée passe dessous */
  --entete-h: calc(52px + env(safe-area-inset-top, 0px));
  --onglets-h: 62px; /* bande collante des onglets du cours (sous l'en-tête) */
  --gouttiere: clamp(16px, 4.2vw, 56px);
  --largeur: 1200px;
  --lecture: 700px;
  --barre-bas-h: 0px; /* barre d'onglets du bas (appli installée, mobile) : voir appli.css */
  --bas-libre: env(safe-area-inset-bottom, 0px); /* d'où partent les éléments flottants du bas */
  color-scheme: light;
}

/* Accent local d'un domaine (carte, étape du parcours) : les variables --accent* sont posées
   en style sur l'élément ; le texte accentué y est recalculé pour le thème courant */
.accent-d { --accent-texte: var(--accent-texte-clair); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #000000;
    --bg-rgb: 0, 0, 0;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --texte: #f5f5f7;
    --texte-rgb: 245, 245, 247;
    --texte-2: #a1a1a6;
    --texte-3: #636366;
    --filet: rgba(255, 255, 255, .10);
    --filet-2: rgba(255, 255, 255, .18);
    --verre: rgba(22, 22, 24, .70);
    --verre-fort: rgba(28, 28, 30, .86);
    --voile: rgba(0, 0, 0, .5);
    --ok: #30d158;
    --ok-fond: rgba(48, 209, 88, .14);
    --ko: #ff453a;
    --ko-fond: rgba(255, 69, 58, .14);
    --orange: #ff9f0a;
    --code-fond: #1c1c1e;
    --ombre-flottant: 0 18px 50px rgba(0, 0, 0, .55);
    --accent-texte: var(--accent-texte-sombre, #409cff);
    color-scheme: dark;
  }
  :root:not([data-theme="clair"]) .accent-d { --accent-texte: var(--accent-texte-sombre); }
}
:root[data-theme="sombre"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --texte: #f5f5f7;
  --texte-rgb: 245, 245, 247;
  --texte-2: #a1a1a6;
  --texte-3: #636366;
  --filet: rgba(255, 255, 255, .10);
  --filet-2: rgba(255, 255, 255, .18);
  --verre: rgba(22, 22, 24, .70);
  --verre-fort: rgba(28, 28, 30, .86);
  --voile: rgba(0, 0, 0, .5);
  --ok: #30d158;
  --ok-fond: rgba(48, 209, 88, .14);
  --ko: #ff453a;
  --ko-fond: rgba(255, 69, 58, .14);
  --orange: #ff9f0a;
  --code-fond: #1c1c1e;
  --ombre-flottant: 0 18px 50px rgba(0, 0, 0, .55);
  --accent-texte: var(--accent-texte-sombre, #409cff);
  color-scheme: dark;
}
:root[data-theme="sombre"] .accent-d { --accent-texte: var(--accent-texte-sombre); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--entete-h) + 24px);
}
/* Pages avec la bande d'onglets collante : les ancres s'arrêtent sous la bande */
html:has(.onglets-barre) { scroll-padding-top: calc(var(--entete-h) + var(--onglets-h) + 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--texte);
  font-family: var(--police);
  font-size: clamp(17px, 0.3vw + 16px, 19px);
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-bottom: var(--barre-bas-h);
  transition: background-color .4s var(--courbe), color .4s var(--courbe);
}
/* Les commandes ne se sélectionnent pas (appui long sur mobile = pas de loupe ni de menu) */
button, .bouton, .segmente, .puce, .entete, .onglets-barre, .barre-bas, .toast, .feuille-tete,
.fiches-nav-btn, .frise-point, .trame-champ, .appro-tete, .mot-tete, .sommaire-flottant {
  -webkit-user-select: none;
  user-select: none;
}
.entete a, .barre-bas a, .bouton { -webkit-touch-callout: none; }
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }
table { border-collapse: collapse; }
code, kbd, pre { font-family: var(--mono); }
::selection { background: rgba(var(--accent-rgb), .22); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

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

/* ---------- Typographie ---------- */
.surtitre {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--texte-2);
  line-height: 1.4;
}
.surtitre--accent { color: var(--accent-texte); }
.titre-heros {
  font-size: clamp(46px, 14vw, 140px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: .94;
}
.titre-1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.titre-2 {
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.titre-3 {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.chapeau {
  font-size: clamp(19px, 1.4vw + 12px, 24px);
  line-height: 1.4;
  letter-spacing: -0.018em;
  color: var(--texte-2);
  font-weight: 500;
}
.gris { color: var(--texte-2); }
.mono { font-family: var(--mono); letter-spacing: 0; }
.num-tab { font-variant-numeric: tabular-nums; }

/* ---------- Conteneurs ---------- */
.cadre {
  width: 100%;
  max-width: calc(var(--largeur) + 2 * var(--gouttiere));
  margin: 0 auto;
  padding-left: var(--gouttiere);
  padding-right: var(--gouttiere);
}

/* ---------- En-tête (verre dépoli, fixe) ---------- */
.entete {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--entete-h);
  background: var(--verre);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--filet);
  padding-top: env(safe-area-inset-top, 0px);
  view-transition-name: entete;
}
.entete-in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: calc(var(--largeur) + 2 * var(--gouttiere));
  margin: 0 auto;
  padding: 0 var(--gouttiere);
  padding-left: max(var(--gouttiere), env(safe-area-inset-left));
  padding-right: max(var(--gouttiere), env(safe-area-inset-right));
}
.marque {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.025em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.marque-point {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  transition: background-color .5s var(--courbe), transform .5s var(--courbe);
}
.marque:hover .marque-point { transform: scale(1.35); }
.fil {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  color: var(--texte-2);
  overflow: hidden;
  white-space: nowrap;
}
.fil a, .fil span {
  flex: none;
  padding: 4px 6px;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s, background-color .2s;
}
.fil [aria-current] { flex: 0 1 auto; min-width: 0; }
.fil a:hover { color: var(--texte); background: var(--surface); }
.fil .sep { padding: 0 1px; color: var(--texte-3); flex: none; }
.fil [aria-current] { color: var(--texte); font-weight: 500; }
.entete-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.entete-lien {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-2);
  transition: background-color .2s, color .2s;
}
.entete-lien:hover { background: var(--surface); color: var(--texte); }
.entete-lien[aria-current="page"] { color: var(--texte); }
/* la barre du bas prend le relais (mobile, appli installée) */
@media (max-width: 760px) { .entete-lien { display: none; } }
html.appli .entete-lien { display: none; }
.theme-btn {
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-2);
  transition: background-color .2s, color .2s, transform .2s var(--courbe);
}
.theme-btn:hover { background: var(--surface); color: var(--texte); }
.theme-btn:active { transform: scale(.95); }
.theme-glyphe {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform .5s var(--courbe);
}
[data-theme="clair"] .theme-glyphe { background: transparent; }
[data-theme="sombre"] .theme-glyphe { background: currentColor; }
.theme-btn:hover .theme-glyphe { transform: rotate(180deg); }

.progression {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.progression span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
body.avec-progression .progression { opacity: 1; }

@media (max-width: 640px) {
  .fil .fil-loin { display: none; }
  .theme-texte { display: none; }
  .theme-btn { padding: 0; width: 32px; justify-content: center; }
}

/* ---------- Vue principale + transitions ---------- */
#vue {
  min-height: 100vh;
  min-height: 100dvh;
  outline: none;
}
/* Ré-affichage sur place (progression arrivée d'un autre appareil) : rien ne rejoue */
#vue.sans-anim [data-r], #vue.sans-anim .anneau-trait, #vue.sans-anim .dc-prog span,
#vue.sans-anim .barre-prog span, #vue.sans-anim .mini-scores i::after { transition: none !important; }
#vue.sans-anim .titre-revele .ligne > span, #vue.sans-anim .sec-num { animation: none !important; transform: none !important; }
.vue-page { padding-top: var(--entete-h); }

/* Transitions de page : jamais deux pages superposées.
   L'ancienne s'efface vite (120 ms), la nouvelle n'arrive qu'ensuite, en fondu
   avec une légère montée (300 ms). L'en-tête (nommé à part) reste fixe. */
::view-transition-group(*) { animation-duration: .32s; animation-timing-function: var(--courbe); }
/* éléments partagés (titre du cours, onglets) : fondu court pendant qu'ils se déplacent */
::view-transition-old(*) { animation: vt-fondu-sortie .12s linear both; }
::view-transition-new(*) { animation: vt-fondu-entree .2s linear .04s both; }
::view-transition-old(root) { animation: vt-sortie .12s cubic-bezier(0, 0, .2, 1) both; }
::view-transition-new(root) { animation: vt-entree .3s var(--courbe) .08s both; }
/* un élément nommé présent d'un seul côté suit la page (règles séparées : un sélecteur
   non reconnu n'annule pas celles du dessus) */
::view-transition-old(*):only-child { animation: vt-sortie .12s cubic-bezier(0, 0, .2, 1) both; }
::view-transition-new(*):only-child { animation: vt-entree .3s var(--courbe) .08s both; }
/* l'en-tête change d'un coup (fil d'Ariane) : pas de fondu enchaîné, pas de texte doublé */
::view-transition-group(entete) { animation: none; }
::view-transition-old(entete) { animation: none; opacity: 0; }
::view-transition-new(entete) { animation: none; opacity: 1; }
@keyframes vt-sortie { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-entree { from { opacity: 0; transform: translateY(12px); } }
@keyframes vt-fondu-sortie { to { opacity: 0; } }
@keyframes vt-fondu-entree { from { opacity: 0; } }

/* Repli sans View Transitions (le routeur retire l'ancienne vue, puis pose la nouvelle) */
#vue.vt-sort { animation: vt-sortie .12s cubic-bezier(0, 0, .2, 1) both; }
#vue.vt-entre { animation: vt-entree .3s var(--courbe) both; }

/* Apparitions au scroll */
[data-r] {
  opacity: 0;
  transform: translateY(18px);
  transition-property: opacity, transform, box-shadow, background-color, color;
  transition-duration: .8s, .9s, .35s, .35s, .35s;
  transition-timing-function: var(--courbe);
  transition-delay: calc(var(--i, 0) * 70ms), calc(var(--i, 0) * 70ms), 0s, 0s, 0s;
}
[data-r].vu { opacity: 1; transform: none; }
[data-r].vu-fini { transition-delay: 0s; transition-duration: .4s, .55s, .35s, .35s, .35s; }

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform .25s var(--courbe), background-color .25s, color .25s, box-shadow .25s, opacity .25s;
  user-select: none;
  -webkit-user-select: none;
}
.bouton:active { transform: scale(.96); }
.bouton-plein { background: var(--texte); color: var(--bg); }
.bouton-plein:hover { background: rgba(var(--texte-rgb), .86); }
.bouton-accent { background: var(--accent-fond, var(--accent)); color: #fff; }
.bouton-accent:hover { background: var(--accent-fond, var(--accent)); filter: brightness(.92); }
.bouton-doux { background: var(--surface); color: var(--texte); }
.bouton-doux:hover { background: var(--surface-2); }
.bouton-filet { box-shadow: inset 0 0 0 1px var(--filet-2); color: var(--texte); }
.bouton-filet:hover { box-shadow: inset 0 0 0 1px var(--texte-2); }
.bouton-danger { background: var(--ko); color: #fff; }
.bouton-danger:hover { background: var(--ko); opacity: .88; }
.bouton.bouton-texte-danger { color: var(--ko); }
.bouton[disabled], .bouton[aria-disabled="true"] { opacity: .38; cursor: default; pointer-events: none; }
.bouton .fleche { display: inline-block; transition: transform .35s var(--courbe); }
.bouton:hover .fleche, a:hover > .fleche, a:hover .fleche-lien { transform: translateX(4px); }
.bouton-petit { min-height: 36px; padding: 0 16px; font-size: 14.5px; }
.lien {
  color: var(--accent-texte);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lien:hover { text-decoration: underline; text-underline-offset: 3px; }
.fleche-lien { display: inline-block; transition: transform .35s var(--courbe); }

/* ---------- Contrôle segmenté ---------- */
.segmente {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface);
  isolation: isolate;
  max-width: 100%;
}
.segmente-curseur {
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 3px 10px rgba(0, 0, 0, .06), inset 0 0 0 .5px var(--filet);
  transition: transform .5s var(--courbe), width .5s var(--courbe);
}
:root[data-theme="sombre"] .segmente-curseur { background: #3a3a3c; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .segmente-curseur { background: #3a3a3c; box-shadow: none; } }
.segmente > button, .segmente > a {
  position: relative;
  min-height: 36px;
  padding: 6px 18px;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--texte-2);
  text-align: center;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  transition: color .3s;
}
.segmente > button:hover, .segmente > a:hover { color: var(--texte); }
.segmente > [aria-checked="true"], .segmente > [aria-current="page"], .segmente > [aria-selected="true"] { color: var(--texte); font-weight: 600; }
.segmente .seg-sous { font-size: 11.5px; font-weight: 500; color: var(--texte-2); letter-spacing: 0; }
.segmente--grand > button { min-height: 52px; padding: 8px 22px; font-size: 15.5px; }
@media (max-width: 520px) {
  .segmente > button, .segmente > a { padding: 6px 10px; font-size: 14px; }
  .segmente--grand > button { padding: 8px 8px; font-size: 14.5px; }
}

/* ---------- Puces (chips) ---------- */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--texte-2);
  box-shadow: inset 0 0 0 1px var(--filet-2);
  white-space: nowrap;
  transition: background-color .25s, color .25s, box-shadow .25s, transform .2s var(--courbe);
}
button.puce:hover { color: var(--texte); box-shadow: inset 0 0 0 1px var(--texte-2); }
button.puce:active { transform: scale(.96); }
.puce[aria-pressed="true"], .puce[aria-checked="true"] {
  background: var(--texte);
  color: var(--bg);
  box-shadow: none;
}
.puce--bientot { color: var(--texte-2); box-shadow: inset 0 0 0 1px var(--filet); }
.puce .puce-num { font-family: var(--mono); font-size: 12px; opacity: .8; }

/* ---------- Mots de vocabulaire (balisage) ---------- */
.terme {
  color: inherit;
  cursor: help;
  background-image: linear-gradient(to right, var(--accent) 45%, transparent 45%);
  background-size: 5px 1.5px;
  background-repeat: repeat-x;
  background-position: 0 calc(100% - 1px);
  padding-bottom: 1px;
  border-radius: 3px;
  transition: background-color .2s, color .2s;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.terme:hover, .terme.actif {
  background-color: rgba(var(--accent-rgb), .12);
  color: var(--texte);
}
.terme:focus-visible { outline-offset: 2px; }
.code-inline, code.ci {
  font-family: var(--mono);
  font-size: .86em;
  padding: .1em .38em;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--filet);
  letter-spacing: 0;
  white-space: nowrap;
}
strong, b { font-weight: 650; }

/* ---------- Calques : bulle, feuille, toast ---------- */
.bulle {
  position: fixed;
  z-index: 80;
  top: 0; left: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 18px 20px 16px;
  border-radius: 20px;
  background: var(--verre-fort);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  box-shadow: var(--ombre-flottant), inset 0 0 0 1px var(--filet);
  font-size: 15.5px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px) scale(.97);
  transform-origin: var(--ox, 50%) var(--oy, 0%);
  transition: opacity .22s var(--courbe), transform .32s var(--courbe);
  pointer-events: none;
}
.bulle.ouverte { opacity: 1; transform: none; pointer-events: auto; }
.bulle-terme { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
.bulle-en { font-size: 13px; color: var(--texte-2); margin-top: 2px; }
.bulle-def { margin-top: 10px; }
.bulle-ex { margin-top: 10px; color: var(--texte-2); font-size: 14.5px; }
.bulle-ex b { color: var(--texte); font-weight: 600; }
.bulle-pied {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--filet);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.bulle-contenu { transition: opacity .2s, transform .3s var(--courbe); }
.bulle-contenu.change { opacity: 0; transform: translateX(8px); }
.bulle-retour { font-size: 13.5px; color: var(--texte-2); }
.bulle-retour:hover { color: var(--texte); }

.voile {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--voile);
  opacity: 0;
  transition: opacity .35s var(--courbe);
}
.voile.ouverte { opacity: 1; }
.feuille-bas {
  position: fixed;
  z-index: 91;
  left: 0; right: 0; bottom: 0;
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  background: var(--verre-fort);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--ombre-flottant), inset 0 1px 0 var(--filet);
  transform: translateY(105%);
  transition: transform .45s var(--courbe);
  padding-bottom: env(safe-area-inset-bottom);
}
.feuille-bas.ouverte { transform: translateY(0); }
.feuille-poignee {
  flex: none;
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
  cursor: grab;
  touch-action: none;
}
.feuille-poignee span { width: 38px; height: 5px; border-radius: 3px; background: var(--filet-2); }
.feuille-tete {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 22px 10px;
}
.feuille-titre { font-size: 13px; }
.feuille-fermer { font-size: 15px; font-weight: 600; color: var(--accent-texte); padding: 6px 2px; }
.feuille-corps {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 22px 26px;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 720px) {
  .feuille-bas { left: 50%; right: auto; width: 600px; margin-left: -300px; bottom: 16px; border-radius: 28px; }
}

.toast {
  position: fixed;
  z-index: 95;
  left: 50%;
  bottom: calc(var(--bas-libre) + 20px);
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 20px;
  border-radius: 999px;
  background: rgba(var(--texte-rgb), .92);
  color: var(--bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
  transform: translate(-50%, 140%);
  opacity: 0;
  /* masqué = ni visible, ni cliquable, ni atteignable au clavier : il ne doit jamais capter un
     toucher destiné à la barre du bas ou au bouton qu'il recouvre (visibility bascule à la
     fin de la sortie, pour laisser le fondu se jouer) */
  visibility: hidden;
  pointer-events: none;
  transition: transform .5s var(--courbe), opacity .3s, visibility 0s linear .5s;
}
.toast.ouverte { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.toast a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--texte);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.toast a:hover { background: rgba(var(--bg-rgb), .85); }
@media (max-width: 520px) {
  .toast { border-radius: 20px; flex-direction: column; align-items: stretch; text-align: center; padding: 14px; gap: 10px; width: calc(100vw - 32px); }
}

.secours-texte {
  width: 100%;
  min-height: 240px;
  margin-top: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 0;
  background: var(--surface);
  color: var(--texte);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}

/* ---------- Chargement / erreurs ---------- */
.chargement {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
.chargement-point {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  animation: pulsation 1.2s var(--courbe) infinite;
}
@keyframes pulsation { 0%, 100% { transform: scale(.6); opacity: .4; } 50% { transform: scale(1); opacity: 1; } }
.vide {
  padding: 28px;
  border-radius: 24px;
  background: var(--surface);
  color: var(--texte-2);
}
.vide strong { color: var(--texte); display: block; font-size: 19px; margin-bottom: 4px; letter-spacing: -0.02em; }

.pied {
  padding: 64px 0 calc(48px + env(safe-area-inset-bottom));
  color: var(--texte-2);
  font-size: 13px;
  border-top: 1px solid var(--filet);
  margin-top: 96px;
}
.pied .cadre { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  [data-r] { transform: none; transition: opacity .45s linear; transition-delay: 0s; }
  .bulle, .feuille-bas, .toast, .segmente-curseur { transition-property: opacity; transition-duration: .2s; }
  .bulle { transform: none; }
  .feuille-bas { transform: none; opacity: 0; }
  .feuille-bas.ouverte { opacity: 1; }
  .toast { transform: translate(-50%, 0); transition: opacity .2s, visibility 0s linear .2s; }
  ::view-transition-old(*), ::view-transition-new(*), ::view-transition-group(*) { animation: none !important; }
  #vue.vt-sort, #vue.vt-entre { animation: none; }
}

@media print {
  .entete, .toast, .bulle, .feuille-bas, .voile, .barre-bas { display: none !important; }
  body { padding-bottom: 0; }
  [data-r] { opacity: 1 !important; transform: none !important; }
}
