* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 40%, #fbc2eb 100%);
  color: #4b2e40;
  overflow: hidden;
  min-height: 100vh;
}

.scene {
  position: relative;
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6vh 5vw 8vh;
  z-index: 1;
}

/* Размытые круги фона */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  z-index: -1;
  animation: float 12s ease-in-out infinite;
}
.blob-1 { width: 320px; height: 320px; background: #fff; top: -60px; left: -60px; }
.blob-2 { width: 420px; height: 420px; background: #ffd35c; bottom: -120px; right: -100px; animation-delay: -4s; }
.blob-3 { width: 260px; height: 260px; background: #8ec5ff; top: 40%; right: 10%; animation-delay: -8s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(20px, -30px) scale(1.08); }
}

.top { position: absolute; top: 6vh; width: 100%; }

.title {
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 12px rgba(120, 40, 70, 0.35);
  transition: opacity .3s;
}

/* ---------- Подарок (экран 1) ---------- */
.gift-wrap {
  position: relative;
  width: min(60vw, 280px);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .4s ease;
}
.gift-wrap.opened { cursor: default; }

.gift {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 20px rgba(90, 20, 50, 0.35));
  transition: transform .2s ease;
}
.gift-wrap:not(.opened):hover .gift { transform: scale(1.05) rotate(-1deg); }
.gift-wrap:not(.opened):active .gift { transform: scale(0.97); }

/* Падение коробки вниз */
.gift-wrap.falling .gift {
  transform: translateY(130vh) rotate(24deg);
  opacity: 0;
  transition: transform .75s ease-in, opacity .5s ease-in !important;
}

.box-lid {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: transform .5s cubic-bezier(.6, -0.4, .4, 1.4), opacity .4s ease;
}
.gift.opened .box-lid {
  transform: translateY(-70px) rotate(-28deg);
  opacity: 0;
}

.inside { opacity: 0; transition: opacity .3s ease .25s; }
.gift.opened .inside { opacity: 1; }

.shadow { transform-box: fill-box; transform-origin: center; transition: opacity .4s; }
.gift-wrap.opened .shadow { opacity: 0.2; }

.hint {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: #a0335b;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .9rem;
  white-space: nowrap;
  animation: pulse 1.6s ease-in-out infinite;
}
.gift-wrap.opened .hint,
.gift-wrap.falling .hint { opacity: 0; pointer-events: none; }

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.12); }
}

/* ---------- Экран выбора (экран 2) ---------- */
.choose {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: rise .5s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.choose-title {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 12px rgba(120, 40, 70, 0.35);
}
.gift-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 14px;
  width: 100%;
}

