/* Démineur - abeilles ! — démineur HEXAGONAL (les mines sont des abeilles).
   100% autonome, aucune dépendance. Thème ruche / miel / alvéoles. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fdf6e3;
  color: #3a2f1c;
  display: flex;
  justify-content: center;
  padding: 14px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#app { width: 100%; max-width: 900px; }

/* ---- Bandeau (stats + contrôles) ---- */
.hud { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.hud-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.stat {
  font-size: 1.15rem; font-weight: 600;
  background: #fff; border-radius: 10px; padding: 6px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  white-space: nowrap;
}

.levels { display: flex; gap: 6px; }
.lvl {
  border: 0; background: #f1e0b0; color: #6a5320;
  padding: 7px 12px; border-radius: 999px; font-weight: 600;
  cursor: pointer; font-size: .92rem;
}
.lvl.is-active { background: #e0a21a; color: #fff; }

.actions { display: flex; gap: 6px; }

.mode {
  border: 0; background: #f1e0b0; color: #6a5320;
  padding: 8px 14px; border-radius: 999px; font-weight: 700;
  cursor: pointer; font-size: .92rem; white-space: nowrap;
}
.mode.is-flag { background: #b5193f; color: #fff; }
.mode:active { transform: translateY(1px); }

.restart {
  border: 0; background: #c2410c; color: #fff;
  padding: 8px 14px; border-radius: 999px; font-weight: 600;
  cursor: pointer; font-size: .92rem;
}
.restart:active { transform: translateY(1px); }

.message { min-height: 1.4em; font-weight: 700; text-align: center; font-size: 1.1rem; }
.message.win  { color: #b8860b; }
.message.lose { color: #c0392b; }

/* ---- Ruche (grille hexagonale) ---- */
/* conteneur à défilement horizontal pour les grandes ruches sur petit écran */
.board-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Plateau en positionnement absolu : chaque alvéole est placée en px par le JS.
   width / height du plateau sont fixés par le JS (selon le niveau). */
.board {
  position: relative;
  margin: 0 auto;
  background: #d9a441;          /* "cire" entre les alvéoles */
  padding: 6px;
  border-radius: 14px;
  touch-action: manipulation;

  --hexW: 32px;                 /* largeur FIXE d'une alvéole (le JS peut la lire) */
  font-size: 16px;
  transition: box-shadow .12s ease;
}
/* Rappel visuel quand on est en mode "Marquer" (liseré + curseur) */
.board.flag-mode { box-shadow: 0 0 0 3px #b5193f; }
.board.flag-mode .cell:not(.revealed) { cursor: cell; }

/* Une alvéole hexagonale (pointe en haut) découpée au clip-path.
   La mise à l'échelle < 1 crée le liseré de cire entre les cases. */
.cell {
  position: absolute;
  width: var(--hexW);
  height: calc(var(--hexW) * 1.1547);   /* hauteur d'un hexa pointe-en-haut */
  display: flex; align-items: center; justify-content: center;
  background: #f6c945;
  background: linear-gradient(150deg, #f8d35a, #eba91f);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transform: scale(.93);                 /* liseré de cire */
  cursor: pointer;
  font-weight: 700;
  font-size: 1em;
  line-height: 1;
  overflow: hidden;
}
.cell:hover { filter: brightness(1.06); }
.cell.revealed { background: #fff6e0; cursor: default; }
.cell.revealed:hover { filter: none; }
.cell.flag { background: linear-gradient(150deg, #f3d27a, #e9bd55); }
.cell.bee  { background: linear-gradient(150deg, #f1b0a8, #e88a80); }
.cell.boom { background: #e2574d; }

/* Aperçu du chord (alvéoles activées à l'enfoncement) */
.cell.active { background: #fbe6a3; box-shadow: inset 0 0 0 0.12em #d9a441; }

/* couleurs des chiffres (1 à 6 — un hexa n'a que 6 voisines) */
.n1{color:#c77f0a}.n2{color:#2e8b4f}.n3{color:#d1462f}
.n4{color:#7b3fa0}.n5{color:#00838f}.n6{color:#b5193f}

.hint { text-align: center; color: #8a7a55; font-size: .85rem; margin: 12px 0 0; line-height: 1.5; }
.hint strong { color: #6a5320; }

@media (max-width: 420px) {
  .stat { font-size: 1rem; }
  .hint { font-size: .78rem; }
}
