/* =========================================================
   Révisions de ma ti — style
   Ambiance : stickers de cahier, contours épais, ombres "tampon"
   ========================================================= */

:root {
  --soleil: #FFD23F;   /* fond */
  --encre: #1E1B4B;    /* texte, contours, ombres */
  --papier: #FFFDF5;   /* cartes */
  --rose: #FF7BAC;     /* examen, consignes piège */
  --menthe: #4ADE9C;   /* bonne réponse */
  --ciel: #7CC6FE;     /* entraînement, sélection */
  --tomate: #FF5A5F;   /* erreur */
  --gris: #6B6893;

  --trait: 3px;
  --ombre: 5px 5px 0 var(--encre);
  --ombre-petite: 3px 3px 0 var(--encre);
  --rayon: 18px;

  --titre: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --texte: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--texte);
  font-size: 17px;
  line-height: 1.5;
  color: var(--encre);
  background-color: var(--soleil);
  background-image: radial-gradient(rgba(30, 27, 75, .12) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px dashed var(--encre); outline-offset: 4px; }
[hidden] { display: none !important; }

.app {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

/* ---------- Boutons "tampon" (réutilisés partout) ---------- */
.btn, .tuile, .reponse, .btn-retour, .filtre {
  border: var(--trait) solid var(--encre);
  box-shadow: var(--ombre);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active:not(:disabled), .tuile:active, .reponse:active:not(:disabled), .btn-retour:active, .filtre:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--encre);
}

.btn {
  font-weight: 900;
  font-size: 1.05rem;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--papier);
}
.btn-principal { background: var(--encre); color: var(--papier); box-shadow: 5px 5px 0 var(--rose); }
.btn-principal:active:not(:disabled) { box-shadow: 1px 1px 0 var(--rose); }
.btn-principal:disabled { opacity: .35; }
.btn-secondaire { background: var(--ciel); }
.btn-discret { background: var(--papier); box-shadow: var(--ombre-petite); }
.btn-danger { background: var(--tomate); color: var(--papier); }

/* ---------- Accueil ---------- */
.titre-accueil {
  font-family: var(--titre);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: .98;
  letter-spacing: -.01em;
  margin: 12px 0 40px;
  text-align: center;
}
.titre-accueil .ligne { display: block; }
.titre-accueil .l1 { transform: rotate(-2deg); }
.titre-accueil .l2 { transform: rotate(1.5deg) translateX(4%); }
.titre-accueil .l3 {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 22px 8px;
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--rose);
  transform: rotate(-3deg);
  animation: dandine 3.2s ease-in-out infinite;
}
@keyframes dandine {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(2deg) scale(1.03); }
}

.choix-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 26px;
}

.tuile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 24px 24px 26px;
  border-radius: 26px;
  box-shadow: 7px 7px 0 var(--encre);
}
.tuile-entrainement { background: var(--ciel); transform: rotate(-1.2deg); }
.tuile-examen       { background: var(--rose); transform: rotate(1.2deg); }
.tuile:hover { transform: rotate(0) translateY(-3px); }
.tuile-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 6px; }
.tuile-titre { font-family: var(--titre); font-size: 1.9rem; line-height: 1.05; }
.tuile-texte { font-weight: 700; font-size: .98rem; max-width: 32ch; }

.lien-reprendre {
  display: block;
  margin: 34px auto 0;
  padding: 10px 20px;
  background: var(--papier);
  border: var(--trait) dashed var(--encre);
  border-radius: 999px;
  font-weight: 800;
}
.infos-banque {
  text-align: center;
  margin-top: 30px;
  font-weight: 700;
  color: var(--gris);
  font-size: .92rem;
}

/* ---------- Écran question ---------- */
.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.btn-retour {
  background: var(--papier);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 800;
  box-shadow: var(--ombre-petite);
}
.compteur {
  margin: 0;
  font-family: var(--titre);
  font-size: 1.35rem;
}

.progression {
  height: 16px;
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}
#progression-barre {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--rose) 0 10px, #ff94bd 10px 20px);
  border-right: var(--trait) solid var(--encre);
  transition: width .3s ease;
}