.pick-card {
  position: relative;
  flex: 0 0 calc((100% - 28px) / 3);
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
  font-family: inherit;
  color: #4b2e40;
  transition: transform .15s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.pick-card:hover { transform: translateY(-3px); }
.pick-card:active { transform: translateY(0) scale(.98); }

.pick-icon { font-size: clamp(2rem, 9vw, 2.8rem); line-height: 1; }
.pick-label { font-weight: 700; font-size: 1.05rem; }

.pick-check {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #4caf72;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  transform: scale(0);
  transition: transform .2s cubic-bezier(.6,-0.4,.4,1.4);
}

/* Выбранное состояние */
.pick-card.selected {
  border-color: #4caf72;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(60, 130, 85, 0.35);
}
.pick-card.selected .pick-check { transform: scale(1); }
.pick-card.selected .pick-icon { transform: scale(1.12); }

/* ---------- Кнопка «Далее» ---------- */
.next-btn {
  border: none;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  padding: 14px 46px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .15s, background .2s, box-shadow .2s, opacity .2s;
}
.next-btn:active { transform: translateY(0) scale(.97); }

/* Неактивная */
.next-btn:disabled {
  background: rgba(255, 255, 255, 0.55);
  color: rgba(90, 50, 70, 0.45);
  cursor: not-allowed;
  box-shadow: none;
}
.next-btn:disabled:hover { transform: none; }

/* Активная */
.next-btn:not(:disabled) {
  background: linear-gradient(135deg, #ff7aa2, #e34b6f);
  color: #fff;
  box-shadow: 0 10px 26px rgba(200, 50, 90, 0.45);
  animation: popIn .3s cubic-bezier(.6,-0.3,.4,1.4) both;
}
@keyframes popIn {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.next-btn:not(:disabled):hover { transform: translateY(-2px); }

/* ---------- Экран оплаты (экран 3) ---------- */
.pay {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  padding: 22px 24px 26px;
  box-shadow: 0 16px 40px rgba(120, 40, 70, 0.3);
  animation: rise .5s cubic-bezier(.2,.9,.3,1.2) both;
}
.pay-title {
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  font-weight: 800;
  color: #e34b6f;
}
.pay-items {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pay-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}
.pay-row .pay-icon { font-size: 1.6rem; }
.pay-row .pay-name { flex: 1; font-weight: 700; text-align: left; }
.pay-row .pay-price { font-weight: 700; color: #6b4a5c; white-space: nowrap; }
.pay-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-top: 10px;
  border-top: 2px dashed rgba(227, 75, 111, 0.4);
  font-size: 1.2rem;
  font-weight: 800;
}
.pay-total #payTotal { color: #e34b6f; }
.pay-note {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4b2e40;
}
.pay-btn {
  border: none;
  background: linear-gradient(135deg, #ff7aa2, #e34b6f);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 15px 50px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(200, 50, 90, 0.45);
  transition: transform .15s ease;
}
.pay-btn:hover { transform: translateY(-2px); }
.pay-btn:active { transform: translateY(0) scale(.97); }

/* ---------- Экран финал (экран 4) ---------- */
.final {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Контент финального экрана ---------- */
.final-card {
  width: min(92%, 460px);
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 24px;
  padding: 26px 26px 30px;
  box-shadow: 0 18px 46px rgba(120, 40, 70, 0.32);
  text-align: center;
  animation: rise .55s cubic-bezier(.2,.9,.3,1.2) both;
}
.final-emoji {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  line-height: 1;
  animation: pop .6s cubic-bezier(.5,1.6,.4,1.2) .15s both;
}
.final-title {
  font-size: clamp(1.4rem, 6vw, 2.1rem);
  font-weight: 800;
  color: #e34b6f;
  margin: 10px 0 14px;
  line-height: 1.25;
}
.final-letter {
  font-size: clamp(1rem, 4.4vw, 1.15rem);
  line-height: 1.6;
  color: #4b2e40;
}
.final-letter p { margin-bottom: 12px; }
.final-letter p:last-child { margin-bottom: 0; }
.final-years {
  font-weight: 800;
  color: #c0355c;
  font-size: clamp(1.05rem, 4.6vw, 1.25rem);
}
.final-picks {
  display: inline-block;
  margin-top: 4px;
  font-weight: 700;
}

@keyframes pop {
  from { opacity: 0; transform: scale(.4); }
  to   { opacity: 1; transform: scale(1); }
}

/* Скрытие экранов */
.hidden { display: none !important; }

/* Конфетти */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.confetti span {
  position: absolute;
  top: -20px;
  width: 12px; height: 16px;
  opacity: .95;
  animation: fall linear forwards;
}
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 1; }
}

/* ---------- «Взрывы» эмодзи при выборе подарка ---------- */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.fx-particle {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 30px;
  line-height: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: transform, opacity;
  animation: fxBurst var(--dur) ease-out forwards;
}
@keyframes fxBurst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot));
  }
}

/* Небольшой «поп» карточки при выборе */
@keyframes pickedPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.14); }
  72%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.pick-card.picked-pop { animation: pickedPop .4s ease; }

/* ---------- Анимация «подбираем подарки» ---------- */
.pick-loading {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(30, 10, 20, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
.pick-loading.show {
  opacity: 1;
  pointer-events: auto;
}
.pick-loading .loading-emoji {
  font-size: 64px;
  animation: loadBounce 0.9s cubic-bezier(.5, 1.6, .4, 1) infinite alternate;
}
.pick-loading .loading-text {
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.pick-loading .loading-icons {
  font-size: 1.6rem;
  display: flex;
  gap: 14px;
  margin-top: 4px;
}
.pick-loading .loading-icons span {
  animation: loadPop 1.2s ease-in-out infinite;
}
.pick-loading .loading-icons span:nth-child(2) { animation-delay: .15s; }
.pick-loading .loading-icons span:nth-child(3) { animation-delay: .3s; }
.pick-loading .loading-icons span:nth-child(4) { animation-delay: .45s; }
.pick-loading .loading-icons span:nth-child(5) { animation-delay: .6s; }

@keyframes loadBounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-18px) scale(1.12); }
}
@keyframes loadPop {
  0%, 100% { transform: translateY(0) scale(1); opacity: .7; }
  50%      { transform: translateY(-12px) scale(1.2); opacity: 1; }
}

/* ---------- Живой счётчик времени отношений ---------- */
.final-counter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 8px 14px;
  margin: 12px auto 6px;
  max-width: 560px;
}
.counter-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
}
.counter-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: #e34b6f;
  font-variant-numeric: tabular-nums;
}
.counter-label {
  font-size: .8rem;
  color: #a0335b;
  margin-top: 6px;
}
