/* ==========================================================================
   Je sais calculer — feuille de style unique
   Idée : le cahier d’écolier. Papier quadrillé, encre bleue, crayon vert pour
   « juste », violet pour les indices (jamais de rouge). En mode sombre : l’ardoise.
   Mobile d’abord (360 px), puis tablette et ordinateur.
   ========================================================================== */

@font-face {
  font-family: "Andika";
  src: url("../fonts/andika-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Andika";
  src: url("../fonts/andika-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --papier: #fbfcff;
  --carreau: #dde6f6;
  --carte: #ffffff;
  --encre: #1d3fa6;
  --encre-fonce: #132b78;
  --texte: #1f2536;
  --texte-doux: #4c556e;
  --bord: #c7d3ec;
  --vert: #157a44;
  --vert-fond: #e1f4e8;
  --violet: #5a43ad;
  --violet-fond: #efebfb;
  --surligneur: #ffe14d;
  --surligneur-fonce: #e9c400;
  --ombre: 0 2px 0 var(--bord);
  --rayon: 14px;
  --police: "Andika", "Trebuchet MS", "Verdana", sans-serif;
  --zone-haut: env(safe-area-inset-top, 0px);
  --zone-bas: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --papier: #17211d;
    --carreau: #22302a;
    --carte: #1e2a25;
    --encre: #a9c0ff;
    --encre-fonce: #d3defe;
    --texte: #eef1ea;
    --texte-doux: #b4beb6;
    --bord: #33443c;
    --vert: #74dc9e;
    --vert-fond: #1f3a2b;
    --violet: #c9bbff;
    --violet-fond: #2c2747;
    --surligneur: #ffd84a;
    --surligneur-fonce: #e0b800;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--papier);
  color: var(--texte);
  font-family: var(--police);
  font-size: 1.125rem;
  line-height: 1.55;
  padding-top: var(--zone-haut);
}

a { color: var(--encre); text-underline-offset: 0.18em; }
a:hover { color: var(--encre-fonce); }

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

h1, h2, h3 { line-height: 1.2; color: var(--texte); }
h1 { font-size: clamp(1.85rem, 7vw, 2.75rem); margin: 0.2em 0 0.5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.35rem, 4.5vw, 1.7rem); margin: 1.6em 0 0.5em; }
h3 { font-size: 1.2rem; margin: 1.3em 0 0.3em; }
p { margin: 0 0 0.9em; }

.texte { max-width: 66ch; }
.texte ul, ul.texte { padding-left: 1.2em; }

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

.evitement {
  position: absolute;
  left: 0.5rem; top: -4rem;
  background: var(--carte);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.evitement:focus { top: 0.5rem; }

.note { color: var(--texte-doux); font-size: 0.98rem; }

/* ---------- En-tête et navigation ---------- */

.entete {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--texte);
  font-weight: 700;
  font-size: 1.3rem;
}
.logo-marque { width: 2.4rem; height: 2.4rem; }
.logo-marque rect:first-child { fill: var(--encre); }
.logo-trait { stroke: var(--papier); stroke-width: 3.2; stroke-linecap: round; fill: none; }
.logo-trou { fill: none; stroke: var(--surligneur); stroke-width: 2.4; stroke-dasharray: 3 2.4; }

.menu ul {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem -1rem 0;
  padding: 0 1rem 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.menu ul::-webkit-scrollbar { display: none; }
.menu a {
  display: block;
  white-space: nowrap;
  padding: 0.5rem 0.95rem;
  border: 2px solid var(--bord);
  border-radius: 999px;
  text-decoration: none;
  color: var(--texte);
  background: var(--carte);
  min-height: 44px;
}
.menu a[aria-current="page"] {
  background: var(--encre);
  border-color: var(--encre);
  color: var(--papier);
}

.fil {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  font-size: 0.95rem;
}
.fil ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; gap: 0.2rem; }
.fil li + li::before { content: "/"; margin: 0 0.35rem; color: var(--texte-doux); }
.fil [aria-current] { color: var(--texte-doux); }

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 3rem;
}

/* ---------- Boutons ---------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.6rem 1.4rem;
  border-radius: var(--rayon);
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  border: 2px solid transparent;
}
.bouton:disabled { opacity: 0.55; cursor: default; }
.bouton-principal {
  background: var(--surligneur);
  color: #17204a;
  border-color: var(--surligneur-fonce);
  box-shadow: 0 3px 0 var(--surligneur-fonce);
}
.bouton-principal:hover { color: #17204a; filter: brightness(1.03); }
.bouton-principal:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--surligneur-fonce); }
.bouton-secondaire {
  background: var(--carte);
  color: var(--encre);
  border-color: var(--encre);
}
.bouton-discret { background: transparent; color: var(--texte-doux); text-decoration: underline; }

/* ---------- Ardoise : la carte de calcul ---------- */

