/* =========================================================================
 * games.css — Jeux éducatifs : cartes de jeu, piste animée (dino, licorne,
 *   avion), grosses réponses tactiles, cartes de géographie.
 * ========================================================================= */

/* ---------- Écran « Mes jeux » ---------- */
.g-level { text-align: center; font-size: 1.15rem; margin: 0 0 12px; }
.g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.g-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 18px; text-align: center; text-decoration: none; color: var(--ink);
  background: #fff; border-radius: 28px; border: 5px solid color-mix(in srgb, var(--gc) 35%, white);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--gc) 40%, white), var(--shadow); transition: transform .12s;
}
.g-card:active { transform: translateY(6px); box-shadow: 0 2px 0 color-mix(in srgb, var(--gc) 40%, white); }
.g-card b { font-size: 1.45rem; }
.g-card small { color: var(--muted); font-size: 1rem; }
.g-card-icon { font-size: 4.2rem; line-height: 1; animation: gBounce 2.4s ease-in-out infinite; }
.g-card-pts { margin-top: 4px; background: color-mix(in srgb, var(--gc) 14%, white); border-radius: 99px; padding: 4px 14px; font-weight: 600; font-size: .95rem; }
.g-pick-level { text-align: center; }
.g-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; }
@keyframes gBounce { 50% { transform: translateY(-8px) rotate(-4deg); } }

