/* ============================================================
   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 img/Fond Bouteilles et Cepages2.png (::before, opacity 0.55)
   Technique identique à Pa_Capona_26Bis.
   Ordre vertical (flex colonne) :
     .zone-bouteilles → bouteilles + labels jaunes (flex 1)
     .grille-zone     → grille 3 col × 4 lignes, fond #B6904A (flex 0)
     .bas-zone        → retour | lézard | score (flex 0)
============================================================ */
.screen {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  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 Bouteilles et Cepages2.png');
  background-size: cover;
  background-position: center center;
  opacity: 0.55;
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   ZONE BOUTEILLES -- prend tout l'espace restant
   align-items: stretch → chaque .bouteille-item fait 100% de la hauteur
   de la zone → contexte de positionnement pour .bouteille-wrapper.
   overflow: hidden → coupe ce qui déborde vers le haut.
============================================================ */
.zone-bouteilles {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
}

/* Colonne pleine hauteur : contexte de positionnement absolu */
.bouteille-item {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
}

/* ============================================================
   WRAPPER BOUTEILLE + LABEL -- l'unité déplaçable
   Positionnement absolu dans la colonne (100% zone).
   Deux propriétés à régler par bouteille ci-dessous :
     height : taille de la bouteille (% de la hauteur de la zone)
     bottom : position verticale depuis le bas de la colonne
              0% = posée en bas ; 20% = remontée de 20% de la zone
   Le label (bottom: 33%) reste ancré dans son wrapper.
============================================================ */
.bouteille-wrapper {
  position: absolute;
  left: 0;
  width: 100%;
  /* height + bottom définis individuellement */
}

/* ============================================================
   RÉGLAGES PAR BOUTEILLE -- 2 valeurs ajustables chacune
   Ordre HTML (G→D) : Nabuchodonosor | Mathusalem | Magnum | Jeroboam
============================================================ */
.bouteille-item:nth-child(1) .bouteille-wrapper { height: 90%; bottom:  7%; } /* Nabuchodonosor */
.bouteille-item:nth-child(2) .bouteille-wrapper { height:  72%; bottom:  2%; } /* Mathusalem     */
.bouteille-item:nth-child(3) .bouteille-wrapper { height:  45%; bottom:  45%; } /* Magnum         */
.bouteille-item:nth-child(4) .bouteille-wrapper { height:  55%; bottom:  15%; } /* Jeroboam       */

/* Image : remplit le wrapper */
.bouteille-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Label jaune : positionné dans le wrapper (= dans la bouteille).
   bottom: 33% = tiers inférieur du wrapper. */
.bouteille-label {
  position: absolute;
  left: 50%;
  bottom: 33%;
  transform: translateX(-50%);
  color: #ffff00;
  font-weight: 900;
  font-size: clamp(1.0rem, 5vw, 1.8rem);
  white-space: nowrap;
  text-shadow:
    1px  1px 3px rgba(0, 0, 0, 0.85),
    -1px -1px 3px rgba(0, 0, 0, 0.70),
     0    2px 6px rgba(0, 0, 0, 0.60);
  z-index: 2;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================================
   GRILLE -- fond #B6904A, texte blanc
   Structure interne :
     .grille-titre → ligne titre centrée (full width)
     .grille-corps → CSS grid 3 colonnes × 4 rangées
       col 1 : nom bouteille (flex, aligné à gauche)
       col 2 : <select> (centré)
       col 3 : "Litres" (aligné à droite)
============================================================ */
.grille-zone {
  flex: 0 0 auto;
  background: #B6904A;
  padding: clamp(8px, 1.6dvh, 16px) clamp(12px, 4%, 24px);
  /* Autoriser les interactions natives (select) */
  user-select: auto;
  -webkit-user-select: auto;
}

.grille-titre {
  color: #ffffff;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(0.80rem, 3.8vw, 1.1rem);
  line-height: 1.4;
  text-align: center;
  margin-bottom: clamp(8px, 1.5dvh, 14px);
}

/* Grille 3 colonnes :
   col 1 (nom) : prend l'espace libre
   col 2 (select) : largeur naturelle du select
   col 3 (Litres) : largeur naturelle du texte */
.grille-corps {
  display: grid;
  grid-template-columns: 1fr auto auto;
  row-gap: clamp(6px, 1.2dvh, 12px);
  column-gap: clamp(10px, 3vw, 20px);
  align-items: center;
}

.grille-nom {
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(0.80rem, 3.8vw, 1.05rem);
  white-space: nowrap;
}

/* Select natif : fond blanc, arrondi, texte centré */
.grille-select {
  appearance: auto;
  -webkit-appearance: auto;
  background: #ffffff;
  color: #333333;
  font-family: inherit;
  font-size: clamp(0.80rem, 3.5vw, 1.05rem);
  font-weight: 700;
  border: 1.5px solid #cccccc;
  border-radius: clamp(4px, 1vw, 6px);
  padding: clamp(3px, 0.6dvh, 7px) clamp(4px, 1.2vw, 8px);
  min-width: clamp(58px, 16vw, 96px);
  text-align: center;
  text-align-last: center; /* Firefox */
  cursor: pointer;
  outline: none;
  touch-action: auto;
}

.grille-select:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.grille-litres {
  color: #ffffff;
  font-weight: 700;
  font-size: clamp(0.80rem, 3.8vw, 1.05rem);
  white-space: nowrap;
}

/* ============================================================
   BARRE BAS : retour (G) | lézard (C) | score (D)
============================================================ */
.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);
  z-index: 4;
}

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

