/* Mode Calcul: launch (Lancement), exercise screens (ExerciceSaisie, ExerciceIndice,
   ExerciceOrdre), Pause, « Tu veux vraiment arrêter ? » and the bilan (Bilan). */

.kid__label { color: var(--ink-muted); }
.kid--center { align-items: center; justify-content: center; padding: var(--space-12); }

/* Launch */
.launch {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-12);
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8) 0;
}
.launch__section { display: flex; flex-direction: column; gap: var(--space-4); }
.launch__heading { display: flex; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
.launch__help { font-size: 18px; font-weight: 600; color: var(--ink-muted); }
.launch__durations { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.launch__themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.launch__actions { display: flex; justify-content: flex-end; }
.launch__actions .icon { width: 24px; height: 24px; stroke-width: 2.5; }

.launch-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 3px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.launch-choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.launch-choice:has(input:focus-visible) { outline: 3px solid var(--info); outline-offset: 2px; }
.launch-choice input { width: 24px; height: 24px; margin: 0; accent-color: var(--brand); flex: none; }
.launch-choice--duration { height: 72px; min-width: 160px; padding: 0 28px; font-size: 24px; font-weight: 800; justify-content: center; gap: 0; }
.launch-choice--duration input { position: absolute; opacity: 0; pointer-events: none; }
.launch-choice--duration { position: relative; }
.launch-choice__unit { margin-left: 0.25em; }
.launch-choice--theme { min-height: 64px; padding: var(--space-2) 20px; font-size: 20px; line-height: 24px; }

/* Exercise page */
.exercise__controls { display: flex; gap: var(--space-2); }
.btn--kid-ghost { height: 56px; padding: 0 20px; font-size: 18px; }
.exercise__pause { color: var(--ink); }
.exercise__pause .icon { width: 24px; height: 24px; stroke-width: 2.5; }

.exercise {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-12) 0;
  animation: exercise-in 200ms ease-out;
}
/* The next exercise slides 24px to the left (DS « Mouvement »); feedback states are instant. */
.exercise--ask { animation-name: exercise-in; }
.exercise--retry, .exercise--correct, .exercise--failed { animation: none; }
@keyframes exercise-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .exercise { animation: none; } }

.exercise__consigne { display: flex; align-items: center; gap: var(--space-3); }
.exercise__answer-form { display: none; }

.listen-button {
  width: 44px;
  height: 44px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.listen-button[hidden] { display: none; }
.listen-button svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.exercise__line { display: flex; flex-direction: column; align-items: center; gap: var(--space-8); max-width: 100%; }
.exercise__expression {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-6) var(--space-8);
  font-family: var(--font-num);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  --size: 112px;
  font-size: var(--size);
}
.exercise__line--lg .exercise__expression { --size: 72px; gap: var(--space-4) var(--space-6); }
.exercise__line--md .exercise__expression { --size: 44px; gap: var(--space-4); max-width: 1000px; }
.exercise__text { white-space: nowrap; }
.exercise__text--words { font-family: var(--font-sans); font-weight: 800; white-space: normal; text-align: center; }
.exercise__line--xl .exercise__text--words { font-size: 72px; }
.exercise__unit { font-size: calc(var(--size) * 0.7); }
.exercise__expression:focus { outline: none; }

/* DS Fraction: numerator over a 4px `ink` bar as wide as the longer number, over
   denominator, about 15 % smaller than its context (112 → 96px, 40 → 34px). */
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06em;
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.86em;
  line-height: 1;
  vertical-align: middle;
}
.fraction__num, .fraction__den { min-width: 1.1em; padding: 0 4px; text-align: center; }
.fraction__bar { align-self: stretch; height: 4px; background: var(--ink); border-radius: 2px; }
.fraction--inline { font-size: 0.82em; gap: 2px; margin: 0 0.1em; }
.fraction--inline .fraction__bar, .fraction--sm .fraction__bar { background: currentColor; }
.fraction--inline .fraction__bar { height: 2px; }
.fraction--sm { font-size: 0.8em; gap: 2px; }
.fraction--sm .fraction__bar { height: 2px; }
/* Typed: boxes of 84 × 72 (AnswerField states per box), the bar between them. */
.fraction--input { gap: 6px; }
.fraction--input .fraction__num, .fraction--input .fraction__den { padding: 0; }
.fraction--input .fraction__bar { align-self: center; width: 84px; }
.fraction--input .answer-field { width: 84px; min-width: 0; height: 72px; padding: 0; font-size: 48px; border-width: 3px; border-radius: var(--radius-sm); }
.fraction--input .answer-field__check { display: none; }
.fraction__den--fixed { display: flex; align-items: center; justify-content: center; width: 84px; height: 72px; font-size: 48px; color: var(--ink); }

/* AnswerField */
.answer-field {
  --chars: 3;
  position: relative;
  width: calc(var(--chars) * 0.64em + 48px);
  min-width: 1.6em;
  height: 1.34em;
  border: 4px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: calc(var(--size, 112px) * 0.86);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ink);
  padding: 0 var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