.ardoise {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  margin: 0;
  padding: 1.2rem 1rem;
  border-radius: 18px;
  border: 2px solid var(--bord);
  background-color: var(--carte);
  background-image:
    linear-gradient(var(--carreau) 1px, transparent 1px),
    linear-gradient(90deg, var(--carreau) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -1px -1px;
  color: var(--encre);
  font-weight: 700;
  font-size: clamp(2.2rem, 12vw, 3.6rem);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ardoise-petite { font-size: clamp(1.6rem, 8vw, 2.2rem); padding: 0.8rem; margin-bottom: 1rem; }

/* ---------- Accueil ---------- */

.accueil-tete {
  display: grid;
  gap: 1.2rem;
  padding-top: 0.5rem;
}
.accueil-tete h1 { font-size: clamp(2.4rem, 11vw, 3.6rem); margin-bottom: 0.25em; color: var(--encre); }
.chapo { font-size: 1.2rem; color: var(--texte-doux); max-width: 34ch; }

@media (min-width: 46rem) {
  .accueil-tete { grid-template-columns: 1.2fr 1fr; align-items: center; padding-top: 1.5rem; }
}

.bloc { margin-top: 2rem; }

.classes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.classe {
  display: grid;
  gap: 0.1rem;
  padding: 0.9rem 1rem;
  min-height: 6rem;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--carte);
  text-decoration: none;
  color: var(--texte);
  box-shadow: 0 3px 0 var(--encre);
}
.classe strong { font-size: 1.8rem; color: var(--encre); line-height: 1.1; }
.classe small { color: var(--texte-doux); font-size: 0.95rem; }
.classe-bientot { border-style: dashed; border-color: var(--bord); box-shadow: none; opacity: 0.8; }
.classe-bientot strong { color: var(--texte-doux); }

.tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.6rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.tuiles-grandes { grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); margin-top: 1.5rem; }
.tuile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 2px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--encre);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.9rem;
  box-shadow: var(--ombre);
  font-variant-numeric: tabular-nums;
}
.tuile:hover { border-color: var(--encre); }
.tuile-signe { font-size: 0.6em; margin-right: 0.12em; color: var(--texte-doux); }
.tuile-bonus { border-style: dashed; }
.tuile-etoiles {
  position: absolute;
  bottom: 0.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--surligneur-fonce);
}
.tuile-etoiles[data-n="0"] { visibility: hidden; }

.liste-competences {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 18rem 2;
  column-gap: 2rem;
}
.liste-competences li { break-inside: avoid; padding: 0.35rem 0; }

.niveaux-courts { color: var(--texte-doux); font-size: 0.9rem; }

.bloc-adultes {
  padding: 1.2rem 1.2rem 0.4rem;
  border-left: 4px solid var(--encre);
  background: var(--carte);
  border-radius: 0 var(--rayon) var(--rayon) 0;
}
.bloc-adultes h2 { margin-top: 0; }

/* ---------- Hubs ---------- */

.reperes {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem 0.3rem;
  border: 2px dashed var(--bord);
  border-radius: var(--rayon);
  background: var(--carte);
}
.reperes h2 { margin-top: 0; font-size: 1.2rem; }

.periode h3, .periode h2 { margin-top: 1.4em; }
.etapes {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--bord);
}
.etapes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.7rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--bord);
}
.etapes a { flex: 1 1 14rem; font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }

.type {
  font-size: 0.85rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--bord);
  color: var(--texte-doux);
}
.type-fait { border-color: var(--encre); color: var(--encre); }
.type-procedure { border-color: var(--violet); color: var(--violet); }

.etoiles { color: var(--surligneur-fonce); letter-spacing: 0.08em; font-size: 1.05rem; }
.etoiles[data-n="0"] { color: var(--bord); }

.appel { margin-top: 1.5rem; }

/* ---------- Page de compétence ---------- */

.pour-qui { color: var(--texte-doux); margin: 0.8rem 0 0; font-size: 1rem; }
.hors-programme {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 2px dashed var(--violet);
  border-radius: 10px;
  color: var(--violet);
}

