/* matieres.css : styles specifiques des matieres (lot 2), namespace .mat-*.
   S'appuie sur les tokens de noyau.css (--fond, --carte, --encre,
   --encre-douce, --marque, --bordure, --succes, --erreur, --rayon, --ombre) :
   le mode sombre vient automatiquement des tokens.
   Les classes internes aux enonces generes (big-num-prompt, op-posee,
   horloge, data-tab, probleme, monnaie...) sont toutes scopees sous
   .mat-enonce : rien ne fuit hors du namespace. */

/* ------------------------------------------------------------ enonces */
.mat-enonce {
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--encre);
  margin: 0.5rem 0 1.25rem;
}

.mat-enonce .big-num-prompt {
  display: inline-block;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03125rem;
  color: var(--marque);
  font-variant-numeric: tabular-nums;
  margin: 0.5rem 0;
}

.mat-enonce .big-num-prompt-inline {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--marque);
  font-variant-numeric: tabular-nums;
}

.mat-enonce .big-text-prompt {
  display: inline-block;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--succes);
  margin: 0.5rem 0;
  font-style: italic;
}

.mat-enonce .big-num-prompt .placeholder {
  display: inline-block;
  min-width: 2rem;
  background: var(--fond);
  color: var(--erreur);
  border: 0.125rem dashed var(--erreur);
  border-radius: 0.5rem;
  padding: 0 0.625rem;
}

.mat-enonce .num-list {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--marque);
  letter-spacing: 0.0625rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.5rem;
}

.mat-enonce .encadre-prompt {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--encre);
  font-variant-numeric: tabular-nums;
  margin-top: 0.375rem;
}

.mat-enonce .encadre-prompt input.ph {
  font: inherit;
  font-size: 1.25rem;
  padding: 0.375rem 0.75rem;
  width: 4.5rem;
  border: 0.125rem dashed var(--erreur);
  background: var(--fond);
  text-align: center;
  color: var(--erreur);
  border-radius: 0.625rem;
  font-weight: 800;
}

.mat-enonce .probleme {
  font-size: 1.0625rem;
  line-height: 1.6;
  text-align: left;
  max-width: 26rem;
  margin: 0 auto;
  padding: 1rem 1.125rem;
  background: var(--fond);
  color: var(--encre);
  border-left: 0.3125rem solid var(--marque);
  border-radius: 0.625rem;
  font-weight: 500;
}

.mat-enonce .monnaie {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--marque);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.mat-enonce .muted {
  color: var(--encre-douce);
  font-size: 0.875rem;
}

/* operation posee : alignement strict par valeur de position.
   1 colonne pour le symbole (+, -, x, =) + N colonnes pour les chiffres
   (variable --op-cols posee par opPoseeHtml). Portage de l'app d'Emmanuel. */
.mat-enonce .op-posee {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--encre);
  background: var(--carte);
  border: 0.125rem solid var(--bordure);
  padding: 0.45em 0.6em;
  border-radius: 0.875rem;
  margin-top: 0.375rem;
  font-variant-numeric: tabular-nums;
}

.mat-enonce .op-posee .op-row {
  display: grid;
  grid-template-columns: 1em repeat(var(--op-cols, 4), 1em);
  column-gap: 0.4em;
}

.mat-enonce .op-posee .op-symbol {
  text-align: center;
  font-weight: 700;
}

.mat-enonce .op-posee .op-digit {
  text-align: center;
}

.mat-enonce .op-posee .op-bar {
  height: 0.08em;
  background: var(--encre);
  margin: 0.2em 0 0.1em;
  /* couvre symbole + N colonnes + N gaps */
  width: calc(1em + var(--op-cols, 4) * 1em + var(--op-cols, 4) * 0.4em);
}

.mat-enonce .op-posee .op-result-row,
.mat-enonce .op-posee .op-result-row .op-symbol,
.mat-enonce .op-posee .op-result-slot {
  color: var(--marque);
}

/* horloge SVG */
.mat-enonce .horloge {
  display: block;
  margin: 1rem auto 0.5rem;
  width: min(15rem, 70vw);
  height: auto;
}

/* tableau de donnees (lire_tableau) */
.mat-enonce table.data-tab {
  margin: 0.75rem auto;
  border-collapse: collapse;
  background: var(--carte);
  border: 0.125rem solid var(--marque);
  border-radius: 0.75rem;
  overflow: hidden;
  font-size: 1.0625rem;
  max-width: 20rem;
  width: auto;
}

.mat-enonce table.data-tab th {
  background: var(--marque);
  color: var(--sur-marque);
  font-size: 0.8125rem;
  padding: 0.625rem 1rem;
  text-align: left;
}

