:root {
  --pink: #ff85a8;
  --pink-dark: #e85d8a;
  --pink-light: #ffd4e1;
  --pink-pale: #fff0f5;
  --cream: #fffaf3;
  --ink: #4a3540;
  --muted: #8a6b78;
  --green: #a8e6b8;
  --green-dark: #2f9e5a;
  --orange: #ffd6a3;
  --orange-dark: #d97b1a;
  --shadow: 0 18px 50px rgba(232, 93, 138, 0.18);
  --radius: 28px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Quicksand", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #ffe6ee;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Fond ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, #fff7fb 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 110%, #ffd0df 0%, transparent 60%),
    linear-gradient(180deg, #fff3f7 0%, #ffe3ec 55%, #ffd6e4 100%);
}

.hills {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 26vh;
  z-index: 1;
  pointer-events: none;
}
.hill {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -40%;
  height: 100%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transition: transform .4s ease-out;
}
.hill-back {
  background: #ffc9da;
  bottom: -30%;
  opacity: .8;
}
.hill-front {
  background: #ffb9cf;
  left: -20%;
  right: 20%;
  bottom: -55%;
}

#petals {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.branch {
  position: fixed;
  top: -10px;
  left: -20px;
  width: min(420px, 70vw);
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(120, 60, 80, .15));
  transition: transform .4s ease-out;
  transform-origin: top left;
  animation: sway 6s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { rotate: 0deg; }
  50% { rotate: 1.2deg; }
}
.bloom { transform-box: fill-box; transform-origin: center; animation: bloom 4s ease-in-out infinite; }
.blossoms > g:nth-child(2n) .bloom { animation-delay: -1.3s; }
.blossoms > g:nth-child(3n) .bloom { animation-delay: -2.6s; }
@keyframes bloom {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(6deg); }
}

/* ---------- Bouton retour ---------- */
.back-btn {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 2;
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 6px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .2s, transform .18s;
}
.back-btn:hover { opacity: 1; transform: translateX(-2px); }

/* ---------- Pages ---------- */
#app {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px 48px;
}

.page {
  display: none;
  width: 100%;
  justify-content: center;
}
.page.is-active {
  display: flex;
  animation: page-in .55s cubic-bezier(.22, 1, .36, 1);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 30px;
  text-align: center;
}
.card-wide { max-width: 620px; }
.card:has(.back-btn) { padding-top: 46px; }

.emoji-big {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.title {
  font-family: "Pacifico", cursive;
  font-weight: 400;
  font-size: clamp(28px, 6vw, 38px);
  margin: 0 0 8px;
  color: var(--pink-dark);
}
.lead {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.55;
  margin: 0 0 22px;
}
.lead em { font-style: normal; color: var(--pink-dark); font-weight: 700; }
.sub {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  margin: 14px 0 10px;
}
.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
}

