/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
}

/* ============================================================
   ECRAN -- fond BLANC (pas d'image de fond sur cette page)
   Flex colonne :
     zone-texte  (bleu #2f98bb)
     icones-zone (2 images decoratives)
     label-chances
     grille-container (CSS grid, 4 colonnes)
     bas-zone    (retour | score)
============================================================ */
.screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   ZONE TEXTE HAUT -- fond bleu #2f98bb
============================================================ */
.zone-texte {
  flex: 0 0 auto;
  background: #2f98bb;
  border-radius: clamp(5px, 1.5vw, 10px);
  padding: clamp(8px, 1.6dvh, 18px) clamp(14px, 5%, 28px);
  margin: clamp(6px, 1.2dvh, 12px) clamp(10px, 4%, 20px) 0;
  text-align: center;
}

.zone-p {
  font-size: clamp(0.68rem, 3.5vw, 1.05rem);
  color: #ffffff;
  font-weight: 500;
  line-height: 1.55;
}

/* ============================================================
   ICONES ZONE -- Coffre_combinaison + iconb3_64 cote a cote
============================================================ */
.icones-zone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: clamp(14px, 6%, 40px);
  padding: clamp(4px, 1dvh, 10px) 0 clamp(2px, 0.5dvh, 6px);
}

.icone-combinaison {
  height: clamp(52px, 10dvh, 90px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

.icone-b3 {
  height: clamp(44px, 8.5dvh, 76px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

/* ============================================================
   LABEL CHANCES  (WinDev : LIB_Votre_reponse)
   Affiche "Vous avez X chances"
   Cache apres le 1er clic sur le lezard (JS : display none)
============================================================ */
.label-chances {
  flex: 0 0 auto;
  text-align: center;
  color: #2f98bb;
  font-weight: 700;
  font-size: clamp(0.76rem, 3.8vw, 1.15rem);
  padding: 0 clamp(10px, 4%, 20px) clamp(4px, 0.8dvh, 8px);
}

/* ============================================================
   GRILLE CONTAINER -- CSS grid 4 colonnes
   Colonnes 1-3 : carre fixe (nb-cell / input-chiffre)
   Colonne 4    : flexible (hint-cell / lezard-cell)

   Les 5 rangees d'indices + 1 rangee de saisie sont toutes
   dans ce meme grid : alignement garanti sans bidouille.
============================================================ */
.grille-container {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, clamp(40px, 10.5vw, 62px)) 1fr;
  gap: clamp(5px, 1.1dvh, 10px) clamp(6px, 1.5vw, 12px);
  align-items: center;
  align-content: space-evenly;
  padding: 0 clamp(10px, 4%, 20px);
}

/* ---- Case d'indice (read-only) ---- */
.nb-cell {
  aspect-ratio: 1;
  width: 100%;
  border: 1.5px solid #aaaaaa;
  border-radius: clamp(3px, 1vw, 7px);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.88rem, 4.5vw, 1.5rem);
  font-weight: 700;
  color: #444444;
}

/* ---- Texte d'indice ---- */
.hint-cell {
  color: #2f98bb;
  font-size: clamp(0.60rem, 3.2vw, 0.95rem);
  font-weight: 600;
  line-height: 1.3;
  padding-left: clamp(4px, 1.5vw, 10px);
}

/* ---- Input chiffre (rangee de saisie) ---- */
.input-chiffre {
  aspect-ratio: 1;
  width: 100%;
  border: 2.5px solid #cc0000;
  border-radius: clamp(3px, 1vw, 7px);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.88rem, 4.5vw, 1.5rem);
  font-weight: 700;
  color: #222222;
  outline: none;
  /* Autoriser la selection/saisie dans les inputs
     (le .screen desactive user-select globalement) */
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  /* Supprimer les fleches +/- des inputs numériques */
  -moz-appearance: textfield;
  appearance: textfield;
  padding: 0;
}

.input-chiffre::-webkit-outer-spin-button,
.input-chiffre::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-chiffre:focus {
  border-color: #2f98bb;
  background: #eef7fb;
  box-shadow: 0 0 0 2px rgba(47, 152, 187, 0.30);
}

/* ---- Cellule lezard (rangee de saisie, colonne 4) ---- */
.lezard-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: clamp(4px, 1.5vw, 10px);
}

.lezard-img {
  height: clamp(42px, 10.5vw, 68px);
  width: auto;
  display: block;
  cursor: pointer;
  border-radius: clamp(4px, 1.5vw, 10px);
  filter: drop-shadow(1px 2px 5px rgba(0, 0, 0, 0.35));
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: transform 0.12s ease;
}
.lezard-img:active { transform: scale(0.93); }

/* ============================================================
   BARRE BAS : retour (gauche) | coffre+score (droite)
   Pas de lezard ici, il est dans la grille
============================================================ */
.bas-zone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: clamp(4px, 0.9dvh, 10px) clamp(10px, 3%, 20px) clamp(6px, 1.3dvh, 14px);
  margin-top: clamp(2px, 0.5dvh, 6px);
}

