/* Socle commun des jeux La Plume. Les couleurs se changent ici, les jeux héritent. */
:root {
  --fond: #fbf7f0;
  --papier: #ffffff;
  --encre: #22201c;
  --encre-douce: #6b645a;
  --accent: #b5471f;
  --accent-clair: #f3dccd;
  --ok: #2f7d4f;
  --ok-clair: #dff1e5;
  --ko: #b3261e;
  --ko-clair: #f8dcda;
  --trait: #e2d9cc;
  --rayon: 12px;
  --police-titre: "Georgia", "Times New Roman", serif;
  --police-texte: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police-texte);
  font-size: 17px;
  line-height: 1.5;
  padding: 16px;
}
.jeu { max-width: 720px; margin: 0 auto; background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 24px; }
.jeu header { margin-bottom: 20px; }
.jeu .surtitre { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent); font-weight: 700; margin: 0 0 6px; }
.jeu h1 { font-family: var(--police-titre); font-size: 30px; line-height: 1.15; margin: 0 0 10px; }
.jeu .intro { color: var(--encre-douce); margin: 0; }
.progression { display: flex; gap: 6px; margin: 16px 0 20px; }
.progression span { flex: 1; height: 6px; border-radius: 3px; background: var(--trait); }
.progression span.fait { background: var(--accent); }
.question { font-family: var(--police-titre); font-size: 22px; margin: 0 0 16px; }
.question .trou { display: inline-block; min-width: 5em; border-bottom: 2px solid var(--accent); text-align: center; color: var(--accent); font-style: italic; }
.choix { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.choix button, .bouton {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--papier); border: 2px solid var(--trait); border-radius: var(--rayon); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; transition: border-color .15s, background .15s;
}
.choix button:hover, .choix button:focus-visible { border-color: var(--accent); outline: none; }
.choix button .lettre { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-clair); color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.choix button[data-etat="ok"] { border-color: var(--ok); background: var(--ok-clair); }
.choix button[data-etat="ko"] { border-color: var(--ko); background: var(--ko-clair); }
.choix button[disabled] { cursor: default; }
.retour { margin-top: 14px; min-height: 1.6em; font-weight: 600; }
.retour.ok { color: var(--ok); }
.retour.ko { color: var(--ko); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.bouton { width: auto; display: inline-flex; justify-content: center; font-weight: 600; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { filter: brightness(1.08); }
.bouton.secondaire:hover { border-color: var(--accent); }
.resultat { text-align: center; padding: 10px 0; }
.resultat .score { font-family: var(--police-titre); font-size: 54px; color: var(--accent); line-height: 1; margin: 10px 0; }
.resultat p { margin: 6px 0; }
.note { color: var(--encre-douce); font-size: 14px; margin-top: 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Grilles (sudoku, carré magique, mots mêlés) */
.grille { display: grid; gap: 0; margin: 0 auto; border: 3px solid var(--encre); border-radius: 6px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.case { display: flex; align-items: center; justify-content: center; border: 1px solid var(--trait); background: var(--papier); font-family: var(--police-titre); font-size: 22px; position: relative; }
.case.fixe { background: #f1ece3; font-weight: 700; }
.case input { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font: inherit; color: var(--accent); padding: 0; }
.case input:focus { outline: 3px solid var(--accent); outline-offset: -3px; }
.case.erreur { background: var(--ko-clair); }
.case.erreur input { color: var(--ko); }
.case.bonne input { color: var(--ok); }
.sudoku .case:nth-child(3n) { border-right: 2px solid var(--encre); }
.sudoku .case:nth-child(9n) { border-right: 0; }
.sudoku .case:nth-child(n+19):nth-child(-n+27), .sudoku .case:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--encre); }
.mots { font-size: 18px; font-weight: 600; letter-spacing: .02em; cursor: pointer; }
.mots.selection { background: var(--accent-clair); }
.mots.trouve { background: var(--ok-clair); color: var(--ok); }
.liste-mots { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 16px 0 0; }
.liste-mots li { padding: 4px 12px; border: 1px solid var(--trait); border-radius: 20px; font-size: 15px; }
.liste-mots li.trouve { text-decoration: line-through; color: var(--ok); border-color: var(--ok); background: var(--ok-clair); }
.somme { font-size: 14px; color: var(--encre-douce); text-align: center; margin-top: 8px; }
@media (max-width: 480px) {
  body { padding: 8px; font-size: 16px; }
  .jeu { padding: 16px; }
  .jeu h1 { font-size: 24px; }
  .question { font-size: 19px; }
  .case { font-size: 18px; }
}
