/* ==========================================================================
   Приглашение для Настюши — «зефирное письмо»
   Светлая пастель, волнистые карточки-облачка, наклейки-моти.
   ========================================================================== */

@font-face {
  font-family: "Lisova";
  src: url("../fonts/lisova-bold.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  --paper: #fff6f9;
  --pink: #ff5c8a;
  --pink-2: #ff8db0;
  --pink-3: #ffc4d6;
  --pink-4: #ffe3ec;
  --pink-5: #fff0f5;
  --berry: #e23d6f;
  --edge: #d8336a;
  --sky: #cfe8f6;
  --sky-2: #9fd7f5;
  --butter: #ffd66b;
  --lilac: #ece6f6;
  --lilac-ink: #6f6390;
  --lilac-edge: #d6cce9;
  --ink: #3b1a2c;
  --ink-2: #7d5b6c;
  --ink-3: #b597a6;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --font: "Lisova", "Segoe Script", "Comic Sans MS", cursive;

  --top: calc(env(safe-area-inset-top, 0px) + 70px);
  --gutter: 14px;
  color-scheme: light;
}

/* ---------- База ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}

/* Ничто (даже повёрнутая карточка во время перехода) не должно расширять
   страницу по горизонтали — иначе телефон «отъезжает» и масштабирует сайт */
html,
body { overflow-x: hidden; }

@supports (overflow-x: clip) {
  html,
  body { overflow-x: clip; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 700 18px/1.35 var(--font);
  letter-spacing: .01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--sky-2); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

.ico {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.safe-probe {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  visibility: hidden;
  pointer-events: none;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 1.3rem;
}

/* ==========================================================================
   Фон: пастельная бумага, точки, плавающие цветочки и сердечки
   ========================================================================== */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg > * { position: absolute; inset: 0; }

.bg__base {
  background:
    radial-gradient(55% 45% at 0% 0%, rgba(255, 205, 222, .95) 0%, transparent 70%),
    radial-gradient(45% 40% at 100% 6%, rgba(207, 232, 246, .9) 0%, transparent 70%),
    radial-gradient(55% 50% at 100% 100%, rgba(255, 210, 226, .9) 0%, transparent 70%),
    radial-gradient(45% 40% at 0% 100%, rgba(255, 238, 196, .75) 0%, transparent 70%),
    var(--paper);
}

.bg__dots {
  background-image: radial-gradient(rgba(255, 120, 165, .2) 1.3px, transparent 1.8px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(75% 70% at 50% 50%, transparent 30%, #000 85%);
  mask-image: radial-gradient(75% 70% at 50% 50%, transparent 30%, #000 85%);
}

.bg__final {
  opacity: 0;
  transition: opacity 1.6s ease;
  background:
    radial-gradient(60% 45% at 50% 0%, rgba(255, 170, 200, .55) 0%, transparent 70%),
    radial-gradient(40% 35% at 15% 85%, rgba(255, 214, 107, .35) 0%, transparent 70%),
    radial-gradient(40% 35% at 85% 80%, rgba(159, 215, 245, .4) 0%, transparent 70%);
}

body.is-final .bg__final { opacity: 1; }

.doodle {
  position: absolute;
  inset: auto;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  opacity: var(--o);
  will-change: transform;
  animation: doodle var(--t) ease-in-out var(--delay) infinite alternate;
}

.doodle svg { display: block; width: 100%; height: 100%; overflow: visible; }

@keyframes doodle {
  from { transform: translate3d(0, 0, 0) rotate(var(--r0)); }
  to { transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--r1)); }
}

#fx {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 45;
  pointer-events: none;
}

/* ==========================================================================
   Вступление: конверт
   ========================================================================== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 34px;
  padding: 24px;
  background: radial-gradient(45% 38% at 50% 48%, rgba(255, 205, 222, .85) 0%, transparent 75%);
}

.envelope {
  --ew: min(78vw, 360px);
  --eh: calc(var(--ew) * .66);
  position: relative;
  width: var(--ew);
  height: var(--eh);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  animation: envIn .9s var(--spring) .15s backwards, envFloat 3s ease-in-out 1.2s infinite;
  touch-action: manipulation;
}

@keyframes envIn {
  from { opacity: 0; transform: translateY(40px) scale(.85) rotate(-6deg); }
}

@keyframes envFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}

.envelope > span { position: absolute; display: block; }

.envelope__back {
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffb3c9 0%, #ff9dba 100%);
  box-shadow: 0 26px 40px -22px rgba(220, 70, 120, .6);
}

.envelope__letter {
  left: 7%;
  right: 7%;
  top: 8%;
  height: 84%;
  z-index: 2;
  display: grid !important;
  place-items: start center;
  padding-top: 13%;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(200, 80, 120, .15);
  color: var(--pink);
  font-size: clamp(1.25rem, 4.8vw, 1.7rem);
  transition: transform .9s var(--ease) .55s;
}

.envelope__letter::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 8px;
  border: 2px dashed var(--pink-3);
}

.envelope__front {
  inset: 0;
  z-index: 3;
  border-radius: 16px;
  background: linear-gradient(170deg, #ffd0dd 0%, #ffbfd2 100%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}

.envelope__front::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), rgba(220, 80, 120, .22) 50%, transparent calc(50% + 1px)) left bottom / 50.5% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1px), rgba(220, 80, 120, .22) 50%, transparent calc(50% + 1px)) right bottom / 50.5% 100% no-repeat;
}

.envelope__flap {
  left: 0;
  right: 0;
  top: 0;
  height: 58%;
  z-index: 4;
  transform-origin: 50% 0;
  background: linear-gradient(180deg, #ffa7c0 0%, #ff94b4 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .6s var(--ease), z-index 0s linear .3s;
}

.envelope__seal {
  left: 50%;
  top: 58%;
  z-index: 5;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  display: grid !important;
  place-items: center;
  border-radius: 47% 53% 50% 50% / 53% 47% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #ff9ab6 0%, #f04a7c 50%, #c2275a 100%);
  box-shadow: 0 6px 12px rgba(180, 30, 80, .4), inset 0 -3px 6px rgba(120, 0, 40, .4), inset 0 2px 3px rgba(255, 255, 255, .45);
  animation: sealBeat 1.6s ease-in-out 1.4s infinite;
  transition: transform .35s var(--spring), opacity .3s ease;
}

.envelope__seal svg { width: 26px; height: 26px; fill: #fff; opacity: .92; }

@keyframes sealBeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.12); }
  30% { transform: scale(.97); }
  45% { transform: scale(1.06); }
}

.intro.is-open .envelope { animation: none; }
.intro.is-open .envelope__seal { animation: none; transform: scale(1.6); opacity: 0; }
.intro.is-open .envelope__flap { transform: rotateX(180deg); z-index: 1; }
.intro.is-open .envelope__letter { transform: translateY(-66%); }

body.has-intro .topbar { opacity: 0; pointer-events: none; }
.topbar { transition: opacity .6s ease, background .3s ease; }

/* при прокрутке под панелью появляется мягкая подложка — ничего не налезает */
.topbar.is-scrolled {
  background: linear-gradient(180deg, rgba(255, 246, 249, .95) 0%, rgba(255, 246, 249, .85) 70%, rgba(255, 246, 249, 0) 100%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.intro__hint {
  text-align: center;
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  color: var(--ink);
  animation: rise .8s var(--ease) .5s backwards;
}

.intro__hint small {
  display: block;
  margin-top: 4px;
  font-size: .78em;
  color: var(--ink-2);
}

.intro.is-open .intro__hint { opacity: 0; transition: opacity .3s; }
.intro.is-done { pointer-events: none; animation: introOut .7s var(--ease) forwards; }

@keyframes introOut { to { opacity: 0; visibility: hidden; transform: scale(1.04); } }

/* ==========================================================================
   Верхняя панель
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }
.topbar > #backBtn { justify-self: start; }

.topbar__right {
  justify-self: end;
  display: flex;
  gap: 8px;
}

#soundBtn .ico--off { display: none; }
#soundBtn.is-muted { color: var(--ink-3); }
#soundBtn.is-muted .ico--on { display: none; }
#soundBtn.is-muted .ico--off { display: block; }
#soundBtn.is-pulse { animation: soundPulse .5s var(--spring); }

@keyframes soundPulse {
  40% { transform: scale(1.18); }
}

.intro__sound {
  display: inline-block !important;
  margin-top: 12px !important;
  padding: 4px 12px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  box-shadow: inset 0 0 0 2px var(--pink-4);
  font-size: .72em !important;
  color: var(--berry) !important;
}

.icon-btn {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 var(--pink-4), 0 10px 20px -10px rgba(230, 80, 130, .45), inset 0 0 0 2px var(--pink-4);
  color: var(--pink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .3s var(--spring), opacity .3s, visibility .3s, box-shadow .3s;
}

.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn--sm { width: 40px; height: 40px; }

.icon-btn.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

@media (hover: hover) {
  .icon-btn:hover { transform: translateY(-2px); }
}

.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-4), inset 0 0 0 2px var(--pink-4); }

#musicBtn .eq { position: absolute; bottom: 8px; display: none; gap: 2px; height: 8px; align-items: flex-end; }
#musicBtn .eq i { width: 2px; height: 100%; border-radius: 1px; background: var(--pink); animation: eq .9s ease-in-out infinite alternate; }
#musicBtn .eq i:nth-child(2) { animation-delay: -.3s; }
#musicBtn .eq i:nth-child(3) { animation-delay: -.6s; }
#musicBtn.is-playing .ico { transform: translateY(-3px) scale(.82); }
#musicBtn.is-playing .eq { display: flex; }

@keyframes eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }

.progress {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 9px 16px;
  list-style: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 4px 0 var(--pink-4), 0 10px 22px -12px rgba(230, 80, 130, .5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.progress li { width: 18px; height: 18px; }

.progress svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #fff;
  stroke: var(--pink-3);
  stroke-width: 2;
  transition: fill .5s, stroke .5s, transform .5s var(--spring);
}

.progress li.is-done svg { fill: var(--pink-2); stroke: var(--pink-2); }

.progress li.is-current svg {
  fill: var(--pink);
  stroke: var(--pink);
  transform: scale(1.3);
  animation: beat 1.8s ease-in-out infinite;
}

/* ==========================================================================
   Этапы и карточки-облачка
   ========================================================================== */
.stages {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

@supports (overflow: clip) {
  .stages { overflow: clip; overflow-clip-margin: 0; }
}

.stage {
  grid-area: 1 / 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--top) + 14px) max(var(--gutter), env(safe-area-inset-right, 0px)) calc(34px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px));
  opacity: 0;
  transform: translate3d(40px, 18px, 0) rotate(2.5deg) scale(.96);
  transition: opacity .5s var(--ease), transform .8s var(--spring);
}

.stage[data-dir="back"] { transform: translate3d(-40px, 18px, 0) rotate(-2.5deg) scale(.96); }
.stage.is-active { opacity: 1; transform: none; }

.stage.is-leaving {
  opacity: 0;
  transform: translate3d(-60px, -10px, 0) rotate(-4deg) scale(.95);
  pointer-events: none;
  transition: opacity .38s ease, transform .5s var(--ease);
}

.stage.is-leaving[data-dir="back"] { transform: translate3d(60px, -10px, 0) rotate(4deg) scale(.95); }

.cloud {
  position: relative;
  width: min(100%, var(--cw, 480px));
  margin: 0 auto;
}

.cloud:not(.is-drawn) {
  background: #fff;
  border-radius: 40px;
}

.cloud__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 0 rgba(255, 196, 214, .9)) drop-shadow(0 24px 36px rgba(236, 92, 140, .2));
  pointer-events: none;
}

.cloud__shape path { fill: #fff; }

.cloud__body {
  --pad-x: 30px;
  position: relative;
  padding: 36px var(--pad-x) 36px;
  text-align: center;
}

/* полоска «скотча», которой карточка приклеена */
.tape {
  position: absolute;
  z-index: 3;
  top: -14px;
  left: 50%;
  width: 116px;
  height: 32px;
  margin-left: -58px;
  transform: rotate(-4deg);
  background: repeating-linear-gradient(-45deg, rgba(255, 168, 196, .85) 0 7px, rgba(255, 206, 222, .85) 7px 14px);
  clip-path: polygon(3% 0, 97% 0, 100% 16%, 97% 32%, 100% 48%, 97% 64%, 100% 80%, 97% 100%, 3% 100%, 0 84%, 3% 68%, 0 52%, 3% 36%, 0 20%);
  pointer-events: none;
}

.tape--blue {
  background: repeating-linear-gradient(-45deg, rgba(159, 215, 245, .85) 0 7px, rgba(207, 232, 246, .85) 7px 14px);
  transform: rotate(3deg);
}

.stage.is-active [data-reveal] {
  animation: rise .8s var(--ease) backwards;
  animation-delay: calc(var(--d, 0) * 1ms + 120ms);
}

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.6) rotate(-4deg); }
  to { opacity: 1; transform: none; }
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.14); }
  28% { transform: scale(.97); }
  42% { transform: scale(1.08); }
  60% { transform: scale(1); }
}

