:root {
  --fond: #f5efe3; --carte: #fffdf8; --encre: #1f2a2e; --doux: #55636a; --trait: #dcd3c1;
  --accent: #0f6b6b; --accent-clair: #d9ecea; --ambre: #8a5206; --bon: #1d6b41; --bon-fond: #dff2e6;
  --faux: #a8321f; --faux-fond: #f8e1dc; --ombre: 0 1px 2px rgba(31, 42, 46, .08), 0 6px 18px rgba(31, 42, 46, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11181a; --carte: #1a2427; --encre: #ece6d9; --doux: #a9b6b9; --trait: #2c3a3e;
    --accent: #4fb8b3; --accent-clair: #17393a; --ambre: #f0a94a; --bon: #58c28a; --bon-fond: #163526;
    --faux: #f08a76; --faux-fond: #3d1f19; --ombre: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--ambre); outline-offset: 2px; }
main:focus-visible, .carte:focus-visible { outline: none; } /* cibles de focus après un changement d'écran */

.entete {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 14px 16px 6px;
}
.marque { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--accent);
  font: 700 1.35rem Georgia, serif; }
.serie-entete { font-weight: 700; color: var(--ambre); font-variant-numeric: tabular-nums; }

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 16px; padding: 18px;
  margin: 0 0 14px; box-shadow: var(--ombre); outline: none; }
.doux { color: var(--doux); } .petit { font-size: .88rem; } .centre { text-align: center; }

.bouton { display: block; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-weight: 700; text-align: center; min-height: 52px; margin-top: 10px; }
@media (prefers-color-scheme: dark) { .bouton { color: #0b1415; } }
.bouton.secondaire { background: transparent; color: var(--accent); }
.bouton:disabled { opacity: .45; }

.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.chiffres div { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 12px 6px;
  text-align: center; }
.chiffres b { display: block; font: 700 1.5rem Georgia, serif; font-variant-numeric: tabular-nums; }
.chiffres span { font-size: .8rem; color: var(--doux); }

.score { font: 700 2.6rem Georgia, serif; font-variant-numeric: tabular-nums; margin: 0; }
.carres { font-size: 1.7rem; letter-spacing: 4px; margin: 0 0 8px; }
.compte { font-variant-numeric: tabular-nums; font-weight: 700; }

.etapes { display: flex; gap: 6px; margin: 4px 0 14px; }
.etapes i { flex: 1; height: 6px; border-radius: 3px; background: var(--trait); }
.etapes i.passee { background: var(--accent); } .etapes i.ici { background: var(--ambre); }
.consigne { font-weight: 700; margin: 12px 0 6px; }
.etiquette { display: inline-block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ambre); font-weight: 700; margin-bottom: 8px; }

.photo { margin: 0 0 10px; border-radius: 12px; overflow: hidden; background: var(--trait); }
.photo img { width: 100%; height: 240px; object-fit: contain; }
.photo.zoom img { object-fit: cover; transform: scale(2.6); }
.nom { font: 700 1.25rem Georgia, serif; margin: 0; }
.categorie { font: 400 .9rem system-ui, sans-serif; color: var(--doux); }

select { width: 100%; min-height: 52px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--trait);
  background: var(--carte); }
.essais { list-style: none; padding: 0; margin: 8px 0; font-size: .92rem; }
.essais li { padding: 6px 10px; border-radius: 8px; background: var(--faux-fond); color: var(--faux); margin-bottom: 4px; }

.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choix button, .puce {
  min-height: 52px; padding: 10px 8px; border-radius: 12px; border: 2px solid var(--trait);
  background: var(--carte); font-weight: 600; line-height: 1.2; color: var(--encre); text-decoration: none;
}
.choix button:not(:disabled):hover, .puce:not(:disabled):hover { border-color: var(--accent); }
.juste { border-color: var(--bon) !important; background: var(--bon-fond) !important; color: var(--bon); }
.fausse { border-color: var(--faux) !important; background: var(--faux-fond) !important; color: var(--faux); }
.choix .juste::before { content: "✓ "; } .choix .fausse::before { content: "✗ "; }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vignette { padding: 0; border: 2px solid var(--trait); border-radius: 12px; overflow: hidden; background: var(--carte);
  text-align: start; display: flex; flex-direction: column; }
.vignette img { width: 100%; height: 118px; object-fit: cover; }
.vignette span { padding: 8px 10px; font-weight: 600; line-height: 1.2; font-size: .95rem; }
.vignette small { padding: 0 10px 8px; color: var(--doux); font-weight: 700; }
.vignette.juste span::before { content: "✓ "; } .vignette.fausse span::before { content: "✗ "; }

.lien { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; width: 100%; text-align: start;
  padding: 8px; margin: 0 0 8px; border: 2px solid var(--trait); border-radius: 12px; background: var(--carte); }
