/* As du calcul — dessin technique : papier millimétré, encre bleue, traits fins.
   Sobre, précis, mathématique. Pas de couleurs criardes. */
* { box-sizing: border-box; }
:root {
  --encre: #16324f;
  --bleu: #1f5f8b;
  --trait: #9db4c6;
  --trait-fin: #d7e2ea;
  --papier: #fdfefe;
  --fond-bleu: #eef4f8;
  --vert: #2e7d4f;
  --vert-fond: #dcefe2;
  --ambre: #8a6d00;
  --ambre-fond: #fdf3c0;
  --rouge: #a33c31;
  --rouge-fond: #fbe9e5;
  --gris-texte: #5a7286;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
html { font-size: 2.2vmin; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--encre);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--papier);
  background-image:
    linear-gradient(rgba(31, 95, 139, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 95, 139, 0.10) 1px, transparent 1px),
    linear-gradient(rgba(31, 95, 139, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 95, 139, 0.05) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
header {
  background: #fff;
  border-bottom: 3px solid var(--encre);
  padding: 1vmin 3vmin;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vmin;
}
.logo { display: flex; align-items: center; gap: 1.5vmin; }
.logo-axes { width: 5vmin; height: 5vmin; stroke: var(--bleu); fill: none; stroke-width: 2; }
header h1 {
  margin: 0;
  font-size: 3.8vmin;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--encre);
}
header nav { display: flex; gap: 1.5vmin; }
header nav button {
  font-size: 2.2vmin;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1vmin 2.5vmin;
  border-radius: 3px;
  border: 2px solid var(--encre);
  background: #fff;
  color: var(--encre);
  cursor: pointer;
}
header nav button:hover { background: var(--fond-bleu); }
main { flex: 1; padding: 2vmin 4vmin 4vmin; max-width: 1400px; width: 100%; margin: 0 auto; }
footer {
  text-align: center;
  padding: 1.8vmin;
  font-size: 1.9vmin;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  color: var(--gris-texte);
  border-top: 1px solid var(--trait);
  background: #fff;
}
footer a { color: var(--bleu); }
h2 {
  font-size: 3.4vmin;
  color: var(--encre);
  margin: 1vmin 0 1.5vmin;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--trait-fin);
  padding-bottom: 1vmin;
}
h3 { font-size: 2.6vmin; color: var(--encre); margin: 2.5vmin 0 1vmin; letter-spacing: 0.04em; }
.cache { display: none !important; }
.intro { font-size: 2.8vmin; text-align: center; margin: 2vmin 0 1vmin; }
.consigne { font-size: 2.5vmin; margin: 0 0 2vmin; color: var(--gris-texte); }
.astuce-accueil { text-align: center; font-size: 2.1vmin; color: var(--gris-texte); margin-top: 3vmin; font-family: var(--mono); }

/* Décor technique : schémas simplistes en lignes fines */
.decor-technique {
  display: flex;
  justify-content: center;
  gap: 6vmin;
  border-top: 1px solid var(--trait);
  border-bottom: 1px solid var(--trait);
  padding: 1.5vmin 0;
  margin: 1.5vmin 0 3vmin;
}
.schema { margin: 0; text-align: center; }
.schema svg { width: 11vmin; height: 11vmin; stroke: var(--bleu); fill: none; stroke-width: 2; stroke-linecap: round; }
.schema figcaption {
  font-family: var(--mono);
  font-size: 1.7vmin;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gris-texte);
  margin-top: 0.5vmin;
}

