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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;          /* empêche le scroll parasite du body sur iOS */
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
}

/* ============================================================
   ECRAN -- fond blanc, colonne flex
============================================================ */
.screen {
  width: 100%;
  height: 100vh;                   /* fallback iOS < 15.4 */
  height: 100svh;                  /* viewport stable */
  height: var(--real-vh, 100svh);  /* JS-driven : hauteur visible réelle (iPhone 16 Pro) */
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   ZONES DE TEXTE -- fond #2f98bb, texte blanc
============================================================ */
.zone-texte {
  flex: 0 0 auto;
  background: #2f98bb;
  border-radius: clamp(5px, 1.5vw, 10px);
  padding: clamp(8px, 1.8dvh, 18px) clamp(14px, 5%, 28px);
  margin: clamp(8px, 2dvh, 18px) clamp(10px, 6%, 30px) 0;
  text-align: center;
}

.zone1 { animation: fadeIn 0.5s ease 0.05s both; }
.zone2 { animation: fadeIn 0.5s ease 0.15s both; }

.zone-p {
  font-size: clamp(0.90rem, 5.5vw, 2.6rem);
  color: #ffffff;
  line-height: 1.55;
}

/* CPVVS -- en rouge */
.cpvvs {
  color: #cc0000;
  font-weight: 700;
}

/* ============================================================
   ZONE IMAGE CLAVAUX -- prend tout l'espace entre les zones texte
============================================================ */
.clavaux-zone {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(6px, 1.4dvh, 14px) clamp(10px, 4%, 22px);
  animation: fadeIn 0.5s ease 0.1s both;
}

.clavaux-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: clamp(4px, 1.5vw, 8px);
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* ============================================================
   BARRE BAS : coffre+score (gauche) | lezard (droite)
============================================================ */
.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);
  animation: fadeIn 0.5s ease 0.2s both;
  margin-top: clamp(4px, 1.2dvh, 16px);   /* était 5% de la largeur → basé sur la hauteur */
}

/* Coffre + points */
.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;
}

.points-box {
  background: #cc0000;
  color: #fff;
  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;
}

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

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

/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   RESPONSIVE -- PORTRAIT ETROIT (<= 360px)
============================================================ */
@media (max-width: 360px) {
  .zone-p     { font-size: 0.85rem; }
  .coffre-img { height: 22px; }
  .points-box { font-size: 0.68rem; min-width: 26px; }
  .lezard-img { height: 38px; }
}

/* ============================================================
   RESPONSIVE -- iPhone 12 Pro / 16 Pro (375–430 px, 700–932 px h)
============================================================ */
/* iPhone portrait — sans condition de hauteur (fix iOS 18 / iPhone 16 Pro) */
@media (min-width: 375px) and (max-width: 430px) {
  .zone-texte { margin:  clamp(6px, 1.4dvh, 12px) clamp(10px, 6%, 30px) 0;
                padding: clamp(6px, 1.4dvh, 12px) clamp(14px, 5%, 28px); }
  .zone-p     { font-size: clamp(0.88rem, 4.8vw, 1.35rem); }
  .lezard-img { height: clamp(44px, 9dvh, 68px); }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .zone-p     { font-size: clamp(1rem, 3.5vw, 1.65rem); }
  .coffre-img { height: clamp(34px, 6dvh, 54px); }
  .points-box { font-size: clamp(0.9rem, 2.2vw, 1.15rem); }
  .lezard-img { height: clamp(54px, 10dvh, 100px); }
}

/* ============================================================
   RESPONSIVE -- TABLETTE PORTRAIT CONTRAINTE (>= 600px, <= 1099px h)
============================================================ */
@media (min-width: 600px) and (max-height: 1099px) {
  .zone-texte { padding: clamp(6px, 1.2dvh, 12px) clamp(14px, 5%, 28px); margin-top: clamp(6px, 1.2dvh, 12px); }
  .clavaux-zone { padding: clamp(4px, 1dvh, 10px) clamp(10px, 4%, 22px); }
  .bas-zone   { padding: clamp(3px, 0.6dvh, 7px) clamp(10px, 3%, 20px) clamp(4px, 0.8dvh, 8px); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 450px)
============================================================ */
@media (max-height: 450px) and (orientation: landscape) {
  .zone-texte   { padding: 3px 10px; margin: 3px 8px 0; }
  .zone-p       { font-size: 0.56rem; line-height: 1.3; }
  .clavaux-zone { padding: 2px 8px; }
  .bas-zone     { padding: 2px 10px 3px; }
  .coffre-img   { height: 20px; }
  .points-box   { font-size: 0.62rem; min-width: 24px; }
  .lezard-img   { height: 30px; }
}