.lien img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.lien.active { border-color: var(--accent); background: var(--accent-clair); }
.lien-texte { display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.attribue { font-weight: 700; color: var(--accent); }
.attribue.vide { font-weight: 400; color: var(--doux); }
.lien.juste .attribue { color: var(--bon); } .lien.fausse .attribue { color: var(--faux); }
.puces, .anciens { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { min-height: 46px; padding: 8px 14px; font-size: .95rem; display: inline-flex; align-items: center; }
.puce.prise { opacity: .5; }
.puce.choisie { border-color: var(--accent); background: var(--accent-clair); color: var(--accent); }

.verdict { border-radius: 12px; padding: 12px 14px; margin: 14px 0 10px; font-weight: 700; }
.verdict.bon { background: var(--bon-fond); color: var(--bon); }
.verdict.mauvais { background: var(--faux-fond); color: var(--faux); }
.verdict.moyen { background: var(--accent-clair); color: var(--accent); }
.fait { margin: 0 0 6px; }
.credit { font-size: .82rem; color: var(--doux); margin: 4px 0 12px; overflow-wrap: anywhere; }
.credit a { display: inline-block; padding: 4px 0; }

.pays { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0;
  border-top: 1px solid var(--trait); }
.pays b { font-weight: 600; }
.niveau { font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--trait); color: var(--doux); }
.niveau.n1 { color: var(--ambre); border-color: var(--ambre); }
.niveau.n2 { color: var(--accent); border-color: var(--accent); }
.niveau.n3 { color: #fff; background: var(--bon); border-color: var(--bon); }
@media (prefers-color-scheme: dark) { .niveau.n3 { color: #0b1415; } }
.jauge { height: 10px; border-radius: 5px; background: var(--trait); overflow: hidden; margin: 8px 0; }
.jauge i { display: block; height: 100%; background: var(--accent); }

.barres { display: grid; gap: 6px; }
.barre-ligne { display: grid; grid-template-columns: 96px 1fr 24px; gap: 8px; align-items: center; font-size: .86rem; }
.barre-ligne i { display: block; height: 14px; border-radius: 7px; background: var(--accent); }
.barre-ligne b { text-align: end; font-variant-numeric: tabular-nums; }

.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.case { padding: 0; border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; background: var(--carte);
  display: flex; flex-direction: column; text-align: start; min-height: 96px; }
.case img { width: 100%; height: 72px; object-fit: cover; }
.case span { padding: 5px 6px 7px; font-size: .78rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.case.vide { align-items: center; justify-content: center; text-align: center; border-style: dashed; color: var(--doux); }
.case.vide b { font: 700 1.6rem Georgia, serif; }

textarea, input[type=text] { width: 100%; font: .85rem ui-monospace, Consolas, monospace; padding: 10px; border-radius: 10px;
  border: 1px solid var(--trait); background: var(--fond); color: var(--encre); }
details { margin-top: 10px; } summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.credits-liste { font-size: .82rem; color: var(--doux); padding-inline-start: 18px; overflow-wrap: anywhere; }
ul.regles { padding-inline-start: 20px; margin: 0 0 .8em; } ul.regles li { margin-bottom: 8px; }

.barre { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 2px;
  background: var(--carte); border-top: 1px solid var(--trait); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.barre button { flex: 1; max-width: 120px; min-height: 52px; border: 0; background: none; border-radius: 10px;
  font-size: .82rem; font-weight: 600; color: var(--doux); position: relative; padding: 0 2px; }
.barre button[aria-current=page] { color: var(--accent); background: var(--accent-clair); }
.pastille { position: absolute; top: 4px; inset-inline-end: 6px; min-width: 18px; height: 18px; border-radius: 9px;
  background: #a8321f; color: #fff; font-size: .72rem; line-height: 18px; padding: 0 4px; }
.essai { background: #7a4805; color: #fff; text-align: center; font-size: .86rem; font-weight: 700; padding: 6px 10px; }
.essai a { color: #fff; }

/* Page d'accueil commune : choix de la langue (le plus souvent, elle redirige aussitôt). */
.choix-langue { max-width: 420px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.choix-langue h1 { justify-content: center; font-size: 1.8rem; }
.choix-langue ul { list-style: none; padding: 0; display: grid; gap: 10px; margin: 24px 0 0; }
.choix-langue a { display: block; padding: 14px; border-radius: 12px; border: 2px solid var(--trait); background: var(--carte);
  color: var(--encre); font-weight: 700; text-decoration: none; }
.choix-langue a:hover { border-color: var(--accent); }

@media (min-width: 480px) { .photo img { height: 300px; } .vignette img { height: 150px; } .album { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: no-preference) {
  .carte { animation: entree .25s ease-out; }
  @keyframes entree { from { opacity: 0; transform: translateY(6px); } }
}
