/* Открытка читается сверху вниз: утро, берег, горы, закат, ночь. Каждое воспоминание — летающий островок. */
:root { --ink: #3b2a4a; --paper: #fff8ec; --wine: #8d2f4f; --rose: #d6476f; --night: #08060f; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--night); }
body { font-family: Nunito, system-ui, sans-serif; color: var(--ink); overflow-x: hidden; line-height: 1.55; }
main { position: relative; }
.sky { position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 64px 20px; overflow: hidden; }
.sky > * { position: relative; z-index: 2; width: min(100%, 440px); }
.sky > .deco { position: absolute; z-index: 0; animation: drift 50s ease-in-out infinite alternate; }
.sky-hello { min-height: 100svh; justify-content: center; background: linear-gradient(#ffd0c2, #ffe9d6 42%, #cfe6fb); text-align: center; gap: 14px; }
.sky-bench { background: linear-gradient(#cfe6fb, #b8d6f4 50%, #7d9fcd); }
.sky-horse { background: linear-gradient(#7d9fcd, #9dbfe9 26%, #c6dbef 52%, #dce8ec); padding: 48px 0 30px; gap: 0; }
.sky-bid { background: linear-gradient(#dce8ec, #ffd2b8 30%, #f0a1b0 62%, #7a5a9e); }
.sky-night { background: linear-gradient(#7a5a9e, #2b1f52 150px, var(--night) 330px); color: #f4efff; text-align: center; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.sky-night::before { content: ''; position: absolute; inset: 0; opacity: .7; background: radial-gradient(1.5px 1.5px at 12% 30px, #fff, transparent), radial-gradient(1.5px 1.5px at 82% 90px, #fff, transparent), radial-gradient(2px 2px at 30% 150px, #ffd9f0, transparent), radial-gradient(1.5px 1.5px at 64% 200px, #fff, transparent), radial-gradient(2px 2px at 90% 250px, #cfe0ff, transparent), radial-gradient(1.5px 1.5px at 6% 230px, #fff, transparent); }
h1, h2 { font-family: 'Marck Script', cursive; font-weight: 400; line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(3.2rem, 16vw, 5.2rem); color: var(--wine); margin-top: 76px; }
h2 { font-size: 2.1rem; color: var(--wine); }
.lead { font-size: 1.08rem; font-weight: 500; }
.down { font-family: 'Marck Script', cursive; font-size: 1.4rem; color: var(--wine); animation: nod 1.8s ease-in-out infinite; }

/* марка и штемпель: это всё-таки открытка */
.sky > .stamp { position: absolute; top: 26px; right: 22px; width: 84px; height: 108px; rotate: 5deg; background: radial-gradient(circle, transparent 3px, var(--paper) 3.6px) -6px -6px / 12px 12px; filter: drop-shadow(0 4px 8px rgba(59, 42, 74, .22)); }
.stamp div { position: absolute; inset: 7px; background: #ffd9df; border: 2px solid var(--wine); display: grid; place-items: center; align-content: center; gap: 2px; font-family: 'Marck Script', cursive; font-size: 1.25rem; color: var(--wine); line-height: 1; }
.stamp svg { width: 40px; }
.sky > .postmark { position: absolute; top: 34px; right: 74px; width: 118px; rotate: -14deg; opacity: .5; }

/* записка на скотче */
.sky > .note { width: min(calc(100% - 8px), 400px); background: var(--paper); border-radius: 6px 18px 8px 16px; padding: 28px 24px 20px; box-shadow: 0 10px 24px rgba(59, 42, 74, .18); font-size: 1.1rem; text-align: center; background-image: repeating-linear-gradient(transparent 0 31px, rgba(141, 47, 79, .09) 31px 32px); }
.note::before { content: ''; position: absolute; top: -11px; left: 50%; width: 92px; height: 24px; margin-left: -46px; background: rgba(255, 176, 160, .8); rotate: -3deg; }
.note h2 { margin-bottom: 6px; }
.sky-horse > .note { width: min(calc(100% - 48px), 400px); z-index: 3; }
.tilt-l { rotate: -1.6deg; }
.tilt-r { rotate: 1.6deg; }

.island { display: block; border: 0; background: none; }
svg [hidden] { display: none; }
.island svg, .isle-horse svg { display: block; width: 100%; height: auto; overflow: visible; }
.float svg { animation: float 6s ease-in-out infinite; }
.peb { animation: float 4.4s ease-in-out infinite reverse; }
.balloon { animation: sway 5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.sun { animation: spin 60s linear infinite; transform-box: fill-box; transform-origin: center; }
.zz { animation: zz 2.6s ease-in-out infinite; }
.awake .zz { display: none; }
.fly circle { animation: glow 2.4s ease-in-out infinite; filter: drop-shadow(0 0 4px #f8ffb0); }
.fly circle:nth-child(2n) { animation-delay: -1.2s; }
.sky > .isle-horse { width: min(100%, 540px); margin-top: -34px; }

.sky > .postcard { width: min(100%, 330px); background: #fff; padding: 10px 10px 6px; box-shadow: 0 12px 28px rgba(59, 42, 74, .26); }
.postcard svg { display: block; width: 100%; height: auto; }
.postcard figcaption { font-family: 'Marck Script', cursive; font-size: 1.4rem; text-align: center; padding-top: 4px; }

.sky > .poke { cursor: pointer; width: min(92%, 380px); -webkit-tap-highlight-color: transparent; }
.poke:focus-visible, button:focus-visible { outline: 3px solid var(--rose); outline-offset: 4px; border-radius: 20px; }
.poke.purr svg { animation: purr .45s ease 2; }
.meow { font-family: 'Marck Script', cursive; font-size: 1.8rem; color: #fff; text-shadow: 0 2px 10px rgba(59, 42, 74, .5); text-align: center; margin-top: -16px; }
.sky > .heartlet { position: absolute; pointer-events: none; width: 20px; color: var(--rose); font-size: 24px; animation: fly 1.2s ease-out forwards; }

/* ночь: руки светятся в небе за островком */
.night-title { color: #fff; text-shadow: 0 0 22px rgba(160, 120, 255, .8); padding-top: 40px; }
.sky > .portal { width: min(calc(100% + 40px), 600px); margin: -10px -20px 0; display: grid; justify-items: center; gap: 16px; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stage { position: relative; width: 100%; height: min(66svh, 580px); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 82%, transparent), linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(transparent, #000 14%, #000 82%, transparent), linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-composite: intersect; }
.stage .island { position: absolute; left: 50%; bottom: 0; width: min(84%, 400px); translate: -50% 0; pointer-events: none; }
.portal-ui { display: grid; justify-items: center; gap: 12px; transition: opacity .6s; }
.portal-ui button { font: 700 1.05rem Nunito, system-ui, sans-serif; color: #fff; background: rgba(80, 55, 150, .6); border: 1px solid rgba(200, 180, 255, .6); border-radius: 99px; min-height: 50px; padding: 0 34px; cursor: pointer; touch-action: none; }
.meter { width: 160px; height: 3px; background: rgba(255, 255, 255, .18); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #3b6bff, #ff5fb0); transform-origin: left; transform: scaleX(0); }
.met .portal-ui { opacity: 0; pointer-events: none; height: 0; overflow: hidden; }
.letter { display: grid; gap: 12px; font-size: 1.15rem; opacity: 0; translate: 0 16px; transition: opacity 1s .8s, translate 1s .8s; }
.letter h2 { color: #ffb3d4; font-size: 2.7rem; }
.letter .sign { font-family: 'Marck Script', cursive; font-size: 1.8rem; }
.letter .days { color: #bdb1e6; }
.met .letter { opacity: 1; translate: 0 0; }

/* дорожка с самолётиком */
#trail { position: absolute; left: 0; top: 0; width: 100%; z-index: 1; pointer-events: none; overflow: visible; }
#trail-p { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 11; opacity: .85; }
#plane { transition: opacity .4s; filter: drop-shadow(0 3px 4px rgba(59, 42, 74, .3)); }

.rv { opacity: 0; translate: 0 36px; scale: .94; transition: opacity .7s ease, translate .9s cubic-bezier(.2, .9, .3, 1.25), scale .9s cubic-bezier(.2, .9, .3, 1.25); }
.rv.in { opacity: 1; translate: 0 0; scale: 1; }
.stage .rv { translate: -50% 36px; } .stage .rv.in { translate: -50% 0; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes drift { to { transform: translateX(46px); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes zz { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-8px); opacity: .5; } }
@keyframes glow { 50% { opacity: .15; } }
@keyframes nod { 50% { transform: translateY(7px); } }
@keyframes purr { 25% { transform: rotate(-3deg) scale(1.03); } 75% { transform: rotate(3deg); } }
@keyframes fly { to { transform: translate(var(--dx), -110px) scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