/* ---------- Наклейки ---------- */
.sticker {
  width: min(100%, 290px);
  margin: -8px auto 8px;
}

.sticker--sm { width: min(100%, 220px); }

.sticker__svg { display: block; width: 100%; height: auto; overflow: visible; }

.stage.is-active .sticker { animation: stickerIn .9s var(--spring) backwards; }

@keyframes stickerIn {
  from { opacity: 0; transform: scale(.6) rotate(-8deg); }
}

.mochi {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: squish 2.6s ease-in-out infinite;
}

.mochi--shy { animation-delay: -1.3s; }
.mochi--jump { animation: hop .9s ease-in-out infinite; }
.mochi--late { animation-delay: .45s; }
.mochi--laugh { animation: giggle .45s ease-in-out infinite; }

@keyframes squish {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.045, .955); }
}

@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1.04, .96); }
  40% { transform: translateY(-16px) scale(.97, 1.03); }
  60% { transform: translateY(-16px) scale(1, 1); }
}

@keyframes giggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg) translateY(-3px); }
}

.st-float { animation: stFloat 3s ease-in-out infinite; }
.st-twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.2s ease-in-out infinite; }
.st-offer { transform-box: fill-box; transform-origin: center; animation: beat 1.6s ease-in-out infinite; }
.st-pulse { transform-box: fill-box; transform-origin: center; animation: beat 2.2s ease-in-out infinite; }
.st-wave { transform-box: fill-box; transform-origin: 50% 100%; animation: wave 2.4s ease-in-out infinite; }
.st-drop { animation: drop 1.1s ease-in infinite; }
.st-drop--2 { animation-delay: .55s; }

