:root {
  --bg: #100706;
  --rose: #e8a07a;
  --rose-soft: rgba(232, 160, 122, 0.22);
  --ivory: #faf5ef;
  --muted: rgba(255, 255, 255, 0.66);
  --glass: rgba(20, 8, 7, 0.72);
  --green: #34c759;
  --red: #ff3b30;
  --gold: #dfb94f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  align-items: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 160, 122, 0.14), transparent 36%),
    linear-gradient(145deg, #070404, #190807 45%, #070404);
  color: var(--ivory);
  display: flex;
  font-family: Georgia, "Times New Roman", serif;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

button,
input,
a {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.stage {
  background: #000;
  border-radius: 44px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 50px 100px rgba(0, 0, 0, 0.9);
  height: min(812px, 100dvh);
  overflow: hidden;
  position: relative;
  width: min(375px, 100vw);
}

.screen {
  display: flex;
  flex-direction: column;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translateY(14px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.call-bg,
.call-bg-blur,
.video-shade {
  inset: 0;
  position: absolute;
}

.call-bg {
  background: var(--bg);
  overflow: hidden;
}

.call-bg-blur {
  background: url("../assets/bottle-label.png") center / cover;
  filter: blur(26px) saturate(0.46) brightness(0.34);
  transform: scale(1.12);
}

.call-bg::after {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.52), transparent 34%),
    linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 46%);
  content: "";
  inset: 0;
  position: absolute;
}

.call-ring {
  animation: ring 2.4s ease-out infinite;
  border: 1.5px solid rgba(232, 160, 122, 0.28);
  border-radius: 50%;
  height: 240px;
  left: calc(50% - 120px);
  position: absolute;
  top: 74px;
  width: 240px;
}

.ring-two { animation-delay: 0.8s; }
.ring-three { animation-delay: 1.6s; }

@keyframes ring {
  from { opacity: 0.7; transform: scale(0.58); }
  to { opacity: 0; transform: scale(1.85); }
}

.status-bar {
  align-items: center;
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 15px;
  font-weight: 700;
  justify-content: space-between;
  padding: 14px 22px 0;
  position: relative;
  z-index: 3;
}

.status-icons {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.caller {
  align-items: center;
  display: flex;
  flex-direction: column;
  padding-top: 32px;
  position: relative;
  text-align: center;
  z-index: 2;
}

.avatar-ring-wrap {
  align-items: center;
  display: flex;
  height: 108px;
  justify-content: center;
  position: relative;
  width: 108px;
}

.avatar-pulse {
  animation: breathe 2.2s ease-out infinite;
  border: 1.5px solid rgba(232, 160, 122, 0.62);
  border-radius: 50%;
  height: 100px;
  position: absolute;
  width: 100px;
}

.pulse-two { animation-delay: 0.7s; }
.pulse-three { animation-delay: 1.4s; }

@keyframes breathe {
  0%, 100% { opacity: 0.54; transform: scale(1); }
  60% { opacity: 0; transform: scale(1.78); }
}

.avatar-img {
  border: 2.5px solid rgba(232, 160, 122, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(232, 160, 122, 0.15), 0 8px 32px rgba(0, 0, 0, 0.5);
  height: 96px;
  object-fit: cover;
  object-position: center 20%;
  position: relative;
  width: 96px;
  z-index: 2;
}

.call-label,
.panel-kicker {
  color: rgba(232, 160, 122, 0.78);
  font-family: "Times New Roman", Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.2em;
}

.call-label { margin-top: 28px; }

.call-name {
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 26px;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-top: 8px;
}

.call-sub {
  color: rgba(255, 255, 255, 0.65);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  margin-top: 8px;
}

.private-badge {
  align-items: center;
  background: var(--rose-soft);
  border: 1px solid rgba(232, 160, 122, 0.5);
  border-radius: 20px;
  color: rgba(232, 160, 122, 0.95);
  display: flex;
  font-size: 9px;
  gap: 7px;
  letter-spacing: 0.12em;
  margin-top: 12px;
  padding: 5px 14px;
}

.private-badge span {
  background: var(--rose);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--rose);
  height: 6px;
  width: 6px;
}

.facetime-tools {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-top: auto;
  padding: 0 20px 28px;
  position: relative;
  z-index: 2;
}

.tool-btn {
  align-items: center;
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-btn span:last-child,
.call-action small {
  color: rgba(255, 255, 255, 0.76);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 11px;
}

.tool-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: white;
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 11px;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.tool-icon svg {
  fill: none;
  height: 27px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 27px;
}

.tool-btn.is-active .tool-icon {
  background: rgba(255, 255, 255, 0.9);
  color: #161616;
}

.call-actions {
  display: flex;
  justify-content: space-around;
  padding: 0 40px 52px;
  position: relative;
  z-index: 2;
}

.call-action {
  align-items: center;
  background: none;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.call-action span {
  align-items: center;
  border-radius: 50%;
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  font-weight: 700;
  height: 74px;
  justify-content: center;
  width: 74px;
}

.phone-symbol {
  fill: currentColor;
  height: 30px;
  width: 30px;
}

.call-decline .phone-symbol {
  transform: rotate(134deg);
}

.call-accept .phone-symbol {
  transform: rotate(-46deg);
}

.call-action:active span { transform: scale(0.93); }
.call-decline span { background: var(--red); box-shadow: 0 6px 24px rgba(255, 59, 48, 0.55); }
.call-accept span { background: var(--green); box-shadow: 0 6px 24px rgba(52, 199, 89, 0.55); }

.screen-video {
  background: #000;
  /* Variante « chien plus grand » : la vidéo occupe une grande bande haute
     (--dog-h % de la hauteur du cadre) en object-fit cover ; le panneau compact
     se cale juste en dessous. Quand des choix sont affichés, la bande se réduit
     (.is-asking) pour laisser la place. Les % de top/height se réfèrent tous à
     la hauteur du cadre → cohérent desktop/mobile. */
  --dog-h: 66%;
}

.arrival-video,
.departure-video,
.avatar-scene,
.avatar-scene video {
  inset: 0;
  position: absolute;
}

.arrival-video,
.departure-video,
.avatar-scene video {
  height: 100%;
  object-fit: cover;
  object-position: center;
  width: 100%;
}

.arrival-video,
.departure-video {
  filter: brightness(0.56) saturate(0.82);
  transition: opacity 480ms ease, filter 480ms ease;
  z-index: 1;
}

.arrival-video {
  opacity: 1;
}

.departure-video {
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.screen-video.is-avatar .arrival-video {
  opacity: 0;
}

.screen-video.is-departing .avatar-scene {
  opacity: 0;
}

.screen-video.is-departing .departure-video {
  opacity: 1;
}

.avatar-scene {
  background: #060403;
  opacity: 0;
  overflow: hidden;
  transition: opacity 520ms ease;
  z-index: 1;
}

.avatar-scene::before {
  background: url("../assets/saint-bernard.webp") center / cover;
  content: "";
  filter: blur(22px) saturate(0.8) brightness(0.42);
  inset: -24px;
  opacity: 0.62;
  position: absolute;
  transform: scale(1.12);
  z-index: 0;
}

.avatar-scene::after {
  background:
    radial-gradient(circle at 50% 34%, transparent 0 28%, rgba(0, 0, 0, 0.18) 54%, rgba(0, 0, 0, 0.76) 100%),
    linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent 46%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.screen-video.is-avatar .avatar-scene {
  opacity: 1;
}

/* Bernard agrandi et ancré en haut : pleine largeur, il occupe tout l'espace
   au-dessus d'une zone basse réservée au panneau question/réponse. Cette réserve
   fixe garantit qu'il n'est jamais masqué pendant qu'il parle ou attend, quelle
   que soit la hauteur d'écran (le formulaire e-mail, lui, peut le recouvrir). */
/* Bande vidéo réduite quand des choix sont affichés (laisse la place au Q/R). */
.screen-video.is-asking { --dog-h: 48%; }
/* Écrans courts : les choix (souvent sur 2-3 lignes) prennent plus de place,
   on réduit davantage la bande vidéo pour tout afficher sans rognage. */
@media (max-height: 740px) {
  .screen-video.is-asking { --dog-h: 39%; }
}

.avatar-scene video {
  filter: brightness(0.74) saturate(0.9);
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  transform: none;
  /* Grande bande haute, pleine largeur, remplie (cover) → Bernard imposant. */
  width: 100%;
  height: var(--dog-h);
  object-fit: cover;
  object-position: center 38%;
  transition: height 420ms ease, opacity 260ms ease;
  z-index: 1;
}

#vid-idle { opacity: 1; }
#vid-speak-a,
#vid-speak-b {
  opacity: 0;
}

#vid-idle { z-index: 1; }
#vid-speak-a { z-index: 3; }
#vid-speak-b { z-index: 4; }

/* Calque clip lip-syncé : par-dessus tout, joué une fois puis masqué en fondu */
#vid-clip {
  z-index: 5;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}
#vid-clip.is-playing { opacity: 1; }

.video-shade {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.22), transparent 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent 34%);
  z-index: 2;
}

.screen-video.is-avatar .video-shade {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.58), transparent 28%),
    linear-gradient(to top, rgba(0, 0, 0, 0.86), transparent 56%),
    rgba(44, 21, 32, 0.12);
}

.video-topbar {
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  justify-content: space-between;
  left: 0;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 22px 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 5;
}

.video-topbar strong,
.video-topbar span {
  display: block;
}

.video-time {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.video-topbar strong { font-size: 16px; }
.video-topbar span { color: rgba(255, 255, 255, 0.55); font-size: 12px; margin-top: 2px; }

.end-call-btn {
  align-items: center;
  background: var(--red);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.42);
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 31px;
  font-weight: 300;
  height: 48px;
  justify-content: center;
  line-height: 1;
  padding-bottom: 4px;
  width: 48px;
}

.conversation-panel,
.form-panel,
.confirm-panel,
.final-panel {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(232, 160, 122, 0.28);
  border-radius: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
  left: 14px;
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  padding: 18px;
  position: absolute;
  right: 14px;
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 7;
}

/* Le panneau se cale JUSTE SOUS la bande vidéo (bloc cohérent). Sa hauteur suit
   --dog-h : compact quand Bernard parle, plus grand quand il attend une réponse.
   (Le formulaire e-mail garde sa feuille basse et peut recouvrir Bernard.) */
.conversation-panel {
  top: calc(var(--dog-h) + 12px);
  bottom: auto;
  max-height: calc(100% - var(--dog-h) - 46px);
  transition: top 420ms ease, max-height 420ms ease;
  /* Colonne flex : la carte épouse son contenu (pas de vide) mais peut s'étendre
     jusqu'à max-height ; au-delà, seule la légende se réduit et défile. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conversation-panel .panel-kicker,
.conversation-panel .choices { flex-shrink: 0; }

.question-text {
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-style: italic;
  line-height: 1.28;
  margin-top: 7px;
  /* La légende remplit l'espace disponible dans la carte flex ; si la réplique
     dépasse (carte à sa hauteur max), elle se réduit et les premières lignes
     défilent hors champ vers le haut (JS cale sur le bas). */
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Fondu haut uniquement quand le texte déborde réellement (longue réplique) :
   les premières lignes s'estompent en défilant vers le haut. La classe est posée
   par le JS (revealText) selon le débordement — pas de fondu sur une question courte. */
.question-text.has-overflow {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.4em);
  mask-image: linear-gradient(to bottom, transparent 0, #000 1.4em);
}


.choices {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

/* Disparition en douceur des choix quand on a répondu */
.choices { transition: opacity 0.3s ease, transform 0.3s ease; }
.choices.is-hiding { opacity: 0; transform: translateY(10px); pointer-events: none; }


.choice-btn,
.animal-grid button,
.submit-btn,
.sound-unlock {
  border: 0;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-weight: 800;
  min-height: 46px;
}

.choice-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--ivory);
  padding: 11px 14px;
  text-align: left;
}

.choice-btn:disabled {
  opacity: 0.52;
}

.choice-btn.is-selected {
  background: rgba(223, 185, 79, 0.9);
  color: #1b0a06;
}

.sound-unlock {
  background: rgba(250, 245, 239, 0.94);
  bottom: calc(42px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  color: #1b0a06;
  left: 50%;
  min-width: 168px;
  opacity: 1;
  padding: 0 22px;
  position: absolute;
  transform: translateX(-50%);
  transition: opacity 240ms ease, transform 240ms ease;
  z-index: 8;
}

.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(14px) !important;
}

.sound-unlock.is-hidden {
  transform: translate(-50%, 8px) !important;
}

.form-panel h2,
.confirm-panel h2,
.final-panel h2 {
  color: white;
  font-size: 27px;
  line-height: 1.05;
  margin: 8px 0 8px;
}

.form-intro,
.confirm-panel p,
.final-panel p {
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.final-panel {
  text-align: center;
}

.final-panel h2 {
  font-size: 30px;
}

.ar-btn {
  margin-top: 16px;
}

.shop-link {
  align-items: center;
  border: 1px solid rgba(223, 185, 79, 0.46);
  border-radius: 999px;
  color: var(--ivory);
  display: flex;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  margin-top: 10px;
  min-height: 46px;
  text-decoration: none;
}

.shop-link:active {
  transform: scale(0.98);
}

.animal-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.animal-grid button {
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--ivory);
  padding: 10px 14px;
  text-align: left;
}

.animal-grid button.is-selected {
  background: rgba(223, 185, 79, 0.92);
  color: #1b0a06;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

label span {
  color: rgba(232, 160, 122, 0.9);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  min-height: 48px;
  outline: 0;
  padding: 0 14px;
}

.submit-btn {
  background: linear-gradient(135deg, var(--rose), #d4856a);
  color: #1a1008;
  margin-top: 12px;
  width: 100%;
}

.submit-btn:disabled {
  filter: grayscale(1);
  opacity: 0.45;
}

/* Section « Cadeaux à gagner » dans le formulaire (photo goodies, sans lister les lots) */
.gifts-block { margin: 14px 0 2px; }
.gifts-block .panel-kicker { margin-bottom: 8px; }
.gifts-photo {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--rose-soft);
}
.gifts-cap {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  margin: 8px 0 0;
  line-height: 1.4;
}

/* ── Consentement RGPD / âge / marketing ── */
.consent {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  cursor: pointer;
}

.consent-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin-top: 1px;
  border: 1px solid rgba(232, 160, 122, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
  display: grid;
  place-content: center;
  cursor: pointer;
}

.consent-item input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: var(--rose);
}

.consent-item input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.consent-item span {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.consent-item a {
  color: var(--rose);
  text-decoration: underline;
}

.consent-item em {
  color: rgba(255, 255, 255, 0.4);
  font-style: normal;
}

.legal-warning {
  margin-top: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.legal-links {
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 11px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
}

.legal-links a {
  color: rgba(232, 160, 122, 0.7);
  text-decoration: none;
}

.legal-links a:hover {
  text-decoration: underline;
}

@media (max-width: 430px), (max-height: 840px) {
  body {
    align-items: stretch;
    justify-content: stretch;
  }

  .stage {
    border-radius: 0;
    box-shadow: none;
    height: 100dvh;
    width: 100vw;
  }
}

@media (max-height: 700px) {
  .conversation-panel,
  .form-panel,
  .confirm-panel,
  .final-panel {
    border-radius: 20px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 14px;
  }

  .question-text {
    font-size: 18px;
    line-height: 1.22;
  }

  .choice-btn,
  .animal-grid button {
    padding: 9px 12px;
  }

  .form-panel h2,
  .confirm-panel h2,
  .final-panel h2 {
    font-size: 23px;
  }
}

/* ── Écrans courts (iPhone SE/8 ~667px, paysage) : formulaire compact ────────
   Les cases de consentement allongent le formulaire ; on resserre pour garder
   le bouton « Participer » proche du pli. Le panneau reste défilable au besoin. */
@media (max-height: 740px) {
  .form-panel h2 { font-size: 21px; margin: 4px 0 3px; }
  .form-intro { font-size: 12.5px; line-height: 1.35; margin-bottom: 2px; }
  .animal-grid { gap: 6px; margin: 9px 0; }
  .animal-grid button { padding: 8px 14px; }
  .form-panel label { margin-top: 8px; }
  .form-panel input { min-height: 42px; }
  .consent { gap: 8px; margin-top: 11px; }
  .consent-item span { font-size: 12px; }
  .submit-btn { margin-top: 9px; }
  .legal-warning { margin-top: 9px; }
  .legal-links { margin-top: 5px; }
}
