@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url("fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #FFF0F3;
  --dots: #FFD6E0;
  --red: #D7263D;
  --red-dark: #A3142B;
  --pink: #FF8FAB;
  --pink-soft: #FFD0DC;
  --pink-pale: #FFE7ED;
  --ink: #4A1020;
  --muted: #8C4A5C;
  --card: #FFFFFF;
  --shadow: 0 10px 0 #F4B5C5, 0 18px 40px rgba(163, 20, 43, .14);
  --display: "Fredoka", "Trebuchet MS", sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 2.5px, transparent 2.6px);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- décor flottant ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky svg {
  position: absolute;
  width: var(--s, 28px); height: var(--s, 28px);
  opacity: var(--o, .5);
  animation: drift var(--d, 9s) ease-in-out infinite alternate;
  animation-delay: var(--dl, 0s);
}
@keyframes drift {
  from { transform: translate(0, 0) rotate(var(--r0, -10deg)); }
  to   { transform: translate(var(--dx, 10px), var(--dy, -24px)) rotate(var(--r1, 12deg)); }
}

/* ---------- écrans ---------- */
.stage {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px;
  margin: 0 auto;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}
.screen { display: none; flex: 1; flex-direction: column; justify-content: center; }
.screen.is-active { display: flex; animation: screen-in .6s var(--bounce) both; }
.screen.is-leaving { display: flex; animation: screen-out .35s ease-in both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(30px) scale(.96); } }
@keyframes screen-out { to { opacity: 0; transform: translateY(-20px) scale(.97); } }

.card {
  position: relative;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 28px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-family: var(--display); font-weight: 700;
  font-size: 1.7rem; line-height: 1.15;
  color: var(--red); margin: 0 0 12px;
}
.card p { margin: 0 0 12px; }
.center { text-align: center; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 26px;
  background: var(--red); color: #fff;
  border: 3px solid var(--ink); border-radius: 999px;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition: transform .15s var(--bounce), box-shadow .15s, background .2s;
}
.btn svg { width: 24px; height: 24px; color: var(--pink-soft); transition: transform .3s var(--bounce); }
.btn:hover { transform: translateY(-2px); background: #E2334A; }
.btn:hover svg { transform: rotate(-18deg) scale(1.15); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible, .opt:focus-visible, .swatch:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.btn:disabled { background: #E9B8C3; color: #fff; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 #C9909D; border-color: #C9909D; }
.btn-ghost { background: #fff; color: var(--red); }
.btn-ghost:hover { background: var(--pink-pale); }
.btn-big { width: 100%; min-height: 60px; font-size: 1.3rem; margin-top: 8px; }

.link-btn {
  background: none; border: 0; padding: 8px 10px; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: .95rem;
  text-decoration: underline; text-decoration-style: wavy; text-decoration-color: var(--pink);
  text-underline-offset: 5px; border-radius: 10px;
}
.link-btn:hover { color: var(--red); }
.link-btn[aria-pressed="true"] { color: var(--red); text-decoration-style: solid; }

/* ---------- accueil ---------- */
.hero { text-align: center; margin-bottom: 30px; }
.hello {
  font-family: var(--display); font-weight: 500; font-size: 1.4rem;
  color: var(--muted); margin: 0; letter-spacing: .04em;
  animation: pop-in .6s .1s var(--bounce) both;
}
.name { margin: 0; font-family: var(--display); font-weight: 700; line-height: .95; }
.name-main {
  display: block; font-size: clamp(4.2rem, 21vw, 6.6rem); color: var(--red);
  text-shadow: 4px 4px 0 var(--pink), 7px 7px 0 var(--ink);
  letter-spacing: .01em;
}
.name-main .ch { display: inline-block; animation: letter-in .7s var(--bounce) both; }
@keyframes letter-in { from { opacity: 0; transform: translateY(-60px) rotate(-12deg) scale(.6); } }
.name-sub {
  position: relative; display: inline-block; margin-top: 10px;
  font-size: clamp(2rem, 10vw, 2.8rem); color: var(--ink);
  background: var(--pink-soft); padding: 2px 18px 6px; border-radius: 999px;
  border: 3px solid var(--ink);
  transform: rotate(-3deg);
  animation: pop-in .6s .9s var(--bounce) both;
}
.r { display: inline-block; animation: rrr 1.2s ease-in-out infinite; }
.r:nth-child(2) { animation-delay: .1s; } .r:nth-child(3) { animation-delay: .2s; } .r:nth-child(4) { animation-delay: .3s; }
@keyframes rrr { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-5px) rotate(-8deg); } 50% { transform: translateY(0) rotate(8deg); } }
.name-star {
  position: absolute; right: -22px; top: -20px; width: 42px; height: 42px; color: #FFC93C;
  filter: drop-shadow(2px 2px 0 var(--ink));
  animation: spin-star 4s linear infinite;
}
@keyframes spin-star { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(1.2); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.4) rotate(-10deg); } }