@keyframes stFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes twinkle {
  0%, 100% { opacity: .35; transform: scale(.7) rotate(0); }
  50% { opacity: 1; transform: scale(1.1) rotate(20deg); }
}

@keyframes wave {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@keyframes drop {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(16px); opacity: 0; }
}

/* ---------- Типографика: Lisova, иерархия размером и цветом ---------- */
.title {
  margin: 0 auto;
  max-width: 16ch;
  font-weight: 700;
  font-size: clamp(1.75rem, 6.8vw, 2.45rem);
  line-height: 1.14;
  color: var(--ink);
  text-wrap: balance;
}

.title--xl { font-size: clamp(2.1rem, 8.6vw, 3rem); max-width: 17ch; color: var(--pink); }

.lead {
  margin: 12px auto 0;
  max-width: 30ch;
  font-size: clamp(1.06rem, 4.1vw, 1.22rem);
  line-height: 1.36;
  color: var(--ink-2);
  text-wrap: balance;
}

.note {
  margin: 12px auto 0;
  max-width: 30ch;
  font-size: clamp(1.04rem, 4vw, 1.18rem);
  line-height: 1.36;
  color: var(--berry);
  text-wrap: balance;
}

.split .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: .12em .05em .2em;
  margin: -.12em -.05em -.2em;
}

.split .w > span { display: inline-block; }

.stage.is-active .split .w > span {
  animation: wordUp .9s var(--ease) backwards;
  animation-delay: calc(var(--d, 0) * 1ms + var(--i) * 50ms + 120ms);
}

@keyframes wordUp {
  from { opacity: 0; transform: translate3d(0, 105%, 0) rotate(5deg); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Кнопки — «мармеладные», с мягкой ступенькой снизу
   ========================================================================== */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 58px;
  padding: .65rem 1.6rem .85rem;
  border: 0;
  border-radius: 999px;
  font-size: 1.24rem;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform .22s var(--spring), box-shadow .22s ease, filter .3s ease, background .3s ease, color .3s ease;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #ff94b5 0%, #ff5c8a 58%, #f4477c 100%);
  box-shadow: 0 5px 0 var(--edge), 0 16px 26px -12px rgba(255, 70, 125, .7), inset 0 2px 0 rgba(255, 255, 255, .4);
  text-shadow: 0 1px 0 rgba(180, 30, 80, .3);
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%);
  transform: translateX(-130%);
  animation: shine 5s ease-in-out 2.5s infinite;
}

@keyframes shine {
  0%, 70% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

.btn--soft {
  color: var(--lilac-ink);
  background: var(--lilac);
  box-shadow: 0 4px 0 var(--lilac-edge), 0 12px 22px -14px rgba(110, 90, 150, .55);
}

.btn--ghost {
  color: var(--pink);
  background: #fff;
  box-shadow: inset 0 0 0 2.5px var(--pink-3), 0 4px 0 var(--pink-4);
}

@media (hover: hover) {
  .btn--primary:not([aria-disabled="true"]):hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--edge), 0 20px 30px -12px rgba(255, 70, 125, .75), inset 0 2px 0 rgba(255, 255, 255, .4); }
  .btn--soft:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--lilac-edge), 0 14px 24px -14px rgba(110, 90, 150, .6); }
  .btn--ghost:hover { transform: translateY(-2px); }
}

.btn--primary:not([aria-disabled="true"]):active { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge), 0 6px 14px -8px rgba(255, 70, 125, .7), inset 0 2px 0 rgba(255, 255, 255, .4); }
.btn--soft:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lilac-edge); }

.btn .ico { width: .95em; height: .95em; stroke-width: 2.8; }

.btn[aria-disabled="true"] {
  color: #fff;
  background: #f1d3dd;
  box-shadow: 0 4px 0 #e6bccb;
  text-shadow: none;
  cursor: not-allowed;
}

.btn[aria-disabled="true"]::after { animation: none; opacity: 0; }

.btn.is-ready { animation: readyPop .7s var(--spring); }