.mat-enonce table.data-tab td {
  padding: 0.5rem 1rem;
  border-bottom: 0.0625rem solid var(--bordure);
  font-weight: 600;
  text-align: left;
}

.mat-enonce table.data-tab td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--marque);
  font-weight: 800;
}

.mat-enonce table.data-tab tr:last-child td {
  border-bottom: 0;
}

/* ------------------------------------------------------------ champs */
/* Decoration optionnelle posee par AffichagesMaths.ameliorerChamps :
   les champs pos1..pos5 du rangement passent en ligne. */
.mat-champs-ranger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
  gap: 0.5rem;
  align-items: end;
}

/* boutons des champs a options (ex-QCM historiques) */
.mat-qcm {
  display: grid;
  gap: 0.625rem;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  margin-top: 0.375rem;
}

.mat-qcm .mat-qcm-option {
  background: var(--carte);
  border: 0.125rem solid var(--bordure);
  padding: 0.875rem 1rem;
  font-size: 1.0625rem;
  font-weight: 700;
  border-radius: 0.75rem;
  box-shadow: var(--ombre);
  color: var(--encre);
  cursor: pointer;
  transition: transform 0.08s ease;
  min-height: 2.75rem; /* cible tactile */
}

.mat-qcm .mat-qcm-option:active {
  transform: scale(0.96);
}

.mat-qcm .mat-qcm-option.mat-qcm-choisi {
  background: var(--marque);
  color: var(--sur-marque);
  border-color: var(--marque);
}

.mat-qcm .mat-qcm-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ------------------------------------------------------------ anglais */
.mat-anglais-enonce .mat-anglais-forme {
  color: var(--encre-douce);
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
}

.mat-anglais-enonce .mat-anglais-valeur {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03125rem;
  color: var(--marque);
  margin-bottom: 0.5rem;
  overflow-wrap: anywhere;
}

.mat-anglais-selecteur {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mat-anglais-selecteur .mat-anglais-plage {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.mat-anglais-selecteur .mat-anglais-plage-libelle {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--encre-douce);
}

.mat-anglais-selecteur .mat-anglais-choix {
  font: inherit;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--bordure);
  background: var(--carte);
  color: var(--encre);
}

.mat-anglais-selecteur .mat-anglais-compteur {
  margin: 0;
  text-align: center;
  font-weight: 700;
  color: var(--marque);
}

/* ------------------------------------------------------------ maths */
.mat-maths-arbre {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.mat-maths-arbre .mat-maths-entete {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.mat-maths-arbre .mat-maths-compteur {
  flex: 1;
  font-weight: 700;
  color: var(--marque);
}

.mat-maths-arbre .mat-maths-bouton {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--encre-douce);
  background: var(--carte);
  border: 0.0625rem solid var(--bordure);
  border-radius: 62.4375rem;
  padding: 0.375rem 0.875rem;
  min-height: 2.25rem;
  cursor: pointer;
}

.mat-maths-arbre .mat-maths-domaine {
  border: 0.125rem solid var(--bordure);
  border-radius: var(--rayon);
  padding: 0.875rem 1rem;
  background: var(--carte);
}

.mat-maths-arbre .mat-maths-domaine-tete {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 800;
  font-size: 1.0625rem;
  padding-bottom: 0.625rem;
  border-bottom: 0.0625rem dashed var(--bordure);
  margin-bottom: 0.625rem;
  cursor: pointer;
}

.mat-maths-arbre .mat-maths-emoji {
  font-size: 1.375rem;
  line-height: 1;
}

.mat-maths-arbre .mat-maths-domaine-nom {
  flex: 1;
}

.mat-maths-arbre .mat-maths-theme {
  margin: 0.375rem 0 0 0.25rem;
  padding: 0.5rem 0 0.25rem;
}

.mat-maths-arbre .mat-maths-theme-tete {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--encre);
  padding: 0.25rem 0;
  cursor: pointer;
}

.mat-maths-arbre .mat-maths-theme-nom {
  flex: 1;
}

.mat-maths-arbre .mat-maths-exercice {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.5rem;
  margin-left: 1.375rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--encre-douce);
  font-weight: 500;
  min-height: 2rem;
}

.mat-maths-arbre .mat-maths-exercice-nom {
  flex: 1;
}

.mat-maths-arbre .mat-maths-case {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--marque);
  flex: none;
}

/* ------------------------------------------------------------ divers */
.mat-vide {
  color: var(--encre-douce);
  text-align: center;
  margin: 0;
}