.lanceur {
  margin: 1.5rem 0 1rem;
  padding: 1.1rem;
  border: 2px solid var(--encre);
  border-radius: 20px;
  background: var(--carte);
  box-shadow: 0 4px 0 var(--encre);
}
.lanceur h2 { margin-top: 0; }

.choix {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.choix legend { font-weight: 700; margin-bottom: 0.4rem; padding: 0; }
.choix label { flex: 1 1 9rem; cursor: pointer; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--bord);
  border-radius: 12px;
  font-weight: 700;
  line-height: 1.25;
}
.choix label small { font-weight: 400; color: var(--texte-doux); font-size: 0.9rem; }
.choix input:checked + span { border-color: var(--encre); background: var(--encre); color: var(--papier); }
.choix input:checked + span small { color: inherit; opacity: 0.85; }
.choix input:focus-visible + span { outline: 3px solid var(--encre); outline-offset: 3px; }

.bouton-commencer { width: 100%; font-size: 1.35rem; min-height: 64px; }
.progression-ligne { margin: 0.9rem 0 0; color: var(--texte-doux); }

.table-complete {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.3rem 1.2rem;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}
.table-complete strong { color: var(--encre); }

.exemples { margin: 0; }
.exemples div {
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--violet);
  background: var(--violet-fond);
  border-radius: 0 12px 12px 0;
  margin-bottom: 0.7rem;
  max-width: 40rem;
}
.exemples dt { font-weight: 700; font-size: 1.35rem; color: var(--encre); font-variant-numeric: tabular-nums; }
.exemples dd { margin: 0.2rem 0 0; }

.voisins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2.5rem 0 0;
}
.voisins a {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border: 2px solid var(--bord);
  border-radius: var(--rayon);
  text-decoration: none;
  font-weight: 700;
  min-height: 56px;
  justify-content: center;
}
.voisins small { font-weight: 400; color: var(--texte-doux); }
.voisin-suiv { text-align: right; }

.liens-lies { padding-left: 1.2em; }
.liens-lies li { margin: 0.35rem 0; }

/* ---------- Pages de texte ---------- */

.page-texte { max-width: 44rem; }
.email { font-size: 1.25rem; font-weight: 700; }

/* ---------- Pied de page ---------- */

.pied {
  border-top: 2px solid var(--bord);
  padding: 1.5rem 1rem calc(1.5rem + var(--zone-bas));
  max-width: 64rem;
  margin: 0 auto;
  font-size: 0.98rem;
  color: var(--texte-doux);
}
.autres-sites p { margin-bottom: 0.3rem; }
.autres-sites ul, .pied-liens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.pied a { display: inline-block; padding: 0.35rem 0; }

/* ==========================================================================
   Exercice plein écran
   ========================================================================== */

html.ex-ouvert, html.ex-ouvert body { overflow: hidden; }

.ex {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  padding: var(--zone-haut) 0 var(--zone-bas);
  background-color: var(--papier);
  background-image:
    linear-gradient(var(--carreau) 1px, transparent 1px),
    linear-gradient(90deg, var(--carreau) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--texte);
  overscroll-behavior: contain;
  outline: none;
}
.ex [hidden] { display: none !important; }

.ex-barre {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  background: var(--papier);
  border-bottom: 2px solid var(--bord);
}
.ex-icone {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--texte);
  cursor: pointer;
  touch-action: manipulation;
}
.ex-icone:hover { background: var(--carreau); }
.ex-icone svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ex-icone[aria-pressed="false"] { color: var(--texte-doux); }

.ex-progres { flex: 1; min-width: 0; display: grid; gap: 0.25rem; font-size: 0.95rem; color: var(--texte-doux); }
.ex-progres-texte { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-jauge {
  --avance: 0;
  display: block;
  height: 8px;
  border-radius: 99px;
  background: var(--carreau);
  overflow: hidden;
}
.ex-jauge span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--encre);
  border-radius: inherit;
  transform-origin: left;
  transform: scaleX(var(--avance));
  transition: transform 0.25s linear;
}

.ex-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  min-height: 0;
}

.ex-question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.6rem, 13vw, 5.5rem);
  line-height: 1.15;
  color: var(--encre);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.ex-question.long { font-size: clamp(2.1rem, 10vw, 4.6rem); }
.ex-question.tres-long { font-size: clamp(1.8rem, 8.2vw, 4rem); }
.ex-mot { font-size: 0.5em; font-weight: 400; color: var(--texte); }
.ex-signe { color: var(--texte-doux); font-weight: 400; }