@keyframes readyPop {
  0% { transform: scale(.9); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.is-nope { animation: nope .42s ease; }

@keyframes nope {
  0%, 100% { translate: 0 0; }
  20% { translate: -7px 0; }
  40% { translate: 6px 0; }
  60% { translate: -4px 0; }
  80% { translate: 2px 0; }
}

.link-btn {
  margin-top: 8px;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.btn-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(100%, 380px);
  margin: 26px auto 0;
}

.btn-pair > * { width: 100%; padding-inline: .8rem; }

/* ==========================================================================
   Убегающие кнопки
   ========================================================================== */
.runaway > span { display: inline-block; }

.runaway-layer {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow: hidden;
  pointer-events: none;
}

.runaway.is-loose {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  pointer-events: auto;
  will-change: transform;
  transition: transform .55s var(--spring), opacity .35s ease;
}

.runaway.is-loose.no-anim { transition: none; }
.runaway.is-land > span { animation: land .55s var(--spring); }

@keyframes land {
  0% { transform: scale(.7, 1.25); }
  45% { transform: scale(1.18, .86); }
  100% { transform: none; }
}

.runaway.is-gone { opacity: 0; pointer-events: none; }

/* пустое «место», откуда сбежала кнопка */
.runaway-ph {
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2.5px dashed var(--lilac-edge);
  color: #b4a9cc;
  font-size: 1rem;
  white-space: nowrap;
  animation: phIn .5s var(--spring);
}

@keyframes phIn { from { opacity: 0; transform: scale(.85); } }

/* ==========================================================================
   Этап 1 — приглашение
   ========================================================================== */
.stage--invite { --cw: 480px; }

.answers {
  width: min(100%, 360px);
  margin: 24px auto 0;
}

.btn--yes {
  width: 100%;
  min-height: calc(62px + var(--boost, 0) * 22px);
  font-size: calc(1.5rem + var(--boost, 0) * .55rem);
  transition: min-height .5s var(--spring), font-size .5s var(--spring), transform .22s var(--spring), box-shadow .22s ease;
}

.btn--yes.is-tempting { animation: tempt 1.3s ease-in-out infinite; }

@keyframes tempt {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.08) drop-shadow(0 0 16px rgba(255, 92, 138, .6)); }
}

.answers__rest {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.answers__rest > * { width: 100%; min-width: 0; }
.answers__rest .btn { padding-inline: .6rem; font-size: 1.12rem; min-height: 52px; }

.answers__rest > :nth-child(3) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - 5px);
}

.invite.is-out { animation: fadeAway .4s var(--ease) forwards; }

@keyframes fadeAway { to { opacity: 0; transform: scale(.94) translateY(-10px); } }

.invite-yes .pop { animation: popIn .8s var(--spring) backwards; animation-delay: calc(var(--d, 0) * 1ms); }
.invite-yes .title { margin-top: 4px; }

/* ==========================================================================
   Этап 2 — конверты и фото-карточки
   ========================================================================== */
.stage--places { --cw: 1180px; }

.places {
  --mat: 9px;
  --info: 124px;
  --cw: min(60vw, 230px);
  --ch: calc((var(--cw) - 2 * var(--mat)) * 1.25 + var(--mat) + var(--info));
  display: flex;
  gap: 16px;
  margin: 16px 0 0;
}

@media (max-width: 759px) {
  .places {
    width: calc(100% + 2 * var(--pad-x));
    margin-left: calc(-1 * var(--pad-x));
    padding: 18px calc((100% - var(--cw)) / 2 + var(--pad-x)) 22px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
  }

  .places::-webkit-scrollbar { display: none; }
  .place { scroll-snap-align: center; scroll-snap-stop: always; }
}

@media (min-width: 760px) {
  .places {
    --cw: 196px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px 18px;
    padding: 18px 0 8px;
  }

  .dots { display: none !important; }
}

@media (min-width: 1180px) {
  .places { --cw: 202px; --info: 128px; flex-wrap: nowrap; gap: 18px; }
}

@media (min-width: 760px) {
  .place__caption { font-size: .86rem; }
}

.place {
  position: relative;
  flex: none;
  width: var(--cw);
  height: var(--ch);
  perspective: 1200px;
}

.stage.is-active .place {
  animation: cardIn .8s var(--spring) backwards;
  animation-delay: calc(var(--i) * 90ms + 550ms);
}

@keyframes cardIn {
  from { opacity: 0; transform: translate3d(0, 40px, 0) rotate(calc((var(--i) - 2) * 4deg)) scale(.9); }
}

.place:nth-child(odd) .place__flip { rotate: -1.2deg; }
.place:nth-child(even) .place__flip { rotate: 1.2deg; }

.place__flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .95s var(--ease), rotate .4s var(--ease);
}

.place.is-open .place__flip { transform: rotateY(180deg); }
.place.no-anim .place__flip,
.place.no-anim .env__flap,
.place.no-anim .env__seal,
.place.no-anim .env__letter { transition: none; }

@media (hover: hover) {
  .place:not(.is-open):hover .place__flip { transform: translateY(-6px) rotateY(-8deg) rotateX(4deg); rotate: 0deg; }
  .place.is-open:hover .place__flip { transform: rotateY(180deg) translateY(-4px); rotate: 0deg; }
}

.place__face {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 4px 0 rgba(255, 180, 205, .9), 0 18px 28px -16px rgba(220, 70, 120, .55);
}

/* --- лицевая сторона: розовый конверт --- */
.place__front {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), rgba(226, 61, 111, .16) 50%, transparent calc(50% + 1px)) left bottom / 50% 42% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1px), rgba(226, 61, 111, .16) 50%, transparent calc(50% + 1px)) right bottom / 50% 42% no-repeat,
    linear-gradient(175deg, #ffe4ec 0%, #ffd2df 100%);
  touch-action: manipulation;
}

.place__front::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 14px;
  border: 2px dashed rgba(255, 140, 175, .55);
  pointer-events: none;
}

.place.is-open .place__front { pointer-events: none; }

.env__letter {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 9%;
  height: 38%;
  border-radius: 8px 8px 0 0;
  background: repeating-linear-gradient(180deg, #fff 0 11px, #ffe9f0 11px 12px);
  box-shadow: 0 -2px 8px rgba(200, 60, 100, .15);
  transform: translateY(30%);
  opacity: 0;
  transition: transform .45s var(--ease) .25s, opacity .3s ease .2s;
}

.env__flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 47%;
  transform-origin: 50% 0;
  background: linear-gradient(180deg, #ffbfd1 0%, #ffaac3 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .5s var(--ease) .12s;
}

.env__seal {
  position: absolute;
  top: calc(47% - 22px);
  left: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  display: grid;
  place-items: center;
  border-radius: 47% 53% 50% 50% / 53% 47% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #ff9ab6 0%, #f04a7c 50%, #c2275a 100%);
  box-shadow: 0 5px 10px rgba(180, 30, 80, .35), inset 0 -3px 6px rgba(120, 0, 40, .4), inset 0 2px 3px rgba(255, 255, 255, .45);
  transition: transform .3s var(--spring), opacity .25s ease;
}

.env__seal svg { width: 19px; height: 19px; fill: #fff; opacity: .92; }

@media (hover: hover) {
  .place:not(.is-open):hover .env__seal { transform: rotate(-12deg) scale(1.1); }
}

.place.is-unsealed .env__seal { transform: scale(1.5) rotate(25deg); opacity: 0; }
.place.is-unsealed .env__flap { transform: perspective(600px) rotateX(-178deg); }
.place.is-unsealed .env__letter { transform: translateY(-6%); opacity: 1; }

.place__label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.place__emoji {
  font-size: 2.1rem;
  line-height: 1.15;
  filter: drop-shadow(0 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff);
}

.place__name { font-size: 1.45rem; line-height: 1.15; white-space: nowrap; color: var(--ink); }
.place__hint { margin-top: 3px; font-size: .95rem; color: var(--berry); }

/* --- оборотная сторона: полароид --- */
.place__back {
  transform: rotateY(180deg);
  padding: var(--mat);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--ink);
  pointer-events: none;
  transition: box-shadow .5s ease;
}

.place.is-open .place__back { pointer-events: auto; }

.place__photo {
  position: relative;
  flex: none;
  aspect-ratio: 4 / 5;
  border-radius: 13px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--pink-4), var(--pink-3));
}

