/* ==========================================================
   Page « Réviser » (étudiants) — pensée d'abord pour le téléphone
   ========================================================== */

/* ---------- En-tête et pied ---------- */
.etude-entete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 16px; padding-bottom: 12px; margin-bottom: 22px; border-bottom: 2px solid var(--texte);
}
.marque-etude { display: inline-flex; align-items: center; gap: 10px; color: var(--texte); text-decoration: none; }
.marque-etude svg { width: 34px; height: 34px; flex: none; }
.marque-etude strong { font-family: var(--police-titre); font-weight: 800; font-size: 24px; letter-spacing: -.03em; }
.marque-etude span.sous { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-doux); }
.logo-etude .tableau { stroke: transparent; stroke-width: 2; }
:root[data-theme="dark"] .logo-etude .tableau { stroke: #5c7068; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-etude .tableau { stroke: #5c7068; } }
.etude-pied { margin-top: 40px; padding-top: 14px; padding-bottom: 28px; border-top: 1.5px dashed var(--bordure); color: var(--texte-doux); font-size: 14px; }
.etude-pied a { color: inherit; }
#app { min-height: 50vh; }
.titre-section { font-family: var(--police); font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-doux); margin: 28px 0 12px; }

/* ---------- Saisie du code ---------- */
.code-entree { display: grid; gap: 12px; padding: 22px; }
.code-entree h1 { font-size: clamp(28px, 7vw, 40px); margin: 0; }
.code-entree p { margin: 0; }
.code-entree form { display: flex; flex-wrap: wrap; gap: 10px; }
.code-entree input {
  flex: 1 1 220px; min-height: 60px; text-align: center; text-transform: uppercase;
  font: 800 30px/1 ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; letter-spacing: .18em;
  border-width: 2px;
}
.code-entree input::placeholder { font: 400 18px var(--police); letter-spacing: normal; text-transform: none; color: var(--texte-doux); }
.code-entree .btn { min-height: 60px; padding: 0 26px; font-size: 18px; flex: 0 0 auto; }
.erreur-code { color: var(--rouge); font-weight: 700; min-height: 1.4em; }
.erreur-code:empty { display: none; }

.mes-paquets ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mes-paquets li { position: relative; display: flex; min-width: 0; }
.mes-paquets li > a {
  flex: 1; min-width: 0; display: grid; gap: 4px; padding: 14px 52px 14px 18px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--bordure); border-left: 6px solid var(--onglet-bleu); border-radius: var(--rayon);
}
.mes-paquets li > a:hover { border-color: var(--stylo); }
.mes-paquets strong { font-family: var(--police-titre); font-weight: 800; font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.mes-paquets li > .btn { position: absolute; top: 8px; right: 6px; width: 40px; min-height: 40px; padding: 0; }
.comment ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.comment li::marker { color: var(--marge); font-weight: 700; }

/* Règle graduée (progression) */
.regle {
  position: relative; display: block; height: 10px; max-width: 280px; margin-top: 4px;
  border: 1.5px solid var(--bordure); border-radius: 3px; overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--bordure) calc(10% - 1px) 10%), var(--surface-2);
}
.regle > span { position: absolute; inset: 0 auto 0 0; background: var(--vert); opacity: .85; }

.message-vue { display: grid; gap: 12px; }
.message-vue h1 { font-size: 28px; margin: 0; }
.message-vue p { margin: 0; }
.message-vue .boutons, .bandeau-apercu { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Page du paquet ---------- */
.bandeau-apercu {
  justify-content: space-between; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--rayon);
  background: var(--stylo-clair); font-size: 15px;
}
.alerte { padding: 12px 14px; border-radius: var(--rayon); background: var(--rouge-clair); color: var(--texte); font-weight: 700; margin: 0 0 18px; }
.paquet-entete h1 { font-size: clamp(30px, 7.5vw, 46px); margin: 6px 0 6px; overflow-wrap: anywhere; }
.paquet-entete .etiquette-maj { color: var(--marge); }
.paquet-entete p { margin: 0; }
.progres { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 15px; }
.progres .regle { flex: 1 1 160px; margin: 0; }

