:root {
  --bg: #FFF4E2;
  --card: #FFFCF6;
  --ink: #2C4A2E;
  --ink-soft: #62775F;
  --line: #2C4A2E;
  --bark: #4E6B3A;
  --leaf: #79B358;
  --leaf-deep: #3F7F3A;
  --pink: #F49AB2;
  --coral: #E8574A;
  --coral-soft: #FFE4DC;
  --green-soft: #E6F3D9;
  --yolk: #FFD04A;
  --ghost: #E9DABD;
  --radius: 18px;
  --shadow: 0 4px 0 var(--line);
  --app-h: 100vh;
  color-scheme: light;
}
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: var(--app-h);
  background:
    radial-gradient(120% 60% at 110% -10%, #FDE3D3 0, transparent 55%),
    radial-gradient(90% 50% at -20% 110%, #E9F1D6 0, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
img { display: block; }
button { font: inherit; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
/* Les titres reçoivent le focus à chaque écran (lecteurs d'écran) : pas de contour */
h1:focus-visible, h2:focus-visible { outline: none; }

/* ---------- Ses têtes qui flottent derrière le site ---------- */
.floaters { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.floater {
  position: absolute;
  width: 74px;
  height: auto;
  opacity: .5;
  filter: drop-shadow(0 4px 6px rgba(44, 74, 46, .18));
  animation: 26s ease-in-out infinite;
  transition: opacity .4s ease;
  -webkit-user-drag: none;
  user-select: none;
}
/* Chaque tête fait sa propre balade à travers l'écran, puis revient à son point de départ */
.floater--1 { top: 9px;  left: -22px;  width: 62px; animation-name: wander-1; animation-duration: 24s; }
.floater--2 { top: 5%;   right: -14px;              animation-name: wander-2; animation-duration: 29s; animation-delay: -9s; }
.floater--3 { top: 56%;  right: -20px; width: 82px; animation-name: wander-3; animation-duration: 33s; animation-delay: -15s; }
.floater--4 { top: 80%;  left: -18px;  width: 70px; animation-name: wander-4; animation-duration: 27s; animation-delay: -5s; }
@keyframes wander-1 {
  0%, 100% { transform: translate(0, 0) rotate(-10deg); }
  25% { transform: translate(38vw, 16vh) rotate(8deg); }
  50% { transform: translate(72vw, 4vh) rotate(-4deg); }
  75% { transform: translate(30vw, 30vh) rotate(14deg); }
}
@keyframes wander-2 {
  0%, 100% { transform: translate(0, 0) rotate(12deg); }
  30% { transform: translate(-34vw, 24vh) rotate(-8deg); }
  55% { transform: translate(-66vw, 8vh) rotate(6deg); }
  80% { transform: translate(-22vw, 38vh) rotate(-14deg); }
}
@keyframes wander-3 {
  0%, 100% { transform: translate(0, 0) rotate(-7deg); }
  25% { transform: translate(-48vw, -22vh) rotate(10deg); }
  50% { transform: translate(-74vw, 12vh) rotate(-12deg); }
  75% { transform: translate(-26vw, 24vh) rotate(5deg); }
}
@keyframes wander-4 {
  0%, 100% { transform: translate(0, 0) rotate(9deg); }
  30% { transform: translate(36vw, -18vh) rotate(-10deg); }
  60% { transform: translate(70vw, 4vh) rotate(12deg); }
  85% { transform: translate(28vw, -36vh) rotate(-6deg); }
}
/* Sur le ticket, les têtes s'effacent un peu pour que la capture reste lisible */
.on-ticket .floater { opacity: .3; }
.on-ticket .floater--4 { opacity: 0; }

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: var(--app-h);
  max-width: 460px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

/* ---------- Branche de progression ---------- */
.branch { flex: none; height: 46px; }
.branch svg { display: block; width: 100%; height: 100%; overflow: visible; }
.branch__ghost { fill: none; stroke: var(--ghost); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 7; }
.branch__grow { fill: none; stroke: var(--bark); stroke-width: 5; stroke-linecap: round; }
.branch__bud { fill: var(--leaf); stroke: var(--bark); stroke-width: 1.5; transition: opacity .3s; }
.branch__bud.is-gone { opacity: 0; }
.leaf { fill: var(--leaf); stroke: var(--leaf-deep); stroke-width: 1; transform-box: fill-box; transform-origin: 0% 50%; transform: scale(0); transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }
.leaf.on { transform: scale(1); }
.flower { fill: var(--pink); stroke: #D9718F; stroke-width: 1; transform-box: fill-box; transform-origin: center; transform: scale(0) rotate(-90deg); transition: transform .7s cubic-bezier(.34, 1.56, .64, 1); }
.flower__heart { fill: var(--yolk); stroke: #E0A92A; }
.branch__flower.on .flower { transform: scale(1) rotate(0deg); }

/* ---------- Écrans ---------- */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 10px 0 6px; }
.screen { display: flex; flex-direction: column; gap: 22px; animation: screen-in .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(16px); } }

.kicker {
  align-self: flex-start;
  margin-bottom: -8px;
  padding: 5px 12px 6px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--line);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}
.title { font-size: 31px; line-height: 1.12; font-weight: 850; letter-spacing: -.01em; }
.lead { font-size: 19px; line-height: 1.45; font-weight: 600; color: var(--ink-soft); margin-top: -8px; }
.lead em { font-style: normal; color: var(--ink); box-shadow: inset 0 -.45em 0 #FCD6E0; }
.q { font-size: 26px; line-height: 1.2; font-weight: 850; letter-spacing: -.01em; }

.choices { display: flex; flex-direction: column; gap: 12px; }
.btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 58px;
  padding: 14px 18px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s ease;
}
.btn:active, .btn.is-picked { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn.is-picked { background: var(--green-soft); }
.btn--primary { background: var(--ink); color: var(--bg); box-shadow: 0 4px 0 #17291A; }
.btn--primary:active, .btn--primary.is-picked { background: var(--ink); box-shadow: 0 1px 0 #17291A; }
.choices.is-locked .btn:not(.is-picked) { opacity: .55; }

/* ---------- Têtes ---------- */
.face {
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ghost);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2.5px var(--line), 0 8px 18px rgba(44, 74, 46, .18);
  -webkit-user-drag: none;
  user-select: none;
}
.face--sm { width: 66px; height: 66px; }
.face--md { width: 74px; height: 74px; }
.face--lg { width: 150px; height: 150px; border-width: 4px; }
.face--xl { width: min(58vw, 220px); height: min(58vw, 220px); border-width: 5px; }

.guide { display: flex; flex-direction: column; gap: 14px; }
.guide__label { font-size: 16px; font-weight: 700; }
.faces-row { display: flex; justify-content: space-between; gap: 6px; }
.mood { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: hop .6s calc(.25s + var(--i) * .09s) cubic-bezier(.34, 1.56, .64, 1) both; }
.mood figcaption { font-size: 13px; font-weight: 750; color: var(--ink-soft); }
@keyframes hop { from { opacity: 0; transform: translateY(18px) scale(.6) rotate(-10deg); } }

/* ---------- Bulles ---------- */
.bubble {
  position: relative;
  max-width: 330px;
  padding: 14px 18px;
  border: 2.5px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
}
.bubble::before, .bubble::after { content: ""; position: absolute; left: 50%; width: 0; height: 0; border: solid transparent; }
.bubble::before { bottom: 100%; margin-left: -12px; border-width: 0 12px 14px; border-bottom-color: var(--line); }
.bubble::after { bottom: calc(100% - 4px); margin-left: -8.5px; border-width: 0 8.5px 10px; border-bottom-color: var(--card); }
.bubble--side { font-size: 17px; text-align: left; padding: 12px 15px; }
.bubble--side::before { left: auto; right: 100%; bottom: auto; top: 50%; margin: -11px 0 0; border-width: 11px 13px 11px 0; border-color: transparent var(--line) transparent transparent; }
.bubble--side::after { left: auto; right: calc(100% - 4px); bottom: auto; top: 50%; margin: -7.5px 0 0; border-width: 7.5px 9px 7.5px 0; border-color: transparent var(--card) transparent transparent; }

/* ---------- Réaction (tête + réplique) ---------- */
.reaction {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 20px;
  background: rgba(255, 244, 226, .9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease;
  -webkit-user-select: none;
  user-select: none;
}
.reaction[hidden] { display: none; }
.reaction.show { opacity: 1; }
.reaction.show .face--xl { animation: pop .65s cubic-bezier(.34, 1.56, .64, 1) both; }
.reaction.show .bubble { animation: bubble-in .45s .18s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes pop { 0% { transform: scale(.2) rotate(-14deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes bubble-in { from { opacity: 0; transform: translateY(10px) scale(.92); } }
.timer { width: 110px; height: 5px; border-radius: 5px; overflow: hidden; background: rgba(44, 74, 46, .14); }
.timer i { display: block; height: 100%; background: var(--leaf-deep); transform-origin: left; animation: drain var(--dur, 1500ms) linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }
.skip { margin-top: -12px; font-size: 13px; font-weight: 650; color: var(--ink-soft); }

/* ---------- Red / green flag ---------- */
.flag-card {
  padding: 16px 18px 18px;
  border: 2.5px solid var(--line);
  border-radius: 20px;
  background: var(--coral-soft);
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.45;
}
.flag-card--green { background: var(--green-soft); }
.flag-card__tag { display: inline-block; margin-bottom: 8px; padding: 4px 11px; border-radius: 99px; background: var(--coral); color: #fff; font-size: 13px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.flag-card--green .flag-card__tag { background: var(--leaf-deep); }
.flag-card.is-past { padding: 12px 16px; font-size: 15px; opacity: .8; box-shadow: 0 2px 0 var(--line); }
.flag-card.is-past .flag-card__tag { margin-bottom: 4px; font-size: 11px; }
.flip-in { animation: flip-in .6s cubic-bezier(.2, .9, .3, 1.15) both; transform-origin: top center; }
@keyframes flip-in { from { opacity: 0; transform: perspective(700px) rotateX(-75deg); } }
.inline-react { display: flex; align-items: center; gap: 16px; animation: bubble-in .5s .45s cubic-bezier(.34, 1.56, .64, 1) both; }
.reveal { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Convaincs-moi ---------- */
.screen--arg { align-items: center; text-align: center; gap: 24px; }
.screen--arg .choices { align-self: stretch; }
.dots { display: flex; gap: 8px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ghost); }
.dots i.on { background: var(--leaf-deep); }
.illu {
  width: 190px;
  height: 190px;
  border: 2.5px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
  animation: hop .55s .05s cubic-bezier(.34, 1.56, .64, 1) both;
}
.screen--arg .bubble { font-size: 19px; }
.aside { font-size: .85em; font-weight: 650; color: var(--ink-soft); }
.q .aside { display: block; margin-top: 6px; font-size: .62em; }

/* ---------- Ticket ---------- */
.screen--ticket { gap: 16px; }
.ticket-wrap {
  filter: drop-shadow(2.5px 0 0 var(--line)) drop-shadow(-2.5px 0 0 var(--line)) drop-shadow(0 2.5px 0 var(--line)) drop-shadow(0 -2.5px 0 var(--line)) drop-shadow(0 4px 0 var(--line));
  animation: ticket-in .75s cubic-bezier(.2, .9, .25, 1.15) both;
}
@keyframes ticket-in { from { opacity: 0; transform: translateY(-26px) rotate(-3deg); } }
.ticket { --notch: 13px; }
.ticket__main, .ticket__stub { background: var(--card); }
.ticket__main {
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 100%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket__stub {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 0 0 18px 18px;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 0, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket__stub::before { content: ""; position: absolute; top: -1.5px; left: calc(var(--notch) + 8px); right: calc(var(--notch) + 8px); border-top: 3px dashed var(--line); opacity: .55; }
.ticket__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 18px; background: var(--ink); color: var(--bg); }
.ticket__brand { font-size: 15px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.ticket__no { font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; opacity: .85; }
.ticket__rows { display: flex; flex-direction: column; gap: 8px; padding: 13px 18px 17px; }
.row { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 1px; }
.row dt { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.row dd { font-size: 16px; font-weight: 750; line-height: 1.3; }
.row--date { margin-top: 3px; align-items: center; }
.stamp { display: inline-block; padding: 3px 10px; border: 2.5px solid var(--leaf-deep); border-radius: 9px; color: var(--leaf-deep); font-size: 17px; font-weight: 900; transform: rotate(-2deg); }
.stamp--soft { border-color: var(--ink-soft); color: var(--ink-soft); }
.barcode { flex: 1; height: 40px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 17px); opacity: .9; }
.stub-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; font-weight: 750; line-height: 1.35; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.stub-meta b { font-size: 13px; color: var(--ink); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.face--stub { width: 52px; height: 52px; border-width: 2.5px; box-shadow: 0 0 0 2px var(--line); }
.cta { font-size: 16px; font-weight: 650; line-height: 1.5; text-align: center; padding: 0 4px; }
.secret {
  display: inline-block;
  margin: 6px 1px 0;
  padding: 2px 13px 3px;
  border: 2.5px solid var(--line);
  border-radius: 12px;
  background: var(--yolk);
  box-shadow: 0 3px 0 var(--line);
  font-size: 1.4em;
  font-weight: 900;
  letter-spacing: .02em;
  transform: rotate(-3deg);
  animation: wiggle 2.8s 1s ease-in-out infinite;
}
.cta--exit { margin-top: -4px; font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--ink-soft); }
.secret--exit { margin: 0 1px; padding: 0 9px 1px; border-width: 2px; border-radius: 9px; background: #DCE8B8; box-shadow: 0 2px 0 var(--line); color: var(--ink); font-size: 1.12em; transform: rotate(2deg); animation: none; }
@keyframes wiggle { 0%, 82%, 100% { transform: rotate(-3deg); } 88% { transform: rotate(3deg) scale(1.06); } 94% { transform: rotate(-4deg); } }

/* Petites feuilles qui tombent à l'arrivée du ticket */
.confetti { position: fixed; inset: 0; z-index: 15; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 12px; border-radius: 0 100% 0 100%; background: var(--leaf); animation: fall var(--t, 2.2s) var(--d, 0s) cubic-bezier(.3, .6, .5, 1) forwards; }
.confetti i:nth-child(3n) { background: var(--pink); border-radius: 50%; width: 9px; height: 9px; }
@keyframes fall { to { transform: translate(var(--x, 0), 110vh) rotate(540deg); } }

.noscript { padding: 40px 20px; font-size: 18px; text-align: center; }

/* ---------- Petits écrans ---------- */
@media (max-height: 640px) {
  .screen { gap: 18px; }
  .title { font-size: 28px; }
  .lead { font-size: 17px; }
  .q { font-size: 24px; }
  .btn { min-height: 54px; padding: 12px 16px; font-size: 17px; }
  .face--lg { width: 124px; height: 124px; }
  .illu { width: 150px; height: 150px; border-radius: 24px; }
  .screen--ticket { gap: 12px; }
  .ticket__rows { gap: 6px; padding: 11px 16px 15px; }
  .cta { font-size: 15px; }
}

/* ---------- Mouvement réduit : plus de rebonds, juste des fondus ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reaction { transition: opacity .2s ease !important; }
  .timer, .confetti { display: none; }
  .secret { animation: none; }
}
