/* Polices intégrées au site (licence libre SIL OFL, voir polices/) : plus aucun appel à Google Fonts */
@font-face { font-family: 'Andika'; font-style: normal; font-weight: 400; font-display: swap; src: url('polices/andika-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Andika'; font-style: normal; font-weight: 400; font-display: swap; src: url('polices/andika-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Andika'; font-style: normal; font-weight: 700; font-display: swap; src: url('polices/andika-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Andika'; font-style: normal; font-weight: 700; font-display: swap; src: url('polices/andika-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Patrick Hand'; font-style: normal; font-weight: 400; font-display: swap; src: url('polices/patrick-hand-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Patrick Hand'; font-style: normal; font-weight: 400; font-display: swap; src: url('polices/patrick-hand-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* Ma petite école — style « livre illustré » : papier, traits de crayon de bois, lavis d'aquarelle.
   Les effets viennent des filtres SVG #crayon, #lavis et #aquarelle définis dans index.html. */

:root {
  --papier: #f8f1e3;
  --feuille: #fffcf4;
  --crayon: #3b3a3f;
  --crayon-doux: #6c6660; /* assombri pour atteindre 4,5:1 sur tous les fonds doux */
  --trait-clair: #d9cfbd;
  --maths: #5f8fbd;
  --maths-lavis: #a9c8e4;
  --maths-doux: #dfeaf4;
  --francais: #9474b5;
  --francais-lavis: #cdb8e3;
  --francais-doux: #ece3f5;
  --juste: #5d8f57;
  --juste-lavis: #b8d6a9;
  --juste-doux: #e5f0dc;
  --aide: #b0802a;
  --aide-lavis: #f0d48e;
  --aide-doux: #f8edcf;
  /* Rouge réservé aux vraies erreurs (question des parents, bouton « danger ») : jamais une couleur de matière */
  --erreur-texte: #a14f3c;
  --erreur-lavis: #efb19f;
  /* Teintes « texte » : plus foncées, pour le texte de couleur et les contours fins (contraste 4,5:1) */
  --maths-texte: #476b8e;
  --francais-texte: #6e4f94;
  --aide-texte: #866120;
  --accent: var(--maths);
  --accent-texte: var(--maths-texte);
  --accent-lavis: var(--maths-lavis);
  --accent-doux: var(--maths-doux);
  /* Coins « dessinés à la main » : jamais tout à fait réguliers */
  --forme: 22px 30px 20px 34px / 30px 22px 34px 20px;
  --forme-petite: 12px 16px 11px 18px / 16px 12px 18px 11px;
  --police: 'Andika', 'Comic Sans MS', system-ui, sans-serif;
  --police-titre: 'Patrick Hand', 'Andika', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--crayon);
  font-family: var(--police);
  font-size: 20px;
  line-height: 1.4;
  background-color: var(--papier);
  /* Grain du papier + deux taches d'aquarelle très pâles */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.35  0 0 0 0 0.26  0 0 0 0.10 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse 45% 35% at 8% 4%, rgba(169, 200, 228, 0.35), transparent 70%),
    radial-gradient(ellipse 40% 35% at 96% 98%, color-mix(in srgb, var(--francais-lavis) 30%, transparent), transparent 70%);
  background-attachment: fixed;
}

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px dashed var(--accent-texte); outline-offset: 4px; }
/* Titres et questions qui reçoivent le focus par programme : pas de contour */
[tabindex="-1"]:focus { outline: none; }
/* Texte lu seulement par les lecteurs d'écran */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

#app { max-width: 1000px; margin: 0 auto; padding: 0 24px 40px; }

.maths { --accent: var(--maths); --accent-texte: var(--maths-texte); --accent-lavis: var(--maths-lavis); --accent-doux: var(--maths-doux); }
.francais { --accent: var(--francais); --accent-texte: var(--francais-texte); --accent-lavis: var(--francais-lavis); --accent-doux: var(--francais-doux); }

/* ---------- Le trait de crayon et le lavis, sur tous les éléments « dessinés » ---------- */
.carte-question, .carte-jeu, .carte-matiere, .bouton-niveau, .bouton-choix, .tuile, .pave button,
.retour, .bouton, .bouton-rond, .pastille-temps, .texte-a-lire, .ligne-phrase, .trou, .segments button,
.reglage input, .bouton-parent, .bouton-texte, .modale {
  position: relative;
  isolation: isolate;
  border-radius: var(--forme);
}
.carte-question::before, .carte-jeu::before, .carte-matiere::before, .bouton-niveau::before, .bouton-choix::before,
.tuile::before, .pave button::before, .retour::before, .bouton::before, .bouton-rond::before, .pastille-temps::before,
.texte-a-lire::before, .ligne-phrase::before, .trou::before, .segments button::before, .bouton-parent::before,
.bouton-texte::before, .modale::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--crayon);
  border-radius: inherit;
  filter: url(#crayon);
  pointer-events: none;
}
/* Le fond « lavis » : une couleur posée à l'aquarelle, qui déborde un peu */
.carte-matiere::after, .retour::after, .bouton::after, .texte-a-lire::after,
.bouton-choix::after, .bouton-niveau::after, .tuile::after, .pave button::after, .segments button::after,
.ligne-phrase::after, .trou::after, .bouton-rond::after, .pastille-temps::after, .bouton-parent::after,
.bouton-texte::after, .modale::after, .champ-parent::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: inherit;
  background: var(--lavis, transparent);
  filter: url(#lavis);
  opacity: 0.85;
  transition: background 0.2s;
}

/* ---------- Illustrations ---------- */
.illus { display: inline-block; flex: none; }
.illus svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Les images ont un fond transparent (le papier blanc a été retiré) */
.illus img { display: block; width: 100%; height: auto; user-select: none; }
.illus.logo { width: 30px; margin-right: 6px; vertical-align: -10px; }
.illus.mini { width: 90px; margin: -12px 0 -14px; }
.illus.moyen { width: 120px; }
.illus.grand { width: 150px; }
.illus.etoile { width: 30px; }
.illus.etoile.vide { opacity: 1; } /* l'étoile vide est tracée en gris doux plein (contraste 3:1) */

/* ---------- En-tête ---------- */
.entete {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}
.logo { font-family: var(--police-titre); font-size: 28px; white-space: nowrap; }
.titre-entete { margin: 0; font-family: var(--police-titre); font-weight: 400; font-size: 32px; text-align: center; }
.entete-droite { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.bouton-rond {
  width: 52px; height: 52px; border-radius: 50% 46% 52% 48%;
  --lavis: var(--feuille);
  font-size: 22px; display: grid; place-items: center;
}
.bouton-rond:hover { --lavis: var(--maths-doux); }

/* Pastille du temps restant */
.pastille-temps {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 10px;
  --lavis: var(--feuille);
  font-family: var(--police-titre); font-size: 24px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pastille-temps .horloge {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--crayon);
  background: conic-gradient(var(--maths-lavis) calc(var(--part) * 360deg), transparent 0);
  filter: url(#crayon);
}
.pastille-temps[hidden] { display: none; }
.pastille-temps.bientot { --lavis: var(--aide-doux); color: var(--aide-texte); }
.pastille-temps.bientot .horloge { background: conic-gradient(var(--aide-lavis) calc(var(--part) * 360deg), transparent 0); }

/* ---------- Accueil ---------- */
.accueil { padding-top: 16px; }
.accueil-titre { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 36px; }
.bonjour { font-family: var(--police-titre); font-weight: 400; font-size: 64px; line-height: 1; margin: 0 0 8px; }
.sous-titre { color: var(--crayon-doux); font-size: 22px; margin: 0 auto 32px; max-width: 640px; }
.accueil-titre .sous-titre { margin: 0; }
.matieres { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.carte-matiere {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 28px 24px 24px;
  --lavis: var(--accent-doux);
  transition: transform 0.2s;
}
.carte-matiere.maths { --lavis: var(--maths-doux); }
.carte-matiere.francais { --lavis: var(--francais-doux); }
.carte-matiere:hover { transform: translateY(-4px) rotate(-1deg); }
.carte-matiere.francais:hover { transform: translateY(-4px) rotate(1deg); }
.carte-matiere:hover::after { background: var(--accent-lavis); }
.nom-matiere { font-family: var(--police-titre); font-size: 48px; line-height: 1.1; color: var(--accent-texte); }
.nb-jeux { color: var(--crayon-doux); }
.pied { text-align: center; color: var(--crayon-doux); font-size: 14px; margin-top: 48px; }

/* ---------- Liste des jeux ---------- */
.liste-jeux { display: grid; gap: 24px; }
.carte-jeu {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; align-items: center;
  padding: 24px; background: var(--feuille);
}
.carte-jeu:nth-child(even) { --forme: 30px 20px 34px 22px / 22px 30px 20px 34px; }
.vignette { display: block; user-select: none; }
.vignette.icone-jeu { width: 96px; height: 96px; margin: -8px 0; }
.titre-icone { display: inline-flex; align-items: center; gap: 10px; }
.vignette.petite { width: 44px; height: 44px; margin: -6px 0; }
.infos-jeu h2 { margin: 0; font-family: var(--police-titre); font-weight: 400; font-size: 32px; line-height: 1.1; }
.infos-jeu p { margin: 2px 0 0; color: var(--crayon-doux); }
.niveaux { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.bouton-niveau {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 10px 10px; border-radius: var(--forme-petite);
}
.bouton-niveau:hover { --lavis: var(--accent-doux); }
.num-niveau { font-family: var(--police-titre); font-size: 24px; color: var(--accent-texte); }
.nom-niveau { font-size: 16px; color: var(--crayon-doux); text-align: center; }
.etoiles { display: flex; gap: 2px; margin-top: 4px; }

/* ---------- Jeu ---------- */
.progression {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  color: var(--crayon-doux); font-size: 16px; margin-bottom: 16px;
}
.points-progression { display: flex; gap: 8px; }
.points-progression i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--crayon-doux); filter: url(#crayon); }
.points-progression i.fait { background: var(--accent-lavis); border-color: var(--crayon); }
.points-progression i.actuel { background: var(--accent); border-color: var(--crayon); transform: scale(1.3); }
.niveau-actuel { font-family: var(--police-titre); font-size: 22px; color: var(--accent-texte); }

.carte-question { padding: 40px; background: var(--feuille); text-align: center; }
.carte-question.avec-pave { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.contenu-question > :last-child { margin-bottom: 0; }
.consigne { margin: 0 0 24px; color: var(--crayon-doux); font-size: 22px; }
.visuel { display: flex; justify-content: center; margin-bottom: 24px; }
.enonce { margin-bottom: 24px; }

.egalite {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px;
  font-family: var(--police); font-weight: 700; font-size: 54px; font-variant-numeric: tabular-nums;
}
.trou {
  display: inline-grid; place-items: center;
  min-width: 1.7em; height: 1.35em; padding: 0 0.25em;
  border-radius: var(--forme-petite);
  --lavis: var(--accent-doux);
  color: var(--crayon);
}
.trou::before { border-style: dashed; border-color: var(--accent-texte); }
.trou.rempli::before { border-style: solid; border-color: var(--crayon); }
.trou.faux { color: var(--aide-texte); }
.trou.faux::before { border-color: var(--aide-texte); }
.trou.faux { text-decoration: line-through; text-decoration-thickness: 3px; }
.trou.juste { --lavis: var(--juste-lavis); }
.trou.corrige { --lavis: var(--aide-lavis); }
.ligne-reponse {
  display: flex; justify-content: center; align-items: center; gap: 16px;
  font-size: 24px; margin-bottom: 24px;
}
.ligne-reponse .trou { font-weight: 700; font-size: 44px; }

.phrase-maths { font-size: 34px; margin: 0; }
.probleme { font-size: 30px; line-height: 1.6; margin: 0 auto; max-width: 760px; text-align: left; }

/* Pavé numérique */
.pave { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; }
.pave button {
  height: 62px; border-radius: var(--forme-petite);
  font-family: var(--police); font-weight: 700; font-size: 28px;
  --lavis: var(--feuille);
}
.pave button:nth-child(3n + 1) { --forme-petite: 16px 12px 18px 11px / 12px 16px 11px 18px; }
.pave button:not(:disabled):hover { --lavis: var(--accent-doux); }
.pave .valider { --lavis: var(--accent-lavis); font-family: var(--police-titre); font-weight: 400; }
.pave button:disabled { opacity: 0.4; }
.pave .effacer { font-size: 24px; }

/* Choix */
.choix { display: grid; gap: 16px; max-width: 640px; margin: 0 auto; }
.choix.grands { grid-template-columns: repeat(3, 1fr); max-width: 560px; }
.bouton-choix { padding: 16px 24px; font-size: 26px; --lavis: var(--feuille); transition: transform 0.15s; }
.choix .bouton-choix:nth-child(2) { --forme: 30px 22px 34px 20px / 20px 34px 22px 30px; }
.choix .bouton-choix:nth-child(3) { --forme: 18px 34px 24px 28px / 28px 20px 32px 22px; }
.choix.grands .bouton-choix { font-size: 50px; padding: 16px 8px; }
.bouton-choix:not(:disabled):hover { --lavis: var(--accent-doux); transform: translateY(-2px) rotate(-0.5deg); }
.bouton-choix.juste { --lavis: var(--juste-lavis); }
.bouton-choix.elimine { opacity: 0.35; text-decoration: line-through; text-decoration-thickness: 2px; }
.bouton-choix.eteint { opacity: 0.35; }

.texte-a-lire {
  font-size: 34px; line-height: 1.6; max-width: 760px; margin: 0 auto;
  padding: 22px 32px; text-align: left;
  --lavis: var(--accent-doux);
}
.question { font-size: 28px; font-weight: 700; margin: 24px 0 0; }
.grande-image { font-size: 96px; line-height: 1.2; }

/* Mots en ordre */
.ligne-phrase {
  min-height: 92px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center;
  padding: 14px; margin-bottom: 24px;
  --lavis: var(--accent-doux);
}
.ligne-phrase::before { border-style: dashed; border-color: var(--accent-texte); }
.ligne-phrase.juste { --lavis: var(--juste-lavis); }
.ligne-phrase.revele { --lavis: var(--aide-doux); }
.ligne-phrase.faux::before { border-style: solid; border-color: var(--aide-texte); }
.ligne-phrase.faux { --lavis: var(--aide-doux); }
.indice { color: var(--crayon-doux); }
.reserve { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; min-height: 64px; margin-bottom: 24px; }
.tuile { padding: 12px 20px; line-height: 1.3; font-size: 30px; border-radius: var(--forme-petite); --lavis: var(--feuille); }
.tuile:nth-child(odd) { transform: rotate(-1deg); }
.tuile:nth-child(even) { transform: rotate(1deg); }
.tuile:not(:disabled):hover { --lavis: var(--accent-doux); }
.actions-ordre { display: flex; gap: 14px; justify-content: center; }

/* Retours après une réponse : bravo, indice, ou réponse montrée */
.retour {
  display: flex; align-items: center; gap: 20px;
  margin-top: 24px; padding: 16px 24px;
  animation: arrivee 0.3s ease-out;
}
.retour .texte-retour { flex: 1; }
.retour strong { font-family: var(--police-titre); font-weight: 400; font-size: 34px; line-height: 1.1; }
.retour p { margin: 4px 0 0; font-size: 22px; }
.retour.juste { --lavis: var(--juste-doux); }
.retour.aide { --lavis: var(--aide-doux); }
.retour.revele { --lavis: var(--aide-doux); }
.etiquette-indice {
  display: inline-block; padding: 0 10px; margin-right: 4px; border-radius: 10px 14px 9px 13px;
  background: var(--aide-lavis); font-family: var(--police-titre); font-size: 22px;
}
.visuel-indice { margin-top: 12px; display: flex; }
.encore { font-weight: 700; }
@keyframes arrivee { from { opacity: 0; transform: translateY(8px); } }

/* Boutons */
.bouton {
  padding: 10px 28px; --lavis: var(--accent-lavis);
  font-family: var(--police-titre); font-size: 28px; white-space: nowrap;
}
.bouton:not(:disabled):hover { transform: rotate(-1deg) scale(1.03); }
.bouton:disabled { opacity: 0.35; }
.bouton.secondaire { --lavis: var(--feuille); }
/* Un lien qui a l'air d'un bouton (ex. « Ouvrir les cartes ») */
a.bouton { color: inherit; text-decoration: none; display: inline-block; }

/* Visuels de maths, un peu tremblés comme dessinés */
.collection, .cadre-dix, .groupes-points, .visuel-indice { filter: url(#crayon); }
.collection { display: flex; gap: 28px; align-items: flex-end; flex-wrap: wrap; justify-content: center; }
.barres { display: flex; gap: 14px; }
.barre { display: flex; flex-direction: column-reverse; gap: 2px; }
.barre i, .cube {
  display: block; width: 22px; height: 22px; border-radius: 3px;
  background: var(--maths-lavis); border: 1.5px solid var(--crayon);
}
.cubes { display: grid; grid-template-columns: repeat(5, 22px); gap: 6px; }
.cube { background: var(--aide-lavis); }
.cadre-dix {
  display: grid; grid-template-columns: repeat(5, 54px); gap: 0;
  border: 2px solid var(--crayon); border-radius: 6px; background: var(--feuille);
}
.cadre-dix i { height: 54px; position: relative; border-right: 1.5px solid var(--crayon); border-bottom: 1.5px solid var(--crayon); }
.cadre-dix i:nth-child(5n) { border-right: none; }
.cadre-dix i:nth-child(n + 6) { border-bottom: none; }
.cadre-dix i.plein::after {
  content: ''; position: absolute; inset: 10px; border-radius: 50%;
  background: var(--accent-lavis); border: 1.5px solid var(--crayon);
}
.groupes-points { display: flex; align-items: center; gap: 20px; font-size: 40px; color: var(--crayon-doux); }
.points { display: grid; grid-template-columns: repeat(5, 24px); gap: 8px; padding: 12px; border: 1.5px dashed var(--crayon-doux); border-radius: 14px; }
.points i { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-lavis); border: 1.5px solid var(--crayon); }

/* ---------- Fins ---------- */
.fin { text-align: center; padding-top: 24px; }
.fin h1 { font-family: var(--police-titre); font-weight: 400; font-size: 46px; line-height: 1.1; margin: 16px 0 8px; }
.grandes-etoiles { display: flex; justify-content: center; gap: 16px; }
.grandes-etoiles .illus.etoile { width: 88px; }
.grandes-etoiles .illus.etoile:nth-child(2) { transform: translateY(-14px); }
.sous-titre.aidees { margin-top: -4px; margin-bottom: 12px; }
.trio { display: flex; justify-content: center; align-items: flex-end; gap: 8px; }
.trio .illus-hibou { width: 170px; }
.actions-fin { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.bouton-parent { padding: 12px 32px; --lavis: var(--feuille); }
.bouton-parent:hover { --lavis: var(--maths-doux); }
.bouton-parent .texte { position: relative; display: flex; flex-direction: column; font-family: var(--police-titre); font-size: 28px; }
.bouton-parent small { font-family: var(--police); font-size: 15px; color: var(--crayon-doux); }

/* ---------- Réglages ---------- */
.reglages { max-width: 640px; margin: 0 auto; }
.reglage {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 0; border-bottom: 2px dashed var(--trait-clair);
}
.reglage input {
  font: inherit; padding: 10px 14px; border: 2px solid var(--crayon); background: var(--feuille); min-width: 240px;
  border-radius: var(--forme-petite);
}
.segments { display: flex; gap: 8px; flex-wrap: wrap; }
.aide-reglage { display: block; max-width: 300px; font-size: 15px; color: var(--crayon-doux); }
.segments button { padding: 6px 14px; border-radius: var(--forme-petite); font-size: 17px; --lavis: var(--feuille); }
.segments button.actif { --lavis: var(--maths-lavis); font-weight: 700; }

@media (max-width: 640px) {
  #app { padding: 0 16px 32px; }
  .bonjour { font-size: 44px; }
  .accueil-titre { flex-direction: column; text-align: center; }
  .titre-entete { font-size: 22px; }
  .carte-question { padding: 24px 16px; }
  .carte-question.avec-pave { grid-template-columns: 1fr; gap: 24px; }
  .egalite { font-size: 40px; }
  .niveaux { grid-template-columns: 1fr; }
  .retour { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ---------- Bouton « Réglages » (discret, en texte) ---------- */
.bouton-texte { padding: 8px 18px; font-family: var(--police-titre); font-size: 22px; color: var(--crayon-doux); --lavis: var(--feuille); }
.bouton-texte:hover { color: var(--crayon); --lavis: var(--maths-doux); }

/* ---------- Fenêtres de confirmation ---------- */
.voile { position: fixed; inset: 0; z-index: 10; background: rgba(59, 58, 63, 0.35); animation: fondu 0.2s ease-out; }
.modale {
  position: fixed; z-index: 11; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px)); padding: 28px 32px; text-align: center;
  background: var(--feuille); --lavis: var(--feuille);
  animation: arrivee-modale 0.25s ease-out;
}
.modale h2 { margin: 0 0 8px; font-family: var(--police-titre); font-weight: 400; font-size: 34px; line-height: 1.1; }
.modale p { margin: 0 0 20px; color: var(--crayon-doux); }
.champ-parent {
  display: block; width: 140px; margin: 0 auto 20px; padding: 8px; text-align: center;
  font: 700 32px var(--police); border: 2px solid var(--crayon); border-radius: var(--forme-petite); background: var(--feuille);
}
.erreur-parent { color: var(--erreur-texte) !important; margin-top: -10px !important; }
.actions-modale { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.bouton.danger { --lavis: var(--erreur-lavis); }
@keyframes fondu { from { opacity: 0; } }
@keyframes arrivee-modale { from { opacity: 0; transform: translate(-50%, -46%); } }

/* ---------- Zoom fort (jusqu'à 400 %) et petits écrans ---------- */
@media (max-width: 480px) {
  .entete { grid-template-columns: auto 1fr; }
  .entete-droite { grid-column: 1 / -1; justify-content: flex-start; }
  .cadre-dix { grid-template-columns: repeat(5, 44px); }
  .cadre-dix i { height: 44px; }
  .cadre-dix i.plein::after { inset: 7px; }
  .egalite { font-size: 34px; gap: 8px; }
  .pave { grid-template-columns: repeat(3, 64px); }
}

/* ---------- Mouvement réduit : on coupe les animations et les petits mouvements ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .carte-matiere:hover, .bouton:not(:disabled):hover, .bouton-choix:not(:disabled):hover, .tuile:not(:disabled):hover, .bouton-rond:hover { transform: none; }
}

/* Images de « La phrase et l'image » (images/scenes/) */
.scene { display: block; width: 100%; height: auto; margin: 0 auto; }
.choix.grands .bouton-choix .scene { max-width: 150px; }
.grande-image .scene { width: 240px; max-width: 70vw; }

/* Partie « À propos » des Réglages et pages de texte */
.titre-groupe { font-family: var(--police-titre); font-weight: 400; font-size: 28px; margin: 40px 0 8px; }
.liens-apropos { display: flex; flex-direction: column; }
.ligne-lien {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 16px 0; border: 0; border-bottom: 2px dashed var(--trait-clair); background: none;
  font: inherit; font-size: 20px; color: var(--crayon); text-align: left; text-decoration: none; cursor: pointer;
}
.ligne-lien::before, .ligne-lien::after { content: none; }
.ligne-lien:hover span:first-child { text-decoration: underline; text-underline-offset: 4px; }
.fleche-lien { flex: none; color: var(--crayon-doux); }
.doc { max-width: 640px; margin: 0 auto; font-size: 19px; line-height: 1.55; }
.doc h2 { font-family: var(--police-titre); font-weight: 400; font-size: 26px; margin: 28px 0 6px; }
.doc p { margin: 0 0 14px; }
.doc a { color: var(--accent-texte, var(--crayon)); }
.doc .maj { margin-top: 32px; color: var(--crayon-doux); font-size: 16px; }

/* Icônes dessinées à la main (Gregor Cresnar, Flaticon) : utilisées comme masques, elles prennent la couleur du texte */
.icone {
  display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: none;
  background: currentColor; -webkit-mask: var(--icone) center / contain no-repeat; mask: var(--icone) center / contain no-repeat;
}
.icone-fleche-gauche { --icone: url(images/icones/fleche-gauche.png); }
.icone-fleche-droite { --icone: url(images/icones/fleche-droite.png); }
.icone-chevron-droit { --icone: url(images/icones/chevron-droit.png); }
.icone-chevron-gauche { --icone: url(images/icones/chevron-gauche.png); }
.icone-lien-externe { --icone: url(images/icones/lien-externe.png); }
.bouton-rond .icone { width: 26px; height: 26px; vertical-align: middle; }
.bouton .icone-fleche-droite { margin-left: 4px; }
.ligne-lien .icone { width: 20px; height: 20px; }