.place__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity .6s ease, transform 1.4s var(--ease);
}

.place.is-open .place__img.is-loaded { opacity: 1; transform: none; }

.place__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(59, 26, 44, .08);
  background: radial-gradient(130% 100% at 50% 40%, transparent 60%, rgba(59, 26, 44, .18) 100%);
  pointer-events: none;
}

.place__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.4rem;
}

.place__badge {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 9px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 14px -4px rgba(226, 61, 111, .8);
  transform: scale(0) rotate(-30deg);
  transition: transform .55s var(--spring);
}

.place__badge svg { width: 19px; height: 19px; fill: var(--pink); }
.place.is-selected .place__badge { transform: none; }

.place__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  padding: 8px 2px 0;
  text-align: center;
}

.place__title { font-size: 1.22rem; line-height: 1.1; color: var(--ink); }

.place__caption {
  min-height: 2.5em;
  font-size: .92rem;
  line-height: 1.25;
  color: var(--ink-2);
  text-wrap: balance;
}

/* Кнопка выбора в карточке — мягкая; залитой становится только выбранная.
   Главное действие на экране одно — «Дальше». */
.place__choose {
  width: 100%;
  min-height: 40px;
  padding: .3rem .7rem .45rem;
  font-size: 1.04rem;
  color: var(--pink);
  background: var(--pink-5);
  box-shadow: inset 0 0 0 2px var(--pink-3), 0 3px 0 var(--pink-4);
  text-shadow: none;
}

.place__choose::after { display: none; }

@media (hover: hover) {
  .place__choose:hover { background: #fff; box-shadow: inset 0 0 0 2px var(--pink-2), 0 4px 0 var(--pink-3); }
}

.place.is-selected .place__choose {
  color: #fff;
  background: linear-gradient(180deg, #ff94b5 0%, #ff5c8a 58%, #f4477c 100%);
  box-shadow: 0 3px 0 var(--edge), 0 10px 18px -10px rgba(255, 70, 125, .7), inset 0 2px 0 rgba(255, 255, 255, .4);
  text-shadow: 0 1px 0 rgba(180, 30, 80, .3);
}

.place.is-selected .place__back {
  box-shadow: 0 0 0 3px var(--pink), 0 0 0 9px rgba(255, 92, 138, .18), 0 22px 32px -16px rgba(220, 70, 120, .7);
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0;
}

.dot {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink-3);
  transition: transform .35s var(--spring), background .3s;
}

.dot.is-open::before { background: var(--pink-2); }
.dot.is-active::before { transform: scale(1.5); background: var(--pink); }

.dot.is-selected::before {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--pink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.stage--places .note { margin-top: 10px; font-size: 1rem; color: var(--ink-3); }
.stage--places .lead { max-width: 36ch; }

@media (min-width: 900px) {
  .stage--places .title { max-width: 30ch; }
  .stage--places .lead { max-width: 52ch; }
  .stage--places .note { max-width: 44ch; }
}

.next-bar {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.next-bar .btn { min-width: 230px; }

/* ==========================================================================
   Этап 3 — кто платит
   ========================================================================== */
.stage--pay { --cw: 500px; }

.seq { opacity: 0; visibility: hidden; }
.seq.is-in { opacity: 1; visibility: visible; }

.pay .lead { margin-top: 0; }
.pay .lead.is-in { animation: rise .9s var(--ease) backwards; }

.title--shout {
  max-width: 14ch;
  margin-top: 10px;
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  line-height: 1.04;
  color: var(--pink);
  text-shadow: 0 3px 0 var(--pink-4);
}

.title--shout.is-in { animation: stamp .7s var(--ease) backwards; }

@keyframes stamp {
  0% { opacity: 0; transform: scale(2.6) rotate(-9deg); }
  55% { opacity: 1; transform: scale(.92) rotate(2deg); }
  78% { transform: scale(1.04) rotate(-1deg); }
  100% { opacity: 1; transform: none; }
}

.btn-pair.is-in { animation: popIn .7s var(--spring) backwards; }

.is-thud { animation: thud .5s ease; }

@keyframes thud {
  0%, 100% { transform: none; }
  20% { transform: translate(-6px, 4px) rotate(-.6deg); }
  40% { transform: translate(5px, -3px) rotate(.5deg); }
  60% { transform: translate(-3px, 2px); }
  80% { transform: translate(2px, -1px); }
}

.pay.is-out { animation: fadeAway .38s var(--ease) forwards; }

.pay-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pay-result .sticker { margin-bottom: 0; }

.laugh {
  font-size: clamp(2.3rem, 10vw, 3.4rem);
  line-height: 1.08;
  color: var(--pink);
  transition: opacity .8s ease, transform .8s var(--ease);
}

.laugh span { display: inline-block; }
.laugh .lw { white-space: nowrap; }
.laugh.is-in { animation: laughIn .7s var(--spring) backwards; }

.laugh.is-in:not(.is-calm) .lw > span {
  animation: waveText .62s ease-in-out infinite;
  animation-delay: calc(var(--i) * 55ms);
}

.laugh.is-calm { opacity: .7; transform: scale(.82); }

@keyframes laughIn {
  from { opacity: 0; transform: scale(.3) rotate(-10deg); }
  to { opacity: 1; transform: none; }
}

@keyframes waveText {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-14%) rotate(-6deg); }
}

.pay-slot { position: relative; display: grid; place-items: center; }

.typing {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 11px;
  border-radius: 18px 18px 18px 6px;
  background: var(--lilac);
  font-size: 1.05rem;
  color: var(--lilac-ink);
  white-space: nowrap;
  animation: rise .5s var(--ease) backwards;
}

.typing__dots { display: inline-flex; gap: 4px; }

.typing__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lilac-ink);
  animation: dots 1.1s ease-in-out infinite;
}

