/* «Наша сказка» — приглашение Максима и Лизы. Всё 2D: плоские нарисованные слои, без 3D-трансформаций. */
:root {
  --indigo: #1b1d3f;
  --indigo-2: #2a2b5c;
  --lilac: #6b5b95;
  --gold: #e8b96a;
  --gold-hi: #fff1c9;
  --gold-lo: #a8732f;
  --warm: #ffd9a0;
  --rose: #e9b8b5;
  --parch: #f4e9d8;
  --ink: #4a3426;
  --ink-soft: #7a5c45;
  --ribbon: #8fa8c8;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --tale: 'Alice', Georgia, serif;
  --script: 'Great Vibes', var(--serif);
  --hand: 'Bad Script', var(--serif);
  --caps: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --pw: 300px;   /* ширина страницы, считает main.js */
  --ph: 400px;
  --vh: 1vh;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--indigo); color: var(--parch);
  font-family: var(--serif); font-size: 18px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.is-locked { overflow: hidden; height: 100%; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ───────── 0. Конверт ───────── */
.envelope-screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh;
  background: radial-gradient(120% 90% at 50% 40%, #3a3270 0%, var(--indigo) 55%, #0f1027 100%);
  overflow: hidden;
}
.env-bokeh { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 12% 22%, rgba(255,217,160,.18) 0 3px, transparent 40px),
    radial-gradient(circle at 82% 18%, rgba(233,184,181,.16) 0 2px, transparent 50px),
    radial-gradient(circle at 70% 78%, rgba(255,217,160,.14) 0 3px, transparent 60px),
    radial-gradient(circle at 22% 82%, rgba(143,168,200,.16) 0 2px, transparent 46px);
}
.env {
  --tip: 64%;               /* где кончик клапана (подгоняется под рисунок конверта) */
  position: relative; width: min(82vw, 600px, calc(var(--vh) * 58 * 1.5)); aspect-ratio: 3 / 2;
  filter: drop-shadow(0 26px 34px rgba(0,0,0,.45));
}
.env > * { position: absolute; }
.env-inside { z-index: 0; inset: 0; background: linear-gradient(180deg, #cdb38c, #e2cda8 70%); border-radius: 4px; }
.env-card {
  z-index: 1; left: 7%; right: 7%; top: 6%; height: 88%;
  border-radius: 3px; background: url(../assets/img/card.webp) center / 100% 100%; box-shadow: 0 2px 10px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
}
.env-card-text { font-family: var(--caps); font-weight: 600; color: #6a4a2c; font-size: clamp(20px, 4.2vw, 36px); letter-spacing: .06em; text-align: center; line-height: 1.05; }
.env-card-text span { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .7em; color: var(--gold-lo); }
.env-body {
  z-index: 2; inset: 0; background: url(../assets/img/envelope.webp) center / 100% 100%;
  clip-path: polygon(0 0, 50% var(--tip), 100% 0, 100% 100%, 0 100%);
  border-radius: 4px;
}
/* клапан закрыт: треугольник вниз; открывается плоско — сжимается к верхнему краю, затем изнанка растёт вверх */
.env-flap { z-index: 5; inset: 0; transform-origin: 50% 0;
  background: url(../assets/img/envelope.webp) center / 100% 100%;
  clip-path: polygon(0 0, 100% 0, 50% var(--tip));
  filter: drop-shadow(0 3px 3px rgba(60,40,20,.25)); }
.env-flap-back { z-index: 0; left: 0; right: 0; bottom: calc(100% - 2px); height: var(--tip); transform-origin: 50% 100%; transform: scaleY(0);
  background: linear-gradient(0deg, #e6d3b0, #f1e4c9);
  clip-path: polygon(0 100%, 100% 100%, 50% 0); }
.env-ribbon {
  left: -1%; right: -1%; top: calc(var(--tip) - 4.5%); height: 9%; z-index: 6;
  background: linear-gradient(180deg, #5f74b8 0%, #8ea3e0 32%, #a9bbec 46%, #7f95d6 64%, #5d72b4 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
.env-bow { left: 50%; top: var(--tip); width: 34%; transform: translate(-50%, -28%); z-index: 7; pointer-events: none; filter: drop-shadow(0 4px 5px rgba(0,0,0,.3)); }
.env-seal {
  left: 50%; top: var(--tip); width: 20%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: 8;
  border-radius: 50%; outline-offset: 6px;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.4));
  transition: transform .4s cubic-bezier(.3,1.6,.5,1);
}
.env-seal:hover, .env-seal:focus-visible { transform: translate(-50%, -50%) scale(1.06); }
.env-seal:focus-visible { outline: 2px solid var(--gold); }
.seal-half { position: absolute; inset: 0; background: url(../assets/img/seal.webp) center / contain no-repeat; }
.seal-l { clip-path: polygon(0 0, 54% 0, 46% 38%, 55% 62%, 48% 100%, 0 100%); }
.seal-r { clip-path: polygon(54% 0, 100% 0, 100% 100%, 48% 100%, 55% 62%, 46% 38%); }
.seal-shine { position: absolute; inset: 8%; border-radius: 50%; overflow: hidden; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,241,201,.55) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat;
  mix-blend-mode: screen; animation: shine 2.4s ease-in-out infinite; }
@keyframes shine { to { background-position: 150% 0; } }
.env-hint { position: relative; margin: 0; font-size: clamp(17px, 2.2vw, 21px); letter-spacing: .06em; color: var(--warm); text-align: center; min-height: 1.6em; font-style: italic; }
.env-hint > span { transition: opacity .6s; }
.env-tap { position: absolute; left: 50%; top: 0; transform: translateX(-50%); white-space: nowrap; opacity: 0; }
.envelope-screen.is-ready .env-load { opacity: 0; }
.envelope-screen.is-ready .env-tap { opacity: 1; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.env-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fff7e0 0%, rgba(255,217,160,.85) 35%, rgba(255,217,160,0) 75%); }

/* ───────── Сцена: комната и книга ───────── */
.story { position: relative; height: 4000vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--indigo); }
.room { position: absolute; left: 0; top: 0; width: 100%; height: 100%; will-change: transform; transform-origin: 0 0; overflow: visible; }
.room picture img { position: absolute; max-width: none; }   /* размер и сдвиг «как cover» считает main.js */
.stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(90% 80% at 50% 62%, transparent 40%, rgba(15,16,39,.5) 100%); }
.room-glow { z-index: 2; position: absolute; left: 50%; top: 58%; width: 120vmax; height: 120vmax; transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(255,226,170,.5) 0%, rgba(255,200,120,.16) 25%, transparent 55%); mix-blend-mode: screen; }

