/* Les Mots Fléchés — feuille de style
   Principes : très lisible (Atkinson Hyperlegible, pensée pour les malvoyants),
   grands contrastes, grandes zones tactiles, mobile d'abord.
   Mise en page : colonne centrale ; le jeu occupe toute la largeur utile sur mobile. */
/* Police Atkinson Hyperlegible (Braille Institute, licence SIL OFL), hébergée sur le site */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); }
:root {
  --fond: #f3f5f9;
  --surface: #ffffff;
  --encre: #15213a;
  --encre-douce: #45526b;
  --trait: #1d2a44;
  --trait-leger: #c9d2e0;
  --def-fond: #dde6f3;
  --def-encre: #172540;
  --accent: #1f4fbf;
  --accent-encre: #ffffff;
  --accent-doux: #e3ebfb;
  --surligne: #ffd23f;
  --surligne-mot: #fff1b3;
  --ok: #1d7a4b;
  --ok-doux: #dcf3e6;
  --erreur: #b42318;
  --erreur-doux: #fde4e1;
  --revele: #1f4fbf;
  --ombre: 0 1px 2px rgba(21, 33, 58, .08), 0 4px 16px rgba(21, 33, 58, .06);
  --police: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --echelle: 1;
  --rayon: 12px;
  --largeur: 72rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0e1422; --surface: #161f33; --encre: #eef2f9; --encre-douce: #b4bfd3;
    --trait: #9fb0cf; --trait-leger: #33405a; --def-fond: #24324f; --def-encre: #e6ecf7;
    --accent: #7ea2ff; --accent-encre: #0e1422; --accent-doux: #1f2c4a;
    --surligne: #e8b923; --surligne-mot: #4a4220; --ok: #58c28b; --ok-doux: #173a2a;
    --erreur: #ff8a7a; --erreur-doux: #4a1f1b; --revele: #9db8ff;
    --ombre: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0e1422; --surface: #161f33; --encre: #eef2f9; --encre-douce: #b4bfd3;
  --trait: #9fb0cf; --trait-leger: #33405a; --def-fond: #24324f; --def-encre: #e6ecf7;
  --accent: #7ea2ff; --accent-encre: #0e1422; --accent-doux: #1f2c4a;
  --surligne: #e8b923; --surligne-mot: #4a4220; --ok: #58c28b; --ok-doux: #173a2a;
  --erreur: #ff8a7a; --erreur-doux: #4a1f1b; --revele: #9db8ff;
  --ombre: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(112.5% * var(--echelle)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font-family: var(--police); line-height: 1.55; font-size: 1rem;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.enveloppe { max-width: var(--largeur); margin-inline: auto; padding-inline: 16px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- En-tête ---------- */
.entete { background: var(--surface); border-bottom: 1px solid var(--trait-leger); position: relative; z-index: 5; }
.entete .enveloppe { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--encre); font-weight: 700; font-size: 1.2rem; margin-right: auto; padding-block: 8px; }
.logo svg { width: 38px; height: 38px; flex: none; }
.logo span small { display: block; font-weight: 400; font-size: .72rem; color: var(--encre-douce); letter-spacing: .02em; }
.bouton-menu { display: none; }
.nav-principale ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-principale a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--encre); font-weight: 700; font-size: .95rem; }
.nav-principale a:hover { background: var(--accent-doux); }
.nav-principale a[aria-current="page"] { background: var(--accent); color: var(--accent-encre); }
@media (max-width: 940px) {
  .bouton-menu { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 10px; border: 2px solid var(--trait-leger); background: var(--surface); color: var(--encre); font: inherit; font-weight: 700; cursor: pointer; }
  .nav-principale { flex-basis: 100%; display: none; padding-bottom: 12px; }
  .nav-principale.ouvert { display: block; }
  .nav-principale ul { flex-direction: column; }
  .nav-principale a { padding: 14px 12px; font-size: 1.05rem; border-bottom: 1px solid var(--trait-leger); border-radius: 0; }
}

