/* 0.9.17 — lot « préparation de dictée » (docs/lots-0.9.17/CONTRAT.md) : regarder, cacher, écrire de
   mémoire, comparer, puis la dictée. */

/* Sur la fiche de l'élève (render.js, avecPreparation) : la dictée pas encore préparée est sous un
   voile posé sur ses numéros, sans rien déplacer (la mise en page reste celle de la fiche) ; s'il
   faut plus de place que les numéros n'en prennent, le voile descend un peu plus bas. */
.dt-prep { display: block; }
.dt-prep.voile-on { position: relative; }
.prep-voile { position: absolute; z-index: 3; left: -5pt; right: -5pt; top: -4pt; min-height: calc(100% + 8pt); box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7pt; padding: 8pt 10pt;
  border: 1.2pt dashed #9db6d6; border-radius: 10pt; background: rgb(255 255 255 / 95%); text-align: center; }
.prep-voile-texte { margin: 0; max-width: 34em; font-size: 12pt; font-weight: 600; line-height: 1.3; color: #1d2b36; }
.prep-voile .prep-ouvrir { min-height: 44px; padding: 8px 20px; font-size: 16px; }
/* Préparée, en mode aidant ou en entraînement : « 👁 Revoir un modèle », dans le coin de l'exercice. */
.dt-prep > .prep-revoir { position: absolute; z-index: 4; right: 0; top: 1pt; display: inline-flex; align-items: center; gap: 3pt; height: 18pt; margin: 0; padding: 0 8pt;
  border: .8pt solid #e2c46a; border-radius: 9pt; background: #fff7df; color: #5f4500; box-shadow: 0 1pt 2pt rgb(0 0 0 / 10%);
  font: 600 8.6pt/1 var(--ui-font, sans-serif); cursor: pointer; white-space: nowrap; }
.dt-prep > .prep-revoir::after { content: ''; position: absolute; inset: -6pt -3pt; }
.dt-prep > .prep-revoir:hover, .dt-prep > .prep-revoir:focus-visible { background: #ffefbf; }
.sheet.step-sheet .dt-prep > .prep-revoir { top: -20pt; }

/* La fenêtre de la préparation (preparation.js) : une seule chose à la fois, en grand. */
dialog.prep-dialog { border: 0; padding: 0; border-radius: 24px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgb(var(--shadow-rgb) / 35%); overflow: hidden; }
dialog.prep-dialog[open] { display: flex; flex-direction: column; }
dialog.prep-dialog::backdrop { background: rgb(var(--backdrop-rgb) / 55%); }
.prep-haut { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line-2); }
.prep-titre { margin: 0; font-size: 19px; line-height: 1.2; }
.prep-ou { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 14px; }
.prep-lot { white-space: nowrap; font-weight: 600; }
.prep-points { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.prep-point { width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; border: 2px solid var(--dot); }
.prep-point.fait { background: var(--brand); border-color: var(--brand); }
.prep-point.ici { box-shadow: 0 0 0 3px var(--sun); }
.prep-ecouter { min-height: 44px; padding: 6px 14px; }
.prep-fermer { flex: none; min-width: 44px; min-height: 44px; font-size: 20px; }
/* (une hauteur stable d'un écran à l'autre : la fenêtre ne saute pas quand le mot se cache) */
.prep-scene { flex: 1 1 auto; min-height: min(380px, calc(100vh - 150px)); min-height: min(380px, calc(100dvh - 150px)); overflow: auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 18px 22px 24px; text-align: center; }
.prep-consigne { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.3; }
.prep-intro { margin: 0; font-size: 18px; line-height: 1.4; color: var(--ink-2); }
.prep-etapes { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 18px; text-align: left; }
/* Le mot à regarder : seul, très grand, dans la police de la fiche. */
.prep-cible { max-width: 100%; box-sizing: border-box; padding: 10px 26px 14px; border-radius: 20px; background: var(--brand-tint); border: 2px solid var(--brand-line);
  color: var(--brand-ink); font: 700 clamp(42px, 9vw, 88px)/1.15 SheetSans, 'DejaVu Sans', Verdana, sans-serif; letter-spacing: .02em; overflow-wrap: anywhere; }
/* Un double clic sur le bouton d'avant ne sélectionne pas le mot apparu à sa place (surligné en
   bleu, il ne se lirait plus tel qu'il s'écrit). */
.prep-cible { -webkit-user-select: none; user-select: none; }
/* Le temps pour regarder : un trait qui se vide (pas de nombre, pas de compte à rebours). */
.prep-temps { width: min(320px, 70%); height: 10px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.prep-temps > span { display: block; height: 100%; border-radius: 5px; background: var(--brand); transform-origin: left center; }
.prep-temps > span.court { animation-name: prep-temps; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes prep-temps { from { transform: scaleX(1); } to { transform: scaleX(0); } }
/* L'écran vide entre le mot et la suite. */
.prep-neutre { width: 100%; min-height: 120px; }
.prep-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.prep-actions .btn { min-width: 180px; }
/* Choisir : deux ou trois écritures, en grand. */
.prep-choix { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.prep-option { min-width: 150px; min-height: 64px; padding: 8px 22px; border: 2px solid var(--line-strong); border-radius: 18px; background: var(--paper); color: var(--ink);
  font: 700 30px/1.2 SheetSans, 'DejaVu Sans', Verdana, sans-serif; cursor: pointer; }
.prep-option:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-tint); }
.prep-option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.prep-option:disabled { cursor: default; }
/* Écrire de mémoire. */
.prep-contexte { margin: 0; font: 400 22px/1.5 SheetSans, 'DejaVu Sans', Verdana, sans-serif; }
.prep-trou { display: inline-block; min-width: 2em; color: var(--muted); }
.prep-trou.ici { color: var(--brand-ink); font-weight: 700; }
.prep-ecrire { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.prep-champ { flex: 1 1 260px; max-width: 420px; min-height: 60px; box-sizing: border-box; padding: 8px 16px; border: 2px solid var(--line-strong); border-radius: 16px;
  background: var(--paper); color: var(--ink); font: 700 30px/1.2 SheetSans, 'DejaVu Sans', Verdana, sans-serif; text-align: center; }
.prep-champ:focus { outline: 3px solid var(--brand); outline-offset: 2px; border-color: var(--brand); }
.prep-msg { margin: 0; min-height: 1.3em; color: var(--sun-ink); font-weight: 600; }
/* Comparer : ce que l'élève a écrit, et le modèle, l'un sous l'autre ; les lettres différentes
   soulignées sur un fond jaune (sans rouge). */
.prep-verdict { margin: 0; font-size: 21px; font-weight: 700; }
.prep-verdict.juste { color: var(--brand-text); }
.prep-verdict.revoir { color: var(--sun-ink); }
.prep-comparer { display: grid; gap: 10px; justify-items: center; }
.prep-ligne { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 14px; }
.prep-etiquette { min-width: 7.5em; color: var(--muted); font-size: 16px; text-align: right; }
.prep-mot { font: 700 clamp(30px, 6vw, 48px)/1.25 SheetSans, 'DejaVu Sans', Verdana, sans-serif; overflow-wrap: anywhere; }
.prep-mot.modele { color: var(--brand-ink); }
.prep-l.faux { background: var(--sun-soft); border-bottom: 4px solid var(--sun-deep); border-radius: 3px; }
.prep-l.faux.espace { min-width: .45em; display: inline-block; }
.prep-indice { margin: 0; max-width: 34em; padding: 10px 16px; border-radius: 14px; background: var(--sun-soft); color: var(--sun-ink); font-size: 17px; line-height: 1.4; }
.prep-bravo { margin: 0; font-size: 26px; font-weight: 700; }
/* Revoir un modèle (mode aidant). */
.prep-numeros { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 560px; }
.prep-numero { min-width: 56px; min-height: 56px; border: 2px solid #9db6d6; border-radius: 16px; background: #eef4fb; color: #1c4fa8; font: 700 22px/1 var(--ui-font, sans-serif); cursor: pointer; }
.prep-numero:hover { background: #dde9f7; }
.prep-note { margin: 0; color: var(--muted); font-size: 15px; }

/* Téléphone, et fenêtre basse d'un ordinateur du collège (1280 × 585) : tout tient sans défiler. */
@media (max-width: 560px) {
  dialog.prep-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .prep-haut { padding: 8px 8px 8px 14px; }
  .prep-titre { font-size: 16px; }
  .prep-actions .btn { min-width: 0; flex: 1 1 140px; }
  .prep-etiquette { min-width: 0; text-align: center; width: 100%; }
}
@media (max-height: 640px) {
  .prep-scene { gap: 10px; padding: 12px 18px 16px; }
  .prep-cible { font-size: clamp(38px, 8vh, 72px); padding: 6px 20px 10px; }
  .prep-consigne { font-size: 19px; }
  .prep-mot { font-size: clamp(26px, 6vh, 40px); }
}

/* Avec la classe (« Présenter » → « ⋯ » → « Préparer la dictée avec la classe ») : tout l'écran,
   lisible au fond de la salle ; rien à sélectionner (pas de champ : un double clic ne surligne rien).
   Le mot garde une ligne (preparation.js, ajusterMots). */
dialog.prep-dialog.classe { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; border-radius: 0; -webkit-user-select: none; user-select: none; }
.prep-dialog.classe .prep-titre { flex: 1; min-width: 0; font-size: clamp(16px, 2.2vw, 22px); }
.prep-dialog.classe .prep-ou { flex: none; white-space: nowrap; font-size: clamp(15px, 1.8vw, 18px); font-weight: 600; }
.prep-dialog.classe .prep-consigne { font-size: clamp(24px, 3.4vw, 40px); }
.prep-dialog.classe .prep-cible { font-size: clamp(64px, 13vw, 180px); padding: 14px 40px 22px; }
.prep-dialog.classe .prep-temps { width: min(520px, 70%); height: 14px; }
.prep-dialog.classe .prep-indice { font-size: clamp(20px, 2.6vw, 30px); }
.prep-ardoise { margin: 0; font-size: clamp(32px, 6vw, 72px); font-weight: 700; color: var(--brand-ink); }
