/* ============================================================
   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: #2f98bb;
}

/* ============================================================
   ECRAN -- fond teal plein, colonne flex
============================================================ */
.screen {
  width: 100%;
  height: 100dvh;
  background: #2f98bb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Supprime le tap-highlight et le callout iOS */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   ZONE TEXTE HAUT -- bordure blanche 3px
============================================================ */
.top-zone {
  flex: 0 0 auto;
  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(14px, 5%, 26px);
  text-align: center;
  animation: fadeIn 0.5s ease 0.1s both;
}

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

/* ============================================================
   ZONE ENVELOPPE -- flex:1, centre l'image + hint
============================================================ */
.env-zone {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2dvh, 20px) clamp(10px, 4%, 22px) clamp(6px, 1.2dvh, 14px);
  gap: clamp(6px, 1dvh, 12px);
  animation: fadeIn 0.5s ease 0.15s both;
}

/* Image enveloppe -- bouton de navigation */
.env-img {
  display: block;
  max-width: 88%;
  max-height: clamp(180px, 52dvh, 440px);
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: pointer;
  border-radius: clamp(4px, 1.5vw, 10px);
  filter: drop-shadow(2px 4px 12px rgba(0, 0, 0, 0.38));
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: transform 0.12s ease;
}
.env-img:active { transform: scale(0.97); }

/* Hint sous l'enveloppe */
.env-hint {
  font-size: clamp(0.62rem, 2.2vw, 0.88rem);
  color: #ffffff;
  font-style: italic;
  opacity: 0.90;
  text-align: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   BARRE BAS -- coffre (gauche) + score
============================================================ */
.bas-zone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  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 {
  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;
}

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

/* ============================================================
   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; }
  .env-img     { max-height: 42dvh; }
  .env-hint    { font-size: 0.52rem; }
  .coffre-img  { height: 24px; }
  .points-box  { font-size: 0.70rem; min-width: 28px; }
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .top-text    { font-size: clamp(1rem, 3.5vw, 2rem); }
  .env-img     { max-height: clamp(220px, 52dvh, 520px); max-width: 80%; }
  .env-hint    { font-size: clamp(0.75rem, 2vw, 1rem); }
  .coffre-img  { height: clamp(34px, 6dvh, 54px); }
  .points-box  { font-size: clamp(0.9rem, 2.2vw, 1.15rem); }
}

/* ============================================================
   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(14px, 5%, 26px); }
  .env-zone  { padding: clamp(8px, 1.4dvh, 14px) clamp(10px, 4%, 22px) clamp(4px, 0.8dvh, 10px); }
  .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; }
  .env-zone   { padding: 4px 10px; gap: 4px; }
  .env-img    { max-height: 36dvh; }
  .env-hint   { font-size: 0.44rem; }
  .bas-zone   { padding: 2px 10px 4px; }
  .coffre-img { height: 22px; }
  .points-box { font-size: 0.68rem; min-width: 26px; }
}