@media (max-width: 400px) {
  /* 360 px (Android courant) : logo et bouton Menu sur une seule ligne */
  .entete .enveloppe { gap: 8px; }
  .logo { font-size: 1.05rem; gap: 8px; }
  .logo svg { width: 34px; height: 34px; }
  .logo span small { font-size: .66rem; letter-spacing: 0; }
  .bouton-menu { padding: 0 12px; }
}
@media (max-width: 350px) {
  .logo span small { display: none; }
  .logo { font-size: 1rem; }
  .logo svg { width: 30px; height: 30px; }
  .bouton-menu { padding: 0 10px; gap: 6px; }
}

/* ---------- Fil d'Ariane ---------- */
.ariane { font-size: .85rem; color: var(--encre-douce); padding-block: 12px 0; }
.ariane ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.ariane li + li::before { content: "›"; margin-right: 4px; color: var(--encre-douce); }
.ariane a { color: var(--encre-douce); display: inline-block; padding-block: 8px; margin-block: -8px; } /* zone de toucher agrandie sans décaler la ligne */
.ariane ol { row-gap: 8px; }

/* ---------- Titre de page ---------- */
.intro { padding-block: 16px 8px; }
.intro p.chapo { font-size: 1.05rem; color: var(--encre-douce); max-width: 60ch; }
.pastilles { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; padding: 0; list-style: none; }
.pastilles a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--trait-leger); background: var(--surface); color: var(--encre); text-decoration: none; font-weight: 700; }
.pastilles a:hover { border-color: var(--accent); }
.pastilles a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }

@media (max-width: 560px) {
  .intro { padding-block: 10px 2px; }
  .intro p.chapo { font-size: .95rem; margin-bottom: .5em; }
  /* tous les niveaux restent visibles (pas de défilement horizontal caché) : « Gros caractères » doit se voir */
  .pastilles { gap: 6px; margin: 8px 0 4px; }
  .pastilles a { min-height: 44px; padding: 0 12px; white-space: nowrap; font-size: .95rem; }
}

/* ---------- Jeu ---------- */
.zone-jeu { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 8px 24px; }
@media (min-width: 1000px) { .zone-jeu { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; } }
.jeu { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 14px; max-width: 46rem; width: 100%; margin-inline: auto; }
@media (max-width: 560px) { .jeu { padding: 10px 8px; border-radius: 10px; } .zone-jeu .enveloppe, .zone-jeu { padding-inline: 0; } }
.jeu-titre { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; padding-inline: 4px; }
.jeu-titre h2 { font-size: 1.15rem; margin: 0; }
.jeu-titre .info { color: var(--encre-douce); font-size: .9rem; }
.chrono { font-variant-numeric: tabular-nums; }