/* Accueil : un bouton par activité, façon fiche technique */
.menu-activites {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36vmin, 1fr));
  gap: 2vmin;
}
.btn-activite {
  font-size: 2.8vmin;
  font-weight: 700;
  padding: 2.5vmin;
  border: 2px solid var(--encre);
  border-radius: 4px;
  background: #fff;
  color: var(--encre);
  cursor: pointer;
  min-height: 13vmin;
  text-align: left;
  box-shadow: 3px 3px 0 var(--trait-fin);
  display: flex;
  align-items: center;
  gap: 2vmin;
}
.btn-activite:hover { background: var(--fond-bleu); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--trait-fin); }
.btn-activite .num {
  font-family: var(--mono);
  font-size: 3.6vmin;
  font-weight: 700;
  color: var(--bleu);
  border-right: 2px solid var(--trait-fin);
  padding-right: 2vmin;
}
.couleur-1, .couleur-2, .couleur-3, .couleur-4, .couleur-5, .couleur-6, .couleur-7 { background: #fff; }

/* Boutons génériques */
button { font-family: inherit; }
.btn-principal, .btn-secondaire, .btn-retour, .btn-mode {
  font-size: 2.5vmin;
  padding: 1.5vmin 3vmin;
  border-radius: 3px;
  cursor: pointer;
}
.btn-principal { background: var(--encre); color: #fff; font-weight: 700; border: 2px solid var(--encre); }
.btn-secondaire { background: #fff; color: var(--encre); border: 2px solid var(--trait); }
.btn-secondaire:hover { background: var(--fond-bleu); }
.btn-retour { background: #fff; color: var(--encre); border: 2px solid var(--encre); margin-top: 3vmin; }
.btn-mode {
  background: #fff;
  color: var(--encre);
  font-size: 3vmin;
  font-weight: 700;
  padding: 3vmin 6vmin;
  margin: 1vmin;
  border: 2px solid var(--encre);
  box-shadow: 3px 3px 0 var(--trait-fin);
}
.btn-mode:hover { background: var(--fond-bleu); }
.rangee-boutons { display: flex; gap: 1.5vmin; flex-wrap: wrap; margin-top: 2.5vmin; }
.choix-mode { text-align: center; margin: 3vmin 0; }
.explication-mode { font-size: 2.3vmin; color: var(--gris-texte); }

/* Progression, minuteur, messages */
.progression { font-size: 2.5vmin; font-weight: 700; font-family: var(--mono); letter-spacing: 0.05em; margin: 1vmin 0 2vmin; }
.minuteur { font-size: 3.8vmin; font-weight: 700; font-family: var(--mono); color: var(--rouge); text-align: center; margin: 1vmin 0; }
.message { font-size: 2.7vmin; min-height: 4vmin; margin: 1.5vmin 0; font-weight: 700; }
.message.bon { color: var(--vert); }
.message.mauvais { color: var(--rouge); }
.grosse-question {
  font-family: var(--mono);
  font-size: 6.5vmin;
  font-weight: 700;
  text-align: center;
  margin: 2vmin 0;
  padding-bottom: 1.5vmin;
  border-bottom: 2px solid var(--trait-fin);
  color: var(--encre);
}
.saisie {
  font-family: var(--mono);
  font-size: 4.8vmin;
  font-weight: 700;
  text-align: center;
  min-height: 7vmin;
  border: 2px solid var(--encre);
  border-radius: 3px;
  background: #fff;
  padding: 1vmin;
  max-width: 50vmin;
  margin: 0 auto;
}
.saisie.bonne { border-color: var(--vert); background: var(--vert-fond); }
.saisie.mauvaise { border-color: var(--rouge); background: var(--rouge-fond); }
.panneau {
  font-size: 2.9vmin;
  background: #fff;
  border: 2px solid var(--encre);
  border-radius: 3px;
  padding: 2vmin 3vmin;
  margin: 2vmin 0;
  min-height: 9vmin;
}
.fait-connu {
  font-family: var(--mono);
  font-size: 4.2vmin;
  font-weight: 700;
  text-align: center;
  background: var(--fond-bleu);
  border: 2px solid var(--bleu);
  border-radius: 3px;
  padding: 2vmin;
  margin: 1vmin 0 2vmin;
  color: var(--encre);
}

/* Grille de multiplication 10 × 10 */
.grille-mult {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0.5vmin;
  max-width: 95vmin;
  margin: 1vmin auto 2vmin;
}
.case-grille {
  aspect-ratio: 1;
  font-family: var(--mono);
  font-size: 2.5vmin;
  font-weight: 700;
  border: 1px solid var(--trait);
  border-radius: 2px;
  background: #fff;
  color: var(--encre);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.case-grille:hover { background: var(--fond-bleu); }
.case-grille.entete { background: var(--encre); color: #fff; cursor: default; border-color: var(--encre); }
.case-grille.selectionnee { background: #dbe9f5; border: 2px solid var(--bleu); }
.case-grille.acquis { background: var(--vert-fond); border-color: var(--vert); }
.case-grille.encours { background: var(--ambre-fond); border-color: var(--ambre); }
.case-grille.arevoir { background: var(--rouge-fond); border-color: var(--rouge); }
.case-grille.secousse { animation: secousse 0.4s; }
@keyframes secousse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-0.8vmin); }
  75% { transform: translateX(0.8vmin); }
}
.legende { font-size: 2.3vmin; text-align: center; margin: 1vmin 0 2vmin; font-family: var(--mono); }
.pastille {
  display: inline-block;
  width: 2.2vmin; height: 2.2vmin;
  border-radius: 2px;
  border: 1px solid var(--trait);
  vertical-align: middle;
  margin: 0 0.5vmin 0 2vmin;
}
.pastille.acquis { background: var(--vert-fond); border-color: var(--vert); }
.pastille.encours { background: var(--ambre-fond); border-color: var(--ambre); }
.pastille.arevoir { background: var(--rouge-fond); border-color: var(--rouge); }
.pastille.vide { background: #fff; }

/* Trucs */
.trucs { display: grid; grid-template-columns: repeat(auto-fit, minmax(40vmin, 1fr)); gap: 2vmin; }
.trucs h4 { margin: 0 0 1vmin; font-size: 2.6vmin; color: var(--encre); font-family: var(--mono); letter-spacing: 0.05em; }
.trucs ul { margin: 0; padding-left: 3vmin; font-size: 2.3vmin; }
.trucs li { margin-bottom: 0.8vmin; }
.bloc-truc { background: #fff; border: 1px solid var(--trait); border-radius: 3px; padding: 2vmin; }

/* Clavier numérique à l'écran */
.clavier {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.2vmin;
  max-width: 70vmin;
  margin: 2vmin auto;
}
.touche {
  font-family: var(--mono);
  font-size: 3.4vmin;
  font-weight: 700;
  padding: 1.6vmin 0;
  border-radius: 3px;
  border: 1px solid var(--trait);
  background: #fff;
  color: var(--encre);
  cursor: pointer;
}
.touche:hover { background: var(--fond-bleu); }
.touche.valider { background: var(--encre); color: #fff; border-color: var(--encre); }
.touche.effacer { background: var(--fond-bleu); }

/* Mémoire des paires */
.grille-memoire {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5vmin;
  max-width: 100vmin;
  margin: 1vmin auto 2vmin;
}
.carte {
  aspect-ratio: 4 / 3;
  font-family: var(--mono);
  font-size: 3.2vmin;
  font-weight: 700;
  border-radius: 3px;
  border: 2px solid var(--encre);
  background-color: var(--bleu);
  background-image:
    linear-gradient(rgba(255,255,255,0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.16) 1px, transparent 1px);
  background-size: 12px 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5vmin;
}
.carte.retournee { background: #fff; background-image: none; color: var(--encre); border-color: var(--bleu); }
.carte.trouvee { background: var(--vert-fond); background-image: none; color: var(--vert); border-color: var(--vert); cursor: default; }
.carte .point { font-size: 5vmin; }

/* Chaînes */
.chaine {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2vmin;
  align-items: center;
  justify-content: center;
  margin: 2vmin 0;
}
.maillon {
  font-family: var(--mono);
  font-size: 3.2vmin;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--encre);
  border-radius: 3px;
  padding: 1vmin 2vmin;
}
.maillon.fait { background: var(--fond-bleu); }
.maillon.actif { background: #dbe9f5; border-color: var(--bleu); }
.fleche { font-size: 3.2vmin; font-weight: 700; color: var(--bleu); }

/* Bilan et résultats */
.bilan {
  background: #fff;
  border: 2px solid var(--encre);
  border-radius: 3px;
  padding: 2vmin 3vmin;
  margin: 2vmin 0;
  font-size: 2.7vmin;
}
.bilan h3 { margin-top: 0; }
.bilan ul { margin: 0.5vmin 0; padding-left: 3vmin; }
.niveau {
  display: inline-block;
  font-weight: 800;
  font-family: var(--mono);
  font-size: 2.3vmin;
  padding: 0.5vmin 2vmin;
  border-radius: 3px;
  margin-left: 1vmin;
  border: 1px solid;
}
.niveau.acquis { background: var(--vert-fond); color: var(--vert); border-color: var(--vert); }
.niveau.consolider { background: var(--ambre-fond); color: var(--ambre); border-color: var(--ambre); }
.niveau.apprendre { background: var(--rouge-fond); color: var(--rouge); border-color: var(--rouge); }

/* Paramètres */
.bloc-parametres { background: #fff; border: 1px solid var(--trait); border-radius: 3px; padding: 2vmin 3vmin; margin-bottom: 2vmin; }
.bloc-parametres h3 { margin-top: 0; }
.choix-cases { display: flex; flex-wrap: wrap; gap: 1.5vmin; }
.choix-cases label {
  font-size: 2.6vmin;
  font-weight: 700;
  font-family: var(--mono);
  background: #fff;
  border: 1px solid var(--trait);
  border-radius: 3px;
  padding: 1vmin 2vmin;
  cursor: pointer;
}
.choix-cases input { width: 2.4vmin; height: 2.4vmin; accent-color: var(--bleu); }
.bloc-parametres label { font-size: 2.5vmin; display: block; margin: 1vmin 0; }
.bloc-parametres select { font-size: 2.5vmin; font-family: var(--mono); padding: 0.5vmin 1vmin; border-radius: 3px; border: 1px solid var(--trait); }
.note { font-size: 2.1vmin; color: var(--gris-texte); }
