:root {
  --bg: #12101c;
  --card: rgba(255,255,255,0.05);
  --card-border: rgba(255,255,255,0.12);
  --text: #f2f0f7;
  --muted: #a5a0b8;
  --primary: #8b5cf6;
  --primary-2: #d946ef;
  --accent: var(--primary);
  --correct: #4ade80;
  --present: #f1c40f;
  --absent: #4a4b55;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* Fond anime : trois taches de couleur floues qui derivent lentement en arriere-plan, meme
   principe que Skip-Bo/Just One/Flip 7 pour garder une identite visuelle coherente entre les
   jeux. Purement decoratif (pointer-events: none), jamais au-dessus du contenu (z-index 0). */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}
.blob-1 { width: 420px; height: 420px; background: var(--primary); top: -120px; left: -100px; animation: float1 38s ease-in-out infinite; }
.blob-2 { width: 380px; height: 380px; background: var(--primary-2); bottom: -140px; right: -100px; animation: float2 44s ease-in-out infinite; }
.blob-3 { width: 300px; height: 300px; background: #6366f1; top: 40vh; left: 60vw; opacity: 0.25; animation: float1 52s ease-in-out infinite reverse; }

@keyframes float1 {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(60vw, 20vh); }
  50%  { transform: translate(30vw, 60vh); }
  75%  { transform: translate(-20vw, 30vh); }
  100% { transform: translate(0, 0); }
}
@keyframes float2 {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-50vw, -25vh); }
  50%  { transform: translate(-25vw, -55vh); }
  75%  { transform: translate(15vw, -20vh); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-blob { animation: none !important; }
}

.header, #app { position: relative; z-index: 1; }

.side-panel[hidden] { display: none; }
.side-panel {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 170px; max-height: calc(100vh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(20,18,30,0.85); backdrop-filter: blur(10px);
  border: 1px solid var(--card-border); border-radius: 12px;
  padding: 10px;
}
.side-panel-btn {
  background: rgba(255,255,255,0.06); color: var(--muted);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 5px 12px; font-size: 0.78rem; font-weight: 500; cursor: pointer;
  text-align: left;
}
.side-panel-btn-active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #10101a; border-color: transparent; font-weight: 700; }
.side-panel-seed {
  width: 100%; box-sizing: border-box; padding: 5px 10px; margin-bottom: 2px;
  border-radius: 999px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04); color: var(--text); font-size: 0.75rem;
}

/* Grands ecrans : la liste de jeux (50+) devient trop longue en une seule colonne, on passe en
   grille a 2 colonnes, puis 3 sur les tres larges ecrans. Le champ de seed reste sur toute la
   largeur en haut (voir grid-column: 1 / -1 dans app.js si besoin, mais il est deja le premier
   enfant donc on force son span ici). */