.barre-def {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 6px;
  background: var(--accent); color: var(--accent-encre); border-radius: 10px; padding: 6px; margin-bottom: 10px; min-height: 64px;
}
.barre-def .texte { font-size: 1.2rem; font-weight: 700; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.barre-def .texte small { display: block; font-weight: 400; font-size: .85rem; opacity: .9; }
.barre-def button { width: 48px; height: 48px; border-radius: 8px; border: 0; background: rgba(255,255,255,.16); color: inherit; font-size: 1.3rem; cursor: pointer; }
.barre-def button:hover { background: rgba(255,255,255,.28); }

.grille {
  --cols: 8; --rows: 10;
  container-type: inline-size;
  width: 100%;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  border: 2px solid var(--trait); background: var(--trait); gap: 1px; margin-inline: auto; max-width: 100%;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.jeu[data-taille="geants"] .grille { max-width: 60rem; }
/* Sur grand écran, la grille entière tient dans la hauteur de la fenêtre */
@media (min-width: 700px) and (min-height: 500px) {
  .grille { max-width: max(26rem, min(100%, calc((100vh - 130px) * var(--cols) / var(--rows)))); }
}
.c { position: relative; aspect-ratio: 1; background: var(--surface); min-width: 0; overflow: visible; }
.c.l { cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--encre); font-size: 1.3rem; line-height: 1; }
@supports (font-size: 1cqw) { .c.l { font-size: calc(100cqw / var(--cols) * .56); } }
.c.l .x { position: relative; z-index: 1; }
.c.d { background: var(--def-fond); color: var(--def-encre); display: flex; flex-direction: column; overflow: hidden; cursor: pointer; }
.c.d .dt { flex: 1 1 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1px 2px; line-height: 1.08; font-size: 9px; overflow: hidden; hyphens: manual; overflow-wrap: normal; word-break: normal; }
@supports (font-size: 1cqw) {
  .c.d .dt { font-size: calc(100cqw / var(--cols) * .165); }
  .c.d .dt:only-child { font-size: calc(100cqw / var(--cols) * .19); }
  .jeu[data-taille="gros-caracteres"] .c.d .dt { font-size: calc(100cqw / var(--cols) * .19); }
  .jeu[data-taille="gros-caracteres"] .c.d .dt:only-child { font-size: calc(100cqw / var(--cols) * .22); }
}
.c.d .dt + .dt { border-top: 1px solid var(--trait); }
.c.d.vide { background: var(--trait); }
.c.d.actif { background: var(--surligne-mot); }
.c.d .dt.actif { background: var(--surligne); color: #15213a; }

/* Flèches : dessinées dans la première case du mot, contre la case-définition */
.c.l::before, .c.l::after { content: ""; position: absolute; width: 11px; height: 11px; background: var(--trait); display: none; z-index: 2; pointer-events: none; }
@supports (width: 1cqw) { .c.l::before, .c.l::after { width: calc(100cqw / var(--cols) * .26); height: calc(100cqw / var(--cols) * .26); } }
.c.l.a-r::before { display: block; left: 0; top: 50%; transform: translateY(-50%); clip-path: polygon(0 12%, 72% 50%, 0 88%); }
.c.l.a-d::after { display: block; top: 0; left: 50%; transform: translateX(-50%); clip-path: polygon(12% 0, 88% 0, 50% 72%); }
.c.l.a-rd::before, .c.l.a-dr::after { display: block; left: 0; top: 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: contain; mask-size: contain; }
.c.l.a-rd::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M0 2.2H6.4V8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M3.4 7 6.4 11.4 9.4 7Z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M0 2.2H6.4V8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M3.4 7 6.4 11.4 9.4 7Z'/%3E%3C/svg%3E"); }
.c.l.a-dr::after { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 0V6.4H8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M7 3.4 11.4 6.4 7 9.4Z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 0V6.4H8' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3Cpath d='M7 3.4 11.4 6.4 7 9.4Z'/%3E%3C/svg%3E"); }

.c.l.mot { background: var(--surligne-mot); }
.c.l.sel { background: var(--surligne); color: #15213a; }
.c.l.err { background: var(--erreur-doux); }
.c.l.err .x { color: var(--erreur); text-decoration: underline wavy; text-decoration-thickness: 2px; }
.c.l.rev .x { color: var(--revele); }
.c.l.bon { background: var(--ok-doux); }
.jeu.termine .c.l { background: var(--ok-doux); }

/* Clavier à l'écran */
.clavier { display: none; margin-top: 12px; gap: 6px; flex-direction: column; }
@media (pointer: coarse) { .clavier { display: flex; } }
.tactile .clavier, .clavier.force { display: flex; }
.clavier .rang { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.clavier button {
  min-height: 54px; border: 0; border-radius: 8px; background: var(--def-fond); color: var(--encre);
  font: inherit; font-weight: 700; font-size: 1.25rem; cursor: pointer; padding: 0; touch-action: manipulation;
  box-shadow: 0 2px 0 var(--trait-leger);
}
.clavier button:active { transform: translateY(1px); box-shadow: none; background: var(--surligne); }
.clavier .large { grid-column: span 2; font-size: 1rem; }
.clavier .rang.bas { grid-template-columns: repeat(10, minmax(0, 1fr)); }

/* Barre d'outils */
.outils { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  border-radius: 10px; border: 2px solid var(--trait-leger); background: var(--surface); color: var(--encre);
  font: inherit; font-weight: 700; font-size: .98rem; cursor: pointer; text-decoration: none;
}
.bouton:hover { border-color: var(--accent); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }
.bouton.discret { border-color: transparent; background: transparent; color: var(--accent); }
.bouton svg { width: 20px; height: 20px; }
.message { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-doux); font-weight: 700; }
.message.ok { background: var(--ok-doux); color: var(--ok); }
.message.erreur { background: var(--erreur-doux); color: var(--erreur); }
.confirmer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--erreur-doux); }
.confirmer p { margin: 0; font-weight: 700; flex-basis: 100%; }

/* Victoire */
.bravo { margin-top: 14px; padding: 18px; border-radius: 12px; background: var(--ok-doux); color: var(--encre); text-align: center; }
.bravo h3 { color: var(--ok); font-size: 1.4rem; }
.bravo .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

/* Liste des définitions */
.liste-defs { margin-top: 16px; border-top: 1px solid var(--trait-leger); padding-top: 10px; }
.liste-defs summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; color: var(--accent); }
.liste-defs .colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 8px 24px; }
.liste-defs h3 { font-size: 1rem; margin: 10px 0 4px; }
.liste-defs ol { margin: 0; padding-left: 0; list-style: none; }
.liste-defs li { padding: 7px 8px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; }
.liste-defs li:hover, .liste-defs li.actif { background: var(--surligne-mot); }
.liste-defs li .n { color: var(--encre-douce); font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste-defs li.fait { color: var(--encre-douce); text-decoration: line-through; }

/* Colonne latérale */
.cote { display: grid; gap: 16px; align-content: start; }
.carte { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px 18px; }
.carte h2, .carte h3 { font-size: 1.1rem; }
.carte ul { margin: 0; padding-left: 1.1em; }
.carte li { margin: .35em 0; }
.serie { display: flex; align-items: center; gap: 12px; }
.serie strong { font-size: 2rem; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }

/* Niveaux (accueil) */
.niveaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 12px; margin: 8px 0 24px; padding: 0; list-style: none; }
.niveau { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--rayon); background: var(--surface); box-shadow: var(--ombre); text-decoration: none; color: var(--encre); border: 2px solid transparent; }
.niveau:hover { border-color: var(--accent); }
.niveau .nom { font-weight: 700; font-size: 1.15rem; color: var(--accent); }
.niveau .desc { color: var(--encre-douce); font-size: .95rem; }
.niveau .mini { display: grid; grid-template-columns: repeat(6, 14px); gap: 2px; margin-bottom: 4px; }
.niveau .mini i { width: 14px; height: 14px; border-radius: 2px; background: var(--def-fond); }
.niveau .mini i.l { background: var(--fond); outline: 1px solid var(--trait-leger); }

