/* ============================================================
   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, colonne flex
   FEN_Pa_Capona_25Ter
============================================================ */
.screen {
  width: 100%;
  height: 100dvh;
  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 (bleu turquoise)
============================================================ */
.zone-texte {
  flex: 0 0 auto;
  background: #2f98bb;
  border-radius: clamp(5px, 1.5vw, 10px);
  padding: clamp(6px, 1.4dvh, 16px) clamp(14px, 5%, 28px);
  margin: clamp(6px, 1.4dvh, 14px) clamp(10px, 4%, 22px) 0;
  text-align: center;
}

/* Zones 2 et 3 : bordure rouge visible */
.border-rouge {
  border: 2px solid #cc0000;
}

/* Texte dans les zones bleues */
.zone-p {
  font-size: clamp(0.72rem, 3.8vw, 1.4rem);
  color: #ffffff;
  line-height: 1.5;
}

/* Modificateurs de style */
.red  { color: #cc0000; }
.bold { font-weight: 700; }

/* ============================================================
   ZONE IMAGE LOUPE
   Espace flexible entre zone1 et zone2/3
============================================================ */
.loupe-zone {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 0.8dvh, 8px) 0;
}

.loupe-img {
  display: block;
  height: clamp(60px, 14dvh, 130px);
  width: auto;
  object-fit: contain;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* ============================================================
   ZONE 3 : EQUATIONS COULEURS (effet Stroop)
   Les mots sont affichés dans une couleur délibérément fausse
============================================================ */
.zone3 {
  text-align: left;
}

.equation {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: clamp(5px, 1.6vw, 14px);
  padding: clamp(4px, 0.9dvh, 10px) 0;
  font-size: clamp(1rem, 5.5vw, 2rem);
  font-weight: 700;
}

/* Opérateurs + et = */
.op {
  color: #ffffff;
  font-weight: 700;
}

/* Couleurs "fausses" pour chaque mot-couleur :
   Rouge   → jaune      (fausse piste)
   Noir    → cyan/bleu  (fausse piste)
   Bleu    → vert       (fausse piste)
   Blanc   → orange     (fausse piste)
   Marron  → violet     (fausse piste)
   Jaune   → blanc      (fausse piste)
   Blanc   → rouge vif  (fausse piste)
*/
.c-rouge  { color: #fcfc04; }   /* "Rouge"  affiché en jaune vif   */
.c-noir   { color: #0dc7fd; }   /* "Noir"   affiché en cyan         */
.c-bleu   { color: #00ff00; }   /* "Bleu"   affiché en vert         */
.c-noir2  { color: #0dc7fd; }   /* "Noir"   affiché en cyan         */
.c-blanc  { color: #ff0000; }   /* "Blanc"  affiché en orange       */
.c-marron { color: #8000ff; }   /* "Marron" affiché en violet       */
.c-jaune  { color: #ffffff; }   /* "Jaune"  affiché en blanc        */
.c-blanc2 { color: #ff0000; }   /* "Blanc"  affiché en rouge vif    */

/* Champ de saisie inséré dans la 3e équation */
.input-reponse {
  font-size: clamp(0.90rem, 4.8vw, 1.8rem);
  font-weight: 700;
  width: clamp(70px, 22vw, 140px);
  padding: clamp(2px, 0.4dvh, 6px) clamp(4px, 1vw, 8px);
  border: 2px solid #aaaaaa;
  border-radius: clamp(3px, 1vw, 6px);
  background: #ffffff;
  color: #333333;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
  outline: none;
  transition: border-color 0.2s ease;
}
.input-reponse::placeholder { color: #aaaaaa; }
.input-reponse:focus { border-color: #2f98bb; }

/* ============================================================
   BARRE BAS : retour (gauche) | lézard (centre) | coffre (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);
  margin-top: clamp(4px, 0.8dvh, 10px);
}

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

/* Coffre + score (droite de la barre bas) */
.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;   /* permet les \n dans textContent */
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
}
.toast.toast-visible { opacity: 1; }

/* ============================================================
   PANELS (Bravo / Erreur) -- overlay + boîte centrée
============================================================ */
.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(18px, 4dvh, 36px) clamp(20px, 6vw, 44px);
  max-width: 82vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2dvh, 20px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}

/* Bordure verte pour Bravo, rouge pour Erreur */
.panel-bravo  { border: 3px solid #22aa44; }
.panel-erreur { border: 3px solid #cc0000; }

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

/* Flèche de navigation dans les panels */
.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;
}

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

/* ============================================================
   RESPONSIVE -- PORTRAIT ETROIT (<= 360px)
   Petits smartphones compacts
============================================================ */
@media (max-width: 360px) {
  .zone-p        { font-size: 1rem; }
  .equation      { font-size: 1.2rem; gap: 3px; }
  .input-reponse { font-size: 1.2rem; width: 60px; }
  .coffre-img    { height: 66px; }
  .points-box    { font-size: 0.68rem; min-width: 26px; }
  .lezard-img    { height: 38px; }
  .retour-img    { height: 28px; }
  .loupe-img     { height: 44px; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
   iPad, Tab A8, etc.
============================================================ */
@media (min-width: 600px) {
  .zone-p        { font-size: clamp(0.82rem, 2.8vw, 1.25rem); }
  .equation      { font-size: clamp(1.1rem, 4vw, 2rem); }
  .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); }
  .loupe-img     { height: clamp(80px, 16dvh, 160px); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 450px)
   iPhone + Samsung en mode paysage
============================================================ */
@media (max-height: 450px) and (orientation: landscape) {
  .zone-texte    { padding: 3px 10px; margin: 3px 8px 0; }
  .zone-p        { font-size: 0.44rem; line-height: 1.3; }
  .equation      { font-size: 0.65rem; padding: 1px 0; gap: 2px; }
  .input-reponse { font-size: 0.60rem; width: 50px; }
  .loupe-img     { height: 28px; }
  .bas-zone      { padding: 2px 10px 3px; margin-top: 2px; }
  .coffre-img    { height: 20px; }
  .points-box    { font-size: 0.62rem; min-width: 24px; }
  .lezard-img    { height: 28px; }
  .retour-img    { height: 22px; }
}
