/* ============================================================
   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 derriere l'image transparente -> eclaircit sans teinte */
}

/* ============================================================
   ECRAN -- fond grappe semi-transparent, colonne flex
   L'image est sur ::before avec opacity pour l'eclaircir :
   le fond clair de body transparait a travers l'image
============================================================ */
.screen {
  position: relative;
  isolation: isolate; /* cree un contexte d'empilement -> ::before z-index:-1 reste dans .screen */
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Supprime le tap-highlight bleu sur le fond et le callout iOS sur les images */
  -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_grappe.png');
  background-size: cover;
  background-position: center center;
  opacity: 1; /* ajuster : 0.4 = tres clair, 0.7 = plus sombre */
  z-index: -1;
  pointer-events: none; /* ne capture aucun evenement souris/touch */
}

/* ============================================================
   ZONE HAUTE -- texte Riri, fond teal, BORDURE BLANCHE 3px
============================================================ */
.top-zone {
  flex: 0 0 auto;
  background: #2f98bb;
  border: 3px solid #ffffff;
  border-radius: clamp(5px, 1.5vw, 10px);
  margin: clamp(8px, 1.8dvh, 18px) clamp(10px, 4%, 22px) 0;
  padding: clamp(10px, 2dvh, 20px) clamp(12px, 4%, 24px);
  text-align: center;
  animation: fadeIn 0.5s ease 0.1s both;
}

.top-text {
  font-size: clamp(0.72rem, 3.5vw, 2rem);
  color: #ffffff;
  line-height: 1.55;
  font-weight: 500;
}

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

/* ============================================================
   RANGEE CENTRALE : info box + fleche + Riri
   margin-top/bottom:auto -> centre dans l'espace libre entre
   top-zone et bas-zone (technique flex la plus fiable)
============================================================ */
.lower-row {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 clamp(8px, 3%, 18px);
  gap: clamp(6px, 2%, 14px);
  margin-top: auto;
  margin-bottom: auto;
  animation: fadeIn 0.5s ease 0.15s both;
}

/* Boite info : titre + explication, fond teal — devant la fleche (z-index:2) */
.info-box {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(0, 103, 120, 0.92);
  border-radius: clamp(5px, 1.5vw, 10px);
  padding: clamp(8px, 1.6dvh, 16px) clamp(10px, 3.5%, 20px);
  position: relative;
  z-index: 2;
}

.info-titre {
  font-size: clamp(0.75rem, 2.2vw, 1.0rem);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  padding-bottom: clamp(4px, 0.7dvh, 8px);
  margin-bottom: clamp(4px, 0.7dvh, 8px);
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.info-texte {
  font-size: clamp(0.62rem, 1.8vw, 0.82rem);
  color: #ffffff;
  text-align: center;
  line-height: 1.48;
}

/* Fleche horizontale : derriere l'info-box (z-index:1), glisse sous son bord droit */
.arrow-img {
  flex: 0 0 auto;
  height: clamp(20px, 5vw, 38px);
  width: auto;
  align-self: center;
  opacity: 0.85;
  position: relative;
  z-index: 1;
  margin-left: -20px; /* chevauche le bord droit de l'info-box -> effet bulle */
  pointer-events: none; /* element decoratif, ne capte pas les touches */
}

/* Riri -- personnage, centre dans la rangee */
.riri-img {
  flex: 0 0 auto;
  width: clamp(90px, 35%, 220px);
  height: auto;
  max-height: clamp(160px, 44dvh, 320px);
  object-fit: contain;
  object-position: center;
  display: block;
  align-self: center;
  /* Bloque le callout iOS (save image) et le drag */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   BARRE BAS
   Trick 3 colonnes : score(flex:1) | lezard | spacer(flex:1)
   -> lezard centre
============================================================ */
.bas-zone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: clamp(4px, 0.8dvh, 10px) clamp(10px, 3%, 20px) clamp(6px, 1.2dvh, 12px);
  animation: fadeIn 0.5s ease 0.2s both;
}

.score-zone {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  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-img {
  flex: 0 0 auto;
  height: clamp(46px, 10dvh, 102px);
  width: auto;
  display: block;
  cursor: pointer;
  border-radius: clamp(4px, 1.5vw, 10px);
  filter: drop-shadow(1px 2px 5px rgba(0,0,0,0.4));
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.lezard-img:active { transform: scale(0.93); }

.bas-spacer { flex: 1; }

/* ============================================================
   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) {
  .top-text      { font-size: 0.60rem; }
  .info-titre    { font-size: 0.62rem; }
  .info-texte    { font-size: 0.52rem; }
  .arrow-img     { height: 16px; }
  .riri-img      { width: 68px; }
  .coffre-img    { height: 24px; }
  .points-box    { font-size: 0.70rem; min-width: 28px; }
  .lezard-img    { height: 38px; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .top-text      { font-size: clamp(0.72rem, 3.5vw, 2rem); }
  .info-titre    { font-size: clamp(0.72rem, 3.5vw, 2rem); }
  .info-texte    { font-size: clamp(0.72rem, 3.5vw, 2rem); }
  .arrow-img     { height: clamp(28px, 4.5vw, 50px); }
  .riri-img      { width: clamp(120px, 26%, 220px); max-height: clamp(200px, 48dvh, 480px); }
  .coffre-img    { height: clamp(34px, 6dvh, 54px); }
  .points-box    { font-size: clamp(0.9rem, 2.2vw, 1.15rem); }
  .lezard-img    { height: clamp(54px, 10dvh, 102px); }
}

/* ============================================================
   RESPONSIVE -- TABLETTE PORTRAIT CONTRAINTE (>= 600px, <= 1099px h)
   Cible iPad 6e generation
============================================================ */
@media (min-width: 600px) and (max-height: 1099px) {
  .top-zone   { padding: clamp(8px, 1.4dvh, 14px) clamp(12px, 4%, 24px); }
  .info-box   { padding: clamp(6px, 1.2dvh, 12px) clamp(10px, 3.5%, 20px); }
  .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) {
  .top-zone      { padding: 4px 10px; margin: 4px 8px 0; }
  .top-text      { font-size: 0.50rem; line-height: 1.3; }
  .middle-zone   { min-height: 6px; }
  .lower-row     { padding: 0 8px; gap: 5px; }
  .lower-row     { margin-top: auto; margin-bottom: auto; }
  .info-box      { padding: 4px 8px; }
  .arrow-img     { height: 14px; margin-left: -14px; }
  .info-titre    { font-size: 0.52rem; padding-bottom: 2px; margin-bottom: 2px; }
  .info-texte    { font-size: 0.44rem; line-height: 1.3; }
  .riri-img      { width: 56px; max-height: 30dvh; }
  .bas-zone      { padding: 2px 10px 4px; }
  .coffre-img    { height: 22px; }
  .lezard-img    { height: 32px; }
}