.ex-trou {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  min-height: 1.25em;
  padding: 0 0.15em;
  border: 0.06em dashed var(--encre);
  border-radius: 0.18em;
  background: var(--carte);
  color: var(--encre);
}
.ex-trou.vide::after {
  content: "";
  width: 0.06em;
  height: 0.8em;
  background: var(--encre);
  animation: curseur 1.1s steps(1) infinite;
}
.ex-trou.a-revoir { border-color: var(--violet); border-style: solid; background: var(--violet-fond); }
.ex-trou.juste {
  border-style: solid;
  border-color: var(--vert);
  background: var(--vert-fond);
  color: var(--vert);
  animation: juste 0.35s ease-out;
}

.ex-retour {
  min-height: 5.5em;
  max-width: 32rem;
  width: 100%;
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.45;
}
.ex-retour p { margin: 0 0 0.35rem; }
.ex-retour p:first-child:not(:empty) {
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  background: var(--violet-fond);
  color: var(--texte);
}
.ex-retour strong { color: var(--violet); }
.ex-retour.ex-bravo p:first-child { background: var(--vert-fond); }
.ex-retour.ex-bravo strong { color: var(--vert); font-size: 1.3rem; }
.ex-retour-suite { color: var(--texte-doux); }

/* Pavé numérique, dans la zone du pouce */
.ex-pave, .ex-qcm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 0.6rem 0.75rem 0.9rem;
}
.ex-qcm { grid-template-columns: repeat(2, 1fr); }
.ex-pave button, .ex-qcm button {
  height: clamp(56px, 9.5dvh, 76px);
  border: 2px solid var(--bord);
  border-radius: 16px;
  background: var(--carte);
  color: var(--texte);
  font: inherit;
  font-weight: 700;
  font-size: 2rem;
  box-shadow: 0 3px 0 var(--bord);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
.ex-pave button:active, .ex-qcm button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bord); }
.ex-pave button svg {
  width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle;
}
.ex-pave .ex-ok {
  background: var(--encre);
  border-color: var(--encre-fonce);
  color: var(--papier);
  box-shadow: 0 3px 0 var(--encre-fonce);
  font-size: 1.6rem;
}
.ex-qcm button.essaye { opacity: 0.4; box-shadow: none; text-decoration: line-through; }

/* Fin de série */
.ex-fin {
  grid-row: 2 / 4;
  align-self: center;
  justify-self: center;
  width: min(30rem, calc(100% - 2rem));
  padding: 1.5rem 1.2rem;
  border: 2px solid var(--encre);
  border-radius: 22px;
  background: var(--carte);
  box-shadow: 0 5px 0 var(--encre);
  text-align: center;
  font-size: 1.2rem;
}
.ex-fin-titre { margin: 0.2rem 0 0.6rem; font-size: 2rem; color: var(--encre); }
.ex-fin-etoiles { font-size: 3.2rem; margin: 0; letter-spacing: 0.1em; color: var(--bord); line-height: 1; }
.ex-fin-etoiles .pleine { color: var(--surligneur-fonce); display: inline-block; animation: etoile 0.5s ease-out both; }
.ex-fin-etoiles .pleine:nth-child(2) { animation-delay: 0.15s; }
.ex-fin-etoiles .pleine:nth-child(3) { animation-delay: 0.3s; }
.ex-fin-actions { display: grid; gap: 0.6rem; margin-top: 1.2rem; }

/* Mode projection (TBI) : très gros chiffres */
.ex.projection .ex-question { font-size: min(14vw, 24vh); }
.ex.projection .ex-retour { font-size: clamp(1.2rem, 2.6vw, 2rem); max-width: 60rem; }
@media (hover: hover) and (pointer: fine) {
  .ex.projection .ex-pave { display: none; }
}
.ex-seulement-grand { display: none; }
@media (min-width: 48rem) {
  .ex-seulement-grand { display: grid; }
}

/* Téléphone à l’horizontale : pavé à droite */
@media (orientation: landscape) and (max-height: 32rem) {
  .ex { grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; }
  .ex-barre { grid-column: 1 / -1; }
  .ex-pave, .ex-qcm { grid-row: 2; grid-column: 2; align-self: center; width: 16rem; padding: 0.5rem; }
  .ex-pave button, .ex-qcm button { height: 52px; }
  .ex-retour { min-height: 3.5em; }
  .ex-fin { grid-row: 2; grid-column: 1 / -1; }
}

/* ---------- Animations (désactivées si l’utilisateur le demande) ---------- */