input.answer-field:focus { outline: 3px solid var(--info); outline-offset: 3px; }
.answer-field--wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  text-decoration: line-through;
  text-decoration-color: var(--danger);
  text-decoration-thickness: 6px;
}
.answer-field--right { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.answer-field__check { position: absolute; left: 12px; top: 12px; width: 0.32em; height: 0.32em; min-width: 24px; min-height: 24px; stroke: var(--success); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Feedback under the exercise */
.exercise__feedback { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); min-height: 32px; }
.feedback { display: flex; align-items: center; gap: var(--space-2); font-size: 26px; line-height: 32px; font-weight: 800; }
.feedback .icon { width: 32px; height: 32px; stroke-width: 3; }
.feedback--right { color: var(--success); }
.feedback--retry { color: var(--danger); }
.feedback form { display: none; }

.given-answers { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; justify-content: center; font-size: 32px; font-weight: 700; color: var(--ink-muted); }
.given-answers__label { font-size: 18px; font-weight: 700; }
.given-answers__value { text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 4px; }
.given-answers__value:not(.num) { font-size: 22px; }
.given-answers__value .fraction__num, .given-answers__value .fraction__den { text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 3px; }

.hint {
  max-width: 720px;
  width: 100%;
  background: var(--info-soft);
  border-radius: var(--radius-md);
  padding: var(--space-6) 28px;
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}
.hint__icon { flex: none; width: 32px; height: 32px; stroke: var(--info); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hint__text { font-size: 20px; line-height: 30px; font-weight: 600; text-align: left; max-width: 32ch; min-width: 0; margin: 0; }
.hint__lead { color: var(--info); font-weight: 800; margin: 0 0 var(--space-2); }
/* One step per line (ExerciceIndice screen), the calculations in `num`. */
.hint__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.hint__step { line-height: 32px; }
.hint__step .num { white-space: nowrap; }
.hint__result { font-weight: 800; font-size: 1.15em; }
/* A fraction in a step is read at the hint's size, not shrunk as in a sentence. */
.hint__step .fraction--inline { font-size: 1em; vertical-align: middle; margin: var(--space-1) 0.1em; }
.hint--table { align-items: center; }
.hint--table .hint__text { font-size: 44px; line-height: 52px; }

/* Comparison: three pills < = > between the two numbers */
.exercise__line--comparison .exercise__expression { --size: 72px; }
.comparison__signs { display: flex; gap: var(--space-3); }
.sign-pill {
  width: 88px;
  height: 88px;
  border: 3px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
  font-family: var(--font-num);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.sign-pill:hover { box-shadow: var(--shadow-lift); }
.sign-pill:focus { background: var(--brand-soft); border-color: var(--brand); }
.sign-pill:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.sign-pill--wrong, .sign-pill--wrong:disabled { opacity: 1; border-color: var(--danger); background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-thickness: 4px; }
.sign-pill--right, .sign-pill--right:disabled { opacity: 1; border-color: var(--success); background: var(--success-soft); color: var(--success); }

/* QCM */
.exercise__question { font-size: 32px; line-height: 40px; font-weight: 800; text-align: center; max-width: 900px; }
.exercise__question .fraction--inline { font-size: 1em; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: var(--space-4); }
.choices:focus { outline: none; }
.choice {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6) var(--space-3) var(--space-3);
  border: 3px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.choice:hover { box-shadow: var(--shadow-lift); }
.choice:focus { background: var(--brand-soft); border-color: var(--brand); }
.choice:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.choice__key {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 700;
}
.choice__label { font-size: 22px; line-height: 28px; font-weight: 700; flex-grow: 1; }
.choice__mark { width: 32px; height: 32px; stroke: var(--success); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.choice--wrong, .choice--wrong:disabled { opacity: 1; border-color: var(--danger); background: var(--danger-soft); }
.choice--wrong .choice__label { text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 4px; color: var(--danger); }
.choice--right, .choice--right:disabled { opacity: 1; border-color: var(--success); background: var(--success-soft); color: var(--success); }

/* Order: tiles, an arrow, the slots */
.order { display: flex; flex-direction: column; align-items: center; gap: var(--space-8); }
.order__tiles { display: flex; gap: clamp(12px, 1.5vw, 20px); flex-wrap: wrap; justify-content: center; }
.order-tile, .order-slot {
  width: clamp(120px, 13vw, 180px);
  height: 96px;
  border: 4px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-tile { cursor: pointer; box-shadow: var(--shadow-card); }
.order-tile:hover { box-shadow: var(--shadow-lift); }
.order-tile--placed { border-style: dashed; opacity: 0.35; box-shadow: none; cursor: default; }
.order__arrow { width: 40px; height: 40px; stroke: var(--line-strong); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.order__row { display: flex; gap: clamp(12px, 1.5vw, 20px); align-items: center; flex-wrap: wrap; justify-content: center; }
.order__end { width: 80px; text-align: right; font-size: 18px; font-weight: 800; color: var(--ink-muted); }
.order__end--last { text-align: left; }
.order-slot { border-style: dashed; border-color: var(--line); background: transparent; color: var(--line-strong); cursor: default; font-family: var(--font-num); font-weight: 700; }
.order-slot--filled { border-style: solid; border-color: var(--brand); background: var(--brand-soft); color: var(--ink); cursor: pointer; }
.order-slot--wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-thickness: 4px; }
.order-slot--right { border-style: solid; border-color: var(--success); background: var(--success-soft); color: var(--success); }
.order__submit[hidden] { display: none; }

/* Pause and « Tu veux vraiment arrêter ? » */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  z-index: 10;
  cursor: pointer;
}
.pause-card, .stop-dialog {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: var(--space-12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  text-align: center;
  max-width: 640px;
  cursor: default;
}
.pause-card__actions, .stop-dialog__actions { display: flex; gap: var(--space-4); flex-wrap: wrap; justify-content: center; }
.stop-dialog { border: 0; color: var(--ink); }
.stop-dialog:not([open]) { display: none; }
.stop-dialog::backdrop { background: var(--overlay); }

/* Bilan */
.summary {
  width: 100%;
  max-width: 760px;
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: var(--space-12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  text-align: center;
}
.summary .display { margin-bottom: var(--space-2); }
.summary__subtitle { color: var(--ink-muted); }
.summary__stars { display: flex; gap: var(--space-3); }
.summary__star { width: 72px; height: 72px; fill: none; stroke: var(--line-strong); stroke-width: 1.6; stroke-linejoin: round; }
.summary__star--won { fill: var(--star); stroke: none; animation: star-in 200ms ease-out var(--delay) both; }
@keyframes star-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .summary__star--won { animation: none; } }
.summary__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: var(--space-4); width: 100%; }
.stat-tile { background: var(--surface); border-radius: var(--radius-md); padding: 20px; display: flex; flex-direction: column; gap: var(--space-1); }
.stat-tile__value { font-family: var(--font-num); font-size: 40px; line-height: 1; font-weight: 700; }
.stat-tile__label { font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink-muted); }
.stat-tile--success { background: var(--success-soft); }
.stat-tile--success .stat-tile__value, .stat-tile--success .stat-tile__label { color: var(--success); }
.stat-tile--star { background: var(--star-soft); }
.summary__actions { display: flex; gap: var(--space-4); flex-wrap: wrap; justify-content: center; }

/* Mode Fluence (§6): family choice on the launch layout, « Prête ? » and 3-2-1, bilan with the errors. */
.launch__families { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.launch-choice--family { min-height: 88px; padding: var(--space-4) 20px; }
.launch-choice__body { display: flex; flex-direction: column; gap: 2px; }
.launch-choice__name { font-size: 22px; line-height: 28px; font-weight: 800; }
.launch-choice__meta { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink-muted); }
.fluence-ready { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 420px; }
.fluence-ready__intro { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); text-align: center; }
.fluence-ready__intro[hidden], .fluence-ready__count[hidden] { display: none; }
.fluence-ready__count { font-size: 200px; color: var(--brand); }
.fluence-errors { width: 100%; text-align: left; display: flex; flex-direction: column; gap: var(--space-3); }
.fluence-errors__list { list-style: none; margin: 0; padding: var(--space-2) var(--space-4); background: var(--surface); border-radius: var(--radius-md); }
.fluence-errors__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--line); }
.fluence-errors__row:last-child { border-bottom: 0; }
.fluence-errors__solution { font-size: 24px; line-height: 30px; }
.fluence-errors__given { font-size: 15px; font-weight: 600; color: var(--ink-muted); }
.summary__form { display: contents; }