.feedback {
  min-height: 1.4em;
  font-weight: 700;
  color: var(--pink-dark);
  margin: 0 0 14px;
  transition: opacity .3s;
}
.feedback.pop { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop {
  from { transform: scale(.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Page de garde ---------- */
.riddle {
  background: var(--pink-pale);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 18px;
}
.riddle em { font-style: normal; color: var(--muted); font-weight: 500; }
.gate-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.gate-input {
  width: auto;
  flex: 1 1 140px;
  max-width: 200px;
  text-align: center;
  font-size: 18px;
  -moz-appearance: textfield;
}
.gate-input::-webkit-outer-spin-button, .gate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.card.is-shaking { animation: shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ---------- Boutons ---------- */
.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s, background .2s, opacity .3s;
  text-decoration: none;
  display: inline-block;
  color: var(--ink);
}
.btn:hover { transform: translateY(-3px) scale(1.04); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(232, 93, 138, .35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(232, 93, 138, .45); }

.btn-soft {
  background: var(--pink-pale);
  color: var(--pink-dark);
  border: 2px solid var(--pink-light);
}

.btn-option {
  background: #fff;
  border: 2px solid var(--pink-light);
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.btn-option { flex-wrap: wrap; }
.btn-option span { font-weight: 600; color: var(--muted); font-size: 14px; }
.option-note {
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}
.btn-option:hover { border-color: var(--pink); background: var(--pink-pale); }
.btn-option-alt { justify-content: center; background: var(--cream); }
.btn-option.is-selected { border-color: var(--pink-dark); background: var(--pink-pale); }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}
.choices-col { flex-direction: column; align-items: stretch; }
.next-wrap { margin-top: 18px; }

.btn.is-fleeing {
  position: fixed;
  z-index: 50;
  transition: left .35s cubic-bezier(.34, 1.56, .64, 1), top .35s cubic-bezier(.34, 1.56, .64, 1), transform .18s;
}
.btn.is-vanishing {
  animation: vanish .6s cubic-bezier(.34, 1.56, .64, 1) forwards;
  pointer-events: none;
}
@keyframes vanish {
  30% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(0) rotate(-30deg); opacity: 0; width: 0; padding: 0; margin: 0; }
}

/* ---------- Chips ---------- */
.block { margin: 18px 0 6px; text-align: left; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chips-col { flex-direction: column; align-items: stretch; }
.chips-col .chip { text-align: left; }

.chip {
  appearance: none;
  border: 2px solid var(--pink-light);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .2s, border-color .2s, color .2s;
}
.chip:hover { transform: translateY(-2px) scale(1.03); border-color: var(--pink); }
.chip.is-on {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(232, 93, 138, .3);
}
.chip-big {
  width: 100%;
  font-size: 17px;
  padding: 14px 18px;
  text-align: left;
}

.meal + .meal { margin-top: 10px; }

.sub-block {
  margin: 12px 0 4px 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--pink-light);
  animation: page-in .4s cubic-bezier(.22, 1, .36, 1);
}
.sub-block .sub { margin-top: 0; }

.text-input {
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid var(--pink-light);
  outline: none;
  width: 100%;
  background: #fff;
}
.text-input:focus { border-color: var(--pink); }

/* ---------- Calendrier ---------- */
.calendar-wrap { margin-top: 20px; animation: page-in .5s cubic-bezier(.22, 1, .36, 1); }
.cal {
  background: #fff;
  border-radius: 20px;
  padding: 14px;
  border: 2px solid var(--pink-light);
}
.cal-head {
  font-family: "Pacifico", cursive;
  color: var(--pink-dark);
  font-size: 22px;
  margin-bottom: 10px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  padding: 4px 0;
}
.cal-day {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  aspect-ratio: 1;
  border-radius: 14px;
  background: #f7eef2;
  color: #c3aab5;
  cursor: default;
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.cal-day.is-empty { background: transparent; }
.cal-day.is-past { opacity: .45; text-decoration: line-through; }
.cal-day.is-green { background: var(--green); color: #1d6b3b; cursor: pointer; }
.cal-day.is-orange { background: var(--orange); color: #8a4c0a; cursor: pointer; }
.cal-day.is-green:hover, .cal-day.is-orange:hover { transform: scale(1.12); box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.cal-day.is-selected { outline: 3px solid var(--pink-dark); outline-offset: 2px; transform: scale(1.1); }

.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.dot-green { background: var(--green); }
.dot-orange { background: var(--orange); }

.day-note {
  background: var(--pink-pale);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 600;
  animation: pop .4s cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- Invitation ---------- */
.invite { position: relative; overflow: hidden; }
.invite-ribbon {
  display: inline-block;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: #fff;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 999px;
  margin-bottom: 14px;
  animation: pop .6s cubic-bezier(.34, 1.56, .64, 1);
}
.invite-box {
  background: #fff;
  border: 2px dashed var(--pink-light);
  border-radius: 20px;
  padding: 18px 20px;
  text-align: left;
  display: grid;
  gap: 12px;
}
.invite-row { display: flex; gap: 14px; align-items: baseline; }
.invite-row-col { flex-direction: column; gap: 6px; }
.invite-k { font-weight: 700; color: var(--pink-dark); min-width: 92px; }
.invite-v { font-weight: 600; }
.invite-list { margin: 0; padding-left: 20px; font-weight: 600; line-height: 1.7; }

@media (max-width: 520px) {
  .card { padding: 28px 20px; }
  .lead { font-size: 17px; }
  .btn { padding: 12px 20px; font-size: 15px; }
  .branch { width: 62vw; }
  .invite-row { flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .branch, .bloom, .emoji-big { animation: none; }
}