@keyframes curseur { 50% { opacity: 0; } }
@keyframes juste { from { transform: scale(1.15); } to { transform: scale(1); } }
@keyframes etoile { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Impression ---------- */

@media print {
  .entete .menu, .fil, .lanceur, .pied, .voisins, .evitement { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Ordinateur : logo et menu sur une ligne ---------- */
@media (min-width: 56rem) {
  .entete { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-bottom: 0.75rem; }
  .menu ul { margin: 0; padding: 0; overflow: visible; }
}

/* ---------- Pavé avec virgule (CM1-CM2) : OK sur toute la largeur ---------- */
.ex-pave.avec-virgule .ex-ok-large { grid-column: 1 / -1; }
.ex-pave.avec-virgule button { height: clamp(52px, 8dvh, 70px); }
.ex-pave .ex-ok-large {
  background: var(--encre);
  border-color: var(--encre-fonce);
  color: var(--papier);
  box-shadow: 0 3px 0 var(--encre-fonce);
  font-size: 1.6rem;
}

/* ---------- Accueil : raccourcis ---------- */
.raccourcis { display: grid; gap: 0.75rem; }
@media (min-width: 40rem) { .raccourcis { grid-template-columns: repeat(3, 1fr); } }
.raccourci {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--bord);
  border-left: 6px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--texte);
  text-decoration: none;
}
.raccourci strong { color: var(--encre); font-size: 1.2rem; }
.raccourci span { color: var(--texte-doux); }
.raccourci:hover strong, .raccourci:focus-visible strong { text-decoration: underline; }

.appel-double { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.lien-fiche { margin: 0.8rem 0 0; }
.choix-tables label { flex: 0 1 3.6rem; }
.choix-tables label span { align-items: center; }
.choix[hidden] { display: none; }

/* ---------- Fiches à imprimer ---------- */
.fiche-page { max-width: 52rem; margin: 0 auto; padding: 0 1rem 2rem; }
.actions-fiche { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0 1.5rem; }
.choix-liens { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.choix-liens a {
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--bord);
  border-radius: 999px;
  background: var(--carte);
  color: var(--texte);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.choix-liens a[aria-current] { background: var(--encre); border-color: var(--encre); color: var(--papier); }

/* La feuille : papier à grands carreaux, marge rouge, comme un cahier */
.feuille {
  position: relative;
  margin: 1.5rem 0;
  padding: 1.25rem 1rem 1.25rem 2.6rem;
  border: 1px solid var(--bord);
  border-radius: 6px;
  background-color: #fff;
  color: #1f2536;
  background-image:
    linear-gradient(to right, transparent 1.9rem, #e3747a 1.9rem, #e3747a calc(1.9rem + 2px), transparent calc(1.9rem + 2px)),
    repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), #c9d6f0 calc(2rem - 1px) 2rem);
}
.feuille h2 { margin: 0.2rem 0 0.4rem; color: #1d3fa6; }
.feuille-entete { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.95rem; }
.feuille-consigne { margin: 0 0 0.8rem; }
.feuille-calculs {
  margin: 0;
  padding-left: 1.4rem;
  columns: 2 14rem;
  column-gap: 2rem;
  font-size: 1.3rem;
}
.feuille-calculs li { break-inside: avoid; margin: 0 0 0.9rem; }
.feuille-calculs li span { margin-right: 0.35em; }
.feuille-calculs .case {
  display: inline-block;
  min-width: 3.2em;
  min-height: 1.5em;
  padding: 0 0.3em;
  border: 2px solid #1d3fa6;
  border-radius: 4px;
  text-align: center;
  vertical-align: middle;
}
.feuille-corrige .case { color: #157a44; font-weight: 700; }
.feuille-pied { margin: 0.5rem 0 0; color: #4c556e; }

.feuille-memo h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.feuille-memo h3 a { color: #1d3fa6; }
.memo-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.8rem; }
.memo-table { padding: 0.5rem 0.7rem; border: 1px solid #c7d3ec; border-radius: 6px; background: rgba(255, 255, 255, 0.85); }
.memo-table ol { list-style: none; margin: 0; padding: 0; font-size: 1.05rem; line-height: 1.6; }

@media print {
  @page { size: A4; margin: 12mm; }
  .ecran-seulement, .entete, .fil, .pied, .voisins, .evitement, .actions-fiche { display: none !important; }
  .fiche-page { max-width: none; padding: 0; }
  .feuille { border: 0; margin: 0; padding: 0 0 0 2.6rem; }
  .feuille-corrige { break-before: page; }
  .feuille-calculs { font-size: 15pt; }
  .feuille-calculs li { margin-bottom: 7mm; }
}
