/* lovelyalya.ru — пастельный розовый, огненные розы. Сначала — iPhone. */
:root {
  --bg: #fdf3f1;
  --card: #fffaf8;
  --ink: #4a2a33;
  --muted: #8d6b73;
  --line: #f0d3d8;
  --orange: #ff9a3c;
  --coral: #f2582f;
  --red: #c81d3a;
  --ombre: linear-gradient(100deg, var(--orange), var(--coral) 45%, var(--red));
  --serif: "Cormorant Garamond", Georgia, serif;
  --hand: "Marck Script", "Cormorant Garamond", cursive;
  --sans: "Manrope", system-ui, sans-serif;
  --spring: cubic-bezier(.3, 1.45, .5, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); overflow-x: hidden; }
/* ничто не должно расширять страницу вбок: иначе на телефоне браузер уменьшает масштаб, и всё, что прижато к краям
   экрана (котики в углах, коробка), съезжает за видимую область */
@supports (overflow: clip) { html, body { overflow-x: clip; } .page { overflow-x: clip; } }
body { font-variant-numeric: lining-nums; min-height: 100vh; color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 60% at 0% 0%, #fde7df 0%, transparent 60%),
              radial-gradient(120% 60% at 100% 30%, #fbe0e7 0%, transparent 60%),
              radial-gradient(100% 50% at 50% 100%, #fde9dd 0%, transparent 70%), var(--bg); }
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.15; text-align: center; }

/* ── котики на фоне ── */
.bgcats { position: absolute; left: 0; top: 0; width: 100%; height: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bgcats .bg { position: absolute; opacity: .28; animation: bob 5s ease-in-out infinite; filter: saturate(.9); }
.bgcats .bg.always { opacity: .42; }
.page { position: relative; z-index: 1; }
body.locked .bgcats { visibility: hidden; }

/* ── слои эффектов ── */
#fx { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.fly { position: fixed; inset: 0; z-index: 35; pointer-events: none; overflow: hidden; }
.stk { display: block; }
.stk img, .stk svg { width: 100% !important; height: 100% !important; object-fit: contain; display: block; }
.fly .stk { position: absolute; filter: drop-shadow(0 8px 14px rgba(150, 40, 60, .25)); will-change: transform; }

/* ── распаковка ── */
.gift { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; overflow: hidden; touch-action: none;
  background: radial-gradient(90% 70% at 50% 42%, #fff4ef, #fbe1e6 70%, #f6d0d9); transition: opacity .9s ease .3s, visibility 0s 1.3s; }
.gift.gone { opacity: 0; visibility: hidden; }
.gift-inner { position: relative; display: grid; justify-items: center; gap: 34px; }
.gift-to { font-family: var(--hand); font-size: clamp(42px, 11.5vw, 64px); line-height: 1; }
.gift-to span { display: inline-block; background: var(--ombre); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 3px; animation: drop .9s var(--spring) both; }
.gift-to span:nth-child(2) { animation-delay: .15s; } .gift-to span:nth-child(3) { animation-delay: .3s; }
.gift-hint { color: var(--muted); font-size: 15px; letter-spacing: .02em; min-height: 1.6em; text-align: center; animation: breathe 2.4s ease-in-out infinite; transition: opacity .2s; }
.gift-hint.bump { animation: bump .5s var(--spring), breathe 2.4s ease-in-out .5s infinite; color: var(--red); }

.box { position: relative; width: 200px; height: 180px; outline: none; cursor: grab; animation: float 3.2s ease-in-out infinite; transition: transform .2s; }
.box.press { animation-play-state: paused; }
.box .glow { position: absolute; left: 50%; top: 58%; width: 270px; height: 270px; margin: -135px 0 0 -135px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 170, 90, .55), rgba(255, 120, 90, .18) 45%, transparent 70%); animation: pulse 2.4s ease-in-out infinite; }
.box .body { position: absolute; left: 12px; right: 12px; bottom: 0; height: 122px; border-radius: 10px 10px 16px 16px;
  background: linear-gradient(160deg, #fbdfe5, #f3bcc8); box-shadow: 0 22px 44px rgba(200, 60, 80, .25), inset 0 -10px 20px rgba(200, 80, 100, .12); }
.box .lid { position: absolute; left: 2px; right: 2px; top: 30px; height: 42px; border-radius: 10px; z-index: 2;
  background: linear-gradient(160deg, #fde8ec, #f6c8d2); box-shadow: 0 8px 18px rgba(200, 60, 80, .18); }
.box .band { position: absolute; left: 50%; top: 0; bottom: 0; width: 26px; transform: translateX(-50%);
  background: linear-gradient(180deg, var(--orange), var(--red)); transition: transform .5s ease-in, opacity .5s; }
.box .lid .band { background: linear-gradient(180deg, var(--orange), var(--coral)); }

/* живая лента от узла к пальцу */
.rope { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; overflow: visible; opacity: 0;
  filter: drop-shadow(0 4px 6px rgba(150, 30, 40, .3)); }
.gift.pulling .rope { opacity: 1; }
.gift.pulling .bow[data-side="r"] .tail-r, .gift.pulling .bow[data-side="l"] .tail-l { opacity: 0; transition: opacity .1s; }

/* бант: --p — насколько натянули ленточку (0…1) */
.bow { --p: 0; position: absolute; left: 50%; top: -38px; width: 150px; margin-left: -75px; z-index: 3; transition: transform .45s var(--spring); }
.bow svg { width: 100%; display: block; overflow: visible; }
.bow .loop, .bow .tail, .bow .knot { transform-box: fill-box; transition: transform .45s var(--spring), opacity .4s; }
.bow .loop-l { transform-origin: 100% 70%; transform: rotate(calc(var(--p) * -38deg)) scale(calc(1 - var(--p) * .55)); }
.bow .loop-r { transform-origin: 0% 70%; transform: rotate(calc(var(--p) * 38deg)) scale(calc(1 - var(--p) * .55)); }
.bow .tail { transform-origin: 50% 0%; }
.bow[data-side="r"] .tail-r, .bow[data-side="l"] .tail-l { transform: scaleY(calc(1 + var(--p) * .9)) rotate(calc(var(--p) * -6deg)); }
.bow .knot { transform-origin: 50% 50%; transform: scale(calc(1 - var(--p) * .3)); }
.box.press .bow, .box.press .bow * { transition: none; }

/* развязали: петли разлетаются, хвосты падают, ленты соскальзывают */
.gift.untie .box { animation: none; }
.gift.untie .loop-l, .gift.untie .loop-r { animation: slip .38s cubic-bezier(.6, 0, .9, .5) forwards; }
.gift.untie .knot { animation: knot .45s ease-in .2s forwards; }
.gift.untie .tail { animation: slip .4s ease-in .1s forwards; }
.gift.untie .band { transition: transform .7s cubic-bezier(.5, 0, .7, .4) .25s, opacity .5s ease-in .4s;
  transform: translateX(calc(-50% + var(--dx, 1) * 260px)) rotate(calc(var(--dx, 1) * 35deg)) scaleY(.6); opacity: 0; }
.gift.untie .gift-hint, .gift.pulling .gift-hint { animation: none; }
.gift.untie .gift-hint { opacity: 0 !important; }

/* «заряд» и открытие */
.gift.charge .box { animation: charge .56s ease-in both; }
.gift.charge .glow { animation: none; transform: scale(1.5); opacity: 1; transition: transform .5s ease-in; }
.rays { position: absolute; left: 50%; top: 50%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 196, 120, .55) 0deg 7deg, rgba(255, 255, 255, 0) 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 62%); mask: radial-gradient(circle, #000 0%, transparent 62%); }
.flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, #fff 0%, rgba(255, 240, 220, .8) 35%, transparent 70%); opacity: 0; pointer-events: none; }
.gift.open .rays { animation: rays 2.2s ease-out forwards; }
.gift.open .flash { animation: flash .7s ease-out; }
.gift.open .box { animation: none; }
.gift.open .glow { animation: none; opacity: 0; transition: opacity .5s; }
.gift.open .lid { animation: lid .9s cubic-bezier(.2, .8, .3, 1) forwards; }
.gift.open .body { animation: sink .8s ease-in .25s forwards; }
.gift.open .gift-to { transition: opacity .35s, transform .35s; opacity: 0; transform: translateY(-10px); }

.gift.repack { transition: opacity .45s ease, visibility 0s; }
.gift.repack .box { animation: none; }
.gift.repack .body { animation: body-in .6s var(--spring) .1s both; }
.gift.repack .lid { animation: lid-in .85s cubic-bezier(.3, .9, .4, 1) .45s both; }
.gift.repack .band { transform-origin: 50% 0; animation: band-in .45s ease-out 1.2s both; }
.gift.repack .bow { animation: bow-in .7s var(--spring) 1.35s both; }
.gift.repack .gift-to span { animation-delay: .2s; }
.gift.repack .gift-hint { animation: drop .6s var(--spring) 1.7s both, breathe 2.4s ease-in-out 2.3s infinite; }

/* ── страница ── */
.page { max-width: 560px; margin: 0 auto; padding: 28px 20px calc(130px + env(safe-area-inset-bottom)); }
body.locked .page { visibility: hidden; }

.hero { text-align: center; padding-top: 4px; }
.bouquet { position: relative; height: 210px; margin: 0 auto 6px; width: 290px; }
.bouquet .layer { position: absolute; inset: 0; will-change: transform; pointer-events: none; }
.bouquet svg { position: absolute; }
.bouquet .r { pointer-events: auto; cursor: pointer; }
.bouquet .r1 { width: 156px; height: 156px; left: 67px; top: 14px; animation: sway 6s ease-in-out infinite; }
.bouquet .r2 { width: 112px; height: 112px; left: 0; top: 78px; animation: sway 7s ease-in-out -2s infinite; }
.bouquet .r3 { width: 106px; height: 106px; right: 0; top: 84px; animation: sway 6.5s ease-in-out -4s infinite; }
.bouquet .leaf { width: 110px; height: 55px; }
.bouquet .l1 { left: 16px; top: 46px; transform: rotate(-32deg); }
.bouquet .l2 { right: 14px; top: 52px; transform: rotate(210deg); }
.hello { font-family: var(--hand); font-size: 48px; line-height: 1; color: var(--red); }
.title { font-family: var(--serif); font-weight: 600; font-size: 36px; line-height: 1.1; margin-top: 6px; }
.amount { position: relative; display: inline-block; overflow: hidden; font-family: var(--serif); font-weight: 700; font-size: 76px; line-height: 1.05;
  margin-top: 18px; padding: 0 6px; background: var(--ombre); -webkit-background-clip: text; background-clip: text; color: transparent; }
.amount::after { content: ""; position: absolute; inset: 0 -20%; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .9) 50%, transparent 65%);
  transform: translateX(-120%); pointer-events: none; }
.amount.shine::after { animation: shine 1.2s ease-out .1s, shine 1.2s ease-out 6s infinite; }
.for { color: var(--muted); font-size: 18px; margin-top: 6px; }

.letter { position: relative; margin: 34px 0 40px; padding: 30px 26px 26px; border-radius: 26px; background: var(--card);
  box-shadow: 0 20px 50px rgba(200, 70, 90, .10), 0 2px 0 rgba(255, 255, 255, .8) inset; border: 1px solid var(--line);
  font-family: var(--serif); font-size: 21px; line-height: 1.5; }
.letter::before { content: ""; position: absolute; inset: 10px; border-radius: 18px; border: 1px dashed #f1c6ce; pointer-events: none; }
.letter p + p { margin-top: 12px; }
.letter .w { display: inline-block; opacity: 0; transform: translateY(8px); filter: blur(4px); transition: opacity .5s, transform .5s var(--spring), filter .5s; }
.letter.on .w { opacity: 1; transform: none; filter: none; }
.letter .sign { font-family: var(--hand); font-size: 30px; line-height: 1.25; color: var(--red); text-align: right; margin-top: 18px;
  clip-path: inset(0 100% 0 0); transition: clip-path 1.4s ease-in-out; }
.letter.on .sign { clip-path: inset(0 -5% 0 0); }

/* ── «Это мы»: стопка фото, каждая карточка по форме своего снимка ── */
.album, .love { text-align: center; margin-bottom: 40px; }
.album-hint { color: var(--muted); font-size: 14px; margin: 2px 0 14px; }
.album-count { color: var(--muted); font-size: 14px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stack { position: relative; height: 380px; margin: 0 auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.card { position: absolute; left: 50%; top: 50%; padding: 10px 10px 40px; background: #fff; border-radius: 6px; cursor: grab;
  box-shadow: 0 14px 30px rgba(150, 50, 70, .2), 0 1px 0 rgba(0, 0, 0, .04); transition: transform .35s var(--spring), opacity .3s; }
.card img { display: block; max-width: min(270px, 72vw); max-height: 310px; width: auto; height: auto; border-radius: 3px; pointer-events: none; }
.card .cap { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-family: var(--hand); font-size: 20px; color: #e25a6a; }
.card .like { position: absolute; left: 50%; top: 42%; width: 110px; height: 100px; pointer-events: none; animation: like 1.3s var(--spring) forwards;
  filter: drop-shadow(0 6px 14px rgba(200, 30, 60, .35)); }

/* ── «Подержи сердечко» ── */
.big-heart { width: 140px; height: 130px; margin: 18px auto 0; display: block; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; filter: drop-shadow(0 14px 24px rgba(220, 50, 50, .35)); animation: beat 1.4s ease-in-out infinite; transition: transform .5s var(--spring); }
.big-heart svg { width: 100%; height: 100%; display: block; }
.big-heart.holding { animation: none; transition: none; }
.love-text { margin-top: 16px; min-height: 1.6em; font-family: var(--hand); font-size: 26px; color: var(--red); }

/* ── котики по углам ── */
.peek { position: fixed; bottom: 0; z-index: 25; width: 76px; height: 76px; transform: translateY(140%);
  transition: transform .9s var(--spring); cursor: pointer; }
.peek.left { left: 4px; } .peek.right { right: 4px; }
.peek.up { transform: translateY(14%); }      /* пустое поле картинки снизу — за краем, котик сидит на краю экрана */
.peek .stk { width: 100%; height: 100%; }
body.locked .peek { visibility: hidden; }

.link { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; display: inline-block; }
.foot { text-align: center; color: var(--muted); padding-top: 6px; }
.foot-rose { width: 56px; height: 56px; animation: sway 5s ease-in-out infinite; }
.foot p { font-family: var(--serif); font-size: 19px; }
.foot .link { font-family: var(--serif); font-size: inherit; color: var(--red); text-decoration-color: rgba(200, 29, 58, .4); }

/* ── анимации ── */
@keyframes drop { from { opacity: 0; transform: translateY(-30px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes breathe { 50% { opacity: .45; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(-1.5deg); } }
@keyframes pulse { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes slip { to { transform: scale(0) rotate(90deg); opacity: 0; } }
@keyframes knot { 50% { transform: scale(1.4); } to { transform: scale(0); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
/* упаковка обратно */
@keyframes body-in { from { transform: scale(.4) translateY(60px); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes lid-in { from { transform: translate(-80px, -460px) rotate(-60deg); opacity: 0; } 55% { transform: translate(0, -6px) rotate(3deg); opacity: 1; }
  75% { transform: translateY(-14px) rotate(-1deg); } to { transform: none; opacity: 1; } }
@keyframes band-in { from { transform: translateX(-50%) scaleY(0); } to { transform: translateX(-50%) scaleY(1); } }
@keyframes bow-in { from { transform: scale(0) rotate(-140deg); } 70% { transform: scale(1.18) rotate(8deg); } to { transform: none; } }
@keyframes charge { 0% { transform: rotate(0); } 15% { transform: rotate(-3deg) scale(1.02); } 30% { transform: rotate(4deg) scale(1.03); }
  45% { transform: rotate(-6deg) scale(1.05); } 60% { transform: rotate(7deg) scale(1.07); } 75% { transform: rotate(-8deg) scale(1.09); }
  90% { transform: rotate(9deg) scale(1.11); } 100% { transform: rotate(0) scale(1.14); } }
@keyframes rays { 0% { opacity: 0; transform: rotate(0) scale(.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(80deg) scale(1.1); } }
@keyframes flash { 0% { opacity: 0; } 20% { opacity: .9; } 100% { opacity: 0; } }
@keyframes lid { 0% { transform: none; } 35% { transform: translate(10px, -90px) rotate(-14deg); opacity: 1; }
  100% { transform: translate(120px, -420px) rotate(70deg); opacity: 0; } }
@keyframes sink { to { transform: scale(.6) translateY(40px); opacity: 0; } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes shine { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes like { 0% { transform: translate(-50%, -50%) scale(0); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1.1); opacity: 0; } }
.card .like svg { width: 100%; height: 100%; display: block; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.08); } 30% { transform: scale(1); } 45% { transform: scale(1.05); } }

@media (min-width: 760px) {
  .page { padding-top: 56px; }
  .bouquet { transform: scale(1.15); margin-bottom: 26px; }
  .amount { font-size: 96px; }
  .stack { height: 420px; }
  .card img { max-width: 320px; max-height: 340px; }
  .peek { width: 120px; height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
