/* Styles propres aux jeux de la famille « logique » (chargés par sa page) : test de logique (lg-),
   rotation mentale (rt-) et tour de Hanoï (hn-). Couleurs du site : sarcelle --p, bleu #2563eb.
   Mobile d'abord : tout tient en 375 px de large ; cibles tactiles ≥ 44 px ; mouvements réduits respectés. */

/* ── Commun : en-tête, barre de progression, carte, propositions ── */
.lg-jeu { --lg-case: 84px; }
.lg-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: .9rem; color: var(--doux); }
.lg-niv { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 99px; padding: 1px 10px; font-size: .78rem; }
.lg-score { color: var(--vert); }
.lg-barre { height: 8px; background: var(--bord); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.lg-barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--p), #2563eb); border-radius: 99px; transition: width .45s ease; }
.lg-carte { text-align: center; }
.lg-entree { animation: lg-entree .35s ease both; }
.lg-sorte { display: inline-block; background: #ccfbf1; color: var(--p-fonce); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; padding: 3px 10px; border-radius: 99px; }
.lg-consigne { font-weight: 800; font-size: 1.12rem; line-height: 1.35; margin: 8px 0 14px; color: var(--texte); }

.lg-case { position: relative; width: var(--lg-case); aspect-ratio: 1; background: #fff; border: 1.5px solid var(--bord); border-radius: 12px; display: grid; place-items: center; padding: 6px; }
.lg-case svg, .lg-option svg, .rt-modele svg { width: 100%; height: auto; aspect-ratio: 1; display: block; }
.lg-trou { border: 2px dashed #93c5fd; background: #eff6ff; color: #2563eb; font-size: 1.9rem; font-weight: 900; }
.lg-revele { border-style: solid; border-color: var(--vert); background: #f0fdf4; animation: lg-pop .3s ease; }
.lg-lettre { position: absolute; top: 2px; left: 6px; font-size: .72rem; color: var(--doux); }

/* Suite : 4 cases + la case à trouver, sur une ligne */
.lg-suite { display: flex; justify-content: center; gap: 8px; margin: 0 auto 18px; max-width: 520px; }
.lg-suite .lg-case { width: auto; flex: 1 1 0; max-width: 96px; min-width: 0; }
.lg-suite .lg-trou { background: #eff6ff; }

/* Analogie : A → B, puis C → ? */
.lg-analogie { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.lg-paire { display: flex; align-items: center; gap: 12px; }
.lg-paire + .lg-paire { padding-top: 10px; border-top: 1px dashed var(--bord); }
.lg-fleche { font-size: 1.6rem; color: var(--p); font-weight: 800; line-height: 1; }

/* Grille 3 × 3 */
.lg-grille { display: grid; grid-template-columns: repeat(3, var(--lg-case)); gap: 6px; justify-content: center; width: max-content; margin: 0 auto 18px; padding: 8px; background: var(--p-pale); border: 1px solid var(--p-bord); border-radius: 16px; }

/* Propositions (boutons dessinés) */
.lg-options { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.lg-n3 { --n: 3; } .lg-n4 { --n: 4; } .lg-n5 { --n: 5; } .lg-n6 { --n: 6; }
.lg-grandes { max-width: 620px; }
.lg-option { position: relative; aspect-ratio: 1; min-height: 56px; background: #fff; border: 2px solid var(--bord); border-radius: 14px; padding: 11%; cursor: pointer; color: inherit; transition: border-color .15s, background .15s, transform .12s, box-shadow .15s; }
.lg-option:hover:not(:disabled) { border-color: var(--p-clair); background: var(--p-pale); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 118, 110, .14); }
.lg-option:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.lg-option:disabled { cursor: default; }
.lg-option:disabled:not(.juste):not(.faux) { opacity: .5; }
.lg-option.juste { border-color: var(--vert); background: #dcfce7; box-shadow: 0 0 0 3px rgba(21, 128, 61, .22); animation: lg-pop .3s ease; }
.lg-option.faux { border-color: var(--rouge); background: #fee2e2; animation: lg-secoue .35s ease; }
.lg-touche { position: absolute; top: 4px; left: 5px; width: 20px; height: 20px; border-radius: 6px; background: var(--fond); border: 1px solid var(--bord); font-size: .7rem; font-weight: 700; color: var(--doux); display: inline-flex; align-items: center; justify-content: center; }
@media (hover: none) { .lg-touche { display: none; } }

.lg-retour { min-height: 1.6em; margin: 14px auto 4px; max-width: 560px; font-size: .95rem; color: #334155; }
.lg-retour.ok strong, .lg-retour.ok:not(:has(strong)) { color: var(--vert); font-weight: 800; }
.lg-retour.ko strong, .lg-retour.ko:not(:has(strong)) { color: var(--rouge); font-weight: 800; }
.lg-explication { display: block; margin-top: 4px; }
.lg-suivant-zone { margin-top: 12px; }

@keyframes lg-entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes lg-pop { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes lg-secoue { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ── Rotation mentale ── */
.rt-aide { font-size: .88rem; color: var(--doux); margin: -6px auto 14px; max-width: 460px; }
.rt-modele { position: relative; width: 150px; height: 150px; margin: 6px auto 18px; background: #eff6ff; border: 2px solid #bfdbfe; border-radius: 18px; padding: 16px; }
.rt-etiquette { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: #2563eb; color: #fff; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; padding: 2px 10px; border-radius: 99px; }
.rt-svg { width: 100%; height: 100%; display: block; }
.rt-options { max-width: 500px; }
.rt-options .lg-option { padding: 13%; }

/* ── Tour de Hanoï ── */
.hn-regle { font-size: .9rem; color: #334155; margin: -6px 0 10px; }
.hn-plateau { position: relative; max-width: 520px; margin: 0 auto 30px; }
.hn-svg { width: 100%; height: auto; display: block; }
.hn-tours { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.hn-tour { position: relative; min-height: 44px; background: transparent; border: 2px solid transparent; border-radius: 14px; cursor: pointer; transition: background .15s, border-color .15s; }
.hn-tour:hover:not(:disabled) { background: rgba(15, 118, 110, .06); }
.hn-tour:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; }
.hn-tour.hn-choisie { background: rgba(37, 99, 235, .08); border-color: #93c5fd; }
.hn-tour:disabled { cursor: default; }
.hn-num { position: absolute; bottom: -27px; left: 50%; transform: translateX(-50%); font-size: .82rem; font-weight: 800; color: var(--doux); white-space: nowrap; }
.hn-arrivee .hn-num { color: var(--p-fonce); }
.hn-disque { transition: transform .22s ease; }
.hn-leve rect { filter: drop-shadow(0 4px 4px rgba(15, 23, 42, .28)); }
.hn-non { animation: lg-secoue .35s ease; }
.hn-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.hn-actions .btn { min-height: 44px; }
.hn-aide { font-size: .82rem; color: var(--doux); margin-top: 10px; }

/* ── Téléphone ── */
@media (max-width: 520px) {
  .g-zone { padding: 12px; }
  .lg-jeu { --lg-case: 78px; }
  .lg-n5, .lg-n6 { --n: 3; }
  .lg-grandes.lg-n4 { --n: 2; max-width: 280px; }       /* l'intrus : les figures SONT l'énigme, on les veut grandes */
  .lg-options { gap: 8px; }
  .lg-suite { gap: 5px; }
  .lg-suite .lg-case { padding: 3px; border-radius: 10px; }
  .lg-consigne { font-size: 1.02rem; }
  .rt-modele { width: 122px; height: 122px; padding: 12px; }
  .rt-options.lg-n4 { --n: 2; max-width: 290px; }         /* des pièces assez grandes pour les « tourner » */
}
@media (max-width: 360px) { .lg-jeu { --lg-case: 68px; } }

@media (prefers-reduced-motion: reduce) {
  .lg-entree, .lg-option.juste, .lg-option.faux, .lg-revele, .hn-non { animation: none; }
  .lg-barre i, .lg-option, .hn-disque, .hn-tour { transition: none; }
  .lg-option:hover:not(:disabled) { transform: none; }
}
