/* ============================================================
   Materia OS — Styles des jeux
   ============================================================ */

.game-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  flex: none;
}
.game-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--r-m);
  background: var(--surface-container-high);
  min-width: 76px;
}
.game-score .gs-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.game-score .gs-value {
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.game-score.hi { background: var(--primary-container); }
.game-score.hi .gs-value { color: var(--on-primary-container); }

.game-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 16px;
  position: relative;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(10px);
  animation: fade-in var(--dur-m) var(--ease);
  text-align: center;
  padding: 20px;
}
.game-overlay h2 { font-size: 26px; font-weight: 500; }
.game-overlay p { font-size: 14px; color: var(--on-surface-variant); line-height: 1.5; }
.game-overlay .material-symbols-rounded.big { font-size: 60px; color: var(--primary); }

/* ================= Snake ================= */
.snake-canvas {
  border-radius: var(--r-l);
  background: var(--surface-container-high);
  max-width: 100%;
  max-height: 100%;
}

/* ================= 2048 ================= */
.g2048-board {
  position: relative;
  border-radius: var(--r-l);
  background: var(--surface-container-highest);
  padding: var(--gap);
  --gap: 10px;
  --cell: 88px;
  width: calc(var(--cell) * 4 + var(--gap) * 5);
  height: calc(var(--cell) * 4 + var(--gap) * 5);
  flex: none;
}
.g2048-cell {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--on-surface) 7%, transparent);
}
.g2048-tile {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: var(--r-s);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: hsl(var(--th) 60% var(--tl));
  color: #fff;
  transition: transform 120ms var(--ease-out);
  animation: tile-pop 160ms var(--ease-out);
  box-shadow: var(--shadow-1);
  z-index: 2;
}
.g2048-tile.small { font-size: 22px; }
.g2048-tile.merged { animation: tile-merge 200ms var(--ease-out); }
@keyframes tile-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes tile-merge {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ================= Démineur ================= */
.mines-grid {
  display: grid;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-m);
  background: var(--surface-container-highest);
}
.mcell {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  background: var(--secondary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background var(--dur-s) var(--ease), transform var(--dur-s) var(--ease);
  cursor: pointer;
}
.mcell:hover { filter: brightness(1.07); }
.mcell:active { transform: scale(.9); }
.mcell.open {
  background: var(--surface-container-low);
  cursor: default;
}
.mcell.open:active { transform: none; }
.mcell.flag { background: var(--tertiary-container); }
.mcell.flag .material-symbols-rounded { font-size: 17px; color: var(--on-tertiary-container); }
.mcell.boom { background: var(--error); }
.mcell.mine-show { background: var(--error-container); }
.mcell .material-symbols-rounded { font-size: 18px; }
.mcell[data-n="1"] { color: hsl(215 70% 50%); }
.mcell[data-n="2"] { color: hsl(150 60% 35%); }
.mcell[data-n="3"] { color: hsl(4 70% 50%); }
.mcell[data-n="4"] { color: hsl(260 55% 55%); }
.mcell[data-n="5"] { color: hsl(25 80% 45%); }
.mcell[data-n="6"] { color: hsl(180 55% 38%); }
.mcell[data-n="7"] { color: hsl(330 60% 45%); }
.mcell[data-n="8"] { color: hsl(0 0% 40%); }

.mines-face {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: var(--primary-container);
  color: var(--on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-s) var(--ease);
}
.mines-face:hover { transform: scale(1.08); }
.mines-face .material-symbols-rounded { font-size: 26px; }
