/* ============================================================
   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 -- flex colonne, 100dvh
   Ordre :
     header-zone    (auto)
     zone-rouge     (auto)
     photo-container (flex 1 1 0 → remplit l'espace restant)
     zone-blanche   (auto)
============================================================ */
.screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  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;
}

/* ============================================================
   HEADER : coffre+score (gauche) | flèche suivant (droite)
============================================================ */
.header-zone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: clamp(6px, 1.2dvh, 12px) clamp(10px, 3%, 18px) clamp(4px, 0.8dvh, 8px);
}

.score-zone {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(4px, 1.2vw, 10px);
}

.coffre-img {
  height: clamp(28px, 5.5dvh, 46px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

.points-box {
  background: #cc0000;
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(0.78rem, 2.6vw, 1.05rem);
  min-width: clamp(30px, 8vw, 52px);
  padding: clamp(2px, 0.5dvh, 5px) clamp(4px, 1vw, 8px);
  border-radius: 5px;
  text-align: center;
  line-height: 1.2;
}

.fleche-img {
  height: clamp(34px, 7dvh, 58px);
  width: auto;
  display: block;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.18));
  transition: transform 0.12s ease;
}
.fleche-img:active { transform: scale(0.90); }

/* ============================================================
   ZONE ROUGE : texte blanc sur fond #ce4d40
============================================================ */
.zone-rouge {
  flex: 0 0 auto;
  background: #ce4d40;
  padding: clamp(10px, 2dvh, 20px) clamp(14px, 5%, 28px);
  text-align: center;
}

.texte-zone-rouge {
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(0.72rem, 3.6vw, 1.1rem);
  line-height: 1.6;
}

/* ============================================================
   PHOTO-CONTAINER
   Contient deux calques :
     1. DrapeauValais.png  (fond, object-fit:cover)
     2. Riri.png           (avant-plan, positionné en absolu)
   position:relative indispensable pour l'absolu de .riri-img.
============================================================ */
.photo-container {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: #ce4d40;
  cursor: pointer;
  position: relative;   /* ancre pour .riri-img */
}

/* ── Drapeau : fond qui remplit tout le conteneur ── */
.photo-principale {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  -webkit-user-drag: none;
  transition: opacity 0.12s ease;
}
.photo-principale:active { opacity: 0.88; }

/* ── Riri : avant-plan, moitié gauche, centré verticalement ──
   Centre de l'image placé à (25 % de la largeur, 50 % de la hauteur).
   max-width: 48 % pour rester dans la moitié gauche quelle que
   soit la résolution.
   pointer-events: none → les clics traversent vers le drapeau.
============================================================ */
.riri-img {
  position: absolute;
  left: 36%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 60%;
  width: auto;
  max-width: 48%;
  z-index: 2;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* ============================================================
   ZONE BLANCHE : texte #ce4d40 sur fond blanc
============================================================ */
.zone-blanche {
  flex: 0 0 auto;
  background: #ffffff;
  padding: clamp(10px, 2dvh, 20px) clamp(14px, 5%, 28px);
  text-align: center;
}

.texte-zone-blanche {
  color: #ce4d40;
  font-weight: 700;
  font-size: clamp(0.72rem, 3.6vw, 1.1rem);
  line-height: 1.6;
}

/* ============================================================
   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) {
  .coffre-img          { height: 22px; }
  .points-box          { font-size: 0.66rem; min-width: 24px; }
  .fleche-img          { height: 26px; }
  .texte-zone-rouge    { font-size: 0.7rem; line-height: 1.4; }
  .texte-zone-blanche  { font-size: 0.7rem; line-height: 1.4; }
  .riri-img            { left: 30%; }
  .riri-img        { height: 60%; }
}

/* ============================================================
   RESPONSIVE -- SMARTPHONES (375-430px, >= 700px hauteur)
   iPhone 12 Pro (390×844), iPhone 16 Pro (402×874), S24 Ultra (412×915)
============================================================ */
@media (min-width: 375px) and (max-width: 430px) and (min-height: 700px) {
  .coffre-img          { height: clamp(30px, 5dvh, 42px); }
  .fleche-img          { height: clamp(38px, 6.5dvh, 52px); }
  .texte-zone-rouge    { font-size: clamp(0.80rem, 3.8vw, 1.05rem); line-height: 1.65; }
  .texte-zone-blanche  { font-size: clamp(0.80rem, 3.8vw, 1.05rem); line-height: 1.65; }
  .riri-img        { height: 60%; }
  .riri-img        { left: 30%; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .coffre-img          { height: clamp(34px, 5.5dvh, 52px); }
  .points-box          { font-size: clamp(0.9rem, 2.2vw, 1.15rem); }
  .fleche-img          { height: clamp(42px, 7dvh, 66px); }
  .texte-zone-rouge    { font-size: clamp(0.84rem, 2.4vw, 1.25rem); }
  .texte-zone-blanche  { font-size: clamp(0.84rem, 2.4vw, 1.25rem); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 430px)
============================================================ */
@media (max-height: 430px) and (orientation: landscape) {
  .header-zone        { padding: 3px 8px 2px; }
  .coffre-img         { height: 20px; }
  .points-box         { font-size: 0.60rem; min-width: 22px; padding: 1px 4px; }
  .fleche-img         { height: 22px; }
  .zone-rouge         { padding: 4px 10px; }
  .texte-zone-rouge   { font-size: 0.44rem; line-height: 1.3; }
  .zone-blanche       { padding: 4px 10px; }
  .texte-zone-blanche { font-size: 0.44rem; line-height: 1.3; }
}
