/* ──────────────────────────────────────────────────────────────
   Надежде — 70 лет. Тёплая юбилейная открытка: изумруд, шампань, золото.
   Фото-дождь и вихрь сохранены из оригинального сайта.
   ────────────────────────────────────────────────────────────── */
:root {
  --forest: #0a282a;
  --forest-deep: #061b20;
  --forest-light: #174345;
  --gold: #dbc18c;
  --gold-light: #f8e6b6;
  --gold-dark: #af8758;
  --paper: #faf4e8;
  --paper-shadow: #e8dcc8;
  --ink: #1b3738;
  --ink-muted: #51615a;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Great Vibes', 'Times New Roman', cursive;
  --sans: 'Manrope', Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  color: var(--paper);
  font-family: var(--serif);
  background: radial-gradient(ellipse 92% 80% at 48% 32%, #1b5051 0%, #0d2f32 45%, #06191e 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; isolation: isolate; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Движущееся свечение и нарисованные золотой линией ветви */
.bg-glow {
  position: absolute; inset: -15%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 24% 38% at 23% 48%, rgba(206, 164, 102, .15), transparent 80%),
    radial-gradient(ellipse 30% 33% at 79% 19%, rgba(101, 170, 152, .17), transparent 75%),
    radial-gradient(ellipse 34% 39% at 75% 85%, rgba(211, 160, 108, .09), transparent 80%);
  animation: glow-breathe 16s ease-in-out infinite alternate;
}
@keyframes glow-breathe { from { transform: translate3d(-2%,1%,0) scale(1); } to { transform: translate3d(2%,-2%,0) scale(1.10); } }
.botanical {
  position: absolute; pointer-events: none; z-index: 1;
  width: min(34vw, 450px); height: min(63vh, 500px);
  background: url('/static/botanical.svg') left center/contain no-repeat;
  opacity: .35; filter: drop-shadow(0 0 10px rgba(220,180,120,.06));
  animation: botanical-arrive 2.5s ease-out both;
}
.botanical--left { left: -34px; bottom: -74px; }
.botanical--right { right: -45px; top: -98px; transform: rotate(180deg); animation: botanical-arrive-right 2.8s ease-out both; }
@keyframes botanical-arrive { from { opacity: 0; translate: -35px 24px; } to { opacity: .35; translate: 0 0; } }
@keyframes botanical-arrive-right { from { opacity: 0; translate: 35px -24px; } to { opacity: .35; translate: 0 0; } }
.hearts { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.heart { position: absolute; bottom: -40px; color: var(--gold-light); text-shadow: 0 0 15px rgba(255,237,188,.6); animation: heart-rise linear infinite; will-change: transform; }
@keyframes heart-rise { from { transform: translate3d(0,0,0) rotate(0); } to { transform: translate3d(30px,-115vh,0) rotate(95deg); } }

/* Три экрана как в оригинале */
.screen {
  position: absolute; inset: 0; padding: 26px;
  display: flex; justify-content: center; align-items: center;
  opacity: 0; visibility: hidden; transform: scale(1.015);
  transition: opacity .85s ease, transform .85s ease, visibility .85s;
  z-index: 3; overflow-y: auto; overscroll-behavior: contain;
}
.screen.is-active { opacity: 1; visibility: visible; transform: scale(1); z-index: 4; }
.screen-index {
  position: fixed; top: max(22px,env(safe-area-inset-top)); right: 32px;
  color: rgba(244,227,190,.6); font: 600 10px/1.2 var(--sans);
  letter-spacing: .2em; z-index: 30; pointer-events: none;
}
.screen-index span { color: rgba(244,227,190,.3); margin: 0 4px; }
.eyebrow { font: 700 10px/1.7 var(--sans); letter-spacing: .31em; text-transform: uppercase; color: #8d7752; }
.eyebrow span { color: #cda767; padding: 0 5px; }

/* Первый экран: светлая открытка на фоне тёмно-зелёного бархата */
.lock-card {
  position: relative; margin: auto; flex-shrink: 0;
  width: min(100%, 470px); padding: 30px 45px 26px;
  text-align: center; color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.98), transparent 59%),
    linear-gradient(155deg, #fffaf0 2%, #f7eedc 57%, #eee0c9 100%);
  border: 1px solid #ead7b4; border-radius: 8px;
  box-shadow: 0 45px 105px rgba(2,12,14,.48), 0 4px 0 rgba(5,37,39,.22), inset 0 0 0 8px rgba(255,255,255,.3);
  animation: card-in 1.2s cubic-bezier(.2,.85,.2,1) both;
  transition: opacity .55s ease, transform .55s ease;
}
.lock-card::before, .lock-card::after, .message-card::before, .message-card::after {
  content: ''; position: absolute; width: 42px; height: 42px; pointer-events: none;
  border-color: rgba(179,135,74,.58); border-style: solid;
}
.lock-card::before, .message-card::before { left: 13px; top: 13px; border-width: 1px 0 0 1px; }
.lock-card::after, .message-card::after { right: 13px; bottom: 13px; border-width: 0 1px 1px 0; }
@keyframes card-in { from { opacity: 0; transform: translateY(25px) scale(.965); } to { opacity: 1; transform: translateY(0) scale(1); } }
.lock-card.is-unlocked { opacity: 0; transform: scale(1.045) translateY(-12px); }
.date-line { margin: 4px 0 7px; color: #837151; font: 500 11px/1.5 var(--sans); letter-spacing: .13em; }
.anniversary-seal {
  width: 126px; height: 126px; margin: 7px auto 10px; display: flex;
  align-items: center; flex-direction: column; justify-content: center; position: relative;
  border-radius: 50%; border: 1px solid rgba(173,130,76,.65);
  color: #a78047; background: radial-gradient(circle at 42% 36%, rgba(255,250,236,.7), rgba(212,177,111,.08));
  box-shadow: 0 0 0 6px rgba(185,151,90,.07), 0 0 0 8px rgba(185,151,90,.24), inset 0 0 0 5px rgba(255,255,255,.38);
  animation: seal-bloom 2.5s ease-out both;
}
.anniversary-seal::before, .anniversary-seal::after { content: '✦'; position: absolute; top: 51%; color: #c3a577; font-size: 13px; }
.anniversary-seal::before { left: 11px; } .anniversary-seal::after { right: 11px; }
@keyframes seal-bloom { from { opacity: 0; transform: scale(.75) rotate(-14deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
.seal-number { font-size: 81px; font-weight: 500; line-height: .88; letter-spacing: -.075em; transform: translateX(-4px); }
.seal-years { font: 700 11px/1.5 var(--sans); text-transform: uppercase; letter-spacing: .36em; margin-left: 9px; }
.lock-title { margin: 0; font: 500 clamp(53px,8vw,75px)/.92 var(--serif); letter-spacing: -.035em; color: #213f40; }
.lock-script { margin: 5px 0 14px; font: 400 clamp(41px,7vw,57px)/1.15 var(--script); color: #b18a52; transform: rotate(-3deg); }
.lock-description { margin: 0 auto; max-width: 350px; font: 500 clamp(17px,2.4vw,19px)/1.28 var(--serif); color: #51635d; }
.ornamental-rule { width: 78%; height: 24px; margin: 9px auto; display: flex; justify-content: center; align-items: center; gap: 12px; color: #b28e5d; font-size: 12px; }
.ornamental-rule::before, .ornamental-rule::after { content: ''; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(172,132,83,.43)); }
.ornamental-rule::after { transform: rotate(180deg); }
.lock-hint { margin: 0 auto 12px; font: 500 12px/1.55 var(--sans); letter-spacing: .01em; color: #718078; max-width: 280px; }
.lock-form { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lock-input {
  width: min(100%, 238px); height: 44px; padding: 8px 16px; border-radius: 4px;
  text-align: center; outline: none; background: rgba(255,255,255,.66);
  border: 1px solid rgba(167,134,85,.5); color: #214243;
  font: 600 16px/1 var(--sans); letter-spacing: .19em;
  transition: box-shadow .25s, border-color .25s;
}
.lock-input::placeholder { color: #9c9f91; font: 400 12px var(--sans); letter-spacing: .025em; }
.lock-input:focus { border-color: #c5a16b; box-shadow: 0 0 0 4px rgba(200,163,103,.16); }
.lock-error { margin: 9px 0 0; min-height: 18px; color: #a8564c; font: 500 12px/1.4 var(--sans); }
.card-footnote { margin: 7px 0 0; font: italic 500 15px/1 var(--serif); color: #a38d6e; }
.shake { animation: shake .5s ease; }
@keyframes shake { 10%,90%{ translate: -2px 0;} 20%,80%{translate:4px 0;} 30%,50%,70%{translate:-8px 0;} 40%,60%{translate:8px 0;} }

/* Праздничные кнопки */
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 17px;
  padding: 13px 25px; min-height: 46px;
  background: linear-gradient(120deg, #d1aa70, #f4e0ae 48%, #cda06a);
  color: #173838; border: 1px solid rgba(183,137,79,.7); border-radius: 3px;
  font: 700 11px/1.2 var(--sans); letter-spacing: .13em;
  text-transform: uppercase; cursor: pointer;
  box-shadow: 0 8px 25px rgba(133,100,57,.18);
  transition: transform .26s ease, box-shadow .26s ease, filter .26s ease;
}
.btn span { font-size: 18px; line-height: 0; font-weight: 400; }
.btn:hover { transform: translateY(-3px); filter: brightness(1.04); box-shadow: 0 12px 27px rgba(144,100,42,.3); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .video-play:focus-visible { outline: 3px solid #83c2b5; outline-offset: 3px; }
.btn:disabled { opacity: .58; cursor: default; transform: none; }
.btn--seal { min-width: 238px; }

/* Вторая страница: ДОЖДЬ ИЗ ФОТО без изменения логики и таймингов */
.rain { position: absolute; inset: 0; overflow: hidden; z-index: 1; pointer-events: none; }
.tile {
  position: absolute; top: -160px; border-radius: 10px; overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(246, 235, 225, 0.7);
  animation: fall var(--dur, 12s) linear var(--delay, 0s) infinite;
  transform: translateZ(0) rotate(var(--tilt, 0deg));
  will-change: transform; backface-visibility: hidden; contain: layout paint;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile--placeholder { display: grid; place-items: center; background: linear-gradient(150deg, #5a2a3d, #2f1420); }
.tile--placeholder span { color: #e6a2b2; font-size: 26px; opacity: 0.75; }
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(var(--tilt, 0deg)); }
  50% { transform: translate3d(var(--sway, 16px), 55vh, 0) rotate(calc(var(--tilt, 0deg) * -1)); }
  100% { transform: translate3d(0, 120vh, 0) rotate(var(--tilt, 0deg)); }
}
.vortex-core {
  position: fixed; top: 50%; left: 50%; width: 10px; height: 10px;
  transform: translate(-50%, -50%) scale(0); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 230, 0.95), rgba(230, 162, 178, 0.6) 40%, transparent 70%);
  box-shadow: 0 0 60px 20px rgba(227, 189, 147, 0.35);
  opacity: 0; z-index: 150; pointer-events: none;
}
.vortex-core.is-forming { transition: transform 2.8s ease-in, opacity 1.8s ease-in; transform: translate(-50%, -50%) scale(6); opacity: .9; }
.vortex-core.is-burst { transition: transform .7s ease-out, opacity .8s ease-out; transform: translate(-50%, -50%) scale(26); opacity: 0; }

.message-wrap { position: relative; z-index: 4; width: min(100%, 604px); max-height: 100%; display: flex; justify-content: center; margin: auto; }
.message-card {
  position: relative; width: 100%; max-height: min(86dvh,800px); padding: 25px 45px 28px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; color: var(--ink);
  background: linear-gradient(150deg, rgba(255,251,242,.97), rgba(245,235,218,.96));
  border: 1px solid #dec69c; border-radius: 8px;
  box-shadow: 0 29px 95px rgba(0,0,0,.55), inset 0 0 0 8px rgba(255,255,255,.2);
  transition: opacity .6s ease, transform .7s ease;
  animation: message-appear 1s ease both;
}
@keyframes message-appear { from { opacity:0; translate: 0 16px; } to {opacity: 1;translate:0 0;} }
.message-card.is-leaving { opacity: 0; transform: translateY(-16px) scale(.96); }
.eyebrow--light { color: #a48658; }
.message-heading { margin: 3px 0 0; font: 500 clamp(37px,5vw,51px)/1.08 var(--serif); color: #264746; }
.message-card .ornamental-rule { margin: 6px auto 4px; }
.message-text { min-height: 0; width: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d6ba83 transparent; padding: 3px 8px 7px; margin-bottom: 13px; -webkit-overflow-scrolling: touch; }
.message-line { margin: 0 auto 11px; font: 500 clamp(18px,2.8vw,23px)/1.25 var(--serif); color: #365250; opacity: 0; animation: line-in 1s ease forwards; }
.message-line--lead { font: 400 clamp(33px,5vw,43px)/1.25 var(--script); color: #a77d46; margin-bottom: 10px; }
.message-line--signature { margin-top: 15px; margin-bottom: 0; font-style: italic; font-weight: 600; color: #9f7b4e; }
@keyframes line-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.btn--next { flex-shrink: 0; margin-top: 3px; }

/* Третья страница: видео в обрамлении, завершение */
.screen--video { flex-direction: column; gap: 14px; justify-content: center; }
.video-intro { text-align: center; width: min(94vw, 900px); flex-shrink: 0; }
.video-intro .eyebrow { color: var(--gold); }
.video-heading { margin: 2px 0 5px; font: 500 clamp(37px,5.5vw,59px)/1.08 var(--serif); color: #fff4dd; }
.video-description { margin: 0; font: 500 clamp(17px,2.2vw,20px)/1.2 var(--serif); color: #c7dbd1; }
.video-frame {
  position: relative; width: min(88vw, 870px); max-height: 59vh; aspect-ratio: 16/9;
  overflow: hidden; border: 5px solid rgba(226,195,137,.64); border-radius: 6px;
  background: #081719; box-shadow: 0 0 0 1px rgba(255,248,211,.45), 0 25px 65px rgba(2,9,12,.55);
  animation: frame-in 1.2s ease both; flex-shrink: 1;
}
@keyframes frame-in { from { opacity: 0; transform: scale(.965); } to { opacity: 1; transform: none; } }
.video-el { display: block; width: 100%; height: 100%; background: #081719; object-fit: contain; }
.video-frame.is-empty::after {
  content: 'Здесь появится ваше видео ♡'; position: absolute; inset: 0;
  display: grid; place-items: center; padding: 25px; text-align: center;
  color: #ead8b2; font: italic 28px/1.1 var(--serif);
  background: radial-gradient(ellipse at center, #174345, #081719);
}
.video-play {
  display: none; place-items: center; position: absolute; inset: 0; margin: auto;
  width: 84px; height: 84px; border: 2px solid var(--gold-light); border-radius: 50%;
  background: linear-gradient(145deg,#f8e6b6,#cdaa73); color: #173c3e;
  font-size: 31px; padding-left: 5px; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.video-play.is-visible { display: grid; animation: play-pulse 2.5s ease-in-out infinite; }
@keyframes play-pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.08);} }
.btn--end { background: transparent; border: 1px solid rgba(226,193,140,.8); color: var(--gold-light); box-shadow: none; flex-shrink: 0; }
.btn--end:hover { background: rgba(226,193,140,.1); box-shadow: 0 0 23px rgba(226,193,140,.15); }
.btn--end.is-glow { animation: end-glow 1.8s ease-in-out infinite; }
@keyframes end-glow { 0%,100% { box-shadow: 0 0 0 rgba(227,189,147,0); } 50%{box-shadow:0 0 28px rgba(227,189,147,.5);} }
.video-footer { margin: 0; font: italic 18px/1 var(--serif); color: #d0bc94; }

/* Доступность и небольшие экраны */
@media (max-width: 700px) {
  .screen { padding: 28px 12px; }
  .screen-index { right: 14px; top: 12px; font-size: 9px; }
  .botanical { width: 57vw; height: 45vh; opacity: .2; }
  .botanical--left { left: -70px; bottom: -34px; }
  .botanical--right { right: -80px; top: -50px; }
  .lock-card { padding: 28px 25px 24px; }
  .anniversary-seal { width: 109px; height: 109px; margin-bottom: 9px; }
  .seal-number { font-size: 71px; }
  .lock-title { font-size: clamp(52px,12vw,66px); }
  .lock-script { font-size: clamp(41px,10vw,52px); }
  .lock-description { font-size: 17px; }
  .message-wrap { width: min(96vw, 604px); }
  .message-card { padding: 24px 22px 25px; max-height: 86dvh; }
  .message-line { font-size: 18px; line-height: 1.2; margin-bottom: 8px; }
  .message-line--lead { font-size: clamp(34px,7.5vw,41px); }
  .video-frame { width: 96vw; max-height: 58vh; }
  .screen--video { gap: 17px; }
  .video-heading { font-size: clamp(37px,8vw,49px); }
}
@media (max-height: 750px) {
  .lock-card { padding-top: 19px; padding-bottom: 16px; }
  .anniversary-seal { width: 100px; height: 100px; margin-top: 3px; margin-bottom: 8px; }
  .seal-number { font-size: 67px; }
  .lock-title { font-size: 57px; }
  .lock-script { font-size: 42px; margin-bottom: 7px; }
  .lock-description { font-size: 16px; }
  .ornamental-rule { height: 19px; margin-top: 5px; margin-bottom: 5px; }
  .video-frame { max-height: 56vh; }
}
@media (max-height: 530px) and (orientation: landscape) {
  .screen--video { padding-top: 12px; gap: 5px; }
  .video-intro .eyebrow, .video-description, .video-footer { display: none; }
  .video-heading { font-size: 27px; margin: 0; }
  .video-frame { width: min(73vw, 660px); max-height: 66vh; }
  .btn--end { min-height: 37px; padding: 9px 18px; }
  .lock-card { width: min(88vw, 480px); }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .screen { transition-duration: .2s !important; }
  .message-line { opacity: 1; }
}