.welcome-card { margin-top: 26px; animation: pop-in .7s 1.1s var(--bounce) both; }
.peek-cat {
  position: absolute; width: 96px; height: 88px; top: -62px; right: 26px;
  animation: peek 5s ease-in-out infinite;
}
.peek-cat .eyes { transform-origin: 50px 53px; animation: blink 4s infinite; }
.peek-cat .ear-l { transform-origin: 30px 40px; animation: ear 3s infinite; }
.peek-cat .ear-r { transform-origin: 70px 40px; animation: ear 3s .4s infinite; }
@keyframes peek { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.1); } }
@keyframes ear { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(6deg); } }
.paws-over { position: absolute; top: -14px; right: 40px; display: flex; gap: 26px; }
.paws-over svg { width: 26px; height: 26px; color: #fff; }
.paws-over svg use { stroke: var(--ink); stroke-width: 7px; }

.welcome-card .lead { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--red); margin-bottom: 10px; }
.welcome-card .sign { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--red); margin-bottom: 18px; }
.facts { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.facts li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; font-size: .95rem; }
.facts svg { width: 20px; height: 20px; color: var(--pink); flex: none; }

.ground { position: relative; height: 110px; margin-top: 18px; }
.ground svg { position: absolute; bottom: 0; }
.g-cat-1 { left: 0; width: 82px; height: 96px; animation: sway 3s ease-in-out infinite; transform-origin: bottom center; }
.g-horse { left: 50%; width: 130px; height: 100px; margin-left: -65px; animation: hop 1.8s ease-in-out infinite; }
.g-cat-2 { right: 0; width: 104px; height: 60px; animation: breathe 3.4s ease-in-out infinite; transform-origin: bottom center; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px) rotate(-3deg); } 60% { transform: translateY(0); } }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .95); } }

