/* ============================================================
   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 -- flex colonne, 100dvh, fond blanc
   Ordre :
     .contenu  (flex 1 1 0 → scrollable)
     .bas-zone (auto → barre basse fixe)
============================================================ */
.screen {
  position: relative;
  width: 100%;
  height: 100dvh;                  /* dvh : dynamique, s'ajuste avec la barre Safari */
  height: var(--real-vh, 100dvh);  /* JS-driven : hauteur visible réelle (iPhone 16 Pro) */
  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;
}

/* ============================================================
   CONTENU SCROLLABLE
   Contient : texte haut + photo + 3 blocs + radios
============================================================ */
.contenu {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TEXTE DU HAUT : couleur #004fa0 sur fond blanc
============================================================ */
.texte-haut {
  flex: 0 0 auto;
  padding: clamp(10px, 2dvh, 18px) clamp(14px, 5%, 28px) clamp(4px, 0.8dvh, 10px);
  text-align: center;
  background: #ffffff;
}

.texte-haut-p {
  font-size: clamp(0.78rem, 3.8vw, 1.1rem);
  font-weight: 700;
  color: #004fa0;
  line-height: 1.5;
  margin-bottom: clamp(6px, 1.2dvh, 12px);
}

.texte-haut-question {
  font-size: clamp(0.80rem, 3.8vw, 1.1rem);
  font-weight: 700;
  color: #004fa0;
  line-height: 1.45;
}

/* ============================================================
   PHOTO : img/VerreDeBlanc.png
   Centrée, hauteur contrainte pour laisser de la place aux blocs.
============================================================ */
.photo-container {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: clamp(4px, 0.8dvh, 10px) clamp(16px, 6%, 32px);
  background: #ffffff;
}

.verre-img {
  height: clamp(100px, 22dvh, 210px);
  width: auto;
  max-width: 72%;
  object-fit: contain;
  border-radius: clamp(4px, 1.5vw, 10px);
  display: block;
  -webkit-user-drag: none;
}

/* ============================================================
   BLOCS QUESTION A / B / C
   Chaque bloc occupe toute la largeur.
   Séparation via margin-bottom minime.
============================================================ */
.bloc-question {
  flex: 0 0 auto;
  padding: clamp(8px, 1.5dvh, 14px) clamp(12px, 4%, 22px);
  margin-bottom: clamp(2px, 0.35dvh, 4px);
}

.bloc-a { background: #2F98BB; }
.bloc-b { background: #DFCBFF; }
.bloc-c { background: #98B900; }

.bloc-p {
  font-size: clamp(0.68rem, 3.2vw, 0.95rem);
  line-height: 1.5;
  font-weight: 400;
}

.texte-blanc { color: #ffffff; }
.texte-noir  { color: #1a1a1a; }

.bloc-lettre {
  font-weight: 900;
}

/* ============================================================
   SÉLECTEUR RADIOS A / B / C
   Ligne horizontale centrée sous les blocs.
   Cercles radio custom bleu (#004fa0).
============================================================ */
.choix-radios {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: clamp(22px, 9vw, 48px);
  padding: clamp(10px, 2dvh, 18px) 0 clamp(6px, 1dvh, 12px);
  background: #ffffff;
  /* autoriser les sélections radio */
  user-select: text;
  -webkit-user-select: text;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Radio natif masqué mais accessible */
.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Cercle radio custom */
.radio-circle {
  width: clamp(20px, 5.5vw, 28px);
  height: clamp(20px, 5.5vw, 28px);
  border-radius: 50%;
  border: 2px solid #888888;
  background: #ffffff;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s ease;
}

/* Point intérieur (visible quand sélectionné) */
.radio-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: #004fa0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.radio-option input[type="radio"]:checked + .radio-circle {
  border-color: #004fa0;
}
.radio-option input[type="radio"]:checked + .radio-circle::after {
  opacity: 1;
}

.radio-letter {
  font-size: clamp(0.95rem, 4.2vw, 1.3rem);
  font-weight: 700;
  color: #004fa0;
}

/* ============================================================
   BARRE BAS : retour (gauche) | lézard (centre) | score (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);
  background: #ffffff;
  border-top: 1px solid #e8e8e8;
}

.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); }

.lezard-img {
  height: clamp(46px, 10dvh, 88px);
  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); }

.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
============================================================ */
.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)
============================================================ */
.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.55;
}

.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 ÉTROIT (<= 360px)
============================================================ */
@media (max-width: 360px) {
  .texte-haut-p        { font-size: 0.8rem; }
  .texte-haut-question { font-size: 0.8rem; }
  .bloc-p              { font-size: 0.8rem; line-height: 1.4; }
  .radio-letter        { font-size: 0.80rem; }
  .radio-circle        { width: 16px; height: 16px; }
  .coffre-img          { height: 22px; }
  .points-box          { font-size: 0.66rem; min-width: 24px; }
  .lezard-img          { height: 38px; }
  .retour-img          { height: 28px; }
  .verre-img           { height: 80px; }
}

/* ============================================================
   RESPONSIVE -- SMARTPHONES (375-430px, >= 700px hauteur)
   iPhone 12 Pro (390×844), iPhone 16 Pro (402×874), S24 Ultra (412×915)
============================================================ */
/* iPhone portrait — sans condition de hauteur (fix iOS 18 / iPhone 16 Pro) */
@media (min-width: 375px) and (max-width: 430px) {
  .texte-haut-p        { font-size: clamp(0.82rem, 3.8vw, 1.05rem); }
  .texte-haut-question { font-size: clamp(0.84rem, 3.8vw, 1.05rem); }
  .bloc-p              { font-size: clamp(0.72rem, 3.3vw, 0.95rem); }
  .verre-img           { height: clamp(110px, 20dvh, 190px); }
  .lezard-img          { height: clamp(50px, 9dvh, 72px); }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .texte-haut-p        { font-size: clamp(0.90rem, 3vw, 1.5rem); }
  .texte-haut-question { font-size: clamp(0.92rem, 3vw, 1.5rem); }
  .bloc-p              { font-size: clamp(0.80rem, 2.5vw, 1.1rem); }
  .verre-img           { height: clamp(130px, 22dvh, 260px); }
  .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); }
  .retour-img          { height: clamp(44px, 8dvh, 72px); }
  .radio-letter        { font-size: clamp(1.1rem, 3vw, 1.5rem); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 430px)
============================================================ */
@media (max-height: 430px) and (orientation: landscape) {
  .texte-haut          { padding: 3px 10px 2px; }
  .texte-haut-p        { font-size: 0.44rem; line-height: 1.3; margin-bottom: 2px; }
  .texte-haut-question { font-size: 0.46rem; line-height: 1.3; }
  .photo-container     { padding: 2px 10px; }
  .verre-img           { height: 60px; }
  .bloc-question       { padding: 3px 10px; margin-bottom: 1px; }
  .bloc-p              { font-size: 0.42rem; line-height: 1.3; }
  .choix-radios        { padding: 4px 0 2px; gap: 14px; }
  .radio-circle        { width: 14px; height: 14px; }
  .radio-letter        { font-size: 0.70rem; }
  .bas-zone            { padding: 2px 10px 3px; }
  .coffre-img          { height: 18px; }
  .points-box          { font-size: 0.58rem; min-width: 20px; padding: 1px 3px; }
  .lezard-img          { height: 30px; }
  .retour-img          { height: 22px; }
}