.exercices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.exercice {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--texte); border: 1.5px solid var(--bordure); border-radius: var(--rayon);
  font: inherit; transition: border-color .15s, transform .15s;
}
.exercice:hover:not(:disabled) { border-color: var(--stylo); transform: translateY(-2px); }
.exercice:disabled { cursor: not-allowed; background: transparent; border-style: dashed; color: var(--texte-doux); }
.exercice .icone { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 8px; background: var(--stylo-clair); color: var(--stylo); }
.exercice:disabled .icone { background: var(--surface-2); color: var(--texte-doux); }
.exercice .icone svg { width: 28px; height: 28px; }
.exercice .txt { display: grid; gap: 2px; min-width: 0; }
.exercice strong { font-family: var(--police-titre); font-weight: 800; font-size: 21px; line-height: 1.15; }
.exercice .txt > span { font-size: 15px; color: var(--texte-doux); }
.exercice .dernier { font-size: 13px !important; font-weight: 700; color: var(--vert) !important; margin-top: 2px; }

.options { display: grid; gap: 16px; margin-top: 18px; }
.option { display: grid; gap: 6px; }
.option .champ { margin: 0; }
.options .segment { width: max-content; max-width: 100%; }
@media (max-width: 480px) { .options .segment { width: 100%; } }

/* ---------- Exercice en cours ---------- */
.session { max-width: 680px; margin: 0 auto 40px; }
.session-entete { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.session-entete .btn.discret { padding: 0; width: 42px; min-height: 42px; flex: none; }
.session-entete .barre { flex: 1; height: 8px; border-radius: 2px; background: var(--surface-2); border: 1.5px solid var(--bordure); overflow: hidden; }
.session-entete .barre span { display: block; height: 100%; background: var(--stylo); transition: width .3s; }
.session-entete .compteur { white-space: nowrap; font-size: 15px; }
.session-entete .consigne { flex: 1; font-size: 15px; }
@media (hover: none) { .plein-ecran-etude { display: none !important; } }

/* La fiche de la question : une fiche bristol, ligne rouge en haut */
.fiche {
  --ligne: 34px;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 190px; padding: 56px 22px 30px; text-align: center; border-radius: 4px;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--marge), var(--marge)),
    repeating-linear-gradient(transparent 0 calc(var(--ligne) - 1px), color-mix(in srgb, var(--stylo) 18%, transparent) calc(var(--ligne) - 1px) var(--ligne));
  background-size: 100% 2px, 100% calc(100% - 50px);
  background-position: 0 42px, 0 50px;
  background-repeat: no-repeat;
  border: 1.5px solid var(--bordure);
  box-shadow: 0 1px 0 var(--bordure), 0 14px 30px -14px rgba(20, 26, 46, .25);
}
.fiche > .etiquette-maj { position: absolute; top: 12px; left: 16px; }
.fiche .texte { font-family: var(--police-titre); font-weight: 600; font-size: clamp(28px, 7vw, 42px); line-height: 1.2; overflow-wrap: anywhere; white-space: pre-line; }
.fiche .texte.cache { display: none; }
.fiche .ecouter { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fiche .ecouter .btn { min-height: 52px; }
.fiche .ecouter .btn:first-child { font-size: 18px; padding: 0 24px; }
.fiche-ecoute .texte { color: var(--stylo); }
.parler {
  position: absolute; top: 4px; right: 6px; width: 40px; height: 40px; border-radius: 6px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--texte-doux); cursor: pointer;
}
.parler:hover { color: var(--stylo); background: var(--stylo-clair); }
.parler svg { width: 22px; height: 22px; }

