/* Pages de jeu — mise en page commune à tous les jeux (le reste est dans /assets/eckes.css) */
.jeu { max-width: 1180px; margin: 0 auto; padding: calc(110px + env(safe-area-inset-top)) var(--gutter) clamp(60px, 8vw, 100px); }
.jeu-retour { color: var(--ink-soft); text-decoration: none; font-size: .92rem; }
.jeu-retour:hover { color: var(--ink); }
.jeu-tete { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin: 18px 0 30px; }
.jeu-tete h1 { margin-top: 10px; font-size: clamp(3rem, 7vw, 5.6rem); font-weight: 500; letter-spacing: -.05em; line-height: .9; }

.jeu-grille { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }

/* ---------- Plateau ---------- */
.plateau { position: relative; aspect-ratio: 1; width: 100%; max-width: 640px; border-radius: calc(var(--radius) + 6px); background: var(--navy); overflow: hidden; box-shadow: 0 30px 60px rgba(18,24,43,.18); touch-action: none; user-select: none; -webkit-user-select: none; }
.plateau canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ecran { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: #fff; background: rgba(14,22,48,.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: ecran-arrive .35s ease both; }
.ecran[hidden] { display: none; }
.ecran h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.ecran p { opacity: .8; }
.ecran .gros { font-size: 1.1rem; }
.ecran .gros b { color: var(--gold); font-size: 1.5rem; }
.ecran .record[hidden] { display: none; }
.ecran .record { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--gold); color: #1a1206; font-size: .82rem; font-weight: 600; }
.ecran .btn { margin-top: 6px; }
@keyframes ecran-arrive { from { opacity: 0; } }

/* ---------- Panneau à droite ---------- */
.panneau-jeu { display: grid; gap: 18px; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scores div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.scores small { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.scores b { display: block; margin-top: 4px; font-size: 2.2rem; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.scores .battu b { color: #b5761e; }
.bloc { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.bloc h3 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; margin-bottom: 12px; }
.couleurs { display: flex; gap: 10px; }
.couleur { width: 40px; height: 40px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .2s; }
.couleur:hover { transform: scale(1.06); }
.couleur[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px #fff inset; }
.touches { display: grid; gap: 8px; font-size: .92rem; color: var(--ink-soft); list-style: none; }
.touches kbd { display: inline-block; min-width: 26px; padding: 2px 7px; margin-right: 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--paper); font: 500 .8rem 'Inter', sans-serif; color: var(--ink); text-align: center; }
.actions-jeu { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-son[aria-pressed="true"] { opacity: .6; }

/* ---------- Croix directionnelle (écrans tactiles) ---------- */
.croix { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 64px); gap: 8px; justify-content: center; margin-top: 16px; }
.croix button { border: 1px solid var(--line); border-radius: 16px; background: #fff; font-size: 1.4rem; color: var(--ink); cursor: pointer; touch-action: manipulation; }
.croix button:active { background: var(--paper-2); }
.croix [data-dir="haut"] { grid-column: 2; grid-row: 1; }
.croix [data-dir="gauche"] { grid-column: 1; grid-row: 2; }
.croix [data-dir="bas"] { grid-column: 2; grid-row: 2; }
.croix [data-dir="droite"] { grid-column: 3; grid-row: 2; }
@media (hover: none) { .croix { display: grid; } .seulement-clavier { display: none; } }
@media (hover: hover) { .seulement-tactile { display: none; } }

.autres-jeux { display: flex; flex-wrap: wrap; gap: 8px; }
.autres-jeux a { padding: .45em .95em; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; text-decoration: none; }
.autres-jeux a:hover { background: var(--paper-2); }

@media (max-width: 860px) {
  .jeu { padding-top: calc(84px + env(safe-area-inset-top)); }
  /* Titre compact : le plateau et la croix tiennent ensemble à l'écran */
  .jeu-tete { margin: 6px 0 14px; }
  .jeu-tete .eyebrow { display: none; }
  .jeu-tete h1 { font-size: 2.6rem; margin-top: 0; }
  .croix { grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 58px); margin-top: 12px; }
  .jeu-grille { grid-template-columns: minmax(0, 1fr); }
  .plateau { max-width: none; }
}

/* ---------- Plateau vertical (Tetris) ---------- */
.plateau.vertical { aspect-ratio: 12 / 20; width: min(100%, 420px, calc((100vh - 300px) * .6)); min-width: 240px; max-width: none; margin-inline: auto; }
@media (hover: none) { .plateau.vertical { width: min(100%, calc((100svh - 240px) * .6)); } }   /* place pour les boutons */
.scores.trois { grid-template-columns: repeat(3, 1fr); }
.suivante canvas { display: block; width: 96px; height: 96px; border-radius: 14px; background: var(--navy); }
.suivante .lignes { margin-top: 10px; color: var(--ink-soft); font-size: .9rem; }
.suivante .lignes b { color: var(--ink); font-weight: 500; }

/* ---------- Boutons tactiles (Tetris, Pong…) ---------- */
.pad { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 420px; margin: 12px auto 0; }
.pad button { height: 54px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 1.3rem; color: var(--ink); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pad button:active { background: var(--paper-2); }
@media (hover: none) { .pad { display: grid; } }

/* ---------- 2048 ---------- */
.p2048 { --g: 2.6%; --t: calc((100% - 5 * var(--g)) / 4); container-type: inline-size; }
.cases2048 { position: absolute; inset: 0; }
.cases2048 i, .tuile { position: absolute; width: var(--t); height: var(--t); border-radius: 8%; }
.cases2048 i { background: rgba(255,255,255,.06); }
.cases2048 i:nth-child(1) { left: calc(var(--g) + 0 * (var(--t) + var(--g))); top: calc(var(--g) + 0 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(2) { left: calc(var(--g) + 1 * (var(--t) + var(--g))); top: calc(var(--g) + 0 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(3) { left: calc(var(--g) + 2 * (var(--t) + var(--g))); top: calc(var(--g) + 0 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(4) { left: calc(var(--g) + 3 * (var(--t) + var(--g))); top: calc(var(--g) + 0 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(5) { left: calc(var(--g) + 0 * (var(--t) + var(--g))); top: calc(var(--g) + 1 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(6) { left: calc(var(--g) + 1 * (var(--t) + var(--g))); top: calc(var(--g) + 1 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(7) { left: calc(var(--g) + 2 * (var(--t) + var(--g))); top: calc(var(--g) + 1 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(8) { left: calc(var(--g) + 3 * (var(--t) + var(--g))); top: calc(var(--g) + 1 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(9) { left: calc(var(--g) + 0 * (var(--t) + var(--g))); top: calc(var(--g) + 2 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(10) { left: calc(var(--g) + 1 * (var(--t) + var(--g))); top: calc(var(--g) + 2 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(11) { left: calc(var(--g) + 2 * (var(--t) + var(--g))); top: calc(var(--g) + 2 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(12) { left: calc(var(--g) + 3 * (var(--t) + var(--g))); top: calc(var(--g) + 2 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(13) { left: calc(var(--g) + 0 * (var(--t) + var(--g))); top: calc(var(--g) + 3 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(14) { left: calc(var(--g) + 1 * (var(--t) + var(--g))); top: calc(var(--g) + 3 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(15) { left: calc(var(--g) + 2 * (var(--t) + var(--g))); top: calc(var(--g) + 3 * (var(--t) + var(--g))); }
.cases2048 i:nth-child(16) { left: calc(var(--g) + 3 * (var(--t) + var(--g))); top: calc(var(--g) + 3 * (var(--t) + var(--g))); }
.tuile { left: calc(var(--g) + var(--x) * (var(--t) + var(--g))); top: calc(var(--g) + var(--y) * (var(--t) + var(--g))); display: grid; place-items: center; font-weight: 600; font-size: 8.5cqi; letter-spacing: -.03em; color: var(--ink); background: #f3efe6; transition: left .11s ease, top .11s ease; z-index: 1; }
.tuile.nouvelle { animation: tuile-pop .18s ease both; }
.tuile.fusion { animation: tuile-fusion .2s ease; z-index: 2; }
@keyframes tuile-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes tuile-fusion { 50% { transform: scale(1.12); } }
.tuile.v4 { background: #ece2cf; } .tuile.v8 { background: #f2c48d; } .tuile.v16 { background: #e8a96a; color: #fff; }
.tuile.v32 { background: #e8876a; color: #fff; } .tuile.v64 { background: #e86f6f; color: #fff; } .tuile.v128 { background: #7fa2f0; color: #fff; font-size: 7.2cqi; }
.tuile.v256 { background: #5f84e0; color: #fff; font-size: 7.2cqi; } .tuile.v512 { background: #3f65c9; color: #fff; font-size: 7.2cqi; }
.tuile.v1024 { background: #e8b26a; color: #1a1206; font-size: 6cqi; } .tuile.v2048 { background: #f3d36b; color: #1a1206; font-size: 6cqi; box-shadow: 0 0 30px rgba(243,211,107,.6); }
.tuile.grand { background: #fff; color: var(--navy); font-size: 5.2cqi; }
.bravo { position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%) scale(.9); padding: 10px 20px; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap; }
.bravo.visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.info-partage { min-height: 1.2em; color: var(--ink-soft); font-size: .88rem; }

/* ---------- Pong (terrain large) ---------- */
.plateau.large { aspect-ratio: 16 / 10; max-width: none; }
.choix-mode { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.opt-mode { padding: .55em 1.1em; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: .92rem; }
.opt-mode[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1206; }
.touches li[hidden] { display: none; }

/* ---------- Démineur ---------- */
.pmines { container-type: inline-size; padding: 2.4%; }
.mines { display: grid; grid-template-columns: repeat(10, 1fr); gap: 1.2%; width: 100%; height: 100%; }
.mine { border: 0; border-radius: 14%; background: rgba(255,255,255,.14); color: #fff; font: 600 4.6cqi 'Inter', sans-serif; cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .1s; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.mine:hover:not(.ouverte) { background: rgba(255,255,255,.22); }
.mine:active:not(.ouverte) { transform: scale(.94); }
.mine.ouverte { background: rgba(255,255,255,.04); cursor: default; }
.mine.drapeau { color: #e86f6f; }
.mine.boum { background: #e86f6f; color: #fff; }
.mine.bombe { color: #f3efe6; }
.mine.n1 { color: #7fa2f0; } .mine.n2 { color: #5fcf8f; } .mine.n3 { color: #e8b26a; } .mine.n4 { color: #c792ea; }
.mine.n5 { color: #e86f6f; } .mine.n6 { color: #5fb4da; } .mine.n7, .mine.n8 { color: #f3efe6; }
.modes { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.mode { padding: .6em 1.2em; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .95rem; }
.mode[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Bataille navale ---------- */
.pnavale { container-type: inline-size; padding: 2.4%; }
.mer { display: grid; grid-template-columns: repeat(10, 1fr); gap: 1.2%; width: 100%; height: 100%; }
.eau { border: 0; border-radius: 14%; background: rgba(127,162,240,.18); color: #fff; font: 600 4.4cqi 'Inter', sans-serif; cursor: crosshair; display: grid; place-items: center; transition: background .15s, transform .1s; }
.eau:hover:not(.tiree) { background: rgba(127,162,240,.34); }
.eau:active:not(.tiree) { transform: scale(.94); }
.eau.tiree { cursor: default; }
.eau.rate { background: rgba(255,255,255,.04); color: rgba(255,255,255,.4); }
.eau.touche { background: #e8b26a; color: #1a1206; }
.eau.coule { background: #e86f6f; color: #fff; }
.eau.revele { box-shadow: inset 0 0 0 2px rgba(232,178,106,.7); }
.ma-flotte { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; padding: 10px; border-radius: 14px; background: var(--navy); }
.ma-flotte span { aspect-ratio: 1; border-radius: 3px; background: rgba(127,162,240,.16); display: grid; place-items: center; font-size: .6rem; color: #fff; }
.ma-flotte .navire { background: #f3efe6; }
.ma-flotte .rate { background: rgba(255,255,255,.05); }
.ma-flotte .rate::after { content: '•'; opacity: .5; }
.ma-flotte .touche { background: #e86f6f; }
.ma-flotte .dernier { outline: 2px solid var(--gold); outline-offset: 1px; }
.tour-navale { margin-top: 12px; text-align: center; font-size: .95rem; color: var(--ink-soft); min-height: 1.4em; }

/* ---------- Morpion ---------- */
.pmorpion { container-type: inline-size; padding: 5%; }
.cases3 { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3%; width: 100%; height: 100%; }
.case3 { border: 0; border-radius: 10%; background: rgba(255,255,255,.08); color: #fff; font: 500 22cqi/1 'Inter', sans-serif; cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .1s; }
.case3:hover:not(:disabled) { background: rgba(255,255,255,.16); }
.case3:disabled { cursor: default; }
.case3.X { color: #f3efe6; }
.case3.O { color: #e8b26a; }
.case3.pose { animation: pose .25s ease-out; }
.case3.gagnante { background: rgba(232,178,106,.28); }
@keyframes pose { from { transform: scale(.6); opacity: 0; } }
.choix-mode { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.statut-morpion { margin-top: 12px; text-align: center; font-size: 1rem; color: var(--ink-soft); min-height: 1.4em; }
@media (prefers-reduced-motion: reduce) { .case3.pose { animation: none; } }

/* ---------- Trophy Survive ---------- */
.ptrophy { aspect-ratio: 9 / 15; background: #c8814f; }
.ptrophy .terrain { position: absolute; left: 0; right: 0; top: -200%; height: 300%; will-change: transform; }
.ptrophy .sol { position: absolute; inset: 0; display: grid; grid-template-rows: repeat(3, 1fr); }
.ptrophy .sol i { background: var(--terrain-img, none) center / cover, var(--terrain-couleur, #c8814f); }
.ptrophy .sol i.miroir { transform: scaleY(-1); }   /* image retournée : le défilement boucle sans raccord visible */
.ptrophy #solSuivant { opacity: 0; transition: opacity .8s linear; }
.ptrophy .objets { position: absolute; inset: 0; }
.objet { position: absolute; left: 0; top: 0; width: var(--taille); height: var(--taille); will-change: transform; }
.objet.rocher { border-radius: 46% 54% 42% 58% / 55% 45% 55% 45%; background: radial-gradient(circle at 35% 30%, #a39a90, #6f665d 55%, #4f4740); box-shadow: 0 6px 6px rgba(0,0,0,.35), inset -4px -6px 0 rgba(0,0,0,.18); }
.objet.essence { border-radius: 18%; background: linear-gradient(135deg, #f6cf61, #e8a83a); box-shadow: 0 0 16px rgba(241,196,15,.85), 0 5px 6px rgba(0,0,0,.3); }
.objet.essence::before { content: ''; position: absolute; top: -12%; left: 22%; width: 26%; height: 18%; border-radius: 3px 3px 0 0; background: #b5761e; }
.objet.essence::after { content: '⛽'; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--taille) * .45); }
.texte-bonus { position: absolute; z-index: 4; color: #fff; font-weight: 600; font-size: 1.1rem; text-shadow: 0 2px 6px rgba(0,0,0,.6); pointer-events: none; animation: bonus-monte 1s ease-out forwards; }
@keyframes bonus-monte { to { opacity: 0; transform: translateY(-50px); } }
.ptrophy .voiture { position: absolute; z-index: 2; left: 0; bottom: 0; width: var(--largeur, 60%); will-change: transform; transition: scale .35s ease-out; }
.ptrophy .voiture img { display: block; width: 100%; filter: drop-shadow(0 10px 8px rgba(0,0,0,.5)) hue-rotate(var(--teinte, 0deg)); -webkit-user-drag: none; }
.ptrophy .voiture.roule img { animation: vibre .1s infinite linear; }
@keyframes vibre { 50% { transform: translateY(1px); } }
.voiture-css { display: none; }
.ptrophy .voiture.sans-image img { display: none; }
.ptrophy .voiture.sans-image .voiture-css { display: block; width: 22%; aspect-ratio: 1 / 1.75; margin: 0 auto; border-radius: 22% / 14%; background: linear-gradient(#14203f 0 0) 50% 24% / 70% 18% no-repeat, linear-gradient(#14203f 0 0) 50% 70% / 64% 12% no-repeat, #f3efe6; filter: drop-shadow(0 8px 6px rgba(0,0,0,.45)) hue-rotate(var(--teinte, 0deg)) sepia(.0); }
.ptrophy .flamme { position: absolute; bottom: -12%; left: 50%; width: 7%; aspect-ratio: 1 / 2; translate: -50% 0; border-radius: 50% 50% 20% 20%; background: linear-gradient(to top, #ffcc00, #ff3300 60%, transparent); filter: drop-shadow(0 0 10px #ff3300); display: none; }
.ptrophy .voiture.boost .flamme { display: block; }
.ptrophy .phare { position: absolute; top: -40%; width: 30%; height: 60%; display: none; background: radial-gradient(ellipse at 50% 100%, rgba(255,240,180,.55), transparent 70%); }
.ptrophy .phare.g { left: 25%; } .ptrophy .phare.d { right: 25%; }
.ptrophy.de-nuit .phare { display: block; }
.ptrophy .nuit { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .6s; background: radial-gradient(ellipse 34% 30% at var(--nx, 50%) var(--ny, 70%), rgba(255,240,190,.05), rgba(6,10,28,.82) 100%); }
.ptrophy.de-nuit .nuit { opacity: 1; }
.compteur-km { position: absolute; z-index: 4; top: 14px; left: 16px; padding: 6px 12px; border-radius: 999px; background: rgba(14,22,48,.55); color: #fff; font-size: .9rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.compteur-km b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.scores .unite { display: inline; font-size: .9rem; letter-spacing: 0; text-transform: none; }
.couleur.teinte { background: #2e9d8a; filter: hue-rotate(var(--teinte)); }
.terrains { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.terrain-choix { position: relative; aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--terrain-img, none) center / cover, var(--couleur); cursor: pointer; overflow: hidden; padding: 0; }
.terrain-choix span { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 2px; background: rgba(14,22,48,.6); color: #fff; font-size: .62rem; text-align: center; }
.terrain-choix[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.interrupteurs { display: grid; gap: 10px; margin-top: 14px; }
.interrupteur { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.interrupteur i { flex: none; position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background .2s; }
.interrupteur i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.interrupteur[aria-pressed="true"] i { background: var(--ink); }
.interrupteur[aria-pressed="true"] i::after { transform: translateX(18px); }
.interrupteur small { display: block; color: var(--ink-soft); font-size: .78rem; }
.pad-trophy button[data-action="accelerer"] { font-size: 1.1rem; }
.pad-trophy button.appuye { background: var(--ink); color: #fff; }
@media (prefers-reduced-motion: reduce) { .ptrophy .voiture.roule img { animation: none; } }