/* Archives */
.archives { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: 10px; list-style: none; padding: 0; margin: 12px 0 24px; }
.archives a { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--surface); box-shadow: var(--ombre); text-decoration: none; color: var(--encre); border: 2px solid transparent; min-height: 48px; }
.archives a:hover { border-color: var(--accent); }
.archives a strong { color: var(--accent); }
.archives a small { color: var(--encre-douce); }
.archives a.fini::after { content: "✓ Terminée"; color: var(--ok); font-size: .8rem; font-weight: 700; }

/* Contenu éditorial */
.contenu { max-width: 46rem; padding-block: 8px 32px; }
.contenu h2 { margin-top: 1.6em; }
.contenu ul, .contenu ol { padding-left: 1.3em; }
.contenu li { margin: .4em 0; }
.contenu table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.contenu th, .contenu td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--trait-leger); vertical-align: top; }
.contenu th { font-weight: 700; }
.tableau { overflow-x: auto; }
.faq details { background: var(--surface); border-radius: 10px; box-shadow: var(--ombre); margin: 10px 0; padding: 4px 16px; }
.faq summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; }
.encart { background: var(--accent-doux); border-radius: var(--rayon); padding: 16px 18px; margin: 16px 0; }

/* Emplacements publicitaires (hauteur réservée : pas de décalage de mise en page) */
.pub { min-height: 280px; margin: 16px auto; display: flex; align-items: center; justify-content: center; max-width: 46rem; }
.pub:empty { min-height: 0; margin: 0; }
.pub::before { content: "Publicité"; display: block; font-size: .7rem; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .08em; }
.pub:empty::before { content: none; }

/* Pied de page */
.pied { background: var(--surface); border-top: 1px solid var(--trait-leger); margin-top: 32px; padding-block: 28px; font-size: .95rem; }
.pied .colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 16px 32px; }
.pied h2 { font-size: 1rem; }
.pied ul { list-style: none; margin: 0; padding: 0; }
.pied li { margin: .45em 0; }
.pied a { color: var(--encre); }
.pied .bas { margin-top: 20px; color: var(--encre-douce); font-size: .85rem; }