.filtres { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.filtre {
  background: var(--papier);
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 800;
  font-size: .9rem;
  box-shadow: var(--ombre-petite);
}
.filtre[aria-pressed="true"] { background: var(--encre); color: var(--papier); }

.carte-question {
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: 8px 8px 0 var(--encre);
  padding: 24px 22px 26px;
}
.carte-question.entree { animation: pop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop {
  from { transform: scale(.94) rotate(-1deg); opacity: .4; }
  to   { transform: none; opacity: 1; }
}

.etiquettes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.etiquette {
  font-size: .8rem;
  font-weight: 900;
  padding: 3px 11px;
  border-radius: 8px;
  border: 2px solid var(--encre);
  background: var(--soleil);
}
.etiquette-consigne { background: var(--papier); }
.etiquette-consigne.piege { background: var(--rose); }
.etiquette-consigne.multi { background: var(--ciel); }

.texte-question {
  font-size: clamp(1.2rem, 3.4vw, 1.45rem);
  font-weight: 900;
  line-height: 1.3;
  margin: 0 0 22px;
  max-width: 62ch;
}

.reponses { display: grid; gap: 12px; }
.reponse {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 10px 14px 10px 10px;
  background: var(--papier);
  border-radius: 14px;
  box-shadow: var(--ombre-petite);
  font-weight: 700;
}
.reponse:hover:not(:disabled) { background: #fff6d6; }
.reponse .lettre {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: var(--trait) solid var(--encre);
  font-family: var(--titre);
  font-size: 1.25rem;
  background: var(--soleil);
}
.reponse[aria-pressed="true"] { background: var(--ciel); }
.reponse[aria-pressed="true"] .lettre { background: var(--encre); color: var(--papier); }
.reponse:disabled { cursor: default; }

/* états après validation */
.reponse.juste { background: var(--menthe); }
.reponse.juste .lettre { background: var(--papier); color: var(--encre); }
.reponse.fausse { background: var(--tomate); color: var(--papier); }
.reponse.fausse .lettre { background: var(--papier); color: var(--encre); }
.reponse.estompee { opacity: .5; }

.retour {
  margin-top: 18px;
  padding: 12px 18px;
  border: var(--trait) solid var(--encre);
  border-radius: 14px;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: var(--ombre-petite);
  animation: pop .25s cubic-bezier(.3, 1.6, .5, 1);
}
.retour.ok   { background: var(--menthe); }
.retour.ko   { background: var(--tomate); color: var(--papier); }
.retour.neutre { background: var(--papier); font-weight: 700; font-size: 1rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 26px;
}
.astuce {
  font-size: .82rem;
  font-weight: 700;
  color: var(--gris);
  text-align: right;
  margin-top: 16px;
}

/* ---------- Résultats ---------- */
.verdict {
  text-align: center;
  padding: 30px 20px 34px;
  margin: 10px 0 30px;
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--encre);
}
.verdict.reussi { background: var(--menthe); transform: rotate(-1deg); }
.verdict.rate   { background: var(--rose); transform: rotate(1deg); }
.verdict-emoji { font-size: 3.4rem; line-height: 1; display: block; }
.verdict-titre {
  font-family: var(--titre);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 3.8rem);
  line-height: 1;
  margin: 10px 0 6px;
}
.verdict-note {
  display: inline-block;
  font-family: var(--titre);
  font-size: 2rem;
  padding: 4px 20px;
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  margin: 8px 0 12px;
}
.verdict-detail { font-weight: 800; margin: 0; }
.verdict.celebre { animation: tampon .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes tampon {
  0%   { transform: scale(1.3) rotate(-8deg); opacity: 0; }
  100% { opacity: 1; }
}

.bilan-disciplines { display: grid; gap: 14px; }
.bilan-ligne { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; align-items: center; gap: 12px; font-weight: 800; }
.bilan-jauge {
  height: 18px;
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-radius: 999px;
  overflow: hidden;
}
.bilan-jauge span { display: block; height: 100%; background: var(--encre); }
.bilan-chiffre { font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right; }

.actions-resultats { justify-content: center; margin: 34px 0 44px; }

.recap-entete {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.recap-titre { font-family: var(--titre); font-weight: 400; font-size: 1.8rem; margin: 0; }
.bascule { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; }
.bascule input { width: 20px; height: 20px; accent-color: var(--encre); }

.recap { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.recap-item {
  background: var(--papier);
  border: var(--trait) solid var(--encre);
  border-left-width: 12px;
  border-radius: 14px;
  padding: 14px 16px 16px;
}
.recap-item.ok { border-left-color: var(--menthe); }
.recap-item.ko { border-left-color: var(--tomate); }
.recap-item.nc { border-left-color: var(--gris); }
.recap-tete { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .85rem; font-weight: 900; }
.recap-num { font-family: var(--titre); font-weight: 400; font-size: 1.1rem; }
.recap-q { font-weight: 900; margin: 0 0 10px; }
.recap-choix { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .95rem; }
.recap-choix li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 4px 8px; border-radius: 8px; }
.recap-choix .l { font-weight: 900; }
.recap-choix .bonne { background: rgba(74, 222, 156, .35); font-weight: 800; }
.recap-choix .choisie-fausse { background: rgba(255, 90, 95, .25); }
.recap-choix .choisie-fausse > span:nth-child(2) { text-decoration: line-through; text-decoration-thickness: 2px; }
.recap-choix .marque { font-size: .8rem; font-weight: 900; white-space: nowrap; }
.recap-vide { font-weight: 800; text-align: center; padding: 20px; }

/* ---------- Fenêtre de confirmation ---------- */
.confirmation {
  border: var(--trait) solid var(--encre);
  border-radius: 22px;
  box-shadow: 8px 8px 0 var(--encre);
  background: var(--papier);
  color: var(--encre);
  padding: 24px;
  max-width: 400px;
  width: calc(100% - 40px);
}
.confirmation::backdrop { background: rgba(30, 27, 75, .45); }
.confirmation p { font-weight: 800; font-size: 1.1rem; margin: 0 0 20px; }
.confirmation-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Petits écrans ---------- */
@media (max-width: 560px) {
  .app { padding: 18px 14px 50px; }
  .carte-question { padding: 18px 14px 20px; box-shadow: 5px 5px 0 var(--encre); }
  .reponse { grid-template-columns: 38px 1fr; gap: 10px; }
  .reponse .lettre { width: 38px; height: 38px; font-size: 1.1rem; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1 1 auto; }
  .astuce { display: none; }
  .bilan-ligne { grid-template-columns: 1fr auto; }
  .bilan-jauge { grid-column: 1 / -1; grid-row: 2; }
}

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