/* QCM */
.choix { display: grid; gap: 10px; margin-top: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .choix { grid-template-columns: 1fr; } }
.choix-btn {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--texte); border: 2px solid var(--bordure); border-radius: var(--rayon);
  font: 700 19px/1.25 var(--police); overflow-wrap: anywhere; transition: border-color .15s, background .15s;
}
.choix-btn > span { min-width: 0; }
.choix-btn kbd { flex: none; }
@media (hover: none) { .choix-btn kbd { display: none; } }
.choix-btn:hover:not(:disabled) { border-color: var(--stylo); }
.choix-btn:disabled { cursor: default; opacity: .55; }
.choix-btn.juste { opacity: 1; border-color: var(--vert); background: var(--vert-clair); }
.choix-btn.faux { opacity: 1; border-color: var(--rouge); background: var(--rouge-clair); text-decoration: line-through; text-decoration-color: var(--rouge); }

/* Écrire et écoute */
.saisie { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.saisie input { flex: 1 1 240px; min-height: 56px; font-size: 22px; border-width: 2px; }
.saisie .btn { min-height: 56px; padding: 0 24px; font-size: 18px; }
.saisie input.juste { border-color: var(--vert); background: var(--vert-clair); }
.saisie input.presque { border-color: var(--onglet-orange); }
.saisie input.faux { border-color: var(--rouge); background: var(--rouge-clair); text-decoration: line-through; text-decoration-color: var(--rouge); }
.saisie input:disabled { opacity: 1; color: var(--texte); }
.accents { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.accents button {
  min-width: 40px; min-height: 40px; padding: 0 8px; border: 1.5px solid var(--bordure); border-radius: 6px;
  background: var(--surface); color: var(--texte); font: 700 18px var(--police); cursor: pointer;
}
.accents button:hover:not(:disabled) { border-color: var(--stylo); color: var(--stylo); }
.accents button:disabled { opacity: .4; cursor: default; }
.je-ne-sais-pas { margin-top: 8px; }

/* Message après la réponse */
.retour-reponse { margin-top: 18px; }
.retour-reponse:empty { display: none; }
.retour-reponse { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--rayon); border: 1.5px solid transparent; font-size: 17px; }
.retour-reponse .message { display: flex; align-items: flex-start; gap: 10px; }
.retour-reponse .message > svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.retour-reponse .bonne { font-family: var(--police-titre); font-weight: 800; font-size: 1.15em; color: var(--stylo); }
.retour-reponse .sens-mot { display: inline-block; color: var(--texte-doux); font-style: italic; }
.retour-reponse .sens-mot::before { content: "— "; }
.retour-reponse .boutons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.retour-reponse .boutons .btn { min-height: 48px; }
.retour-reponse.ok { background: var(--vert-clair); border-color: color-mix(in srgb, var(--vert) 40%, transparent); }
.retour-reponse.ok .message > svg { color: var(--vert); }
.retour-reponse.ko { background: var(--rouge-clair); border-color: color-mix(in srgb, var(--rouge) 35%, transparent); }
.retour-reponse.ko .message > svg { color: var(--rouge); }
.retour-reponse.presque { background: color-mix(in srgb, var(--onglet-orange) 14%, var(--surface)); border-color: color-mix(in srgb, var(--onglet-orange) 45%, transparent); }

/* Cartes à retourner (même fiche que l'outil Flashcards) */
.scene { perspective: 1400px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; border-radius: 6px; }
.flashcard { position: relative; height: min(50vh, 340px); min-height: 230px; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .3, 1); }
.flashcard.retournee { transform: rotateY(180deg); }
.face {
  --ligne: 34px;
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px 40px; text-align: center; border-radius: 4px;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--marge), var(--marge)),
    repeating-linear-gradient(transparent 0 calc(var(--ligne) - 1px), color-mix(in srgb, var(--stylo) 18%, transparent) calc(var(--ligne) - 1px) var(--ligne));
  background-size: 100% 2px, 100% calc(100% - 50px);
  background-position: 0 42px, 0 50px;
  background-repeat: no-repeat;
  border: 1.5px solid var(--bordure);
  box-shadow: 0 1px 0 var(--bordure), 0 14px 30px -14px rgba(20, 26, 46, .25);
}
.face.verso { transform: rotateY(180deg); }
.face .etiquette { position: absolute; top: 12px; left: 16px; }
.face .texte { font-family: var(--police-titre); font-weight: 600; font-size: clamp(28px, 7vw, 42px); line-height: 1.2; overflow-wrap: anywhere; white-space: pre-line; }
.face.verso .texte { color: var(--stylo); }
.face .indice { position: absolute; bottom: 12px; font-size: 14px; color: var(--texte-doux); }
.reponses { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.reponses .btn { min-height: 56px; font-size: 17px; }
.btn.rate { background: var(--surface); color: var(--rouge); border-color: var(--rouge); }
.btn.rate:hover { background: var(--rouge-clair); }
.btn.reussi { background: var(--vert); color: var(--surface); border-color: var(--vert); }
.btn.reussi:hover { background: color-mix(in srgb, var(--vert) 85%, var(--texte)); }
.raccourcis { text-align: center; margin-top: 14px; }
@media (hover: none) { .raccourcis { display: none; } }

/* Jeu des paires */
.tuiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
@media (max-width: 480px) { .tuiles { grid-template-columns: 1fr 1fr; gap: 8px; } }
.tuile-paire {
  min-height: 74px; padding: 10px 12px; border-radius: var(--rayon); cursor: pointer;
  background: var(--surface); color: var(--texte); border: 2px solid var(--bordure);
  font: 700 18px/1.25 var(--police); overflow-wrap: anywhere; transition: transform .12s, border-color .12s, background .12s, opacity .3s;
}
.tuile-paire.cote-v { color: var(--stylo); font-family: var(--police-titre); font-weight: 600; }
.tuile-paire:hover:not(:disabled) { border-color: var(--stylo); }
.tuile-paire.choisie { border-color: var(--stylo); background: var(--stylo-clair); transform: scale(1.03); }
.tuile-paire.erreur { border-color: var(--rouge); background: var(--rouge-clair); animation: secoue .35s; }
.tuile-paire.trouvee { border-color: var(--vert); background: var(--vert-clair); opacity: .35; cursor: default; transform: none; }
@keyframes secoue { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.infos-paires { text-align: center; margin-top: 14px; }

/* Bilan : la note entourée au stylo rouge */
.bilan { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 18px; }
.bilan h2 { margin: 6px 0 0; font-size: 28px; }
.bilan .etiquette-maj { color: var(--marge); }
.note { position: relative; display: inline-block; margin: 12px 0 4px; padding: 18px 34px; }
.note .chiffres { font-family: var(--police-titre); font-weight: 800; font-size: 58px; line-height: 1; color: var(--marge); font-variant-numeric: tabular-nums; }
.note svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.note ellipse { fill: none; stroke: var(--marge); stroke-width: 3; stroke-linecap: round; }
.bilan h3 { justify-self: stretch; text-align: left; font-size: 19px; margin: 18px 0 4px; }
.liste-erreurs { justify-self: stretch; list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.liste-erreurs li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px;
  border: 1.5px solid var(--bordure); border-radius: 6px; background: var(--papier);
}
.liste-erreurs .q { font-weight: 700; overflow-wrap: anywhere; }
.liste-erreurs .fleche { color: var(--texte-doux); }
.liste-erreurs .r { color: var(--stylo); font-family: var(--police-titre); font-weight: 800; overflow-wrap: anywhere; }
.liste-erreurs .donnee { flex-basis: 100%; font-size: 14px; color: var(--texte-doux); }
.liste-erreurs s { text-decoration-color: var(--rouge); }
.bilan .boutons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* Plein écran (projection en classe) : tout en plus grand */
:fullscreen body { overflow: auto; }
:fullscreen .session { max-width: 980px; }
:fullscreen .fiche .texte, :fullscreen .face .texte { font-size: clamp(36px, 6vw, 72px); }
:fullscreen .choix-btn { font-size: 26px; min-height: 84px; }
:fullscreen .tuile-paire { font-size: 24px; min-height: 96px; }

@media (prefers-reduced-motion: reduce) {
  .flashcard { transition: none; }
  .tuile-paire.erreur { animation: none; }
}