/* ---------- Partie ---------- */
.g-play { display: flex; flex-direction: column; gap: 12px; }
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--gc); color: #fff; border-radius: 22px; padding: 10px 14px; font-size: 1.3rem; box-shadow: var(--shadow); }
.g-head .btn-round { background: rgba(255, 255, 255, .25); color: #fff; }
.g-score { background: rgba(255, 255, 255, .25); border-radius: 99px; padding: 4px 14px; }
.g-track { position: relative; height: 74px; border-radius: 22px; background: linear-gradient(180deg, #e8f7ff, color-mix(in srgb, var(--gc) 18%, white)); overflow: hidden; box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--gc) 30%, white); }
.g-path { position: absolute; left: 4%; right: 4%; top: 50%; border-top: 4px dashed color-mix(in srgb, var(--gc) 45%, white); }
.g-goal { position: absolute; right: 2%; top: 50%; transform: translateY(-50%); font-size: 2.6rem; animation: gBounce 2s ease-in-out infinite; }
.g-mover { position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleX(-1); font-size: 3rem; transition: left .8s cubic-bezier(.5, 1.6, .6, 1); margin-left: 2%; }
.g-mover.no-flip { transform: translateY(-50%); }
.g-mover.hop { animation: gHop .6s ease-out; }
.g-mover.no-flip.hop { animation: gHopN .6s ease-out; }
.g-mover.shake { animation: gShake .4s; }
@keyframes gHop { 40% { transform: translateY(-110%) scaleX(-1) rotate(-12deg); } }
@keyframes gHopN { 40% { transform: translateY(-110%) rotate(-12deg); } }
@keyframes gShake { 25% { transform: translate(-6px, -50%) scaleX(-1); } 75% { transform: translate(6px, -50%) scaleX(-1); } }

.g-stage { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; min-height: 52vh; }
.g-num { margin: 0; color: var(--muted); font-weight: 600; }
.g-prompt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.g-prompt .btn-listen { position: absolute; top: 0; right: 0; }
.g-op { font-size: clamp(2.6rem, 8vw, 4rem); font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.g-story { font-size: clamp(1.3rem, 3.5vw, 1.8rem); line-height: 1.5; max-width: 640px; }
.g-count { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.3; max-width: 520px; word-break: break-all; }
.g-emoji { font-size: 4.6rem; line-height: 1; animation: gBounce 3s ease-in-out infinite; }
.g-ask { margin: 0; font-size: clamp(1.25rem, 3.4vw, 1.7rem); font-weight: 600; }
.g-ask small { font-weight: 400; color: var(--muted); font-size: .8em; }
.g-big { font-size: 2.2em; color: var(--gc); }
.g-sentence { margin: 0; font-size: clamp(1.5rem, 4.2vw, 2.2rem); font-family: 'Andika', var(--font); }
.g-blank { display: inline-block; min-width: 3em; border-bottom: 4px solid var(--gc); color: transparent; }
.g-hint { margin: 0; color: var(--muted); font-size: 1.1rem; }
.g-flag-big { width: 180px; }
.g-flag-big .geo-flag, .g-choice .geo-flag { width: 100%; display: block; border-radius: 6px; }

.g-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(640px, 100%); }
.g-choices.big { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-choices.flags { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.g-choice {
  min-height: 74px; padding: 10px 14px; border-radius: 22px; border: 4px solid color-mix(in srgb, var(--gc) 30%, white); background: #fff;
  font-family: inherit; font-size: clamp(1.2rem, 3.2vw, 1.6rem); font-weight: 600; color: var(--ink); cursor: pointer;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--gc) 30%, white); transition: transform .1s;
}
.g-choices.big .g-choice { font-size: 2.4rem; min-height: 96px; }
.g-choice:active { transform: translateY(4px); box-shadow: none; }
.g-choice.ok { background: #dcfce7; border-color: #22c55e; animation: gPop .4s; }
.g-choice.ko { background: #fee2e2; border-color: #ef4444; opacity: .6; animation: gShakeX .35s; }
.g-choice.reveal { background: #dcfce7; border-color: #22c55e; }
.g-msg { margin: 0; min-height: 1.6em; font-size: 1.35rem; font-weight: 600; }
@keyframes gPop { 50% { transform: scale(1.08); } }
@keyframes gShakeX { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Cartes ---------- */
.g-map { width: min(640px, 100%); }
.g-map .geo-france { width: auto; max-width: 100%; height: min(42vh, 380px); margin: 0 auto; }
.g-map .geo-world { max-height: 46vh; }
.geo-map { width: 100%; height: auto; display: block; }
.geo-shape { transition: filter .2s, opacity .2s; }
.g-map.tap .geo-shape { cursor: pointer; }
.g-map.tap .geo-shape:hover { filter: brightness(1.1); }
.geo-shape.ok { filter: drop-shadow(0 0 4px #22c55e) brightness(1.15); }
.geo-shape.ko { opacity: .35; }
.geo-shape.reveal { filter: drop-shadow(0 0 5px #22c55e); animation: gPulse 1s ease-in-out infinite; }
.geo-pulse { animation: gPulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.geo-hl-line { animation: gPulseOp 1.2s ease-in-out infinite; }
.geo-ocean { font-size: 7px; fill: #3a6fa8; font-style: italic; font-family: var(--font); }
.geo-label { font-size: 13px; fill: var(--ink); font-family: var(--font); font-weight: 600; }
@keyframes gPulse { 50% { transform: scale(1.25); opacity: .6; } }
@keyframes gPulseOp { 50% { opacity: .45; } }

/* ---------- Fin de partie ---------- */
.g-end { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.g-end h2 { margin: 0; font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
.g-end-scene { font-size: 5rem; animation: gBounce 1.4s ease-in-out infinite; }
.g-stars { font-size: 3.4rem; display: flex; gap: 8px; }
.g-stars span { filter: grayscale(1) opacity(.3); transition: filter .3s; }
.g-stars span.on { filter: none; animation: gPop .6s; }
.g-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ---------- Espace parent : classe ---------- */
.kid-level { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.kid-level select { min-width: 170px; }

@media (max-width: 700px) {
  .g-choices.big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-mover { font-size: 2.4rem; }
  .g-goal { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { .g-card-icon, .g-emoji, .g-goal, .g-end-scene { animation: none; } }

/* ---------- 3.17 : « Relie les images » (maternelle) ---------- */
.g-relier { display: flex; justify-content: center; gap: clamp(24px, 12vw, 120px); margin: 12px 0; }
.gr-col { display: flex; flex-direction: column; gap: 12px; }
.gr-item, .gr-word { min-width: 92px; min-height: 76px; border: 4px solid var(--line, #e4e0f5); border-radius: 20px; background: #fff; font-family: inherit; cursor: pointer; box-shadow: 0 4px 0 rgba(42, 35, 80, .1); }
.gr-item { font-size: 2.6rem; }
.gr-word { font-size: 1.6rem; font-weight: 700; padding: 0 18px; }
.gr-item.sel { border-color: var(--gc, #8b5cf6); transform: scale(1.06); background: #f4efff; }
.gr-item.ok, .gr-word.ok { border-color: #22c55e; background: #e9fbe9; cursor: default; }
.gr-word.ko { border-color: #ef4444; animation: shake .4s; }
.g-hint { text-align: center; color: var(--muted); margin: 0 0 6px; font-size: 1.1rem; }

/* ---------- 3.17 : mémoire contre l'ordinateur ---------- */
.mem-level { text-align: center; margin: 4px 0; }
.mem-msg { text-align: center; font-size: 1.3rem; min-height: 1.8em; margin: 6px 0 10px; }
.mem-grid { width: min(100%, 720px); box-sizing: border-box; align-self: center; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: clamp(6px, 1.5vw, 12px); max-width: 720px; margin: 0 auto; padding: 0 8px; }
.mem-card { position: relative; aspect-ratio: 1; width: 100%; min-height: 64px; border: 0; border-radius: 16px; background: #7c4dff; color: #fff; font-family: inherit; cursor: pointer; perspective: 600px; box-shadow: 0 4px 0 rgba(42, 35, 80, .18); padding: 0; }
.mem-card .mc-face, .mem-card .mc-back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; backface-visibility: hidden; transition: transform .35s; }
.mem-card .mc-back { font-size: clamp(1.4rem, 5vw, 2.4rem); background: linear-gradient(135deg, #7c4dff, #b388ff); }
.mem-card .mc-face { font-size: clamp(1.8rem, 7vw, 3.2rem); background: #fff; transform: rotateY(180deg); border: 3px solid #ddd; }
.mem-card.up .mc-back { transform: rotateY(180deg); }
.mem-card.up .mc-face { transform: rotateY(0); }
.mem-card.matched .mc-face { border-color: #22c55e; background: #e9fbe9; }
.mem-card:disabled { opacity: .85; cursor: default; }
@media (prefers-reduced-motion: reduce) { .mem-card .mc-face, .mem-card .mc-back { transition: none; } }
.mem-play { width: 100%; box-sizing: border-box; }
