/* ============================================================
   THÈME « CLAIR » COMMUN AUX JEUX
   Utilisé par : quiz.html, chemin.html, reflexe.html, bataille.html, memory.html, camion.html, domino.html, course.html, meteorites.html, tapis-roulant.html, bataille-navale.html, haricot-magique.html, tirs-au-but-table-11.html, defi-du-jour.html
   — et la page d'accueil index.html (couleurs, menu du site, boutons).
   Chaque jeu ajoute ensuite ses propres styles dans sa page.
   ============================================================ */
:root {
    --bg: #F1F4F9;
    --surface: #FFFFFF;
    --line: #DFE5EE;
    --key-line: #D5DDE9;
    --ink: #14213D;
    --muted: #4A5A78;
    --accent: #2558C9;
    --accent-dark: #1A3F94;
    --accent-soft: #EDF2FD;
    --track: #E3E9F2;
    --score-bg: #FFF1E8;
    --score-ink: #A3410F;
    --ok-bg: #E3F5EA;
    --ok-ink: #17643A;
    --bad-bg: #FDECEC;
    --bad-ink: #A61B1B;
    --shadow-card: 0 24px 48px rgba(20, 33, 61, 0.08), 0 2px 6px rgba(20, 33, 61, 0.06);
}
/* Mode « tables d'addition » : couleur principale turquoise */
html.mode-addition {
    --accent: #0F766E;
    --accent-dark: #0B5A54;
    --accent-soft: #E6F4F2;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0; padding: 0; width: 100%;
    font-family: 'Lexend', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
}
body {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------
   Navigation du site
   ------------------------------------------------------------ */
.site-nav-game {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0 20px;
}
.nav-game-inner {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    white-space: nowrap; padding: 8px 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.nav-game-inner::-webkit-scrollbar { display: none; }
.nav-game-inner a {
    color: var(--muted); text-decoration: none;
    padding: 8px 14px; border-radius: 10px; font-size: 0.9rem; line-height: 1.65;   /* interligne fixé : même hauteur de menu sur toutes les pages */
    font-weight: 500; transition: background 0.2s ease, color 0.2s ease; flex-shrink: 0;
}
.nav-game-inner a:hover { background: var(--bg); color: var(--ink); }
/* Icônes dessinées du menu (bande du haut et menu plein écran) : elles prennent la couleur du lien */
.nav-game-inner a, .nav-mobile-overlay a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.nav-ic { width: 18px; height: 18px; flex-shrink: 0; }
.nav-mobile-overlay .nav-ic { width: 20px; height: 20px; }
.nav-game-inner a.nav-active { background: var(--accent-soft); color: var(--accent); }

/* Menu mobile */
.nav-hamburger {
    display: none; position: relative; z-index: 2100; flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--bg); border: none;
    cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav-hamburger span {
    display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
.nav-mobile-overlay {
    display: none; position: fixed; inset: 0; z-index: 2050;
    background: rgba(241, 244, 249, 0.96);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.nav-mobile-overlay.open { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.nav-mobile-overlay a {
    color: var(--ink); text-decoration: none; font-size: 1.1rem; font-weight: 600;
    padding: 14px 40px; border-radius: 14px; background: var(--surface);
    border: 1px solid var(--line); min-width: 220px; text-align: center;
}
.nav-mobile-overlay a:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------
   Barre du jeu : accueil, titre, progression, score
   ------------------------------------------------------------ */
.game { flex: 1; display: flex; flex-direction: column; }
.game-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 14px 32px;
    display: flex; align-items: center; gap: 16px;
}
.game-home, .icon-btn {
    width: 46px; height: 46px; flex-shrink: 0;
    border: none; border-radius: 14px; background: var(--bg); color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 700; cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.game-home:hover, .icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.game-title { margin: 0; font-size: 1.3rem; font-weight: 700; flex-shrink: 0; }
.game-progress {
    flex: 1; max-width: 420px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 6px;
}
.game-progress-label { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.game-progress-track { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.game-progress-fill {
    height: 100%; width: 0; border-radius: 5px;
    background: var(--accent); transition: width 0.4s ease;
}
.game-score {
    padding: 10px 18px; flex-shrink: 0;
    background: var(--score-bg); color: var(--score-ink);
    border-radius: 999px; font-weight: 700; font-size: 1.1rem;
    display: flex; align-items: center; gap: 8px;
}
.game-score .score-total { font-weight: 500; }
.game-score.pop { animation: scorePop 0.4s ease; }
@keyframes scorePop {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* ------------------------------------------------------------
   Zone de jeu : la question à gauche, l'action à droite
   (en dessous sur tablette et téléphone, voir plus bas)
   ------------------------------------------------------------ */
.game-play {
    flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 56px;
    padding: 40px 48px;
}
.game-stage {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.q-card {
    width: 100%;
    background: var(--surface); border-radius: 28px;
    box-shadow: var(--shadow-card);
    padding: 48px 32px;
    display: flex; align-items: center; justify-content: center; gap: 0.25em;
    font-weight: 700; line-height: 1.1;
}

/* Case réponse (jeux avec pavé numérique) */
.q-answer {
    min-width: 1.9em; padding: 0 0.2em;
    text-align: center; font-size: 0.82em;
    background: var(--accent-soft); color: var(--accent);
    border: 3px solid var(--accent); border-radius: 22px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.q-answer.empty { color: #9AA8C2; }
.q-answer.correct { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.q-answer.wrong { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-ink); }
.shake { animation: shake 0.4s ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* Message sous la question : hauteur fixe pour que rien ne bouge quand il apparaît */
.feedback-row {
    height: 56px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; gap: 12px;
}
.feedback {
    display: none; align-items: center; gap: 10px;
    padding: 12px 22px; border-radius: 999px;
    font-weight: 600; font-size: 1.15rem; text-align: center;
    animation: feedbackIn 0.25s ease;
}
.feedback.ok { display: inline-flex; background: var(--ok-bg); color: var(--ok-ink); }
.feedback.bad { display: inline-flex; background: var(--bad-bg); color: var(--bad-ink); }
.feedback.info { display: inline-flex; color: var(--muted); font-weight: 500; font-size: 1rem; animation: none; }
.feedback svg { display: none; flex-shrink: 0; }
.feedback.ok .ic-ok, .feedback.bad .ic-bad { display: block; }
@keyframes feedbackIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   Dos de carte (Bataille, Memory) : rayures + losange par défaut.
   L'élément doit être positionné (absolute ou relative) par la page.
   Les autres dos au choix sont des jeux de variables --dos-*, posés par une classe
   dos-… sur <html> (le choix du joueur) ou sur une vignette de la fenêtre de choix.
   ------------------------------------------------------------ */
.card-back {
    background: var(--dos-fond, repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 8px, transparent 8px 16px) var(--accent));
    border: 5px solid #FFFFFF;
    box-shadow: 0 6px 16px rgba(20, 33, 61, 0.18), 0 0 0 1px var(--key-line);
}
.card-back::before, .card-back::after {
    content: ''; position: absolute; left: 50%; top: 50%;
}
.card-back::before {
    display: var(--dos-cadre, block);
    width: 34%; aspect-ratio: 1; border-radius: 12%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    transform: translate(-50%, -50%) rotate(45deg);
}
.card-back::after {
    width: var(--dos-motif-w, 16%);
    aspect-ratio: var(--dos-motif-ratio, 1);
    border-radius: var(--dos-motif-r, 12%);
    background: var(--dos-motif, rgba(255, 255, 255, 0.85));
    transform: translate(-50%, -50%) rotate(var(--dos-motif-rot, 45deg));
}
/* 1. Losange : le dos d'origine (valeurs par défaut ci-dessus) */
.dos-losange {
    --dos-fond: initial; --dos-cadre: initial; --dos-motif: initial;
    --dos-motif-w: initial; --dos-motif-ratio: initial; --dos-motif-r: initial; --dos-motif-rot: initial;
}
/* 2. Mascotte (logo Kyu Games) : vert doux sur fond menthe à petits points */
.dos-mascotte {
    --dos-fond: radial-gradient(circle, #C9EBD5 1.6px, transparent 2.2px) 0 0 / 14px 14px, #E8F6ED;
    --dos-cadre: none;
    --dos-motif: url("../img/mascotte-dos.svg") center / contain no-repeat;
    --dos-motif-w: 60%; --dos-motif-ratio: 335 / 422; --dos-motif-r: 0; --dos-motif-rot: 0deg;
}
/* 3. Étoiles : bleu nuit à petites étoiles jaunes */
.dos-etoiles {
    --dos-fond: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cg fill='%23FFD45C'%3E%3Cpath d='M8 3.5l1.3 2.7 3 .4-2.2 2 .6 2.9L8 10l-2.7 1.5.6-2.9-2.2-2 3-.4z' opacity='.85'/%3E%3Ccircle cx='30' cy='11' r='1.2' opacity='.7'/%3E%3Ccircle cx='18' cy='31' r='1' opacity='.6'/%3E%3Cpath d='M32 24l1 2 2.2.3-1.6 1.5.4 2.2-2-1.1-2 1.1.4-2.2-1.6-1.5 2.2-.3z' opacity='.75'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 40px 40px, linear-gradient(160deg, #2E3F8F, #1A2456);
    --dos-cadre: none; --dos-motif: none;
}
/* 4. Pois : pêche à pois blancs */
.dos-pois {
    --dos-fond: radial-gradient(circle, rgba(255, 255, 255, 0.55) 2.6px, transparent 3.2px) 0 0 / 16px 16px,
                radial-gradient(circle, rgba(255, 255, 255, 0.55) 2.6px, transparent 3.2px) 8px 8px / 16px 16px, #F4A27E;
    --dos-cadre: none; --dos-motif: none;
}

/* Fenêtre « Choisis tes cartes » (Bataille, Memory) : 4 vignettes de deux cartes en éventail */
.pick-card { max-width: 520px; padding: 36px 32px 32px; }
.back-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.back-opt {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 8px 8px 12px; border-radius: 20px; cursor: pointer;
    background: var(--surface); border: 2px solid var(--line);
    font: inherit; font-weight: 600; font-size: 1rem; color: var(--ink);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.back-opt:hover { border-color: var(--accent); }
.back-opt:active { transform: scale(0.97); }
.back-opt[aria-checked="true"] {
    border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.back-opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.back-table {
    position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 14px;
    background: var(--bg); border: 1px solid var(--line);
}
.back-table .card-back {
    position: absolute; border-width: 4px;
    box-shadow: 0 4px 10px rgba(20, 33, 61, 0.16), 0 0 0 1px var(--key-line);
    transition: transform 0.25s ease;
}
/* cartes de Bataille : rectangulaires */
.back-table.portrait .card-back { width: 38%; height: 74%; top: 13%; border-radius: 12px; }
.back-table.portrait .c1 { left: 16%; transform: rotate(-8deg); }
.back-table.portrait .c2 { left: 45%; transform: rotate(7deg); }
/* cartes de Memory : carrées */
.back-table.carre .card-back { width: 40%; aspect-ratio: 1; border-radius: 16%; }
.back-table.carre .c1 { left: 14%; top: 17%; transform: rotate(-8deg); }
.back-table.carre .c2 { left: 46%; top: 25%; transform: rotate(7deg); }
.back-opt[aria-checked="true"] .c1 { transform: rotate(-12deg) translate(-4%, -3%); }
.back-opt[aria-checked="true"] .c2 { transform: rotate(10deg) translate(4%, -3%); }
.back-check {
    position: absolute; top: 14px; right: 14px; z-index: 1;
    width: 26px; height: 26px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
    background: var(--accent); color: #FFFFFF; box-shadow: 0 0 0 2px #FFFFFF;
}
.back-opt[aria-checked="true"] .back-check { display: flex; }
@media (max-width: 600px) {
    .pick-card { padding: 24px 16px 20px; }
    .pick-card .result-title { font-size: 1.5rem; }
    .back-grid { gap: 10px; }
    .back-opt { padding: 6px 6px 10px; gap: 6px; border-radius: 18px; }
    .back-check { top: 10px; right: 10px; width: 22px; height: 22px; }
    .back-table .card-back { border-width: 3px; }
}
/* Téléphone en paysage : les 4 choix sur une ligne */
@media (orientation: landscape) and (max-height: 540px) {
    .pick-card { max-width: 640px; padding: 16px 24px; gap: 6px; }
    .pick-card .result-label { display: none; }
    .pick-card .result-title { font-size: 1.3rem; }
    .back-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 4px; }
    .back-opt { padding: 5px 5px 8px; gap: 4px; font-size: 0.9rem; }
    .back-table .card-back { border-width: 3px; }
    .pick-card .result-actions { margin-top: 6px; }
}

/* ------------------------------------------------------------
   Boutons
   ------------------------------------------------------------ */
.btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 12px 28px; border-radius: 16px;
    font-size: 1.1rem; font-weight: 600; text-decoration: none; cursor: pointer;
    white-space: nowrap; touch-action: manipulation;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-primary {
    background: var(--accent); color: #FFFFFF;
    border: 1px solid var(--accent-dark); box-shadow: 0 3px 0 var(--accent-dark);
}
.btn-secondary {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--key-line); box-shadow: 0 3px 0 var(--key-line);
}
.btn-primary:active, .btn-secondary:active { transform: translateY(3px); box-shadow: none; }

/* ------------------------------------------------------------
   Pavé numérique
   ------------------------------------------------------------ */
.keypad-wrap { flex-shrink: 0; display: flex; justify-content: center; }
.keypad {
    width: 330px;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.key {
    height: 76px; border-radius: 18px;
    border: 1px solid var(--key-line); box-shadow: 0 3px 0 var(--key-line);
    background: var(--surface); color: var(--ink);
    font-weight: 600; font-size: 1.9rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.key:active, .key.pressed { transform: translateY(3px); box-shadow: 0 0 0 var(--key-line); }
.key-del { background: var(--bg); color: var(--muted); }
.key-ok { background: var(--accent); color: #FFFFFF; border-color: var(--accent-dark); box-shadow: 0 3px 0 var(--accent-dark); }
.key-ok:active, .key-ok.pressed { box-shadow: 0 0 0 var(--accent-dark); }
.key:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible,
.game-home:focus-visible, .icon-btn:focus-visible {
    outline: 3px solid var(--accent); outline-offset: 3px;
}

/* Bouton son de la barre du jeu (ajouté par Sons.bouton() de js/jeux.js) : haut-parleur, barré quand le son est coupé */
.sound-btn .ic-off { display: none; }
.sound-btn[aria-pressed="false"] .ic-on { display: none; }
.sound-btn[aria-pressed="false"] .ic-off { display: block; }
.sound-btn[aria-pressed="false"] { color: var(--muted); }

/* ------------------------------------------------------------
   Écran de fin et fenêtres (règles, victoire)
   ------------------------------------------------------------ */
.result {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
}
.result-card {
    width: 100%; max-width: 480px;
    background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-card);
    padding: 48px 40px; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.result-label {
    font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted);
}
.result-score { margin: 0; font-size: 5rem; font-weight: 700; line-height: 1; color: var(--accent); }
.result-title { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.2; }
.result-msg { margin: 0; font-size: 1.25rem; font-weight: 600; }
.result-text { margin: 0; font-size: 1.05rem; line-height: 1.6; color: var(--muted); }
.result-actions { width: 100%; margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
/* Pastille « record » (Réflexe, Memory) */
.record {
    margin: 0; display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 999px;
    background: var(--score-bg); color: var(--score-ink); font-weight: 600;
}

.game-modal {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(20, 33, 61, 0.3);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; overflow-y: auto;
    animation: modalIn 0.25s ease;
}
/* margin: auto centre la carte tout en la laissant défiler si elle est plus haute que l'écran */
.game-modal .result-card { margin: auto; animation: modalCardIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.confetti {
    position: fixed; top: 0; pointer-events: none;
    width: 10px; height: 10px; border-radius: 3px;
    animation: confetti-fall linear forwards; z-index: 9000;
}
@keyframes confetti-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============================================================
   TABLETTE (portrait) ET PETITS ÉCRANS : l'action passe en bas
   ============================================================ */
@media (max-width: 1023px) {
    .game-play { flex-direction: column; align-items: stretch; gap: 0; padding: 0; max-width: none; }
    .game-stage { flex: 1; justify-content: center; padding: 32px 48px; gap: 20px; }
    .keypad-wrap {
        background: var(--surface); border-top: 1px solid var(--line);
        padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
    }
    .keypad { width: 100%; max-width: 440px; gap: 14px; }
    .key { height: 84px; font-size: 2rem; border-radius: 20px; }
}

/* Menu du site replié : téléphones et écrans peu hauts */
@media (max-width: 700px), (max-height: 540px) {
    .site-nav-game { display: none; }
    .nav-hamburger { display: flex; }
}
@media (min-width: 701px) and (min-height: 541px) {
    body:not(:has(.game-bar)) .nav-mobile-overlay { display: none !important; }
}
/* Pages de jeux : pas de bande de menu en haut (place gagnée pour le jeu),
   le menu du site s'ouvre avec le bouton ☰ de la barre du jeu, à toutes les tailles */
body:has(.game-bar) .site-nav-game { display: none; }
body:has(.game-bar) .nav-hamburger { display: flex; }

/* ============================================================
   TÉLÉPHONE (portrait)
   ============================================================ */
@media (max-width: 600px) {
    .game-bar { padding: 12px 16px; gap: 12px; }
    .game-home, .icon-btn { width: 44px; height: 44px; border-radius: 12px; }
    .game-title {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
    }
    .game-progress { gap: 5px; }
    .game-progress-label { font-size: 0.75rem; }
    .game-progress-track { height: 8px; }
    .game-score { padding: 8px 12px; font-size: 0.95rem; gap: 6px; }

    .game-stage { padding: 20px 16px; gap: 14px; }
    .q-card { padding: 28px 16px; border-radius: 24px; }
    .q-answer { min-width: 2.4em; padding: 4px 16px; font-size: 0.88em; border-radius: 18px; }
    .feedback-row { height: 48px; gap: 10px; }
    .feedback { padding: 10px 18px; font-size: 1rem; }
    .feedback.info { font-size: 0.9rem; }
    .btn-primary, .btn-secondary { min-height: 48px; padding: 10px 22px; font-size: 1rem; }

    .keypad-wrap { padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); }
    .keypad { gap: 10px; }
    .key { height: 60px; font-size: 1.6rem; border-radius: 16px; }

    .result-card { padding: 36px 24px; }
    .result-score { font-size: 4rem; }
    .result-title { font-size: 1.6rem; }
}
/* Petits téléphones (ex. iPhone SE) */
@media (max-width: 600px) and (max-height: 700px) {
    .game-stage { padding: 12px 16px; gap: 10px; }
    .keypad { gap: 8px; }
    .key { height: 48px; font-size: 1.4rem; }
}
/* Très petits téléphones (≤ 360 px) : la barre a un bouton de plus (son), on la resserre un peu */
@media (max-width: 360px) {
    .game-bar { padding: 10px 12px; gap: 8px; }
    .game-home, .icon-btn, .nav-hamburger { width: 40px; height: 40px; }
    .game-score { padding: 8px 10px; }
}

/* ============================================================
   TÉLÉPHONE EN PAYSAGE : tout sur une ligne, en compact
   ============================================================ */
@media (orientation: landscape) and (max-height: 540px) {
    .game-bar { padding: 8px 16px; }
    .game-play { flex-direction: row; align-items: center; gap: 20px; padding: 12px 20px; }
    .game-stage { padding: 0; gap: 10px; }
    .feedback-row { height: 52px; flex-direction: row; justify-content: center; }
    .keypad-wrap { background: none; border: 0; padding: 0; }
    .keypad { width: 250px; gap: 8px; }
    .key { height: 50px; font-size: 1.4rem; border-radius: 14px; }
    .result-card { padding: 20px 28px; gap: 8px; }
    .result-score { font-size: 3rem; }
    .result-title { font-size: 1.5rem; }
    .result-actions { margin-top: 8px; gap: 8px; }
    .btn-primary, .btn-secondary { min-height: 44px; padding: 8px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
