/* Indice animé de numération (accord de Loïc, 18 novembre 2026).
   DA conservée : verre blanc, encre, vert profond de Tomo, menthe pastel. Le repère glisse avec translate seulement ;
   en mouvement réduit, il change directement de colonne et le soulignement apparaît sans se dessiner.
   Le repère et le soulignement sont des bordures : ils restent visibles en mode couleurs forcées. */
.mt-rang {
  container-type: inline-size;
  margin: .75rem auto 1rem;
  max-width: 34rem;
  padding: .9rem 1rem 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(31, 42, 39, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
  color: var(--ink, #1f2a27);
  text-align: center;
}
.mt-rang-table {
  --w: 3rem;
  --w: min(3.6rem, calc((100cqi - .5rem) / var(--cols)));
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--w);
  margin-inline: auto;
}
.mt-rang-col {
  position: relative;
  display: grid;
  grid-template-rows: 2.4em auto;
  align-items: end;
  justify-items: center;
  padding-block-end: .35rem;
}
.mt-rang-col small {
  font: 700 clamp(.62rem, 2.6cqi, .78rem)/1.15 Nunito, system-ui, sans-serif;
  color: #3f8a70;
  max-inline-size: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  padding-inline: 2px;
  transition: opacity .25s ease;
}
.mt-rang-col small.is-hidden { opacity: 0; }
.mt-rang-col b {
  font: 800 clamp(1.6rem, 8cqi, 2.4rem)/1.1 Nunito, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #1f2a27);
}
.mt-rang-comma {
  position: absolute;
  inset-inline-end: -.2em;
  inset-block-end: .35rem;
  font: 800 clamp(1.6rem, 8cqi, 2.4rem)/1.1 Nunito, system-ui, sans-serif;
}
/* Premier indice : la colonne des unités se souligne (trait menthe profond). */
.mt-rang-col.is-units::after {
  content: '';
  position: absolute;
  inset-inline: 18%;
  inset-block-end: 0;
  border-block-end: 4px solid #3f8a70;
  border-radius: 4px;
  transform-origin: right center;
}
.mt-rang.is-first.is-moving .mt-rang-col.is-units::after {
  @media (prefers-reduced-motion: no-preference) {
    animation: mt-rang-trait .55s calc(0ms - var(--elapsed, 0ms)) cubic-bezier(.2, .8, .2, 1) both;
  }
}
/* « Chiffre des unités » (20/11/2026) : ni repère ni soulignement, la phrase rappelle la règle et l'enfant pose le doigt. */
.mt-rang.is-own .mt-rang-marker,
.mt-rang.is-own .mt-rang-col.is-units::after { display: none; }
/* Le repère : un cadre arrondi autour de la colonne en cours, qui glisse d'un rang à l'autre. */
.mt-rang-marker {
  position: absolute;
  inset-block: -.3rem 0;
  inset-inline-start: 0;
  width: var(--w);
  border: 3px solid #3f8a70;
  border-radius: 16px;
  background: rgba(143, 208, 174, .2);
  translate: calc(var(--at) * var(--w)) 0;
  pointer-events: none;
}
.mt-rang.is-moving .mt-rang-marker {
  @media (prefers-reduced-motion: no-preference) {
    animation: mt-rang-glisse calc(var(--walk) * .7s + .2s) calc(0ms - var(--elapsed, 0ms)) cubic-bezier(.3, .7, .2, 1) both;
  }
}
.mt-rang.is-first.is-moving:not(.is-replay) .mt-rang-marker {
  @media (prefers-reduced-motion: no-preference) {
    animation: mt-rang-pose .4s calc(.35s - var(--elapsed, 0ms)) ease-out both;
  }
}
@keyframes mt-rang-glisse {
  from { translate: calc(var(--from) * var(--w)) 0; }
}
@keyframes mt-rang-pose {
  from { opacity: 0; scale: .9; }
}
@keyframes mt-rang-trait {
  from { scale: 0 1; }
}
.mt-rang-say {
  margin: .7rem auto 0;
  max-width: 28rem;
  font: 600 .98rem/1.45 Nunito, system-ui, sans-serif;
}
/* Boutons en verre blanc comme la barre du haut : texte encre, vert seulement au survol. */
.mt-rang-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  margin-block-start: .8rem;
}
.mt-rang-btn {
  min-height: 44px;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 39, .12);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 4px 14px rgba(31, 42, 39, .06), inset 0 1px 0 #fff;
  color: #1f2a27;
  font: 700 .92rem/1.2 Nunito, system-ui, sans-serif;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.mt-rang-btn:hover { color: #438775; background: rgba(255, 255, 255, .94); }
.mt-rang-btn:focus-visible { outline: 3px solid #3f8a70; outline-offset: 2px; }
/* Veilleuse (nuit) : boutons en verre sombre comme les réponses, texte clair ; le repère reste menthe. */
:root[data-veilleuse=on] .mt-rang { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); box-shadow: inset 0 1px 0 #ffffff33; }
:root[data-veilleuse=on] .mt-rang-btn { background: rgba(58, 76, 132, .55); border-color: rgba(255, 255, 255, .3); box-shadow: inset 0 1px 0 #ffffff33; }
:root[data-veilleuse=on] .mt-rang-btn:hover { color: #9fd6b9; }
:root[data-veilleuse=on] .mt-rang-marker { border-color: #9fd6b9; background: rgba(159, 214, 185, .16); }
:root[data-veilleuse=on] .mt-rang-col.is-units::after { border-color: #9fd6b9; }
.mt-rang-col small:lang(ko) { word-break: keep-all; }
/* 22/11/2026 (rejeu iPhone 13, friction n°1) : sur téléphone, le geste se fait plus compact pour que l'énoncé, le geste,
   les réponses, la bulle de Tomo et « Je vérifie » tiennent ensemble au-dessus de la barre du bas.
   Les boutons gardent 44 px de haut (cible tactile). Contrôle : tests/erreur-bouton-visible-20261122.test.mjs. */
@media (max-width: 640px), (max-height: 800px) {
  .mt-rang { margin: .4rem auto .6rem; padding: .55rem .8rem .7rem; }
  .mt-rang-col { grid-template-rows: 2.1em auto; }
  .mt-rang-say { margin-block-start: .4rem; font-size: .92rem; line-height: 1.35; }
  .mt-rang-actions { margin-block-start: .45rem; }
}