@media (min-width: 900px) {
  .side-panel { width: 320px; display: grid; grid-template-columns: repeat(2, 1fr); align-content: start; }
  .side-panel-seed { grid-column: 1 / -1; }
}
@media (min-width: 1300px) {
  .side-panel { width: 460px; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .side-panel { position: static; width: 100%; max-width: 480px; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: visible; margin: 4px 16px 0; }
}

.header {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 { font-size: 1.4rem; margin: 0; }
.streak { font-weight: 600; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

#app { width: 100%; max-width: 480px; padding: 8px 16px 40px; }
.loading, .error { color: var(--muted); text-align: center; margin-top: 40px; }
.test-banner {
  background: #4a3a12; color: #f1c40f; border-radius: 8px;
  padding: 8px 12px; font-size: 0.85rem; text-align: center; margin-bottom: 10px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.game-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.game-rules { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }

button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #10101a;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Porte de depart des jeux chronometres : la zone de jeu est floutee et inerte tant que le
   joueur n'a pas clique "Demarrer", pour ne pas lui laisser un temps d'etude gratuit avant que
   le chrono ne tourne. */
.timer-gated { position: relative; }
.timer-gated > *:not(.timer-gate-overlay) { filter: blur(10px); pointer-events: none; user-select: none; }
.timer-gate-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,8,16,0.35); border-radius: 8px;
}
.timer-gate-btn { font-size: 1.05rem; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* Motus */
.motus { display: flex; flex-direction: column; align-items: center; }
.motus-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.motus-row { display: flex; gap: 6px; }
.motus-cell {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; border-radius: 6px;
  background: transparent; border: 2px solid #33343d; text-transform: uppercase;
}
.motus-cell.correct { background: var(--correct); border-color: var(--correct); }
.motus-cell.present { background: var(--present); border-color: var(--present); color: #222; }
.motus-cell.absent { background: var(--absent); border-color: var(--absent); }
.motus-cell-input { border-color: #4a4b58; }
.motus-cell-active { border-color: var(--accent); }
.motus-msg { margin-top: 10px; margin-bottom: 14px; color: var(--muted); }
.motus-keyboard { display: flex; flex-direction: column; gap: 6px; }
.motus-keyboard-row { display: flex; gap: 5px; justify-content: center; }
.motus-key {
  /* Largeur fixe plutot que flex:1 : dans un conteneur parent centre (align-items: center),
     des enfants flex:1 sans largeur de reference explicite peuvent s'ecraser au lieu de
     garder leur taille naturelle (bug classique de calcul de flex-basis "shrink-to-fit"). */
  flex: 0 0 auto; width: 34px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: #33343d; color: var(--text);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; padding: 0;
}
.motus-key-wide { width: 56px; font-size: 0.75rem; }
.motus-key-correct { background: var(--correct); color: #0c1f12; }
.motus-key-present { background: var(--present); color: #222; }
.motus-key-absent { background: #202127; color: var(--muted); }

/* Mastermind */
.mastermind { display: flex; flex-direction: column; align-items: center; }
/* column-reverse : la 1ere ligne creee (le 1er essai) s'affiche tout en bas, comme sur un
   vrai plateau Mastermind physique ou l'on empile ses essais du bas vers le haut. */
.mm-board { display: flex; flex-direction: column-reverse; align-items: center; gap: 5px; margin-bottom: 16px; }
/* La colonne de pastilles reste l'ancre centrale de chaque ligne. Le score ⚫⚪, quand il existe,
   est positionne en dehors du flux (absolute) plutot que d'elargir la ligne : sinon une ligne
   jouee devient plus large qu'une ligne vide et sa colonne de pastilles se decale par rapport
   aux lignes pas encore jouees en dessous. */
.mm-row { position: relative; display: flex; align-items: center; }
.mm-row-pegs { display: flex; gap: 5px; }
.mm-feedback { position: absolute; left: 100%; margin-left: 12px; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.mm-picker { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.mm-peg {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #333; cursor: pointer; padding: 0;
}
.mm-slot { border: 2px dashed var(--muted); background: transparent; }
.mm-msg { color: var(--muted); }

/* Simon */
.simon { display: flex; flex-direction: column; align-items: center; }
.simon-pads {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: 220px; margin-bottom: 16px;
}
.simon-pad {
  height: 100px; border-radius: 12px; border: none; opacity: 0.55; transition: opacity 0.1s;
}
.simon-pad.active { opacity: 1; box-shadow: 0 0 20px currentColor; }
.simon-msg { color: var(--muted); margin-bottom: 12px; }

/* 7 differences */
.diff-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.diff-status { color: var(--muted); font-size: 0.9rem; margin: 0; }
.diff-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.diff-panel-wrap { display: flex; flex-direction: column; gap: 10px; }
.diff-panel {
  position: relative;
  width: 100%; aspect-ratio: 3 / 2;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
}
.diff-item {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 1.6rem; line-height: 1; pointer-events: none;
}
.diff-item-hidden { visibility: hidden; }
.diff-item-found { filter: drop-shadow(0 0 6px var(--correct)); }
.diff-ring {
  position: absolute; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--correct);
  pointer-events: none;
  animation: diff-pop 0.3s ease-out;
}
.diff-miss {
  position: absolute; transform: translate(-50%, -50%);
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--absent);
  pointer-events: none;
}
@keyframes diff-pop {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Anagramme */
.anag-game { display: flex; flex-direction: column; align-items: center; }
.anag-answer {
  min-height: 46px; display: flex; gap: 6px; margin-bottom: 16px;
  padding: 8px; border-radius: 8px; background: rgba(255,255,255,0.04);
  border: 1px dashed var(--card-border); flex-wrap: wrap; align-items: center;
}
.anag-answer-tile {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1); border-radius: 6px; font-weight: 700; text-transform: uppercase;
}
.anag-answer-placeholder { color: var(--muted); font-size: 0.85rem; }
.anag-tiles { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.anag-tile {
  width: 38px; height: 38px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #10101a;
  font-weight: 700; font-size: 1.05rem; text-transform: uppercase; cursor: pointer;
}
.anag-tile-used { opacity: 0.25; cursor: default; }
.anag-actions { display: flex; gap: 10px; margin-bottom: 10px; }
#anag-clear { background: rgba(255,255,255,0.08); color: var(--text); }
.anag-msg { color: var(--muted); text-align: center; }

/* Nombre mystere */
.nm-game { display: flex; flex-direction: column; align-items: center; }
.nm-history { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; justify-content: center; max-width: 320px; }
.nm-guess { background: rgba(255,255,255,0.06); border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; }
.nm-form { display: flex; gap: 8px; margin-bottom: 12px; }
.nm-form input { width: 120px; padding: 10px; border-radius: 8px; border: none; background: #2a2c35; color: var(--text); font-size: 1rem; text-align: center; }
.nm-msg { color: var(--muted); }

/* Reflexes */
.reaction-game { display: flex; flex-direction: column; align-items: center; }
.reaction-zone {
  width: 260px; height: 180px; border-radius: 16px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text);
  font-size: 1.1rem; font-weight: 700; cursor: pointer; margin-bottom: 14px;
}
.reaction-waiting { background: rgba(239,68,68,0.25); }
.reaction-ready { background: var(--correct); color: #0c1f12; }
.reaction-fail { background: rgba(239,68,68,0.4); }
.reaction-msg { color: var(--muted); }

/* Pendu */
.pendu-game { display: flex; flex-direction: column; align-items: center; }
.pendu-figure { font-size: 3.5rem; margin-bottom: 10px; }
.pendu-word { font-size: 1.6rem; letter-spacing: 6px; font-weight: 700; margin-bottom: 10px; }
.pendu-errors { color: var(--muted); margin-bottom: 14px; }
.pendu-keyboard { display: flex; flex-direction: column; gap: 6px; }
.pendu-keyboard-row { display: flex; gap: 5px; justify-content: center; }
.pendu-key {
  width: 32px; height: 40px; border-radius: 6px; border: none;
  background: #33343d; color: var(--text); font-weight: 600; cursor: pointer;
}
.pendu-key:disabled { cursor: default; }
.pendu-key-correct { background: var(--correct); color: #0c1f12; }
.pendu-key-wrong { background: #202127; color: var(--muted); }

/* Memoire */
.mem-game { display: flex; flex-direction: column; align-items: center; }
.mem-header { display: flex; justify-content: space-between; width: 260px; margin-bottom: 10px; }
.mem-status { color: var(--muted); font-size: 0.9rem; margin: 0; }
.mem-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 260px; }
.mem-card {
  aspect-ratio: 1; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); font-size: 1.3rem; cursor: pointer;
}
.mem-card-flipped { background: rgba(255,255,255,0.15); }
.mem-card-matched { background: rgba(74,222,128,0.2); cursor: default; }

/* Nerdle */
.nerdle-game { display: flex; flex-direction: column; align-items: center; }
.nerdle-grid { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.nerdle-row { display: flex; gap: 5px; }
.nerdle-cell {
  width: 32px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; border-radius: 6px; background: transparent; border: 2px solid #33343d;
}
.nerdle-cell.correct { background: var(--correct); border-color: var(--correct); }
.nerdle-cell.present { background: var(--present); border-color: var(--present); color: #222; }
.nerdle-cell.absent { background: var(--absent); border-color: var(--absent); }
.nerdle-cell-input { border-color: #4a4b58; }
.nerdle-cell-active { border-color: var(--accent); }
.nerdle-msg { color: var(--muted); margin-bottom: 12px; text-align: center; }
.nerdle-keyboard { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.nerdle-keyboard-row { display: flex; gap: 4px; justify-content: center; }
.nerdle-key {
  flex: 1; min-width: 0; padding: 0; max-width: 56px;
  height: 40px; border-radius: 6px; border: none; background: #33343d; color: var(--text);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
/* Rangee des operateurs separee visuellement de celle des chiffres, pour ne pas tout melanger
   dans un seul bloc de 16 touches indifferenciees. */
.nerdle-key-op { background: rgba(139,92,246,0.18); color: var(--primary); }
.nerdle-key-enter { max-width: none; flex: none; width: 100%; font-size: 0.85rem; }
.nerdle-key-correct { background: var(--correct); color: #0c1f12; }
.nerdle-key-present { background: var(--present); color: #222; }
.nerdle-key-absent { background: #202127; color: var(--muted); }

/* Binairo */
.binairo-game { display: flex; flex-direction: column; align-items: center; }
.binairo-grid { display: grid; width: 264px; height: 264px; border: 2px solid var(--text); border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.binairo-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
  color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.binairo-cell-given { background: rgba(255,255,255,0.08); color: var(--muted); cursor: default; }
.binairo-cell-correct { color: var(--correct); cursor: default; }
.binairo-cell-wrong { color: #f87171; }
.binairo-msg { color: var(--muted); text-align: center; }

/* Bataille navale */
.bn-game { display: flex; flex-direction: column; align-items: center; }
.bn-grid-wrap {
  display: grid; grid-template-columns: 26px 264px; grid-template-rows: 26px 264px;
  margin-bottom: 14px;
}
.bn-corner { grid-column: 1; grid-row: 1; }
.bn-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(6, 1fr); }
.bn-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(6, 1fr); }
.bn-clue { display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.bn-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr);
  width: 264px; height: 264px;
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
}
.bn-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02);
  font-size: 1rem; cursor: pointer; padding: 0;
}
.bn-cell-ship { background: rgba(139,92,246,0.3); }
.bn-cell-water { color: var(--muted); }
.bn-cell-correct { background: rgba(74,222,128,0.25) !important; }
.bn-cell-wrong { background: rgba(248,113,113,0.35) !important; }
.bn-msg { color: var(--muted); text-align: center; }

/* Kakuro */
.kk-game { display: flex; flex-direction: column; align-items: center; }
.kk-grid-wrap {
  display: grid; grid-template-columns: 30px 264px; grid-template-rows: 30px 264px;
  margin-bottom: 14px;
}
.kk-corner { grid-column: 1; grid-row: 1; }
.kk-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(5, 1fr); }
.kk-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(5, 1fr); }
.kk-clue { display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: var(--present); font-weight: 700; }
.kk-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
  width: 264px; height: 264px;
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
}
.kk-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
  color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.kk-cell-given { background: rgba(255,255,255,0.08); color: var(--muted); cursor: default; }
.kk-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.kk-cell-correct { color: var(--correct); cursor: default; }
.kk-cell-wrong { color: #f87171; }
.kk-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.kk-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.kk-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.kk-msg { color: var(--muted); text-align: center; }

/* Picross */
.pic-game { display: flex; flex-direction: column; align-items: center; }
.pic-grid-wrap {
  display: grid; grid-template-columns: 46px 264px; grid-template-rows: 46px 264px;
  margin-bottom: 14px;
}
.pic-corner { grid-column: 1; grid-row: 1; }
.pic-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(8, 1fr); }
.pic-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(8, 1fr); }
.pic-clue { color: var(--muted); font-size: 0.68rem; font-weight: 700; display: flex; }
.pic-clue-col { flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 1px; padding-bottom: 2px; }
.pic-clue-row { align-items: center; justify-content: flex-end; padding-right: 6px; white-space: nowrap; }
.pic-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: 264px; height: 264px;
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
  touch-action: none;
}
.pic-cell {
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02);
  cursor: pointer; padding: 0; color: var(--muted); font-size: 1rem; font-weight: 700;
  user-select: none;
}
.pic-cell-filled { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.pic-cell-marked { color: #f87171; }
.pic-cell-wrong { background: rgba(248,113,113,0.35) !important; }
.pic-msg { color: var(--muted); text-align: center; }

/* Flow */
.flow-game { display: flex; flex-direction: column; align-items: center; }
.flow-board {
  display: grid; grid-template-columns: repeat(6, 1fr);
  width: 288px; height: 288px;
  border: 2px solid var(--card-border); border-radius: 8px; overflow: hidden;
  margin-bottom: 14px; touch-action: none;
}
.flow-cell {
  position: relative; border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.02);
}
.flow-cell-filled { background: var(--flow-fill, rgba(255,255,255,0.1)); }
.flow-cell-endpoint { display: flex; align-items: center; justify-content: center; }
.flow-dot { width: 60%; height: 60%; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); }
.flow-msg { color: var(--muted); text-align: center; }

/* Lights Out */
.lo-game { display: flex; flex-direction: column; align-items: center; }
.lo-grid { display: grid; gap: 4px; width: 260px; height: 260px; margin-bottom: 12px; }
.lo-cell { border-radius: 6px; border: none; background: #2a2c35; cursor: pointer; }
.lo-cell-on { background: linear-gradient(135deg, var(--present), #fdbb2d); box-shadow: 0 0 12px rgba(253,187,45,0.6); }
.lo-msg { color: var(--muted); text-align: center; }

/* Sokoban */
.sok-game { display: flex; flex-direction: column; align-items: center; }
.sok-grid {
  display: grid; gap: 0; width: 320px; height: 320px; margin-bottom: 12px;
  border-radius: 4px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.sok-cell { display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }
/* Murs d'enceinte en "briques" : un vrai entrepot ferme, pas une grille qui s'arrete dans le
   vide. Motif diagonal en degrade pour suggerer la maconnerie sans image externe. */
.sok-cell-wall {
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,0.25) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #6b4a34, #4a3222);
  border: 1px solid rgba(0,0,0,0.3);
}
.sok-cell-floor {
  background:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    #232030;
  background-size: 16px 16px, 16px 16px, auto;
  border: 1px solid rgba(0,0,0,0.15);
}
.sok-cell-target { background-color: rgba(139,92,246,0.28); box-shadow: inset 0 0 0 2px rgba(139,92,246,0.6); }
.sok-cell-box { filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }
.sok-cell-box-ok { filter: drop-shadow(0 0 6px rgba(74,222,128,0.9)); }
.sok-cell-player { filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }
.sok-pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; margin-bottom: 12px; }
.sok-btn { border-radius: 8px; border: none; background: rgba(255,255,255,0.08); font-size: 1.1rem; cursor: pointer; }
.sok-msg { color: var(--muted); text-align: center; }

/* Mots meles */
.mm-game { display: flex; flex-direction: column; align-items: center; }
.mm-play-area { display: flex; flex-direction: column; align-items: center; }
.mm-header { display: flex; justify-content: space-between; width: 100%; max-width: 320px; margin-bottom: 10px; }
.mm-status { color: var(--muted); font-size: 0.9rem; margin: 0; }
.mm-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.mm-wordlist { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; max-width: 320px; }
.mm-word { background: rgba(255,255,255,0.06); border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; color: var(--muted); }
.mm-word-found { background: rgba(74,222,128,0.2); color: var(--correct); text-decoration: line-through; }
.mm-grid { display: grid; gap: 2px; width: 320px; height: 320px; touch-action: none; }
.mm-cell {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.03); border-radius: 3px;
  font-size: 0.85rem; font-weight: 700; color: var(--text); user-select: none;
}
.mm-cell-preview { background: rgba(139,92,246,0.35); }
.mm-cell-found { background: rgba(74,222,128,0.35); color: var(--correct); }

/* Taquin */
.taq-game { display: flex; flex-direction: column; align-items: center; }
.taq-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.taq-grid { display: grid; gap: 4px; width: 260px; height: 260px; margin-bottom: 12px; }
.taq-cell {
  border-radius: 6px; border: none; background: rgba(255,255,255,0.08);
  color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.taq-cell-empty { background: transparent; cursor: default; }
.taq-msg { color: var(--muted); text-align: center; }

/* Hitori */
.hit-game { display: flex; flex-direction: column; align-items: center; }
.hit-grid { display: grid; gap: 2px; width: 264px; height: 264px; margin-bottom: 14px; border: 2px solid var(--text); border-radius: 4px; overflow: hidden; }
.hit-cell {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: none; color: var(--text);
  font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.hit-cell-shaded { background: #111; color: #333; }
.hit-cell-wrong { outline: 2px solid #f87171; outline-offset: -2px; }
.hit-msg { color: var(--muted); text-align: center; }

/* Skyscrapers */
.sky-game { display: flex; flex-direction: column; align-items: center; }
.sky-grid-wrap {
  display: grid; grid-template-columns: 26px 240px 26px; grid-template-rows: 26px 240px 26px;
  margin-bottom: 14px;
}
.sky-clue { display: flex; align-items: center; justify-content: center; color: var(--present); font-weight: 700; font-size: 0.85rem; }
.sky-clues-top { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(5, 1fr); }
.sky-clues-bottom { grid-column: 2; grid-row: 3; display: grid; grid-template-columns: repeat(5, 1fr); }
.sky-clues-left { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(5, 1fr); }
.sky-clues-right { grid-column: 3; grid-row: 2; display: grid; grid-template-rows: repeat(5, 1fr); }
.sky-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
}
.sky-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
  color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.sky-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.sky-cell-wrong { color: #f87171; }
.sky-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.sky-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.sky-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.sky-msg { color: var(--muted); text-align: center; }

/* KenKen */
.kk2-game { display: flex; flex-direction: column; align-items: center; }
.kk2-grid { display: grid; gap: 2px; width: 264px; height: 264px; margin-bottom: 14px; }
.kk2-cell {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cage-color) 20%, rgba(255,255,255,0.02));
  border: 1px solid color-mix(in srgb, var(--cage-color) 55%, transparent);
  border-radius: 2px; cursor: pointer; padding: 0;
}
.kk2-clue-label { position: absolute; top: 2px; left: 3px; font-size: 0.65rem; color: var(--muted); font-weight: 700; }
.kk2-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.kk2-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.kk2-cell-wrong .kk2-value { color: #f87171; }
.kk2-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.kk2-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.kk2-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.kk2-msg { color: var(--muted); text-align: center; }

/* Aquarium */
.aq-game { display: flex; flex-direction: column; align-items: center; }
.aq-grid-wrap { display: grid; grid-template-columns: 30px 264px; grid-template-rows: 30px 264px; margin-bottom: 14px; }
.aq-corner { grid-column: 1; grid-row: 1; }
.aq-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(6, 1fr); }
.aq-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(6, 1fr); }
.aq-clue { display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: #6ec6ff; font-weight: 700; }
.aq-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr);
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
}
.aq-cell { border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02); cursor: pointer; padding: 0; }
.aq-cell-filled { background: linear-gradient(180deg, #3498db, #1c6ea4); }
.aq-cell-wrong { background: rgba(248,113,113,0.35) !important; }
.aq-msg { color: var(--muted); text-align: center; }

/* Domino solitaire */
.dom-game { display: flex; flex-direction: column; align-items: center; }
.dom-grid { display: grid; gap: 3px; width: 300px; height: 240px; margin-bottom: 14px; }
.dom-cell {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 2px solid transparent; border-radius: 4px;
  color: var(--text); font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.dom-cell-selected { border-color: #fff; }
.dom-cell-paired { background: rgba(139,92,246,0.25); border-color: var(--primary); }
.dom-msg { color: var(--muted); text-align: center; }

/* Slitherlink / Masyu (plateau a points + aretes cliquables) */
.sl-game, .ma-game { display: flex; flex-direction: column; align-items: center; }
.sl-board, .ma-board { position: relative; width: 280px; height: 280px; margin-bottom: 14px; }
.sl-clue {
  position: absolute; transform: translate(-50%, -50%);
  color: var(--muted); font-weight: 700; font-size: 0.95rem; pointer-events: none;
}
.sl-edge, .ma-edge { position: absolute; background: transparent; border: none; padding: 0; cursor: pointer; z-index: 1; }
.sl-edge-h, .ma-edge-h { height: 14px; transform: translateY(-7px); }
.sl-edge-v, .ma-edge-v { width: 14px; transform: translateX(-7px); }
.sl-edge-on, .ma-edge-on { background: var(--primary); }
.sl-edge-h.sl-edge-on, .ma-edge-h.ma-edge-on { height: 4px; transform: translateY(-2px); border-radius: 2px; }
.sl-edge-v.sl-edge-on, .ma-edge-v.ma-edge-on { width: 4px; transform: translateX(-2px); border-radius: 2px; }
.sl-dot, .ma-dot {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text); transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
}
.ma-dot-white { width: 16px; height: 16px; background: #fff; border: 2px solid #222; }
.ma-dot-black { width: 16px; height: 16px; background: #111; border: 2px solid #fff; }
.sl-msg, .ma-msg { color: var(--muted); text-align: center; }

/* Demineur */
.ms-game { display: flex; flex-direction: column; align-items: center; }
.ms-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.ms-grid { display: grid; gap: 2px; width: 306px; height: 306px; margin-bottom: 12px; }
.ms-cell { border-radius: 2px; border: none; font-size: 0.85rem; font-weight: 700; padding: 0; }
.ms-cell-hidden { background: rgba(255,255,255,0.1); cursor: pointer; }
.ms-cell-flag { background: rgba(253,187,45,0.25); cursor: pointer; }
.ms-cell-open { background: rgba(255,255,255,0.02); cursor: default; }
.ms-cell-mine { background: rgba(239,68,68,0.4); cursor: default; }
.ms-msg { color: var(--muted); text-align: center; }

/* Kropki */
.kr-game { display: flex; flex-direction: column; align-items: center; }
.kr-grid { display: flex; flex-direction: column; align-items: center; margin-bottom: 14px; }
.kr-row { display: flex; align-items: center; }
.kr-cell {
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.03);
  color: var(--text); font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 0;
}
.kr-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.kr-cell-wrong { color: #f87171; }
.kr-dot { width: 10px; height: 8px; display: inline-flex; align-items: center; justify-content: center; }
.kr-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.kr-dot-white::before { background: #fff; }
.kr-dot-black::before { background: #111; border: 1px solid #555; }
.kr-vdots-row { display: flex; align-items: center; height: 10px; }
.kr-vdots-row .kr-dot { width: 42px; height: 10px; }
.kr-dot-spacer { width: 10px; }
.kr-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.kr-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.kr-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.kr-msg { color: var(--muted); text-align: center; }

/* Nurikabe */
.nur-game { display: flex; flex-direction: column; align-items: center; }
.nur-grid { display: grid; gap: 2px; width: 294px; height: 294px; margin-bottom: 14px; }
.nur-cell {
  border: none; border-radius: 2px; background: rgba(255,255,255,0.04);
  color: var(--text); font-size: 0.95rem; font-weight: 700; cursor: pointer; padding: 0;
}
.nur-cell-clue { background: rgba(255,255,255,0.1); color: var(--muted); cursor: default; }
.nur-cell-shaded { background: #111; }
.nur-cell-wrong { outline: 2px solid #f87171; outline-offset: -2px; }
.nur-msg { color: var(--muted); text-align: center; }

/* Str8ts */
.st-game { display: flex; flex-direction: column; align-items: center; }
.st-grid { display: grid; gap: 2px; width: 264px; height: 264px; margin-bottom: 14px; }
.st-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
  color: var(--text); font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 0;
}
.st-cell-black { background: #111; border-color: #000; }
.st-cell-given { background: rgba(255,255,255,0.1); color: var(--muted); cursor: default; }
.st-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.st-cell-correct { color: var(--correct); cursor: default; }
.st-cell-wrong { color: #f87171; }
.st-pad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.st-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.st-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.st-msg { color: var(--muted); text-align: center; }

/* Tri de couleurs */
.ws-game { display: flex; flex-direction: column; align-items: center; }
.ws-tubes { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: center; margin-bottom: 14px; max-width: 100%; box-sizing: border-box; }
.ws-tube {
  display: flex; flex-direction: column-reverse; gap: 2px;
  width: 28px; padding: 3px; border-radius: 0 0 8px 8px; box-sizing: content-box;
  border: 2px solid rgba(255,255,255,0.2); border-top: none; background: rgba(255,255,255,0.03);
  cursor: pointer; flex-shrink: 0;
}
.ws-tube-selected { border-color: #fff; transform: translateY(-6px); }
.ws-unit { width: 100%; height: 16px; border-radius: 2px; background: transparent; }
.ws-msg { color: var(--muted); text-align: center; }

/* 2048 */
.g2048-game { display: flex; flex-direction: column; align-items: center; }
.g2048-score { font-weight: 700; margin-bottom: 10px; }
.g2048-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 6px; width: 280px; height: 280px; margin-bottom: 14px; background: rgba(255,255,255,0.03); padding: 6px; border-radius: 8px; box-sizing: border-box; }
.g2048-cell { border-radius: 6px; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; color: #10101a; }
.g2048-cell-small { font-size: 0.9rem; }
.g2048-pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; margin-bottom: 12px; }
.g2048-btn { border-radius: 8px; border: none; background: rgba(255,255,255,0.08); font-size: 1.1rem; cursor: pointer; }
.g2048-msg { color: var(--muted); text-align: center; max-width: 300px; }

/* Rotation Lock */
.rl-game { display: flex; flex-direction: column; align-items: center; }
.rl-rings { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.rl-ring-row { display: flex; align-items: center; gap: 8px; }
.rl-rotate-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,0.1); font-size: 1rem; cursor: pointer; padding: 0; }
.rl-segments { display: flex; gap: 2px; border-radius: 8px; overflow: hidden; }
.rl-segment { width: 22px; height: 34px; display: inline-block; }
.rl-msg { color: var(--muted); text-align: center; }

/* Tentes & Arbres */
.tt-game { display: flex; flex-direction: column; align-items: center; }
.tt-grid-wrap { display: grid; grid-template-columns: 26px 294px; grid-template-rows: 26px 294px; margin-bottom: 14px; }
.tt-corner { grid-column: 1; grid-row: 1; }
.tt-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(7, 1fr); }
.tt-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(7, 1fr); }
.tt-clue { display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: var(--present); font-weight: 700; }
.tt-grid { grid-column: 2; grid-row: 2; display: grid; gap: 2px; border: 2px solid var(--text); border-radius: 4px; overflow: hidden; }
.tt-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02);
  font-size: 1.1rem; cursor: pointer; padding: 0;
}
.tt-cell-tree { background: rgba(74,222,128,0.15); cursor: default; }
.tt-cell-tent { background: rgba(253,187,45,0.2); }
.tt-cell-wrong { background: rgba(248,113,113,0.35) !important; }
.tt-msg { color: var(--muted); text-align: center; }

/* Mathrax */
.mx-game { display: flex; flex-direction: column; align-items: center; }
.mx-grid { display: grid; width: 300px; height: 300px; margin-bottom: 14px; }
.mx-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.03);
  color: var(--text); font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 0;
}
.mx-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.mx-cell-wrong { color: #f87171; }
.mx-clue { display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: var(--present); font-weight: 700; }
.mx-spacer {}
.mx-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 300px; }
.mx-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.mx-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.mx-msg { color: var(--muted); text-align: center; }

/* Puzzle couleurs */
.pc-game { display: flex; flex-direction: column; align-items: center; }
.pc-reference { display: flex; gap: 2px; margin-bottom: 10px; border-radius: 6px; overflow: hidden; }
.pc-ref-swatch { width: 16px; height: 16px; }
.pc-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.pc-grid { display: grid; gap: 4px; width: 260px; height: 260px; margin-bottom: 12px; }
.pc-cell { border-radius: 6px; border: none; cursor: pointer; }
.pc-cell-empty { background: transparent; cursor: default; }
.pc-msg { color: var(--muted); text-align: center; }

/* Sudoku */
.sudoku-game { display: flex; flex-direction: column; align-items: center; }
.sudoku-grid {
  display: grid; grid-template-columns: repeat(9, 1fr);
  width: 306px; height: 306px;
  border: 2px solid var(--text); border-radius: 8px; overflow: hidden;
  margin-bottom: 14px;
}
.sudoku-cell {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer; padding: 0;
}
.sudoku-cell-given { background: rgba(255,255,255,0.08); color: var(--muted); cursor: default; }
.sudoku-cell-selected { background: rgba(139,92,246,0.35); }
.sudoku-cell-correct { color: var(--correct); cursor: default; }
.sudoku-cell-wrong { color: #f87171; }
.sudoku-border-left { border-left: 2px solid var(--text); }
.sudoku-border-top { border-top: 2px solid var(--text); }
.sudoku-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 306px; }
.sudoku-pad-btn {
  height: 40px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.sudoku-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.sudoku-msg { color: var(--muted); text-align: center; }

/* Rush Hour */
.rh-game { display: flex; flex-direction: column; align-items: center; }
.rh-board {
  position: relative;
  width: 306px; height: 306px;
  background: rgba(255,255,255,0.03);
  border: 2px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 12px;
  background-image:
    repeating-linear-gradient(to right, transparent, transparent calc(100%/6 - 1px), rgba(255,255,255,0.08) calc(100%/6 - 1px), rgba(255,255,255,0.08) calc(100%/6)),
    repeating-linear-gradient(to bottom, transparent, transparent calc(100%/6 - 1px), rgba(255,255,255,0.08) calc(100%/6 - 1px), rgba(255,255,255,0.08) calc(100%/6));
}
.rh-cell { position: absolute; width: calc(100%/6); height: calc(100%/6); background: transparent; border: none; cursor: pointer; z-index: 1; padding: 0; }
.rh-vehicle {
  position: absolute; z-index: 2;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border: 2px solid rgba(255,255,255,0.3); border-radius: 8px;
  cursor: pointer; padding: 2px; box-sizing: border-box;
}
.rh-vehicle-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.rh-vehicle-selected { outline: 3px solid #fff; outline-offset: -1px; }
.rh-exit {
  position: absolute; right: -8px; width: 8px; height: calc(100%/6);
  background: var(--correct); border-radius: 0 4px 4px 0; z-index: 0;
}
.rh-msg { color: var(--muted); text-align: center; }

/* Tatami */
.tatami-game { display: flex; flex-direction: column; align-items: center; }
.tatami-grid {
  display: grid; width: 306px; height: 306px; margin-bottom: 14px;
  border: 2px solid var(--text); border-radius: 4px;
}
.tatami-cell {
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--mat-color) 18%, rgba(255,255,255,0.02));
  border: 1px solid transparent;
  color: var(--text); font-size: 1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.tatami-border-left { border-left: 2px solid var(--text); }
.tatami-border-top { border-top: 2px solid var(--text); }
.tatami-border-right { border-right: 2px solid var(--text); }
.tatami-border-bottom { border-bottom: 2px solid var(--text); }
.tatami-cell-given { color: var(--muted); cursor: default; }
.tatami-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.tatami-cell-correct { color: var(--correct); cursor: default; }
.tatami-cell-wrong { color: #f87171; }
.tatami-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 306px; }
.tatami-pad-btn {
  height: 40px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.tatami-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.tatami-msg { color: var(--muted); text-align: center; }

/* Suguru */
.suguru-game { display: flex; flex-direction: column; align-items: center; }
.suguru-grid {
  display: grid; gap: 2px;
  width: 306px; height: 306px;
  margin-bottom: 14px;
}
.suguru-cell {
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--region-color) 22%, rgba(255,255,255,0.03));
  border: 1px solid color-mix(in srgb, var(--region-color) 55%, transparent);
  color: var(--text); font-size: 1rem; font-weight: 700; cursor: pointer; padding: 0; border-radius: 2px;
}
.suguru-cell-given { color: var(--muted); cursor: default; }
.suguru-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.suguru-cell-correct { color: var(--correct); cursor: default; }
.suguru-cell-wrong { color: #f87171; }
.suguru-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 306px; }
.suguru-pad-btn {
  height: 40px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.suguru-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.suguru-msg { color: var(--muted); text-align: center; }

/* Pyramide */
.pyr-game { display: flex; flex-direction: column; align-items: center; }
.pyr-grid { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 16px; }
.pyr-row { display: flex; gap: 4px; }
.pyr-cell {
  width: 44px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-weight: 700; font-size: 0.95rem;
  border: 2px solid var(--card-border); background: rgba(255,255,255,0.03); color: var(--text);
  text-align: center; padding: 0;
}
.pyr-cell-given { background: rgba(255,255,255,0.08); border-color: var(--card-border); color: var(--muted); }
.pyr-cell-input { font-family: inherit; }
.pyr-cell-input:disabled { background: rgba(74,222,128,0.15); border-color: var(--correct); color: var(--correct); }
.pyr-cell-correct { border-color: var(--correct) !important; }
.pyr-cell-wrong { border-color: var(--fail, #f87171) !important; animation: pyr-shake 0.3s; }
@keyframes pyr-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.pyr-msg { color: var(--muted); margin-top: 10px; text-align: center; }

/* Rebus */
.rebus-game { display: flex; flex-direction: column; align-items: center; text-align: center; }
.rebus-clue { font-size: 2.4rem; margin-bottom: 20px; letter-spacing: 4px; }
.rebus-form { display: flex; gap: 8px; width: 100%; margin-bottom: 12px; }
.rebus-form input {
  flex: 1; padding: 10px; border-radius: 8px; border: none;
  background: #2a2c35; color: var(--text); font-size: 1rem; text-transform: uppercase;
}
#rebus-hint-btn { background: rgba(255,255,255,0.08); color: var(--muted); font-weight: 500; }
.rebus-hint { color: var(--present); margin-top: 10px; font-style: italic; }
.rebus-msg { color: var(--muted); margin-top: 10px; }

/* Fin de partie */
.done-status { font-size: 1.1rem; margin-bottom: 16px; }
.share-preview {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px;
  font-size: 1.2rem;
  line-height: 1.4;
  white-space: pre;
  margin-bottom: 16px;
  text-align: center;
}
#share-btn { font-weight: 700; font-size: 1.05rem; }
.done-stats { color: var(--muted); font-size: 0.85rem; margin: -4px 0 16px; min-height: 1.2em; }

/* Hashi */
.has-game { display: flex; flex-direction: column; align-items: center; }
.has-board { position: relative; margin-bottom: 14px; }
.has-island {
  position: absolute; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); border: 2px solid var(--card-border);
  color: var(--text); font-size: 0.95rem; font-weight: 700; cursor: pointer; padding: 0;
  z-index: 2;
}
.has-island-selected { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.6); }
.has-island-done { border-color: var(--correct); color: var(--correct); }
.has-bridge { position: absolute; background: var(--primary); z-index: 1; }
.has-bridge-h { height: 3px; }
.has-bridge-v { width: 3px; }
.has-msg { color: var(--muted); text-align: center; }

/* Fillomino */
.fil-game { display: flex; flex-direction: column; align-items: center; }
.fil-grid { display: grid; gap: 2px; width: 280px; height: 280px; margin-bottom: 14px; }
.fil-cell {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
  color: var(--text); font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 0;
}
.fil-cell-clue { background: rgba(255,255,255,0.1); color: var(--muted); cursor: default; }
.fil-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.fil-cell-wrong { color: #f87171; }
.fil-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 264px; }
.fil-pad-btn { height: 38px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; }
.fil-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.fil-msg { color: var(--muted); text-align: center; }

/* Yin-Yang */
.yy-game { display: flex; flex-direction: column; align-items: center; }
.yy-grid { display: grid; gap: 2px; width: 294px; height: 294px; margin-bottom: 14px; }
.yy-cell {
  border: none; border-radius: 2px; background: rgba(255,255,255,0.06);
  cursor: pointer; padding: 0;
}
.yy-cell-black { background: #111; }
.yy-cell-white { background: #f2f2f2; }
.yy-cell-clue { cursor: default; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18); }
.yy-cell-wrong { outline: 2px solid #f87171; outline-offset: -2px; }
.yy-msg { color: var(--muted); text-align: center; }

/* Killer Sudoku */
.ks-game { display: flex; flex-direction: column; align-items: center; }
.ks-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  width: 306px; height: 306px;
  border: 2px solid var(--text); border-radius: 8px; overflow: hidden;
  margin-bottom: 14px;
}
.ks-cell {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cage-color) 16%, rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; padding: 0;
}
.ks-cage-border-left { border-left: 2px dashed color-mix(in srgb, var(--cage-color) 65%, transparent); }
.ks-cage-border-top { border-top: 2px dashed color-mix(in srgb, var(--cage-color) 65%, transparent); }
.ks-cage-border-right { border-right: 2px dashed color-mix(in srgb, var(--cage-color) 65%, transparent); }
.ks-cage-border-bottom { border-bottom: 2px dashed color-mix(in srgb, var(--cage-color) 65%, transparent); }
.ks-cage-sum { position: absolute; top: 1px; left: 2px; font-size: 0.55rem; color: var(--muted); font-weight: 700; pointer-events: none; }
.ks-value { font-size: 1rem; font-weight: 600; }
.ks-cell-given { color: var(--muted); cursor: default; }
.ks-cell-selected { background: rgba(139,92,246,0.35); }
.ks-cell-correct { color: var(--correct); cursor: default; }
.ks-cell-wrong, .ks-cell-wrong .ks-value { color: #f87171; }
.ks-border-left { border-left: 2px solid var(--text); }
.ks-border-top { border-top: 2px solid var(--text); }
.ks-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 306px; }
.ks-pad-btn {
  height: 40px; border-radius: 8px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.ks-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.ks-msg { color: var(--muted); text-align: center; }

/* Numberlink */
.numberlink-game { display: flex; flex-direction: column; align-items: center; }
.numberlink-board {
  display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr);
  width: 288px; height: 288px;
  border: 2px solid var(--card-border); border-radius: 8px; overflow: hidden;
  margin-bottom: 14px; touch-action: none;
}
.numberlink-cell {
  position: relative; border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.02);
}
.numberlink-cell-filled { background: rgba(139,92,246,0.35); }
.numberlink-cell-endpoint { display: flex; align-items: center; justify-content: center; }
.numberlink-dot {
  width: 60%; height: 60%; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: var(--text);
}
.numberlink-msg { color: var(--muted); text-align: center; }

/* Suite logique */
.suitelogique-game { display: flex; flex-direction: column; align-items: center; }
.suitelogique-seq { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; max-width: 320px; }
.suitelogique-term {
  min-width: 44px; padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--card-border);
  font-weight: 700; font-size: 1.05rem; text-align: center;
}
.suitelogique-term-unknown { color: var(--primary); border-color: var(--primary); background: rgba(139,92,246,0.15); }
.suitelogique-history { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; justify-content: center; max-width: 320px; }
.suitelogique-guess { background: rgba(255,255,255,0.06); border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; }
.suitelogique-form { display: flex; gap: 8px; margin-bottom: 12px; }
.suitelogique-form input { width: 140px; padding: 10px; border-radius: 8px; border: none; background: #2a2c35; color: var(--text); font-size: 1rem; text-align: center; }
.suitelogique-msg { color: var(--muted); text-align: center; }

/* Codeword */
.cw-game { display: flex; flex-direction: column; align-items: center; }
.cw-grid {
  display: grid; gap: 2px;
  width: 288px; height: 288px;
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
  margin-bottom: 14px; background: rgba(255,255,255,0.1);
}
.cw-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); position: relative; padding: 2px;
}
.cw-cell-block { background: var(--bg); }
.cw-cell-num { font-size: 0.55rem; color: var(--muted); line-height: 1; }
.cw-cell-letter { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.1; min-height: 1.1em; }
.cw-cell-given .cw-cell-letter { color: var(--correct); }
.cw-cell-wrong .cw-cell-letter { color: #f87171; }
.cw-panel {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  width: 100%; max-width: 320px; margin-bottom: 14px;
}
.cw-panel-row { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cw-panel-digit { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.cw-panel-input {
  width: 34px; height: 34px; text-align: center; text-transform: uppercase;
  font-size: 1rem; font-weight: 700; color: var(--text);
  background: rgba(255,255,255,0.06); border: 1px solid var(--card-border); border-radius: 6px;
}
.cw-msg { color: var(--muted); text-align: center; }

/* Picross couleurs */
.pc-game { display: flex; flex-direction: column; align-items: center; }
.pc-palette { display: flex; gap: 8px; margin-bottom: 12px; }
.pc-palette-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--card-border);
  cursor: pointer; padding: 0;
}
.pc-palette-btn-active { border-color: var(--text); box-shadow: 0 0 0 2px rgba(255,255,255,0.3); }
.pc-palette-eraser {
  background: var(--card); color: var(--muted); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.pc-grid-wrap {
  display: grid; grid-template-columns: 46px 264px; grid-template-rows: 46px 264px;
  margin-bottom: 14px;
}
.pc-corner { grid-column: 1; grid-row: 1; }
.pc-col-clues { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(8, 1fr); }
.pc-row-clues { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(8, 1fr); }
.pc-clue { color: var(--muted); font-size: 0.68rem; font-weight: 700; display: flex; }
.pc-clue-col { flex-direction: column-reverse; align-items: center; justify-content: flex-start; gap: 1px; padding-bottom: 2px; }
.pc-clue-row { align-items: center; justify-content: flex-end; padding-right: 6px; white-space: nowrap; gap: 3px; }
.pc-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: 264px; height: 264px;
  border: 2px solid var(--text); border-radius: 4px; overflow: hidden;
  touch-action: none;
}
.pc-cell {
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.02);
  cursor: pointer; padding: 0;
}
.pc-cell-wrong { outline: 3px solid #f87171; outline-offset: -3px; }
.pc-msg { color: var(--muted); text-align: center; }

/* Set (jeu de cartes) */
.set-game { display: flex; flex-direction: column; align-items: center; }
.set-header { display: flex; justify-content: space-between; width: 300px; margin-bottom: 10px; }
.set-status { color: var(--muted); font-size: 0.9rem; margin: 0; }
.set-timer { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.set-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); gap: 8px; width: 300px; margin-bottom: 14px; }
.set-card {
  aspect-ratio: 3 / 2; border-radius: 10px; border: 2px solid var(--card-border);
  background: rgba(255,255,255,0.05); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px;
}
.set-card-selected { border-color: var(--primary); background: rgba(139,92,246,0.2); box-shadow: 0 0 0 2px rgba(139,92,246,0.4) inset; }
.set-shape { width: 100%; max-width: 70px; height: auto; }
.set-msg { color: var(--muted); text-align: center; }

/* Hidato */
.hid-game { display: flex; flex-direction: column; align-items: center; }
.hid-grid {
  display: grid; gap: 3px;
  width: 264px; height: 264px;
  margin-bottom: 14px;
}
.hid-cell {
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.03);
  color: var(--text); font-size: 1rem; font-weight: 700; cursor: pointer; padding: 0;
}
.hid-cell-given { background: rgba(255,255,255,0.1); color: var(--muted); cursor: default; }
.hid-cell-selected { outline: 2px solid #fff; outline-offset: -2px; }
.hid-cell-wrong { color: #f87171; outline: 2px solid #f87171; outline-offset: -2px; }
.hid-pad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; width: 100%; max-width: 320px; }
.hid-pad-btn { height: 32px; border-radius: 8px; border: none; background: rgba(255,255,255,0.08); color: var(--text); font-weight: 600; cursor: pointer; font-size: 0.8rem; }
.hid-pad-clear { background: rgba(248,113,113,0.15); color: #f87171; }
.hid-msg { color: var(--muted); text-align: center; }
