/* ============================================================
   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; /* blanc derrière l'image semi-transparente → éclaircit */
}

/* ============================================================
   ECRAN -- fond Fond_page29.png semi-transparent
   Technique identique à Pa_Capona_20_Riri :
     ::before avec opacity pour laisser transparaître le fond blanc
   Tous les enfants sont en position: absolute
============================================================ */
.screen {
  position: relative;
  isolation: isolate;          /* ::before z-index:-1 reste dans .screen */
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('img/Fond_page29.png');
  background-size: cover;
  background-position: center center;
  opacity: 0.55;               /* ajuster : 0.4 = très clair, 0.7 = plus sombre */
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   PERSONNAGES -- position: absolute
   Prune (IMG_Cloe) : haut-droite, z-index 3
   Marc  (IMG_Marc) : gauche,      z-index 2
   Riri  (IMG_Riri) : bas-droite,  z-index 2
   (Prune est devant Riri au niveau de ses pieds)
============================================================ */
.char-img {
  position: absolute;
  width: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  animation: fadeIn 0.6s ease 0.2s both;
}
.char-img:active { transform: scale(0.97); }

/* Prune : ancrée par ses pieds à 40% du bas, côté droit */
.prune-img {
  height: clamp(230px, 46dvh, 550px);
  bottom: 40%;
  right: 3%;
  z-index: 3;
}

/* Marc : pieds près de la barre bas, côté gauche */
.marc-img {
  height: clamp(240px, 52dvh, 620px);
  bottom: 12%;
  left: 2%;
  z-index: 2;
}

/* Riri : pieds près de la barre bas, côté droit */
.riri-img {
  height: clamp(155px, 28dvh, 340px);
  bottom: 12%;
  right: 3%;
  z-index: 2;
}

/* ============================================================
   BULLES DE DIALOGUE -- position: absolute
   Chaque bulle a un triangle CSS pointant vers le personnage
============================================================ */
.bubble-zone {
  position: absolute;
  z-index: 4;
  animation: fadeIn 0.5s ease 0.1s both;
}

/* ---- Bulle Prune (mauve) : déplacée à droite (triangle → Prune) ---- */
.bubble-prune-zone {
  top: 24%;    /* était 7%  → descendue de 17% */
  left: 20%;   /* était 3%  → déplacée à droite pour toutes les configs */
  width: clamp(140px, 46vw, 290px);
}

/* ---- Bulle Marc (verte) : centre, triangle → gauche ---- */
.bubble-marc-zone {
  top: 50%;    /* était 33% → descendue de 17% */
  left: 24%;
  width: clamp(130px, 38vw, 240px);
}

/* ---- Bulle Riri (blanche) : bas-centre, triangle → droite ---- */
.bubble-riri-zone {
  top: 70%;    /* était 55% → descendue de 13% (évite le chevauchement barre bas) */
  left: 33%;
  width: clamp(130px, 44vw, 280px);
}

/* ---- Styles communs des bulles ---- */
.speech-bubble {
  position: relative;
  border-radius: clamp(8px, 2vw, 14px);
  padding: clamp(8px, 1.6dvh, 16px) clamp(10px, 2.5vw, 18px);
  text-align: center;
}

.speech-bubble p {
  font-size: clamp(0.66rem, 3vw, 0.92rem);
  font-weight: 700;
  line-height: 1.45;
}

/* ---- Bulle mauve (Prune) ---- */
.bubble-mauve {
  background: #9b59b6;
}
.bubble-mauve p { color: #ffffff; }

/* Triangle → droite (vers Prune) */
.bubble-mauve::after {
  content: '';
  position: absolute;
  top: 38%;
  right: -12px;
  transform: translateY(-50%);
  border-top:    10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left:   12px solid #9b59b6;
}

/* ---- Bulle verte (Marc) ---- */
.bubble-verte {
  background: #6cbf3e;
}
.bubble-verte p { color: #ffffff; }

/* Triangle → gauche (vers Marc) */
.bubble-verte::after {
  content: '';
  position: absolute;
  top: 38%;
  left: -12px;
  transform: translateY(-50%);
  border-top:    10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right:  12px solid #6cbf3e;
}

/* ---- Bulle blanche (Riri) ---- */
.bubble-blanche {
  background: #ffffff;
  border: 1px solid #bbbbbb;
}
.bubble-blanche p { color: #1a2a3a; }

/* Triangle → droite (vers Riri) */
.bubble-blanche::after {
  content: '';
  position: absolute;
  top: 38%;
  right: -12px;
  transform: translateY(-50%);
  border-top:    10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left:   12px solid #ffffff;
}

/* ============================================================
   BARRE BAS -- ancrée en bas, coffre+score (gauche) | lézard (droite)
   z-index 5 pour passer devant les personnages
============================================================ */
.bas-zone {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: clamp(4px, 0.8dvh, 10px) clamp(10px, 3%, 20px) clamp(6px, 1.2dvh, 12px);
  z-index: 5;
  animation: fadeIn 0.4s ease 0.05s both;
}

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

.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: #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)
============================================================ */
@media (max-width: 360px) {
  .speech-bubble p { font-size: 0.58rem; }
  .prune-img       { height: 180px; }
  .marc-img        { height: 195px; }
  .riri-img        { height: 125px; }
  .coffre-img      { height: 24px; }
  .points-box      { font-size: 0.70rem; min-width: 28px; }
  .lezard-img      { height: 38px; }
  .bubble-prune-zone { width: clamp(115px, 44vw, 200px); }
  .bubble-marc-zone  { width: clamp(105px, 36vw, 180px); left: 22%; }
  .bubble-riri-zone  { width: clamp(105px, 42vw, 180px); left: 23%; }
}

/* ============================================================
   RESPONSIVE -- SMARTPHONES (375-430px, >= 700px hauteur)
   iPhone 12 Pro (390×844), iPhone 16 Pro (402×874), S24 Ultra (412×915)
   Personnages réduits d'un tiers + bulles verte/blanche décalées à droite
   Tab A8 non affectée (> 600px wide)
============================================================ */
@media (min-width: 375px) and (max-width: 430px) and (min-height: 700px) {
  .prune-img        { height: clamp(180px, 38dvh, 380px); }
  .marc-img         { height: clamp(175px, 40dvh, 400px); }
  .riri-img         { height: clamp(120px, 22dvh, 250px); }
  .bubble-marc-zone { left: 36%; }
  .bubble-riri-zone { left: 37%; }
  .bubble-riri-zone { top: 70%; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .speech-bubble p   { font-size: clamp(0.70rem, 2.4vw, 1.05rem); }
  .prune-img         { height: clamp(300px, 46dvh, 660px); }
  .marc-img          { height: clamp(320px, 52dvh, 720px); right: auto; }
  .riri-img          { height: clamp(200px, 28dvh, 400px); }
  .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); }
  .bubble-prune-zone { width: clamp(180px, 38vw, 320px); left: 32%;}
  .bubble-marc-zone  { width: clamp(160px, 32vw, 280px); left: 28%; }
  .bubble-riri-zone  { width: clamp(160px, 38vw, 320px); left: 35%; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE HAUTE (>= 600px, >= 1100px hauteur)
   ex. Samsung Tab A8 (800×1280 CSS px)
============================================================ */
@media (min-width: 600px) and (min-height: 1100px) {
  .prune-img { height: clamp(400px, 46dvh, 700px); }
  .marc-img  { height: clamp(460px, 52dvh, 780px); }
  .riri-img  { height: clamp(280px, 28dvh, 440px); }
  .bubble-prune-zone { top: 23%; }   /* était 6%  → descendue de 17% */
  .bubble-marc-zone  { top: 47%; }   /* était 30% → descendue de 17% */
  .bubble-riri-zone  { top: 66%; }   /* était 52% → descendue de 14% */
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 450px)
============================================================ */
@media (max-height: 450px) and (orientation: landscape) {
  .speech-bubble p   { font-size: 0.48rem; line-height: 1.3; }
  .speech-bubble     { padding: 4px 8px; }
  .prune-img         { height: 130px; bottom: 38%; }
  .marc-img          { height: 150px; bottom: 10%; }
  .riri-img          { height: 95px;  bottom: 10%; }
  .bubble-prune-zone { top: 5%;  width: 34vw; left: 20%; }  /* left: hérité base */
  .bubble-marc-zone  { top: 30%; width: 30vw; left: 26%; }
  .bubble-riri-zone  { top: 52%; width: 34vw; left: 18%; }
  .bas-zone          { padding: 2px 10px 3px; }
  .coffre-img        { height: 22px; }
  .points-box        { font-size: 0.62rem; min-width: 24px; }
  .lezard-img        { height: 30px; }
}