/* DS ConsignePicto (« Consignes courtes », §12.5): one word and its pictogram in a pill. */
.consigne-picto {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 72px;
  padding: 0 24px 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
}
.consigne-picto:has(.listen-button:not([hidden])) { padding-right: 14px; }
.consigne-picto__icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.consigne-picto__icon svg { width: 28px; height: 28px; stroke: var(--brand); fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.consigne-picto__icon--sign { font: 700 26px/1 var(--font-num); color: var(--brand); }
.consigne-picto__word { margin: 0; font: 700 26px/1 var(--font-sans); }
.consigne-picto .listen-button { margin-left: 4px; }

/* DS Numpad (« Pavé numérique », §5.4): phone layout, ✓ in `brand` over two columns at the right. */
.numpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.numpad__key {
  height: 64px;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font: 700 30px/1 var(--font-num);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.numpad__key:hover { box-shadow: var(--shadow-card); }
.numpad__key:active { transform: translateY(1px); }
.numpad__key svg { width: 28px; height: 28px; stroke: var(--ink); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.numpad__key--go { grid-column: 2 / span 2; background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.numpad__key--go svg { stroke: var(--on-brand); stroke-width: 2.6; }

/* Constituer une somme (format coins): the picker card, its total, then Valider. */
.coins { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); }