.typing__dots i:nth-child(2) { animation-delay: .15s; }
.typing__dots i:nth-child(3) { animation-delay: .3s; }

@keyframes dots {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.pay-joke { font-size: clamp(1.45rem, 5.8vw, 1.85rem); line-height: 1.2; color: var(--berry); }
.pay-joke.is-in { animation: popIn .8s var(--spring) backwards; }

.pay-big {
  max-width: 18ch;
  font-size: clamp(1.5rem, 6vw, 2.05rem);
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}

.pay-big.is-in { animation: rise 1s var(--ease) backwards; }

#payNext { margin-top: 10px; }
#payNext.is-in { animation: popIn .7s var(--spring) backwards; }

/* ==========================================================================
   Этап 4 — календарь и время
   ========================================================================== */
.stage--date { --cw: 480px; }
.stage--date .title { max-width: 24ch; }

.date-grid { margin-top: 18px; }

.only-wide { display: none; }

@media (min-width: 900px) {
  .stage--date { --cw: 880px; }
  .only-wide { display: block; }
  .only-narrow { display: none; }
  .date-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 34px;
    align-items: center;
    text-align: center;
  }
  .date-side .sticker { margin: 0 auto 10px; }
}

.calendar {
  width: min(100%, 380px);
  margin: 0 auto;
  padding: 14px 12px 12px;
  border-radius: 26px;
  background: var(--pink-5);
  box-shadow: inset 0 0 0 2px var(--pink-4);
  touch-action: pan-y;
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cal__month { font-size: 1.5rem; color: var(--ink); }

.cal__week,
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal__week span { padding: 6px 0; font-size: .95rem; color: var(--ink-3); }
.cal__week span:nth-child(n + 6) { color: var(--pink-2); }

.cal__grid.slide-next { animation: slideNext .38s var(--ease); }
.cal__grid.slide-prev { animation: slidePrev .38s var(--ease); }

@keyframes slideNext { from { opacity: 0; transform: translateX(26px); } }
@keyframes slidePrev { from { opacity: 0; transform: translateX(-26px); } }

.day {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #cdb4c0;
  font-size: 1.15rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .2s ease, color .2s ease;
}

.day--empty { pointer-events: none; }
.day.is-weekend { color: #f0b4c6; }

@media (hover: hover) {
  .day:not(.day--empty):not(.is-destiny):hover { background: #fff; }
}

.day.is-today::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--sky-2);
}

.day.is-destiny {
  z-index: 1;
  color: var(--pink);
  font-size: 1.35rem;
  background: #fff;
  box-shadow: inset 0 0 0 2.5px var(--pink), 0 6px 16px -6px rgba(255, 92, 138, .8);
  animation: destiny 1.8s ease-in-out infinite;
}

.day__heart {
  position: absolute;
  top: -8px;
  right: -7px;
  width: 20px;
  height: 20px;
  fill: var(--pink);
  filter: drop-shadow(0 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 -1.5px 0 #fff);
}

.day.is-selected {
  color: #fff;
  background: linear-gradient(180deg, #ff94b5 0%, #ff5c8a 100%);
  box-shadow: 0 4px 0 var(--edge), 0 10px 20px -8px rgba(255, 70, 125, .8);
  animation: picked .7s var(--spring), destiny 1.8s ease-in-out .7s infinite;
}

@keyframes destiny {
  0%, 100% { scale: 1; }
  50% { scale: 1.09; }
}

@keyframes picked {
  0% { scale: .7; }
  60% { scale: 1.2; }
  100% { scale: 1; }
}

.cal__hint {
  position: relative;
  grid-column: 1 / -1;
  height: 44px;
  pointer-events: none;
}

.cal__bubble {
  position: absolute;
  bottom: 10px;
  padding: 6px 13px 8px;
  border-radius: 14px;
  background: var(--pink);
  font-size: 1.05rem;
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 6px 14px -6px rgba(255, 70, 125, .8);
  animation: bob 2.4s ease-in-out infinite;
}

.cal__bubble.is-left { left: 0; }
.cal__bubble.is-right { right: 0; }
.cal__bubble.is-center { left: var(--cx); transform: translateX(-50%); }

.cal__arrow {
  position: absolute;
  bottom: 4px;
  left: var(--cx);
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--pink);
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

.cal__jump {
  display: block;
  margin: 8px auto 2px;
  padding: 8px 16px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.date-side { margin-top: 22px; }

@media (min-width: 900px) {
  .date-side { margin-top: 0; }
}

.date-wait {
  padding: 22px 18px;
  border-radius: 22px;
  background: var(--pink-5);
  box-shadow: inset 0 0 0 2px dashed var(--pink-4);
  border: 2px dashed var(--pink-3);
  color: var(--ink-2);
  font-size: 1.15rem;
}

.time { animation: rise .8s var(--ease) backwards; }

.time__title { margin-bottom: 14px; font-size: 1.75rem; color: var(--ink); }

.time__slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
}

.slot {
  position: relative;
  min-width: 62px;
  height: 48px;
  padding: 0 9px 3px;
  border: 0;
  border-radius: 16px;
  background: var(--lilac);
  box-shadow: 0 3px 0 var(--lilac-edge);
  color: #a99dc0;
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}

.slot.is-locked > span:first-child { text-decoration: line-through; text-decoration-color: rgba(111, 99, 144, .45); }

.slot__lock { position: absolute; top: -8px; right: -5px; font-size: .75rem; line-height: 1; }

.slot.is-target {
  min-width: 86px;
  height: 58px;
  color: var(--pink);
  font-size: 1.4rem;
  background: #fff;
  box-shadow: inset 0 0 0 2.5px var(--pink), 0 4px 0 var(--pink-3);
  animation: destiny 1.8s ease-in-out infinite;
}

@media (hover: hover) {
  .slot.is-target:not(.is-selected):hover { background: var(--pink-5); }
  .slot.is-locked:hover { color: var(--lilac-ink); }
}

.slot:active { translate: 0 2px; }

.slot.is-selected {
  color: #fff;
  background: linear-gradient(180deg, #ff94b5 0%, #ff5c8a 100%);
  box-shadow: 0 4px 0 var(--edge), 0 10px 20px -8px rgba(255, 70, 125, .8);
  animation: picked .7s var(--spring);
}

.time__note { margin-top: 14px; }

.confirm-bar { display: flex; justify-content: center; margin-top: 22px; }

/* ==========================================================================
   Этап 5 — финал
   ========================================================================== */
.stage--final { --cw: 560px; }

.stage--final .title { max-width: 21ch; }

@media (min-width: 900px) {
  .stage--final { --cw: 700px; }
  .stage--final .title { max-width: 28ch; }

  /* «Молодец» + подарок — в одну строку: текст слева, подарок справа */
  .praise {
    display: grid;
    grid-template-columns: 1fr 170px;
    grid-template-areas: "title gift" "text gift" "hint gift";
    align-items: center;
    column-gap: 10px;
    padding: 18px 22px;
    text-align: left;
  }

  .praise__title { grid-area: title; align-self: end; }
  .praise__text { grid-area: text; margin: 6px 0 0; max-width: none; }
  .gift { grid-area: gift; margin: 0 auto; }
  .gift__hint { grid-area: hint; align-self: start; margin-top: 8px; }

  .praise.is-opened { grid-template-columns: 1fr; grid-template-areas: "title" "text"; text-align: center; }
}

.praise {
  position: relative;
  margin: 24px auto 0;
  padding: 22px 18px 18px;
  border-radius: 26px;
  background: var(--pink-5);
  border: 2px dashed var(--pink-3);
}

.praise__title { font-size: clamp(1.55rem, 6.4vw, 2.05rem); line-height: 1.15; color: var(--pink); }

.praise__text {
  margin: 8px auto 0;
  max-width: 26ch;
  font-size: clamp(1.08rem, 4.3vw, 1.25rem);
  line-height: 1.35;
  color: var(--ink-2);
  text-wrap: balance;
}

.gift {
  position: relative;
  display: block;
  width: 170px;
  height: 160px;
  margin: 10px auto 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.gift::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 107, .55) 0%, transparent 65%);
  animation: glowPulse 1.6s ease-in-out infinite alternate;
}

@keyframes glowPulse { from { opacity: .55; transform: scale(.92); } to { opacity: 1; transform: scale(1.05); } }

.gift__wrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  animation: wiggle 2.6s ease-in-out 1s infinite;
}

.gift__box {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 8px;
  height: 90px;
  border-radius: 12px 12px 16px 16px;
  background:
    linear-gradient(90deg, transparent calc(50% - 13px), #ffe6a3 calc(50% - 13px), #ffd66b calc(50% + 13px), transparent calc(50% + 13px)),
    linear-gradient(180deg, #ff94b5 0%, #ff5c8a 100%);
  box-shadow: 0 5px 0 var(--edge), 0 16px 26px -12px rgba(255, 70, 125, .7);
}

.gift__lid {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 94px;
  height: 32px;
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent calc(50% - 14px), #fff0c4 calc(50% - 14px), #ffe08a calc(50% + 14px), transparent calc(50% + 14px)),
    linear-gradient(180deg, #ffb0c7 0%, #ff7aa2 100%);
  box-shadow: 0 4px 0 #e85486;
  transition: transform .8s var(--ease), opacity .6s ease .2s;
}

.gift__bow { position: absolute; left: 50%; bottom: 26px; width: 0; height: 0; }

.gift__bow::before,
.gift__bow::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 40px;
  height: 30px;
  border: 8px solid #ffd66b;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.gift__bow::before { right: -2px; transform: rotate(-24deg); }
.gift__bow::after { left: -2px; transform: rotate(24deg); }

@keyframes wiggle {
  0%, 62%, 100% { transform: rotate(0); }
  68% { transform: rotate(-6deg); }
  74% { transform: rotate(5deg); }
  80% { transform: rotate(-3deg); }
  86% { transform: rotate(2deg); }
}

@media (hover: hover) {
  .gift:hover .gift__wrap { animation: wiggle 1s ease-in-out infinite; }
  .gift:hover .gift__lid { transform: translateY(-8px) rotate(-4deg); }
}

.gift:active .gift__wrap { transform: scale(.95); }
.gift:focus-visible { outline-offset: 6px; border-radius: 24px; }

.gift.is-opening .gift__wrap { animation: none; }
.gift.is-opening .gift__lid { transform: translateY(-120px) rotate(-28deg); opacity: 0; }
.gift.is-opening { animation: giftOut .6s var(--ease) .55s forwards; pointer-events: none; }

@keyframes giftOut { to { transform: scale(1.15); opacity: 0; } }

.gift__hint { margin-top: 4px; font-size: 1.05rem; color: var(--berry); }

.surprise { margin-top: 22px; }
.surprise.is-revealing > * { animation: rise .9s var(--ease) backwards; }
.surprise.is-revealing > :nth-child(2) { animation-delay: .15s; }
.surprise.is-revealing > :nth-child(3) { animation-delay: .3s; }
.surprise.is-revealing > :nth-child(4) { animation-delay: .45s; }

.surprise__lead { font-size: clamp(1.3rem, 5vw, 1.6rem); color: var(--pink); }

/* билет */
.ticket-wrap {
  position: relative;
  width: min(100%, 410px);
  margin: 46px auto 0;
  filter: drop-shadow(0 4px 0 rgba(255, 180, 205, .9)) drop-shadow(0 20px 26px rgba(220, 70, 120, .3));
  transition: transform .4s var(--ease);
}

.ticket {
  --cut: 75%;
  position: relative;
  border-radius: 26px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(165deg, #fff1f6 0%, #ffe2ec 100%);
  -webkit-mask:
    radial-gradient(circle at 0 var(--cut), transparent 14px, #000 14.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% var(--cut), transparent 14px, #000 14.5px) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 var(--cut), transparent 14px, #000 14.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% var(--cut), transparent 14px, #000 14.5px) right / 51% 100% no-repeat;
}

.ticket::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 20px;
  border: 2px dashed rgba(255, 120, 165, .45);
  pointer-events: none;
}

.ticket__main { padding: 52px 24px 20px; }

.ticket__title { font-size: 1.6rem; letter-spacing: .04em; text-align: center; color: var(--pink); }

.ticket__ornament { position: relative; display: block; height: 14px; margin: 8px auto 0; width: 70%; }

.ticket__ornament::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--pink-3) 15%, var(--pink-3) calc(50% - 16px), transparent calc(50% - 16px), transparent calc(50% + 16px), var(--pink-3) calc(50% + 16px), var(--pink-3) 85%, transparent 100%);
}

.ticket__ornament svg { position: absolute; left: 50%; top: 0; width: 14px; height: 14px; margin-left: -7px; fill: var(--pink); }

.ticket__rows { display: grid; gap: 11px; margin: 20px 0 0; }

.ticket__row { display: flex; align-items: baseline; gap: 8px; }

.ticket__row dt { font-size: 1.05rem; color: var(--ink-2); white-space: nowrap; }

.ticket__row::after {
  content: "";
  order: 1;
  flex: 1 1 10px;
  min-width: 10px;
  border-bottom: 3px dotted var(--pink-3);
  transform: translateY(-5px);
}

.ticket__row dd { order: 2; margin: 0; max-width: 66%; font-size: 1.12rem; text-align: right; color: var(--ink); text-wrap: balance; }

.ticket__stub { position: relative; padding: 18px 24px 24px; }

.ticket__stub::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  border-top: 3px dashed var(--pink-3);
}

.ticket__motto { font-size: 1.35rem; line-height: 1.25; text-align: center; color: var(--berry); text-wrap: balance; }

.seal {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 70px;
  height: 70px;
  margin-left: -35px;
  display: grid;
  place-items: center;
  padding-bottom: 3px;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #ff9ab6 0%, #f04a7c 50%, #c2275a 100%);
  box-shadow: inset 0 -4px 8px rgba(120, 0, 40, .4), inset 0 3px 4px rgba(255, 255, 255, .4), 0 6px 14px rgba(180, 30, 80, .35);
  font-size: 1.15rem;
  color: #fff;
  transform: rotate(-8deg);
}

.seal::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, .55);
}