/* ---------- consentement / refus ---------- */
.consent-card { padding-top: 64px; }
.consent-cat { position: absolute; width: 90px; height: 104px; top: -58px; left: 50%; margin-left: -45px; animation: sway 3s ease-in-out infinite; transform-origin: bottom center; }
.consent-q { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--red); margin-top: 6px; }
.consent-btns, .done-btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.consent-btns .btn, .done-btns .btn { flex: 1 1 180px; }
.refused-cat { width: 150px; height: 86px; margin: 0 auto 10px; display: block; --fur: #fff; animation: breathe 3.4s ease-in-out infinite; }

/* ---------- progression ---------- */
.progress { position: relative; height: 44px; margin: 4px 6px 22px; }
.progress-track {
  position: absolute; left: 0; right: 0; top: 16px; height: 16px;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #E5465B 10px 20px);
  background-size: 28px 28px;
  animation: stripes 1s linear infinite;
  transition: width .6s var(--bounce);
}
@keyframes stripes { to { background-position: 28px 0; } }
.progress-cat {
  position: absolute; top: 0; width: 46px; height: 42px; margin-left: -23px; left: 0%;
  transition: left .6s var(--bounce);
  animation: bob .5s ease-in-out infinite alternate;
}
@keyframes bob { to { transform: translateY(-4px) rotate(6deg); } }

/* ---------- question ---------- */
.q-wrap { position: relative; }
.q-card { padding: 24px 20px 18px; }
.q-card.enter { animation: q-in .55s var(--bounce) both; }
.q-card.enter-back { animation: q-in-back .55s var(--bounce) both; }
.q-card.leave { animation: q-out .28s ease-in both; }
.q-card.leave-back { animation: q-out-back .28s ease-in both; }
@keyframes q-in { from { opacity: 0; transform: translateX(70px) rotate(4deg) scale(.95); } }
@keyframes q-in-back { from { opacity: 0; transform: translateX(-70px) rotate(-4deg) scale(.95); } }
@keyframes q-out { to { opacity: 0; transform: translateX(-70px) rotate(-5deg) scale(.95); } }
@keyframes q-out-back { to { opacity: 0; transform: translateX(70px) rotate(5deg) scale(.95); } }

.q-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-section {
  font-family: var(--display); font-weight: 700; font-size: .85rem; letter-spacing: .05em; text-transform: uppercase;
  background: var(--pink-pale); color: var(--red); border: 2px solid var(--pink); border-radius: 999px; padding: 3px 12px;
}
.q-count { font-family: var(--display); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-title { font-size: 1.6rem !important; margin-bottom: 4px !important; }
.q-hint { color: var(--muted); font-weight: 700; font-size: .95rem; margin-bottom: 18px !important; }

.opts { display: flex; flex-wrap: wrap; gap: 9px; }
.opts.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.opt {
  position: relative;
  min-height: 46px; padding: 9px 16px;
  background: #fff; color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: 16px;
  font-weight: 800; font-size: 1rem; line-height: 1.2;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform .18s var(--bounce), background .2s, color .2s, box-shadow .15s;
}
.opts.grid .opt { padding: 9px 4px; font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.opt:hover { transform: translateY(-2px) rotate(-1.5deg); background: var(--pink-pale); }
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.opt[aria-pressed="true"] { background: var(--red); color: #fff; animation: pop .4s var(--bounce); }
.opt[aria-pressed="true"]::after {
  content: ""; position: absolute; top: -9px; right: -7px; width: 20px; height: 20px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 90'%3E%3Cpath d='M50 86 C20 64 4 46 4 27 C4 13 15 4 28 4 C38 4 46 10 50 18 C54 10 62 4 72 4 C85 4 96 13 96 27 C96 46 80 64 50 86Z' fill='%23D7263D'/%3E%3C/svg%3E") center/12px no-repeat;
  border: 2px solid var(--ink); border-radius: 50%;
  animation: pop .4s var(--bounce);
}
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px 8px; }
.swatch { background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: .82rem; border-radius: 14px; }
.swatch .dot {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink); transition: transform .2s var(--bounce);
  display: grid; place-items: center;
}
.swatch:hover .dot { transform: scale(1.08) rotate(-6deg); }
.swatch .dot svg { width: 22px; height: 22px; color: #fff; opacity: 0; transform: scale(.3); transition: all .3s var(--bounce); filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.swatch[aria-pressed="true"] .dot { transform: scale(1.1); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--red); }
.swatch[aria-pressed="true"] .dot svg { opacity: 1; transform: scale(1); }
.swatch[aria-pressed="true"] { color: var(--red); }

.field {
  width: 100%; margin-top: 12px;
  font: inherit; font-weight: 700; color: var(--ink);
  background: var(--pink-pale); border: 2.5px solid var(--ink); border-radius: 16px;
  padding: 13px 16px; min-height: 52px;
  transition: box-shadow .2s, background .2s;
}
.opts + .field { margin-top: 14px; }
textarea.field { min-height: 110px; resize: vertical; }
.field::placeholder { color: #B98394; font-weight: 600; }
.field:focus { outline: none; background: #fff; box-shadow: 0 0 0 4px var(--pink); }
.field.reveal { animation: q-in .45s var(--bounce) both; }

.q-nav { display: flex; gap: 10px; margin-top: 22px; }
.q-nav .btn { min-height: 50px; }
.q-nav .btn-prev { flex: 0 0 auto; padding: 10px 18px; }
.q-nav .btn-next { flex: 1; }
.q-skip { text-align: center; margin-top: 10px; }
.skipped-note { display: block; color: var(--muted); font-size: .88rem; font-weight: 700; margin-top: 2px; }

.save-status { text-align: center; color: var(--muted); font-size: .85rem; font-weight: 700; min-height: 1.4em; margin: 14px 0 0; transition: opacity .4s; }

/* ---------- accès direct aux questions ---------- */
.jump-toggle {
  align-self: flex-end; margin-bottom: 10px;
  background: #fff; color: var(--red); cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 14px;
  font-family: var(--display); font-weight: 700; font-size: .95rem;
  box-shadow: 0 3px 0 var(--ink);
}
.jump-toggle[aria-expanded="true"] { background: var(--red); color: #fff; }
.jump-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px;
  background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 14px;
  margin-bottom: 16px; box-shadow: 0 6px 0 #F4B5C5;
  animation: q-in .4s var(--bounce) both;
}
.jump-panel[hidden] { display: none; }
.jump-btn {
  height: 42px; border-radius: 12px; cursor: pointer;
  border: 2.5px solid var(--ink); background: #fff; color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 1rem;
}
.jump-btn.done { background: var(--red); color: #fff; }
.jump-btn.skipped { background: var(--pink-soft); color: var(--muted); }
.jump-btn.current { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--pink); }
.jump-legend { grid-column: 1 / -1; margin: 4px 0 0; font-size: .82rem; font-weight: 700; color: var(--muted); }
/* ---------- fin ---------- */
.done-card { padding-top: 26px; }
.done-cats { display: flex; justify-content: center; gap: 4px; margin: -82px 0 12px; height: 96px; }
.done-cats svg { width: 78px; height: 92px; animation: jump .9s ease-in-out infinite; transform-origin: bottom center; }
.done-cats svg:nth-child(2) { animation-delay: .15s; width: 90px; height: 104px; margin-top: -10px; }
.done-cats svg:nth-child(3) { animation-delay: .3s; }
@keyframes jump { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(0) scale(1.08, .9); } 55% { transform: translateY(-22px) scale(.95, 1.06); } }
.done-card h2 { font-size: 2.1rem; }
.done-error { color: var(--red-dark); font-weight: 800; }

/* ---------- cheval qui galope ---------- */
.gallop { position: fixed; left: 0; right: 0; bottom: 4vh; height: 150px; pointer-events: none; z-index: 5; display: none; }
.gallop.run { display: block; }
.gallop-runner { position: absolute; bottom: 0; left: -200px; width: 140px; height: 150px; }
.gallop.run .gallop-runner { animation: cross 2.4s cubic-bezier(.45, .05, .55, .95) forwards; }
@keyframes cross { to { left: calc(100% + 60px); } }
.gallop-horse { position: absolute; bottom: 0; left: 0; width: 140px; height: 107px; }
.gallop.run .gallop-horse { animation: gallop-bob .28s ease-in-out infinite alternate; }
@keyframes gallop-bob { to { transform: translateY(-9px) rotate(-3deg); } }
.gallop-horse .leg { transform-box: fill-box; transform-origin: 50% 8%; }
.gallop.run .leg-a { animation: leg .28s ease-in-out infinite alternate; }
.gallop.run .leg-b { animation: leg .28s ease-in-out infinite alternate-reverse; }
.gallop.run .mane, .gallop.run .tail { transform-box: fill-box; transform-origin: 100% 0; animation: flutter .28s ease-in-out infinite alternate; }
@keyframes leg { from { transform: rotate(-28deg); } to { transform: rotate(28deg); } }
@keyframes flutter { from { transform: skewY(-6deg); } to { transform: skewY(6deg); } }
.gallop-banner {
  position: absolute; right: 70px; bottom: 96px;
  font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: #fff; white-space: nowrap;
  background: var(--red); border: 3px solid var(--ink); border-radius: 14px; padding: 3px 14px;
  box-shadow: 0 4px 0 var(--ink); transform: rotate(-4deg);
}

/* ---------- particules ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.fx svg { position: absolute; width: 18px; height: 18px; animation: burst .8s ease-out forwards; }
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(.4) rotate(0); opacity: 1; }
  to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--rot)); opacity: 0; }
}
.fx .confetti { animation: fall var(--d, 3s) cubic-bezier(.3, .2, .6, 1) forwards; }
@keyframes fall {
  from { transform: translate(0, -40px) rotate(0); opacity: 1; }
  85% { opacity: 1; }
  to { transform: translate(var(--x), 105vh) rotate(var(--rot)); opacity: 0; }
}

@media (min-width: 600px) {
  .stage { padding-top: 48px; }
  .card { padding: 32px 34px; }
  .q-card { padding: 30px 30px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .gallop { display: none !important; }
}
