/* Jeu « Le mot et l'image » — famille 3 (le sens des mots).
   Mise en page : une carte centrale par question, le mot en grand au-dessus de trois images. */
:root {
  --navy: #13233f; --teal: #0e6e6b; --gold: #d4a647; --gold-deep: #b8892b;
  --bg: #eef3f2; --card: #ffffff; --panel: #f5f8f7; --ink: #14202e; --muted: #566572; --line: #d6dfde;
  --good: #1e8a4c; --good-soft: #def3e6; --bad: #c0392b; --bad-soft: #fbe3df;
  --font-display: "Young Serif", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1524; --card: #142038; --ink: #e7edf0; --muted: #9eaebb; --line: #26375a;
          --good-soft: #143a27; --bad-soft: #3d1c1a; --teal: #45b3ab; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 var(--font-body); min-height: 100vh; }
.topbar { background: var(--navy); color: #eef3f4; }
.topbar-inner { max-width: 820px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar a { color: #b4c2cc; text-decoration: none; font-size: .9rem; }
.topbar .title { font-family: var(--font-display); font-size: 1.1rem; }
.topbar .title span { font-family: var(--font-ar); color: var(--gold); margin-inline-start: 8px; }
main { max-width: 820px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left)) 48px; }
.card { background: var(--card); border-radius: 18px; padding: 28px; box-shadow: 0 2px 0 var(--line); }
h1, h2 { font-family: var(--font-display); font-weight: 400; margin: 0 0 10px; line-height: 1.2; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 14px 26px; font: 700 1.05rem var(--font-body); cursor: pointer; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-deep); }
.btn-soft { background: transparent; color: var(--teal); border: 2px solid var(--teal); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Accueil */
.intro { text-align: center; display: grid; gap: 14px; justify-items: center; }
.intro .big-ar { font-family: var(--font-ar); font-size: 2.6rem; color: var(--teal); line-height: 1.4; }
.intro p { color: var(--muted); max-width: 32em; margin: 0; }
.rules { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: .95rem; margin: 6px 0 10px; }
.rules b { color: var(--ink); }

/* Progression */
.progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.progress-label { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.current { background: var(--gold); transform: scale(1.15); }
.dot.ok { background: var(--good); }
.dot.ko { background: var(--bad); }

/* Question */
.prompt { text-align: center; margin-bottom: 22px; }
.prompt .ask { color: var(--muted); margin-bottom: 4px; }
.word { font-family: var(--font-ar); font-size: clamp(3rem, 11vw, 4.6rem); line-height: 1.5; color: var(--ink); display: inline-block; }
.listen { margin-top: 4px; background: var(--panel); color: var(--teal); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: 600 .9rem var(--font-body); cursor: pointer; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.choice { background: #f5f8f7; border: 3px solid var(--line); border-radius: 16px; padding: 10px; cursor: pointer; aspect-ratio: 1; display: grid; place-items: center; transition: transform .12s ease, border-color .12s ease; }
.choice:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); }
.choice:disabled { cursor: default; }
.choice svg { width: 100%; height: 100%; }
.choice.is-good { border-color: var(--good); background: #e4f5ea; }
.choice.is-bad { border-color: var(--bad); background: #fbe7e4; }
.choice.is-dim { opacity: .45; }

/* Retour après réponse */
.feedback { margin-top: 20px; border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.feedback.good { background: var(--good-soft); }
.feedback.bad { background: var(--bad-soft); }
.fb-icon { width: 54px; height: 54px; flex: none; }
.fb-text { flex: 1; min-width: 200px; }
.fb-title { font-weight: 700; font-size: 1.15rem; }
.feedback.good .fb-title { color: var(--good); }
.feedback.bad .fb-title { color: var(--bad); }
.fb-detail { color: var(--ink); }
.fb-detail .ar { font-family: var(--font-ar); font-size: 1.25rem; }

/* Résultat */
.result { text-align: center; display: grid; gap: 12px; justify-items: center; }
.score { font-family: var(--font-display); font-size: 4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { font-size: 1.6rem; color: var(--muted); }
.stars { display: flex; gap: 8px; }
.stars svg { width: 44px; height: 44px; }
.verdict { font-size: 1.2rem; font-weight: 700; }
.recap { width: 100%; max-width: 520px; list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; text-align: start; }
.recap li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; background: var(--panel); border-radius: 10px; padding: 8px 12px; }
@media (prefers-color-scheme: dark) { .recap li, .listen { background: #1b2a47; } }
.recap .ar { font-family: var(--font-ar); font-size: 1.3rem; }
.recap .fr { color: var(--muted); }
.recap svg { width: 26px; height: 26px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 520px) {
  .card { padding: 18px; }
  .choices { gap: 8px; }
  .choice { padding: 4px; border-radius: 12px; }
  .dot { width: 10px; height: 10px; }
}
@media (prefers-reduced-motion: reduce) { .choice { transition: none; } }

/* ---------- Jeu 2 « Le mot juste » ---------- */
.level-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--navy); color: #eef3f4; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: .85rem; }
.level-badge b { color: var(--gold); }
.target-img { width: min(220px, 60vw); aspect-ratio: 1; margin: 0 auto 18px; background: #f5f8f7; border: 3px solid var(--line); border-radius: 18px; padding: 12px; }
.target-img svg { width: 100%; height: 100%; }
.text-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.text-choice { font-family: var(--font-ar); font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.6; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; direction: rtl; transition: transform .12s ease, border-color .12s ease; }
.text-choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold); }
.text-choice:disabled { cursor: default; }
.text-choice.is-good { border-color: var(--good); background: var(--good-soft); }
.text-choice.is-bad { border-color: var(--bad); background: var(--bad-soft); }
.text-choice.is-dim { opacity: .45; }
.levels-recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 520px; }
.levels-recap div { background: var(--panel); border-radius: 12px; padding: 10px; text-align: center; }
@media (prefers-color-scheme: dark) { .levels-recap div { background: #1b2a47; } }
.levels-recap .lv-name { font-size: .85rem; color: var(--muted); }
.levels-recap .lv-score { font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .text-choices { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .text-choice { transition: none; } }

/* ---------- Page « Jeux et quiz » ---------- */
.games-head { margin-bottom: 20px; }
.games-head p { color: var(--muted); margin: 0; }
.games { display: grid; gap: 16px; }
.game-card { display: grid; grid-template-columns: 96px 1fr auto; gap: 18px; align-items: center; background: var(--card); border-radius: 18px; padding: 18px; box-shadow: 0 2px 0 var(--line); text-decoration: none; color: inherit; border: 2px solid transparent; }
a.game-card:hover { border-color: var(--gold); }
.game-thumb { width: 96px; height: 96px; background: #f5f8f7; border-radius: 14px; padding: 6px; }
.game-thumb svg { width: 100%; height: 100%; }
.game-card h2 { font-size: 1.3rem; margin: 0 0 4px; }
.game-card h2 span { font-family: var(--font-ar); color: var(--teal); margin-inline-start: 8px; font-size: 1.1rem; }
.game-card p { margin: 0; color: var(--muted); }
.game-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--panel); color: var(--muted); }
.tag.easy { background: var(--good-soft); color: var(--good); }
.tag.hard { background: var(--bad-soft); color: var(--bad); }
.game-go { font-weight: 700; color: var(--teal); white-space: nowrap; }
.game-card.soon { opacity: .6; }
@media (max-width: 560px) { .game-card { grid-template-columns: 64px 1fr; } .game-thumb { width: 64px; height: 64px; } .game-go { grid-column: 1 / -1; } }
