:root {
  --mobile-h: 94vh; /* hauteur cible mobile */
  --mobile-w: 98vw; /* largeur cible mobile */
}

html,
body {
  height: 100%;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
}

/* Floater centré sur tout l’écran avec fondu */
.promo-floater {
  position: fixed;
  z-index: 2147483647;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none; /* clics ignorés hors de la carte */
  opacity: 0;
  transition: opacity 240ms ease-out;
}
.promo-visible {
  opacity: 1;
}

/* Légère translation à l’apparition */
.promo-center {
  pointer-events: auto;
  transform: translateY(8px);
  transition: transform 240ms ease-out;
}
.promo-visible .promo-center {
  transform: translateY(0);
}

/* Carte + ombre (CORRIGÉ) */
.promo-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden; /* Garantit que rien ne dépasse */
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  background: #fff;
  isolation: isolate;

  /* === NOUVELLE LOGIQUE DE TAILLE === */
  /* Utilise la largeur du viewport mais avec une limite maximale */
  width: 90vw;
  max-width: 980px;

  /* La hauteur s'adapte au contenu, mais ne dépasse jamais 90% du viewport */
  height: auto;
  max-height: 90vh;

  /* Utilise Flexbox pour bien contenir l'image */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image responsive, sans déformation (CORRIGÉ) */
.promo-img {
  display: block;
  /* L'image prend 100% de la largeur de la carte */
  width: 100%;
  /* La hauteur est automatique pour garder le ratio */
  height: auto;
  /* Assure que l'image s'adapte sans être coupée */
  object-fit: contain;
}

/* Bouton fermeture visible */
.promo-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 24px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

/* Mobile: quasi plein écran */
@media (max-width: 600px) {
  .promo-card {
    border-radius: 12px;
    width: clamp(280px, var(--mobile-w), 100vw);
    max-width: var(--mobile-w);
    max-height: var(--mobile-h);
  }
  .promo-img {
    max-height: var(--mobile-h);
  }
  .promo-close {
    top: 8px;
    right: 8px;
    width: 46px;
    height: 46px;
    line-height: 46px;
    font-size: 26px;
    background: rgba(0, 0, 0, 0.88);
  }
}

/* Safe areas iOS (encoches) */
@supports (padding: max(0px)) {
  @media (max-width: 600px) {
    .promo-card {
      margin: max(6px, env(safe-area-inset-top))
        max(6px, env(safe-area-inset-right))
        max(6px, env(safe-area-inset-bottom))
        max(6px, env(safe-area-inset-left));
    }
  }
}
