/* =====================================================================
   Hashi — styles propres au jeu (préfixe hs-)
   La barre, le plein écran et les infobulles sont dans css/games.css.
   ===================================================================== */

/* Barre commune aux couleurs du jeu : lagon et sable */
.hs-jeu {
  --mg-jeu-largeur: 1204px; /* barre de 1180 px + marges de 12 px : ne pas changer */
  --mgb-fond: radial-gradient(120% 180% at 0% 0%, rgba(255, 224, 140, 0.25), transparent 55%),
    linear-gradient(120deg, #0b5f8f, #13a0b8);
  --mgb-accent: #ffe08a;
  --mgb-titre: linear-gradient(100deg, #ffffff, #fff1c9 50%, #ffd36b);
  --mgb-doux: #bfe9f2;
  --mg-fs-fond: #0b5f8f;
  --mg-bulle-fond: #0b4a70;
  --hs-sable: #f4d996;
  --hs-bois: #8a5a2b;
}

.hs-jeu [hidden] {
  display: none !important;
}

/* Zone de jeu : même largeur que la barre (css/games.css), hauteur posée par game.js (ajuster) */
.hs-zone {
  position: relative;
  box-sizing: border-box;
  align-self: center;
  display: flex;
  width: min(var(--mg-barre-largeur, 1180px), calc(100vw - 24px));
  border-radius: 16px;
  overflow: hidden;
  background: #138fb3;
  box-shadow: 0 18px 40px -18px rgba(11, 95, 143, 0.6);
  user-select: none;
  -webkit-user-select: none;
}

/* Plein écran : la zone prend toute la place sous la barre */
.hs-jeu.mg-fs .hs-zone {
  align-self: stretch;
  width: auto;
  flex: 1;
  min-height: 0;
}

.hs-canvas {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Message bref (passage bloqué, indice) */
.hs-message {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 3;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(8, 60, 92, 0.85);
  color: #fff;
  font-family: "Outfit", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95em;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.hs-message.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Fenêtres : dans la zone, la barre reste visible ---------- */
.hs-voile {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(6, 50, 80, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Fin de partie : l'archipel reste bien visible derrière */
.hs-voile-clair {
  background: rgba(6, 50, 80, 0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.hs-fen {
  box-sizing: border-box;
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  margin: 0;
  padding: 22px 24px 18px 24px;
  border-radius: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #fffaf0, #fdf0d2);
  border: 3px solid #e9c987;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.25),
    0 30px 60px -20px rgba(4, 40, 70, 0.6);
  color: #5a3a1a;
  font-family: "Outfit", system-ui, sans-serif;
  text-align: center;
  animation: hs-fen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hs-fen {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
}

.hs-fen-titre {
  font-family: "Baloo 2", "Madimi One", sans-serif;
  font-weight: 800;
  font-size: 2.2em;
  line-height: 1.05;
  color: #0b6e99;
}

.hs-fen-sous {
  margin: 4px 0 14px 0;
  color: #8a6a44;
  font-size: 0.97em;
}

.hs-niveaux {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hs-niveaux button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 12px 8px;
  border: 2px solid #ecd3a0;
  border-radius: 16px;
  background: #fffaf0;
  color: #5a3a1a;
  font: inherit;
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.hs-niveaux button b {
  color: inherit;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.25em;
  line-height: 1.1;
}

.hs-niveaux button span {
  font-size: 0.8em;
  color: #a2835c;
}

.hs-niveaux button:hover {
  transform: translateY(-2px);
  border-color: #f0b84f;
}

.hs-niveaux button[aria-pressed="true"] {
  background: linear-gradient(160deg, #19a9c4, #0b6e99);
  border-color: #0b6e99;
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(11, 110, 153, 0.8);
}

.hs-niveaux button[aria-pressed="true"] span {
  color: #cdeff7;
}

.hs-niveaux button:focus-visible {
  outline: 3px solid #f0b84f;
  outline-offset: 2px;
}

.hs-fen-boutons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.hs-fen .btn-vert {
  min-width: 140px;
  background: #0b6e99;
}

.hs-fen .btn-vert:hover {
  background: #0d82b3;
}

.hs-fin-stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0;
}

.hs-fin-stats div {
  display: flex;
  flex-direction: column;
  min-width: 90px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(233, 201, 135, 0.3);
}

.hs-fin-stats span {
  font-size: 0.75em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a2835c;
}

.hs-fin-stats b {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.6em;
  line-height: 1.1;
  color: #0b6e99;
}

@media (max-width: 600px) {
  /* Barre trop chargée sur téléphone : rétablir et recommencer restent au clavier */
  #hs-retablir,
  #hs-recommencer {
    display: none;
  }

  .hs-niveaux {
    grid-template-columns: 1fr;
  }

  .hs-fin-stats div {
    min-width: 0;
    flex: 1;
  }
}

.hs-fen .btn-bleu {
  background: #f0a830;
  box-shadow: 0 10px 22px -12px rgba(240, 168, 48, 0.9);
}

.hs-fen .btn-bleu:hover {
  background: #e3961c;
}