.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 (essai restant)
============================================================ */
.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;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
}
.toast.toast-visible { opacity: 1; }

/* ============================================================
   PANELS (Bravo / Erreur) -- identiques aux autres pages
============================================================ */
.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(16px, 3.5dvh, 32px) clamp(20px, 6vw, 44px);
  max-width: 82vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.8dvh, 18px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}

.panel-bravo  { border: 3px solid #22aa44; }
.panel-erreur { border: 3px solid #cc0000; }

.panel-emoticone {
  height: clamp(44px, 9dvh, 72px);
  width: auto;
  display: block;
  -webkit-user-drag: none;
}

.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;
  min-height: 1.2em;
}

.panel-text {
  font-size: clamp(0.78rem, 3.5vw, 1.15rem);
  color: #333333;
  line-height: 1.6;
}

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

/* ============================================================
   RESPONSIVE -- PORTRAIT ÉTROIT (<= 360px)
============================================================ */
@media (max-width: 360px) {
  .bouteille-label  { font-size: 0.90rem; }
  .grille-titre     { font-size: 0.9rem; line-height: 1.3; margin-bottom: 5px; }
  .grille-nom       { font-size: 0.9rem; }
  .grille-select    { font-size: 0.9rem; min-width: 44px; padding: 2px 3px; }
  .grille-litres    { font-size: 0.9rem; }
  .grille-corps     { column-gap: 6px; row-gap: 4px; }
  .coffre-img       { height: 22px; }
  .points-box       { font-size: 0.66rem; min-width: 24px; }
  .lezard-img       { height: 38px; }
  .retour-img       { height: 28px; }
}

/* ============================================================
   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) {
  .bouteille-label  { font-size: clamp(1.0rem, 5vw, 1.4rem); }
  .grille-titre     { font-size: clamp(0.82rem, 3.8vw, 1.05rem); }
  .grille-nom       { font-size: clamp(0.82rem, 3.8vw, 1.05rem); }
  .grille-select    { font-size: clamp(0.82rem, 3.5vw, 1.0rem); }
  .grille-litres    { font-size: clamp(0.82rem, 3.8vw, 1.05rem); }
  .lezard-img       { height: clamp(52px, 9dvh, 76px); }
  /* ============================================================
   RÉGLAGES PAR BOUTEILLE -- 2 valeurs ajustables chacune
   Ordre HTML (G→D) : Nabuchodonosor | Mathusalem | Magnum | Jeroboam
============================================================ */
.bouteille-item:nth-child(1) .bouteille-wrapper { height: 90%; bottom:  17%; } /* Nabuchodonosor */
.bouteille-item:nth-child(2) .bouteille-wrapper { height:  72%; bottom:  12%; } /* Mathusalem     */
.bouteille-item:nth-child(3) .bouteille-wrapper { height:  45%; bottom:  50%; } /* Magnum         */
.bouteille-item:nth-child(4) .bouteille-wrapper { height:  55%; bottom:  25%; } /* Jeroboam       */
  
}

/* ============================================================
   RESPONSIVE -- TABLETTE (>= 600px)
============================================================ */
@media (min-width: 600px) {
  .bouteille-label  { font-size: clamp(1.2rem, 4vw, 2.0rem); }
  .grille-titre     { font-size: clamp(0.90rem, 3vw, 1.5rem); }
  .grille-nom       { font-size: clamp(0.90rem, 2.8vw, 1.3rem); }
  .grille-select    { font-size: clamp(0.88rem, 2.5vw, 1.2rem); min-width: clamp(68px, 14vw, 110px); }
  .grille-litres    { font-size: clamp(0.90rem, 2.8vw, 1.3rem); }
  .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); }
  .retour-img       { height: clamp(44px, 8dvh, 72px); }
}

/* ============================================================
   RESPONSIVE -- PAYSAGE MOBILE (hauteur <= 430px)
============================================================ */
@media (max-height: 430px) and (orientation: landscape) {
  .bouteille-label  { font-size: 0.70rem; bottom: 28%; }
  .grille-zone      { padding: 3px 10px 4px; }
  .grille-titre     { font-size: 0.42rem; margin-bottom: 3px; }
  .grille-nom       { font-size: 0.42rem; }
  .grille-select    { font-size: 0.42rem; min-width: 36px; padding: 1px 2px; border-radius: 3px; }
  .grille-litres    { font-size: 0.42rem; }
  .grille-corps     { row-gap: 2px; column-gap: 6px; }
  .bas-zone         { padding: 2px 10px 3px; margin-top: 2px; }
  .coffre-img       { height: 18px; }
  .points-box       { font-size: 0.58rem; min-width: 20px; padding: 1px 3px; }
  .lezard-img       { height: 26px; }
  .retour-img       { height: 20px; }
}