/* закрытая книга на столе: позицию задаёт main.js (стол на картинке комнаты) */
/* тень, на которую книга ложится всем низом */
.book-closed-shadow { position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(20,8,24,.7), rgba(20,8,24,.35) 60%, transparent); filter: blur(6px); }

/* книга «в лицо»: точка (0,0) — корешок по центру экрана */
/* имена: проявляются слева направо, как пером; --rv — ход проявления */
.names { position: absolute; z-index: 4; left: 50%; top: 41%; margin: 0; width: min(80vw, 58vh); translate: -50% -50%; pointer-events: none; opacity: 1; visibility: hidden; --rv: 0; }
.names img { width: 100%; height: auto;
  filter: drop-shadow(0 0 3px rgba(255,226,160,.9)) drop-shadow(0 0 16px rgba(255,190,100,.55)) drop-shadow(0 3px 5px rgba(30,14,40,.6));
  -webkit-mask-image: linear-gradient(100deg, #000 calc(var(--rv) * 125% - 25%), transparent calc(var(--rv) * 125%));
  mask-image: linear-gradient(100deg, #000 calc(var(--rv) * 125% - 25%), transparent calc(var(--rv) * 125%)); }
.names.is-live img { animation: breatheGold 4.5s ease-in-out infinite; }
@keyframes breatheGold { 50% { filter: drop-shadow(0 0 4px rgba(255,236,180,1)) drop-shadow(0 0 26px rgba(255,200,110,.8)) drop-shadow(0 3px 5px rgba(30,14,40,.6)); } }
/* табличка висит на лентах, ось качания — наверху */
.sign { --w: min(72vw, 300px); position: absolute; z-index: 6; top: calc(var(--w) * -.16 + env(safe-area-inset-top)); left: 50%; width: var(--w); aspect-ratio: 720 / 343; margin-left: calc(var(--w) / -2);
  background: url(../assets/img/sign.webp) center / 100% 100% no-repeat; visibility: hidden; transform-origin: 50% 0; color: #ffefcd; text-decoration: none; pointer-events: auto; filter: drop-shadow(0 6px 8px rgba(20,8,30,.45)); }
.sign:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.veil { position: fixed; inset: 0; z-index: 58; background: #f8f2e6; opacity: 0; pointer-events: none; }

/* книга: (0,0) — середина корешка */
.book-pos { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 3; transform-origin: 0 0; will-change: transform; pointer-events: none; }
.book-eye { position: absolute; left: 0; top: 0; width: 1px; height: 1px; -webkit-perspective: var(--P, 2400px); perspective: var(--P, 2400px);
  -webkit-perspective-origin: var(--ex, 0) 0; perspective-origin: var(--ex, 0) 0; }
.book, .book-turn { position: absolute; left: 0; top: 0; width: 1px; height: 1px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }
.book-shadow { position: absolute; left: calc(var(--pw) * -1.02); width: calc(var(--pw) * 2.04); top: calc(var(--ph) * .42); height: calc(var(--ph) * .16);
  border-radius: 50%; background: rgba(8,6,20,.55); filter: blur(22px); opacity: 0; }
/* толщина: --t — блок страниц (вглубь от разворота), --tc — обложка над ним */
.book { --t: calc(var(--pw) * .085); --tc: calc(var(--pw) * .014); }
.block-bottom, .spine { position: absolute; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.block-bottom { left: 0; top: calc(var(--ph) * .5); width: var(--pw); height: var(--t); transform-origin: 50% 0; transform: rotateX(-90deg);
  background: repeating-linear-gradient(180deg, #e6d2ae 0 2px, #c8b18d 2px 3px, #dfc9a3 3px 5px), #dcc5a0;
  box-shadow: inset 0 1px 2px rgba(50,25,45,.2); }
.spine { top: calc(var(--ph) * -.515); height: calc(var(--ph) * 1.03); left: calc((var(--t) + var(--tc)) * -1); width: calc(var(--t) + var(--tc));
  transform-origin: 100% 50%; transform: translateZ(var(--tc)) rotateY(-90deg);
  background: url(../assets/img/spine.webp) center / 100% 100%; border-radius: 6px 0 0 6px; }
.page { position: absolute; top: calc(var(--ph) * -.5); width: var(--pw); height: var(--ph); overflow: hidden; isolation: isolate; }
.page-r { left: 0; transform-origin: 0 50%; border-radius: 0 4px 4px 0; }
.page-l { left: calc(var(--pw) * -1); transform-origin: 100% 50%; border-radius: 4px 0 0 4px; }
.book:not(.is-open) .pg-r, .book:not(.is-open) .spread-r { box-shadow: none; }
.page .shade { position: absolute; inset: 0; background: #1a0f08; opacity: 0; pointer-events: none; z-index: 5; }

.spread-r { background: url(../assets/img/page0.webp) center / 100% 100%; overflow: visible;
  /* срез блока страниц справа и снизу */
  box-shadow: 1px 1px 0 #a8927a, 2px 2px 0 #8f7a68, 3px 3px 0 #a08a73, 4px 4px 0 #6f5c52; }
.spread-l { background: url(../assets/img/spread-l.webp) center / 100% 100%; overflow: visible;
  box-shadow: -1px 1px 0 #a8927a, -2px 2px 0 #8f7a68, -3px 3px 0 #a08a73, -4px 4px 0 #6f5c52; color: var(--ink); }
.spread-r::before { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(90deg, rgba(70,40,20,.28) 0%, rgba(70,40,20,.07) 5%, transparent 12%); }
.pg-r, .pg-l { background-position: center; background-size: 100% 100%; }
#r1 { background-image: url(../assets/img/page1.webp); } #r2 { background-image: url(../assets/img/page2.webp); }
#r3 { background-image: url(../assets/img/page3.webp); } #r4 { background-image: url(../assets/img/page4.webp); }
#l1 { background-image: url(../assets/img/left-p.webp); } #l2 { background-image: url(../assets/img/left-z.webp); }
#l3 { background-image: url(../assets/img/left-k.webp); } #l4 { background-image: url(../assets/img/left-i.webp); }
.pg-r { box-shadow: 1px 1px 0 #a8927a, 2px 2px 0 #8f7a68, 3px 3px 0 #a08a73, 4px 4px 0 #6f5c52; }
.pg-l { color: var(--ink); overflow: visible; box-shadow: -1px 1px 0 #a8927a, -2px 2px 0 #8f7a68, -3px 3px 0 #a08a73, -4px 4px 0 #6f5c52; }
.pg-r::before { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(90deg, rgba(70,40,20,.28) 0%, rgba(70,40,20,.07) 5%, transparent 12%); }
.pg-l::after, .spread-l::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(270deg, rgba(70,40,20,.28) 0%, rgba(70,40,20,.07) 5%, transparent 12%); }
/* вечерний свет на страницах: тёплый от свечей слева, сиреневые сумерки справа и по краям */
.light { position: absolute; inset: 0; z-index: 3; pointer-events: none; mix-blend-mode: multiply;
  background: radial-gradient(130% 110% at 20% 25%, #fff0d6 0%, #f3d6a8 40%, #e2c6cf 80%, #b9a3c4 100%); opacity: .38; }
.spread-r .light { background: radial-gradient(140% 110% at 0% 30%, #fff0d8 0%, #f4dcb8 40%, #dcc4d4 80%, #b8a2c6 100%); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* текст встаёт в свободные места нарисованной страницы: буквица «Н» уже есть на рисунке (x .12–.51, y .09–.34) */
.first-line { position: absolute; left: 52%; right: 8%; top: 13.5%; margin: 0;
  font-family: var(--serif); font-weight: 500; font-size: calc(var(--pw) * .082); line-height: 1.12; color: #4f3524; }
.page-text { position: absolute; left: 27%; right: 10%; top: 37.5%; margin: 0; font-size: calc(var(--pw) * .046); line-height: 1.45; font-weight: 500; }
.page-turn { position: absolute; left: 20%; right: 8%; bottom: 17.5%; margin: 0; text-align: center; font-style: italic; font-size: calc(var(--pw) * .042); color: var(--ink-soft); }
/* «пишущийся» текст: слово проявляется маской слева направо, как пером */
.ink .w { display: inline-block; --w: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--w) * 130% - 30%), transparent calc(var(--w) * 130%));
  mask-image: linear-gradient(90deg, #000 calc(var(--w) * 130% - 30%), transparent calc(var(--w) * 130%)); }

.cover-front { top: calc(var(--ph) * -.515); height: calc(var(--ph) * 1.03); width: calc(var(--pw) * 1.025); border-radius: 0 6px 6px 0;
  background: url(../assets/img/cover.webp) center / 100% 100%; }
/* корешок: видно слева, пока книга закрыта */
.cover-sheen { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0; z-index: 3;
  background: linear-gradient(110deg, transparent 30%, rgba(255,236,190,0) 38%, rgba(255,236,190,.55) 48%, rgba(255,236,190,0) 58%, transparent 70%) -120% 0 / 240% 100% no-repeat; }
.hint-scroll { z-index: 4; position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; color: #ffe6b8; font-size: 19px; letter-spacing: .24em; padding: 10px 26px 4px; border-radius: 40px; background: radial-gradient(closest-side, rgba(15,16,39,.75), rgba(15,16,39,0)); opacity: 0; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.hint-scroll i { width: 1px; height: var(--hl, 36px); background: linear-gradient(var(--warm), transparent); animation: drip 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ───────── Сцены глав: плоские слои на весь экран ───────── */
.scene { position: absolute; inset: 0; z-index: 5; opacity: 0; visibility: hidden; overflow: hidden; pointer-events: none;
  --r: 0%; --cx: 50%; --cy: 50%;
  -webkit-mask-image: radial-gradient(circle at var(--cx) var(--cy), #000 var(--r), transparent calc(var(--r) + 12%));
  mask-image: radial-gradient(circle at var(--cx) var(--cy), #000 var(--r), transparent calc(var(--r) + 12%)); }
.sc-layer { position: absolute; inset: -4%; will-change: transform; }
.sc-layer img { width: 100%; height: 100%; object-fit: cover; }
.sc-bg img { object-position: 45% 60%; }
.sc-hero, .sc-table { inset: auto; left: 0; top: 0; width: 100%; height: 100%; }
.sc-hero img { position: absolute; width: auto; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(20,10,40,.3)); }
.sc-fg img { object-position: 50% 100%; }
/* I. кафе: стол и герои привязаны к линии стола --tbl (считает main.js) */
#scene1 .sc-bg, #scene1 .sc-table { inset: -4%; width: auto; height: auto; }
#scene1 .sc-bg img, #scene1 .sc-table img { object-position: 50% 60%; }
#scene1 .sc-hero { --H: 58vh; }
#scene1 .sc-hero img { max-width: none; }
#scene1 .cafe-b { left: 50%; height: var(--H); bottom: calc(100% - var(--tbl, 70%) - 2vh); }
#scene1 .cafe-sofa { left: -2%; width: 104%; height: calc(var(--H) * .54); top: calc(var(--tbl, 70%) - var(--H) * .5); object-fit: cover; object-position: 50% 0; filter: none; }   /* спинка по плечи */
.sc-cake { position: absolute; left: 50%; top: var(--tbl, 70%); width: min(15vw, 24vh); translate: -50% -78%; }
.sc-cake img { width: 100%; }
.flame { position: absolute; left: 50%; top: 2%; width: 60%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255,220,150,.9), rgba(255,170,90,.25) 45%, transparent 75%); animation: flick 1.3s ease-in-out infinite alternate; }
@keyframes flick { from { opacity: .7; scale: .9; } to { opacity: 1; scale: 1.1; } }
/* II. пляж */
#scene2 .sc-bg img { position: absolute; left: 0; bottom: 0; width: 125%; height: 125%; max-width: none; object-position: 0 100%; }   /* горизонт выше голов: солнце остаётся видно */
#scene2 .sc-hero img { height: 52%; left: 42%; bottom: 3%; }
/* III. Каппадокия: шары поднимаются из-за дальних скал */
.sc-balloons .bl { position: absolute; height: auto; max-width: none; filter: drop-shadow(0 6px 8px rgba(80,40,60,.25)); will-change: transform; }
.sc-balloons .bl-1 { left: 3%;  top: 39%; width: 7vmin; }   .sc-balloons .bl-6 { left: 15%; top: 47%; width: 3.6vmin; }
.sc-balloons .bl-3 { left: 27%; top: 31%; width: 5vmin; }   .sc-balloons .bl-8 { left: 39%; top: 45%; width: 2.8vmin; }
.sc-balloons .bl-5 { left: 51%; top: 35%; width: 4vmin; }   .sc-balloons .bl-7 { left: 63%; top: 49%; width: 3.2vmin; }
.sc-balloons .bl-2 { left: 75%; top: 31%; width: 6vmin; }   .sc-balloons .bl-4 { left: 87%; top: 43%; width: 5.5vmin; }
#scene3 .sc-hero img { height: 56%; left: 50%; bottom: 3%; }
.sc-glow3 { background: radial-gradient(55% 45% at 50% 62%, rgba(255,205,150,.55), rgba(255,170,150,.12) 55%, transparent 75%); }
.sc-glow { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(60% 50% at 78% 62%, rgba(255,190,120,.55), rgba(255,150,120,.12) 55%, transparent 75%); }
.scene::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 42%; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(22,14,48,.72), rgba(22,14,48,.5) 55%, rgba(22,14,48,0)); }   /* подложка под подпись */
.sc-caption { position: absolute; z-index: 3; left: 50%; top: calc(9vh + env(safe-area-inset-top)); transform: translateX(-50%); width: min(90vw, 900px); margin: 0; text-align: center;
  font-family: var(--hand); font-size: clamp(22px, 2.6vw, 34px); line-height: 1.25; color: #ffe9bd; text-shadow: 0 0 14px rgba(255,190,110,.5), 0 2px 6px rgba(20,10,40,.85); }
@media (max-aspect-ratio: 4/5) {
  #scene1 .sc-hero { --H: 66vw; }
  .sc-cake { width: 26vw; }
  #scene2 .sc-bg img { left: auto; right: 0; width: 100%; height: 100%; object-position: 26% 100%; }
  #scene2 .sc-hero img { height: auto; width: 100%; left: 50%; bottom: 6%; }
  #scene3 .sc-hero img { height: auto; width: 96%; bottom: 6%; }
  .sc-balloons .bl-1 { left: 2%; width: 10vmin; } .sc-balloons .bl-2 { width: 9vmin; } .sc-balloons .bl-4 { left: 87%; width: 9vmin; }
  .sc-balloons .bl-3 { width: 8vmin; } .sc-balloons .bl-5 { width: 7vmin; } .sc-balloons .bl-6, .sc-balloons .bl-7 { width: 6vmin; } .sc-balloons .bl-8 { width: 5vmin; }
}

/* ───────── Финал: алтарь ───────── */
.altar { position: absolute; inset: 0; z-index: 2; opacity: 0; overflow: hidden; pointer-events: none; background: #1b1d3f; }
.alt-bg { position: absolute; inset: 0; transform-origin: 50% 58%; will-change: transform; }
.alt-bg > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.altar::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,16,50,.7) 0%, rgba(20,16,50,.42) 30%, transparent 50%); }
.alt-sil { position: absolute; z-index: 2; left: 50%; bottom: 19%; height: 52%; width: auto; max-width: none; opacity: 0; filter: drop-shadow(0 0 16px rgba(255,214,190,.55)); }
.altar::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; z-index: 1; pointer-events: none; background: linear-gradient(0deg, rgba(20,14,44,.78), rgba(20,14,44,0)); }
.alt-lanterns { position: absolute; inset: 0; overflow: hidden; }
.lt { position: absolute; top: var(--from, 50%); width: var(--s); height: auto; max-width: none; opacity: 0; animation: rise var(--d) linear var(--dl) infinite; animation-play-state: paused; will-change: transform; }
.altar.is-on .lt { animation-play-state: running; }
@keyframes rise { 0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0; } 12% { opacity: 1; } 50% { transform: translate3d(var(--dx), calc(var(--from, 50vh) * -.5), 0) scale(.78); } 88% { opacity: .9; } 100% { transform: translate3d(0, calc(var(--from, 50vh) * -1 - 60px), 0) scale(.55); opacity: 0; } }
.soon { position: absolute; left: 0; right: 0; top: max(5vh, calc(14px + env(safe-area-inset-top))); z-index: 4; text-align: center; color: #fff4dc; opacity: 0; visibility: hidden; padding: 0 16px; text-shadow: 0 2px 10px rgba(10,6,30,.6); }
.soon-title { margin: 0; font-family: var(--script); font-size: clamp(56px, 10vh, 92px); line-height: 1.05; color: var(--gold-hi); }
.count { display: flex; justify-content: center; gap: clamp(14px, 3vw, 40px); margin-top: 1.2vh; }
.count div { min-width: 64px; }
.count b { display: block; font-weight: 500; font-size: clamp(32px, 6vh, 58px); line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.count b.tick { animation: tick .5s ease-out; }
@keyframes tick { from { opacity: .35; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.count span { font-size: 16px; letter-spacing: .08em; opacity: .9; }
.soon-date { margin: 1.2vh 0 0; font-size: clamp(17px, 2.2vh, 22px); letter-spacing: .04em; }
@media (max-aspect-ratio: 4/5) {
  .alt-bg > img { object-position: 50% 60%; }
  .alt-sil { height: 44%; bottom: 20%; }
  .count { gap: 8px; }
  .count div { min-width: 68px; }
}

.more { position: absolute; z-index: 6; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); width: max-content; margin: 0 auto; padding: 6px 18px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  opacity: 0; visibility: hidden; color: #ffe9bd; text-decoration: none; font-family: var(--hand); font-size: clamp(22px, 3vh, 28px); line-height: 1.1; text-shadow: 0 0 14px rgba(255,190,110,.55), 0 2px 6px rgba(20,10,40,.85); }
.more svg { width: 34px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 3px rgba(20,10,40,.8)); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(7px); } }
.more:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ───────── Блоки после сказки: сказочные шрифты, спокойная вёрстка ───────── */
.info { font-family: var(--tale); background: #f8f2e6; color: #4a3426; padding: clamp(72px, 12vh, 130px) 16px; text-align: center; }
.info + .info { padding-top: 0; }
.wrap { max-width: 640px; margin: 0 auto; }
.eyebrow { margin: 0 0 10px; font-size: 16px; letter-spacing: .12em; color: #76562a; }
.info h2 { margin: 0 0 18px; font-family: var(--script); font-weight: 400; font-size: clamp(46px, 7vw, 68px); line-height: 1.12; color: #5a3b22; }
.info p { margin: 0 0 14px; font-size: 19px; line-height: 1.55; }
.info .note { font-size: 17px; color: #7a5c45; }
.facts { display: flex; justify-content: center; gap: clamp(32px, 8vw, 80px); margin: 34px 0 26px; padding: 22px 0; border-block: 1px solid #d9c49c; }
.facts dt { font-size: 15px; color: #76562a; }
.facts dd { margin: 4px 0 0; font-size: 23px; }
.swatches { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 22px; margin: 28px 0 0; padding: 0; }
.swatches li { width: 84px; }
.swatches li::before { content: ''; display: block; width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(90,60,30,.15); }
.swatches span { font-size: 15px; }
.form { text-align: left; margin-top: 26px; display: grid; gap: 20px; }
.field { display: block; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; padding: 0; margin-bottom: 8px; font-size: 17px; }
.field input:not([type=radio]), .field textarea { width: 100%; padding: 13px 14px; font: inherit; font-size: 19px; color: inherit; background: #fffdf8; border: 1px solid #cdb78e; border-radius: 6px; }
.field textarea { resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .btn:focus-visible { outline: 2px solid #a8732f; outline-offset: 2px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 19px; cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: #8a5a2a; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.btn { justify-self: center; min-height: 52px; padding: 12px 40px; border-radius: 6px; font-size: 20px; color: #fff8ea; background: #5a3f7a; transition: background .25s; }
.btn:hover { background: #4a3268; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-line { color: #4a3426; background: none; border: 1px solid #a8896a; }
.btn-line:hover { background: #efe3cc; }
.form-msg { margin: 0; min-height: 1.5em; text-align: center; font-size: 19px !important; }
.form-msg.is-err { color: #9a2f2a; }
.info-end { padding-bottom: 110px; }
.end-text { font-family: var(--script); font-size: clamp(40px, 6vw, 56px) !important; line-height: 1.25 !important; margin-bottom: 28px !important; }

/* ───────── Птички: спрайт-лист, кадры по горизонтали ───────── */
.bird { position: fixed; left: 0; top: 0; width: var(--bw, 150px); height: calc(var(--bw, 86px) / var(--ba, 1)); margin: calc(var(--bw, 86px) / var(--ba, 1) * -.5) 0 0 calc(var(--bw, 86px) * -.5);
  z-index: 62; pointer-events: none; opacity: 0; will-change: transform; }
.bird i { position: absolute; inset: 0; background-repeat: no-repeat; background-size: calc(var(--frames, 7) * 100%) 100%;
  animation: flap .42s steps(1) infinite; filter: drop-shadow(0 3px 4px rgba(20,10,30,.3)); }
.bird-blue i { background-image: url(../assets/img/bird-blue.webp); }
.bird-pink i { background-image: url(../assets/img/bird-pink.webp); animation-delay: -.2s; }
.bird.is-rest i { animation: none; background-position: 100% 0; }
.bird.is-left i { transform: scaleX(-1); }
/* 6 кадров взмаха (0..5), седьмой — сидит */
@keyframes flap {
  0% { background-position: 0 0; } 16.66% { background-position: calc(100% / 6 * 1) 0; } 33.33% { background-position: calc(100% / 6 * 2) 0; }
  50% { background-position: calc(100% / 6 * 3) 0; } 66.66% { background-position: calc(100% / 6 * 4) 0; } 83.33% { background-position: calc(100% / 6 * 5) 0; }
}

.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 44; pointer-events: none; }

/* ───────── Шкатулка ───────── */
.music { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 55;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; opacity: 0; pointer-events: none;
  background: rgba(27,29,63,.55); border: 1px solid rgba(232,185,106,.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .6s, transform .3s; }
.music.is-shown { opacity: 1; pointer-events: auto; }
.music:hover { transform: scale(1.06); }
.music svg { width: 30px; height: 30px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.music-crank { transform-origin: 33px 24px; }
.music[aria-pressed="true"] .music-crank { animation: crank 1.6s linear infinite; }
@keyframes crank { to { transform: rotate(360deg); } }
.music-notes { position: absolute; inset: 0; pointer-events: none; }
.music-notes i { position: absolute; left: 50%; top: 4px; font-style: normal; color: var(--gold); font-size: 14px; opacity: 0; }
.music[aria-pressed="true"] .music-notes i { animation: note 2.4s ease-out infinite; }
.music[aria-pressed="true"] .music-notes i + i { animation-delay: 1.2s; }
@keyframes note { 0% { transform: translate(-50%, 0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(6px, -30px) rotate(12deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .bird i { animation-duration: 1.2s; }
  .seal-shine, .hint-scroll i { animation: none; }
}