.retour-img {
  height: clamp(36px, 8dvh, 64px);
  width: auto;
  display: block;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: transform 0.12s ease;
}
.retour-img:active { transform: scale(0.90); }

.score-zone {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(4px, 1.2vw, 10px);
}

.coffre-img {
  height: clamp(28px, 6dvh, 48px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

.points-box {
  background: #cc0000;
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(0.80rem, 2.8vw, 1.1rem);
  min-width: clamp(32px, 9vw, 58px);
  padding: clamp(3px, 0.6dvh, 6px) clamp(4px, 1vw, 9px);
  border-radius: 5px;
  text-align: center;
  line-height: 1.2;
}

/* ============================================================
   TOAST -- message temporaire (essais restants)
============================================================ */
.toast {
  position: fixed;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #ffffff;
  padding: clamp(8px, 1.5dvh, 14px) clamp(14px, 4vw, 24px);
  border-radius: 10px;
  font-size: clamp(0.70rem, 3vw, 1rem);
  text-align: center;
  max-width: 82vw;
  line-height: 1.5;
  white-space: pre-line;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
}
.toast.toast-visible { opacity: 1; }

/* ============================================================
   PANELS (Bravo / Erreur) -- identiques aux pages precedentes
============================================================ */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-box {
  background: #ffffff;
  border-radius: clamp(10px, 3vw, 20px);
  padding: clamp(16px, 3.5dvh, 32px) clamp(20px, 6vw, 44px);
  max-width: 82vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.8dvh, 18px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}

.panel-bravo  { border: 3px solid #22aa44; }
.panel-erreur { border: 3px solid #cc0000; }

.panel-emoticone {
  height: clamp(44px, 9dvh, 72px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

.panel-title {
  font-size: clamp(1.1rem, 5.5vw, 2rem);
  font-weight: 900;
  color: #222222;
}

.panel-pts {
  font-size: clamp(0.80rem, 3.5vw, 1.2rem);
  color: #22aa44;
  font-weight: 700;
}

.panel-text {
  font-size: clamp(0.78rem, 3.5vw, 1.15rem);
  color: #333333;
  line-height: 1.5;
}

.panel-arrow {
  height: clamp(36px, 7dvh, 56px);
  width: auto;
  display: block;
  cursor: pointer;
  filter: drop-shadow(1px 1px 3px rgba(0, 0, 0, 0.25));
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: transform 0.12s ease;
}
.panel-arrow:active { transform: scale(0.90); }

/* ============================================================
   OVERLAY DE TRANSITION (fondu noir)
============================================================ */
.transition-overlay {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 100;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.4s ease;
}

/* ============================================================
   RESPONSIVE -- PORTRAIT ETROIT (<= 360px)
============================================================ */
@media (max-width: 360px) {
  .zone-p           { font-size: 0.68rem; }
  .hint-cell        { font-size: 0.8rem; }
  .label-chances    { font-size: 0.64rem; }
  .grille-container { grid-template-columns: repeat(3, clamp(34px, 9vw, 46px)) 1fr; gap: 4px 5px; }
  .lezard-img       { height: 34px; }
  .retour-img       { height: 28px; }
  .coffre-img       { height: 22px; }
  .points-box       { font-size: 0.68rem; min-width: 26px; }
  .icone-combinaison{ height: 40px; }
  .icone-b3         { height: 36px; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .zone-p           { font-size: clamp(0.78rem, 2.4vw, 1.15rem); }
  .hint-cell        { font-size: clamp(0.68rem, 2.0vw, 1.05rem); }
  .label-chances    { font-size: clamp(0.84rem, 2.2vw, 1.2rem); }
  .grille-container { grid-template-columns: repeat(3, clamp(52px, 9vw, 76px)) 1fr; gap: 10px 14px; padding: 0 clamp(16px, 5%, 32px); }
  .lezard-img       { height: clamp(52px, 8vw, 76px); }
  .retour-img       { height: clamp(44px, 7dvh, 70px); }
  .icone-combinaison{ height: clamp(64px, 10dvh, 100px); }
  .icone-b3         { height: clamp(56px, 8.5dvh, 88px); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 430px)
============================================================ */
@media (max-height: 430px) and (orientation: landscape) {
  .zone-texte       { padding: 4px 10px; margin: 3px 8px 0; border-radius: 5px; }
  .zone-p           { font-size: 0.46rem; line-height: 1.25; }
  .icones-zone      { padding: 2px 0; gap: 10px; }
  .icone-combinaison{ height: 32px; }
  .icone-b3         { height: 28px; }
  .label-chances    { font-size: 0.56rem; padding-bottom: 2px; }
  .grille-container { gap: 3px 5px; padding: 0 8px; }
  .hint-cell        { font-size: 0.44rem; }
  .lezard-img       { height: 30px; }
  .bas-zone         { padding: 2px 10px 3px; margin-top: 1px; }
  .coffre-img       { height: 20px; }
  .points-box       { font-size: 0.62rem; min-width: 24px; }
  .retour-img       { height: 22px; }
}