.surprise.is-revealing .seal { animation: sealIn .8s var(--spring) .7s backwards; }

@keyframes sealIn {
  from { opacity: 0; transform: scale(2.2) rotate(-40deg); }
  to { opacity: 1; transform: rotate(-8deg); }
}

.final-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
}

.final-actions .btn { width: min(100%, 380px); }

.signature { margin-top: 26px; }

/* ==========================================================================
   Всплывающие сообщения
   ========================================================================== */
.toasts {
  position: fixed;
  top: calc(var(--top) + 2px);
  left: 50%;
  z-index: 60;
  width: min(calc(100vw - 28px), 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: .6rem 1.2rem .78rem;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--pink-3), 0 4px 0 var(--pink-4), 0 16px 30px -14px rgba(230, 80, 130, .55);
  font-size: 1.12rem;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
  animation: toastIn .5s var(--spring) backwards;
}

.toast.is-out { animation: toastOut .3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.96); } }

/* ==========================================================================
   Модальные окна
   ========================================================================== */
.modal {
  width: min(calc(100vw - 28px), 440px);
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}

.modal::backdrop {
  background: rgba(255, 220, 232, .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.modal.is-fallback[open] { position: fixed; inset: 0; z-index: 80; margin: auto; height: fit-content; }

.modal[open] > * { animation: letterIn .65s var(--spring) backwards; }

@keyframes letterIn { from { opacity: 0; transform: translateY(30px) scale(.9) rotate(-2deg); } }

.letter,
.sheet {
  position: relative;
  padding: 38px 26px 26px;
  border-radius: 28px;
  text-align: center;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 0 var(--pink-4), 0 30px 60px -24px rgba(220, 70, 120, .5);
}

.letter {
  background:
    repeating-linear-gradient(180deg, transparent 0 35px, rgba(255, 140, 175, .18) 35px 37px) 0 18px,
    #fff;
}

.letter__heart {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  fill: var(--pink);
  filter: drop-shadow(0 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 8px 10px rgba(226, 61, 111, .35));
  animation: beat 1.6s ease-in-out infinite;
}

.letter__title { font-size: 1.5rem; color: var(--pink); }
.letter__text { margin-top: 14px; font-size: 1.3rem; line-height: 1.42; color: var(--ink); text-wrap: pretty; }
.letter__sign { margin: 14px 0 22px; font-size: 1.4rem; color: var(--berry); }
.letter .btn { min-height: 50px; font-size: 1.12rem; }

.sheet { padding: 22px 20px 20px; }
.sheet__title { font-size: 1.5rem; color: var(--pink); }

.sheet__img {
  width: auto;
  max-width: 100%;
  max-height: 52dvh;
  margin: 14px auto 0;
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--pink-4), 0 16px 30px -16px rgba(220, 70, 120, .6);
  -webkit-touch-callout: default;
}

.sheet__hint { margin-top: 12px; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }

.sheet__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.sheet__actions .btn { min-height: 48px; font-size: 1.05rem; padding-inline: 1.1rem; }

/* ==========================================================================
   Небольшие экраны
   ========================================================================== */
@media (max-width: 520px) {
  .time__slots { gap: 5px; }
  .slot { min-width: 54px; height: 46px; padding: 0 6px 3px; font-size: 1rem; }
  .slot.is-target { min-width: 76px; height: 54px; font-size: 1.28rem; }
  .ticket__main { padding: 50px 18px 18px; }
  .ticket__stub { padding: 16px 18px 22px; }
  .ticket__row dt { font-size: .9rem; }
  .ticket__row dd { font-size: .96rem; max-width: 78%; }
  .ticket__row { gap: 5px; }
  .ticket__row::after { min-width: 6px; }
  .cloud__body { --pad-x: 18px; padding: 30px var(--pad-x) 28px; }
  .sticker { width: min(100%, 250px); }
  .tape { width: 96px; margin-left: -48px; height: 28px; top: -12px; }
}

@media (max-width: 360px) {
  :root { --gutter: 10px; }
  .btn { font-size: 1.12rem; padding-inline: 1.1rem; }
  .answers__rest .btn { font-size: 1.02rem; }
  .slot { min-width: 54px; }
  .place__name { font-size: 1.3rem; }
}

@media (max-width: 350px) {
  .slot:first-child,
  .slot:last-child { display: none; }
}

/* Ноутбук (MacBook ~1440×800 в окне браузера): чуть компактнее по высоте */
@media (max-height: 880px) and (min-width: 760px) {
  :root { --top: calc(env(safe-area-inset-top, 0px) + 64px); }
  .stage { padding-top: calc(var(--top) + 8px); padding-bottom: 22px; }
  .sticker { width: 236px; }
  .sticker--sm { width: 200px; }
  .cloud__body { padding-top: 30px; padding-bottom: 30px; }
}

/* ==========================================================================
   Уменьшенная анимация
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  .doodle { display: none; }
}
