[hidden] { display: none !important; }
:root {
  --fond: #f4f1ea; --carte: #ffffff; --texte: #23302e; --doux: #77817f; --ligne: #e3ddd2;
  --accent: #2f6f6a; --accent-c: #d9ebe8; --chaud: #e07a4f; --chaud-c: #fbe4d9; --or: #e9b949; --vert: #4f9a5e; --rouge: #c8463d;
  --rayon: 14px; --ombre: 0 1px 3px rgba(30, 40, 35, .08), 0 4px 14px rgba(30, 40, 35, .05);
  --case-a: #efe5d2; --case-b: #b98f62; --tapis: #2e6b4f;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #161b1a; --carte: #222927; --texte: #e9eeec; --doux: #9aa6a3; --ligne: #34403d; --accent: #5fb3aa; --accent-c: #1f3a37; --chaud-c: #4a2c20; --ombre: none;
    --case-a: #cdbb98; --case-b: #8a6440; --tapis: #1f4a37; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
body.avec-pause { padding-top: 46px; }
#app { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }
h1 { font-size: 1.5rem; margin: 0; } h2 { font-size: 1.1rem; margin: 22px 0 10px; }
.doux { color: var(--doux); } .petit { font-size: .85rem; } .centre { text-align: center; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--ligne); border-radius: 10px; padding: 10px; }
.btn { border: 1px solid var(--ligne); background: var(--carte); border-radius: 999px; padding: 8px 16px; box-shadow: var(--ombre); }
.btn.plein { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.chaud { background: var(--chaud); color: #fff; border-color: var(--chaud); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.petit { padding: 5px 12px; font-size: .85rem; }

.entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 8px; }
.entete .moi { display: flex; gap: 8px; align-items: center; }
.recherche { width: 100%; margin: 6px 0 10px; }
.puces { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.puces button { border: 1px solid var(--ligne); background: var(--carte); border-radius: 999px; padding: 6px 13px; white-space: nowrap; font-size: .9rem; }
.puces button.actif { background: var(--accent); color: #fff; border-color: var(--accent); }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tuile { position: relative; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 12px 12px; text-align: left; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.tuile:hover { border-color: var(--accent); }
.tuile .ico { font-size: 2rem; line-height: 1.1; }
.tuile b { font-size: 1rem; } .tuile span { font-size: .8rem; color: var(--doux); }
.tuile .etoile { position: absolute; top: 6px; right: 6px; border: 0; background: none; font-size: 1.15rem; padding: 4px; color: var(--doux); }
.tuile .etoile.on { color: var(--or); }
.tuile .rec { margin-top: auto; font-size: .75rem; color: var(--accent); }

.barre-jeu { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 0 6px; }
.barre-jeu h1 { font-size: 1.25rem; flex: 1; }
.retour { border: 0; background: var(--carte); border-radius: 50%; width: 40px; height: 40px; font-size: 1.2rem; box-shadow: var(--ombre); }
.outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.niveaux { display: inline-flex; background: var(--carte); border: 1px solid var(--ligne); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.niveaux button { border: 0; background: none; border-radius: 999px; padding: 5px 12px; font-size: .88rem; }
.niveaux button.actif { background: var(--accent); color: #fff; }
.statut { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; min-height: 28px; font-variant-numeric: tabular-nums; color: var(--doux); margin-bottom: 8px; }
.statut b { color: var(--texte); }
#zone { display: flex; flex-direction: column; align-items: center; gap: 12px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }

/* Bandeau de pause (appli de concentration) */
.pause { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; gap: 12px; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; font-size: .95rem; min-height: 46px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.pause.alerte { background: var(--chaud); }
.pause b { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.pause button { border: 1px solid rgba(255,255,255,.6); background: transparent; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: .85rem; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 20, 19, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.boite { background: var(--carte); border-radius: 18px; padding: 22px; max-width: 440px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.boite h2 { margin-top: 0; }
.boite .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.gros { font-size: 2.6rem; text-align: center; margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: 10px 18px; border-radius: 999px; z-index: 60; font-size: .92rem; max-width: 92vw; text-align: center; }
table.classe { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.classe td { padding: 6px 4px; border-bottom: 1px solid var(--ligne); }
table.classe tr.moi td { font-weight: 700; color: var(--accent); }
.login { max-width: 420px; margin: 12vh auto 0; text-align: center; background: var(--carte); padding: 30px 22px; border-radius: 20px; box-shadow: var(--ombre); }
.login .gros { font-size: 3.4rem; }
#gbtn { display: flex; justify-content: center; margin-top: 18px; min-height: 44px; }

/* Éléments communs aux jeux */
.plateau { display: grid; gap: 0; background: var(--ligne); border-radius: 8px; overflow: hidden; box-shadow: var(--ombre); touch-action: manipulation; }
.case { display: flex; align-items: center; justify-content: center; background: var(--carte); border: 0; padding: 0; font-weight: 600; }
.clavier { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; max-width: 520px; }
.clavier div { display: flex; gap: 5px; justify-content: center; width: 100%; }
.clavier button { flex: 1; max-width: 44px; height: 48px; border: 0; border-radius: 8px; background: var(--carte); box-shadow: var(--ombre); font-weight: 700; text-transform: uppercase; padding: 0; }
.clavier button.large { max-width: 72px; flex: 1.6; font-size: .8rem; }
.clavier button.bon { background: var(--vert); color: #fff; } .clavier button.place { background: var(--or); color: #222; } .clavier button.non { background: var(--ligne); color: var(--doux); }
.carte-jeu { position: absolute; border-radius: 7px; background: #fff; border: 1px solid #bbb; color: #111; box-shadow: 0 1px 2px rgba(0,0,0,.25); font-weight: 700; overflow: hidden; cursor: pointer; }
.carte-jeu.rouge { color: #c62828; }
.carte-jeu .c1 { position: absolute; top: 2px; left: 4px; line-height: 1; text-align: center; }
.carte-jeu .c2 { position: absolute; bottom: 2px; right: 4px; line-height: 1; transform: rotate(180deg); text-align: center; }
.carte-jeu .cm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .9; }
.carte-jeu.dos { background: repeating-linear-gradient(45deg, #2f6f6a 0 6px, #3b827c 6px 12px); border-color: #fff; }
.carte-jeu.choisie { outline: 3px solid var(--or); outline-offset: -1px; }
.emplacement { position: absolute; border-radius: 7px; border: 2px dashed rgba(255,255,255,.35); color: rgba(255,255,255,.5); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.tapis { position: relative; background: var(--tapis); border-radius: 12px; width: 100%; touch-action: manipulation; }
.aide { color: var(--doux); font-size: .88rem; text-align: center; max-width: 560px; }
canvas.jeu { background: var(--carte); border-radius: 12px; box-shadow: var(--ombre); touch-action: none; max-width: 100%; }
.pad { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; }
.pad button { height: 50px; border: 0; border-radius: 10px; background: var(--carte); box-shadow: var(--ombre); font-size: 1.3rem; }
@media (min-width: 700px) { .tactile-seul { display: none; } }