/* Réglages d'affichage */
.reglages { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reglages span { font-weight: 700; margin-right: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .c.l.sel { transition: background-color .12s; }
  .bravo { animation: apparait .4s ease-out; }
  @keyframes apparait { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* ---------- Impression : une grille propre sur une page A4 ---------- */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  :root { --fond: #fff; --surface: #fff; --encre: #000; --trait: #000; --def-fond: #e9e9e9; --def-encre: #000; --surligne: #fff; --surligne-mot: #fff; }
  body { background: #fff; font-size: 11pt; }
  .entete, .pied, .ariane, .barre-def, .clavier, .outils, .liste-defs, .pub, .cote, .pastilles, .contenu, .intro .chapo, .message, .bravo, .confirmer, .no-print { display: none !important; }
  .intro { padding: 0; }
  .intro h1 { font-size: 16pt; margin-bottom: 2mm; }
  .zone-jeu { display: block; padding: 0; }
  .jeu { box-shadow: none; padding: 0; max-width: none; }
  .jeu-titre { margin-bottom: 3mm; }
  .grille { width: min(186mm, calc(228mm * var(--cols) / var(--rows))); max-width: none; gap: 0; background: none; border: 1.5pt solid #000; break-inside: avoid; }
  .c { border: .6pt solid #000; }
  .c, .c.l::before, .c.l::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .c.l::before, .c.l::after { background: #000 !important; }
  .chrono-bloc { display: none; }
  main > *:not(.intro):not(.zone-jeu) { display: none !important; }
  .c.d .dt { font-size: calc(100cqw / var(--cols) * .15) !important; }
  .c.d .dt:only-child { font-size: calc(100cqw / var(--cols) * .17) !important; }
  .c.l .x { visibility: hidden; }
  .imprimer-solution .c.l .x { visibility: visible; color: #000 !important; }
  .c.l.sel, .c.l.mot, .c.l.err, .c.l.bon { background: #fff !important; }
  .c.d .dt.actif, .c.d.actif { background: #e9e9e9 !important; }
  .mention-impression { display: block !important; margin-top: 4mm; font-size: 9pt; color: #444; }
}
.mention-impression { display: none; }

/* =====================================================================
   Moteur de solutions, pages de définitions, listes de mots
   ===================================================================== */
.lien-solutions { margin: 8px 0 0; font-size: .95rem; }
.lien-solutions a { font-weight: 700; }
.reglages { margin-top: 12px; }
.compte { font-size: .8em; font-weight: 400; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.etiquette { display: block; font-weight: 700; margin-bottom: 6px; }

/* Barre d'outils du jeu : 3 actions principales, le reste en lien discret */
.outils { display: grid; gap: 10px; }
.outils-principaux { display: flex; flex-wrap: wrap; gap: 8px; }
.outils-secondaires { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.lien-bouton { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.lien-bouton svg { width: 18px; height: 18px; }
.lien-bouton:hover { text-decoration-thickness: 2px; }
.taille-texte { display: inline-flex; gap: 4px; margin-left: auto; }
.taille-texte .lien-bouton { text-decoration: none; border: 2px solid var(--trait-leger); border-radius: 8px; padding: 0 10px; }

/* Formulaire complet (/solutions/) */
.zone-recherche { padding-block: 4px 16px; }
.recherche { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; display: grid; gap: 18px; max-width: 46rem; }
.recherche .champ { margin: 0; padding: 0; border: 0; min-width: 0; }
.recherche label[for], .recherche legend { display: block; font-weight: 700; margin-bottom: 8px; padding: 0; }
.facultatif { font-weight: 400; color: var(--encre-douce); }
.recherche #q { width: 100%; }
.actions-recherche { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.actions-recherche .principal { flex: 1 1 14rem; }
input[type="search"], input[type="text"].motif, .recherche-courte select, .recherche-courte input {
  min-height: 52px; padding: 0 14px; border: 2px solid var(--trait-leger); border-radius: 10px; background: var(--surface); color: var(--encre);
  font: inherit; font-size: 1.1rem; width: 100%;
}
input[type="search"]:focus, input.motif:focus, .recherche-courte select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-doux); }
.js .recherche .motif { display: none; } /* remplacé par les cases dès l'affichage : pas de décalage de mise en page */
.cases:empty { min-height: 52px; }
@media (max-width: 400px) { .cases:empty { min-height: 48px; } }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { position: relative; }
.puce input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.puce span { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 0 12px; border: 2px solid var(--trait-leger); border-radius: 10px; background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; }
.puce input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }
.puce input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.puce:hover span { border-color: var(--accent); }
.cases { display: flex; flex-wrap: wrap; gap: 6px; }
.cases input { width: 48px; height: 52px; padding: 0; text-align: center; text-transform: uppercase; font: inherit; font-weight: 700; font-size: 1.45rem; border: 2px solid var(--trait); border-radius: 8px; background: var(--surface); color: var(--encre); }
.cases input:focus { outline: none; border-color: var(--accent); background: var(--surligne-mot); }
.cases input.fixe { background: var(--def-fond); }
@media (max-width: 400px) { .cases { gap: 4px; } .cases input { width: 40px; height: 48px; font-size: 1.25rem; } }
.indice-cases { margin: 0; color: var(--encre-douce); font-size: .95rem; }
.cases:not([hidden]) ~ .indice-cases { display: none; }
.effacer-tout { margin: -8px 0 0; }

/* Résultats */
.resultats { max-width: 46rem; margin-top: 16px; }
.resume { font-size: 1.05rem; }
.lien-fort { font-weight: 700; }
.groupe { margin: 0 0 18px; }
.groupe h2, .groupe h3 { display: flex; align-items: baseline; gap: 10px; font-size: 1.05rem; margin: 0 0 8px; }
.nb-lettres { display: inline-block; background: var(--accent); color: var(--accent-encre); border-radius: 6px; padding: 2px 10px; font-size: 1rem; font-variant-numeric: tabular-nums; }
.solutions { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--trait-leger); }
.solutions li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 10px 4px; border-bottom: 1px solid var(--trait-leger); }
.solutions .mot, .mots-motif .mot { font-weight: 700; font-size: 1.35rem; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.solutions .def, .mots-motif .def { color: var(--encre-douce); font-size: .95rem; min-width: 0; }
.mots-motif { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 0 16px; }
.mots-motif li { padding: 8px 0; border-bottom: 1px solid var(--trait-leger); display: grid; }
.mots-motif .mot { font-size: 1.15rem; }
.vide { font-weight: 700; padding: 12px 14px; border-radius: 10px; background: var(--accent-doux); }
.actions-vide { display: flex; flex-wrap: wrap; gap: 8px; }
.sous-titre { margin-top: 20px; font-size: 1.1rem; }
.aide { color: var(--encre-douce); font-size: .95rem; }

/* Petit formulaire (accueil, pages de solution, 404) */
.recherche-courte { display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem auto; gap: 8px; align-items: end; }
.recherche-courte .champ { display: grid; gap: 4px; min-width: 0; }
.recherche-courte label { font-weight: 700; font-size: .9rem; }
.recherche-courte .bouton { min-height: 52px; }
.cote-solutions .recherche-courte, .page-404 .recherche-courte { grid-template-columns: minmax(0, 1fr) 8rem; }
.cote-solutions .recherche-courte .bouton, .page-404 .recherche-courte .bouton { grid-column: 1 / -1; }
@media (max-width: 560px) { .recherche-courte { grid-template-columns: minmax(0, 1fr) 7.5rem; } .recherche-courte .bouton { grid-column: 1 / -1; } }
.bloc-solutions .carte { max-width: 46rem; }
.bloc-solutions h2 { font-size: 1.25rem; }
.themes-rapides { margin: 12px 0 0; font-size: .95rem; }

/* Page d'une définition ou d'un thème */
.zone-solutions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 4px 24px; }
@media (min-width: 1000px) { .zone-solutions { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; } }
.reponse { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; min-width: 0; }
.filtre { display: grid; gap: 12px; margin: 0 0 16px; padding: 0 0 14px; border-bottom: 1px solid var(--trait-leger); }
.filtre .champ { margin: 0; padding: 0; border: 0; min-width: 0; }
.filtre legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.filtre-resume { margin: 0; color: var(--encre-douce); font-size: .9rem; }
.cote-solutions { display: grid; gap: 16px; align-content: start; }
.cote-solutions h2 { font-size: 1.05rem; }
ul.liens-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.liens-chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 2px solid var(--trait-leger); border-radius: 999px; background: var(--surface); color: var(--encre); text-decoration: none; font-weight: 700; font-size: .95rem; }
.liens-chips a:hover { border-color: var(--accent); }
.hubs { display: grid; gap: 28px; padding-block: 8px 24px; }
.hubs h2 { font-size: 1.25rem; }
.hubs .contenu { padding: 0; }

/* Index A–Z et listes de mots */
.az ul { list-style: none; margin: 8px 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.az a, .az span[aria-current], .az .sans-page { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 44px; min-height: 44px; padding: 0 8px; border-radius: 8px; border: 2px solid var(--trait-leger); background: var(--surface); text-decoration: none; font-weight: 700; color: var(--encre); }
.az a:hover { border-color: var(--accent); }
.az span[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-encre); }
.az .sans-page { color: var(--encre-douce); border-style: dashed; }
.section-az h2 { font-size: 1.4rem; border-bottom: 2px solid var(--trait-leger); padding-bottom: 4px; }
.colonnes-liens { list-style: none; margin: 0 0 20px; padding: 0; columns: 16rem auto; column-gap: 24px; }
.colonnes-liens li { padding: 0; break-inside: avoid; }
.colonnes-liens a { display: inline-block; padding-block: 9px; } /* cible de 40 px de haut */
.liste-mots { list-style: none; margin: 0 0 16px; padding: 0; columns: calc(var(--n, 12) * .62em + .6em) auto; column-gap: 20px; font-size: 1.05rem; }
.liste-mots li { padding: 4px 0; break-inside: avoid; }
.liste-mots a { font-weight: 700; }
.tuiles-longueur { list-style: none; margin: 8px 0 24px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); gap: 10px; }
.tuiles-longueur a { display: grid; gap: 2px; padding: 14px 16px; border-radius: 10px; background: var(--surface); box-shadow: var(--ombre); text-decoration: none; color: var(--encre); border: 2px solid transparent; }
.tuiles-longueur a:hover { border-color: var(--accent); }
.tuiles-longueur strong { color: var(--accent); font-size: 1.15rem; }
.tuiles-longueur span { color: var(--encre-douce); font-size: .9rem; }

/* Pages diverses */
.page-404 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); padding-block: 8px 24px; }
.section-impression { margin-bottom: 24px; }
.grille-impression { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 12px; padding: 0; margin: 0; }
.carte .date { color: var(--encre-douce); }
.actions-impression { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.nav-principale a.nav-solutions { border: 2px solid var(--accent); color: var(--accent); }
.nav-principale a.nav-solutions[aria-current] { color: var(--accent-encre); }
.nav-principale a[aria-current="true"] { background: var(--accent-doux); }
.nav-principale a.nav-solutions[aria-current="true"] { background: var(--accent); color: var(--accent-encre); }
@media print { .filtre, .cote-solutions, .recherche, .resultats { display: none !important; } }
.ligne-filtre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ligne-filtre legend { float: left; margin: 0 4px 0 0; padding: 0; font-weight: 700; }
.filtre .puce span { min-height: 44px; min-width: 44px; padding: 0 12px; font-size: .95rem; }
.filtre .connues-filtre .etiquette { margin-bottom: 6px; }
.proches { padding-left: 1.2em; }
.proches li { margin: .35em 0; }

/* relance « autre longueur » sous une liste de solutions */
.autre-longueur { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--trait-leger); grid-template-columns: minmax(0, 1fr) auto; }
.autre-longueur .champ-titre { grid-column: 1 / -1; margin: 0; font-weight: 700; }
.autre-longueur .bouton { grid-column: auto; }
@media (max-width: 560px) { .autre-longueur { grid-template-columns: minmax(0, 1fr) auto; } .autre-longueur .bouton { grid-column: auto; } }
.h1-suite { display: block; margin-top: 4px; font-size: .5em; line-height: 1.3; color: var(--encre-douce); }
