/* ---------- ОСНОВНЫЕ ЦВЕТА ---------- */
:root {
  --background: #0a0a12;
  --card: #151522;
  --pink: #e8b4b8;
  --light-pink: #ffd2d5;
  --text: #f5f1ee;
  --muted: #aaa4ad;
  --line: rgba(232, 180, 184, .25);
}

/* ---------- БАЗОВЫЕ ПРАВИЛА ---------- */
* { box-sizing: border-box; }
html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--background);
  overflow-x: hidden;
}
body {
  color: var(--text);
  font-family: Arial, sans-serif;
}
h1, h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-weight: normal;
  line-height: 1.1;
}
h1 { font-size: clamp(2.8rem, 12vw, 6rem); }
h2 { font-size: clamp(2.2rem, 8vw, 4.8rem); }
p { line-height: 1.7; color: #d8d2d6; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- ОБЩИЕ ЭЛЕМЕНТЫ ---------- */
.app {
  width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  position: relative;
}
.screen {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  padding: 40px 20px;
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease, visibility .6s;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--background);
}
.screen::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image: radial-gradient(#ffffffb8 1px, transparent 1.5px), radial-gradient(#e8b4b88c 1px, transparent 1.5px);
  background-size: 97px 113px, 151px 167px;
  opacity: .45;
  animation: stars-move 18s linear infinite;
  pointer-events: none;
}
.screen::after {
  content: '';
  position: absolute;
  z-index: 0;
  width: 75vw;
  height: 75vw;
  max-width: 100vw;
  max-height: 100vw;
  right: -20%;
  bottom: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, #6f436055, transparent 67%);
  pointer-events: none;
}
.screen.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.screen.intro.active {
  animation: first-screen-appear .9s ease both;
}
.content {
  width: min(100%, 880px);
  min-width: 0;
  margin: auto;
  position: relative;
  z-index: 1;
}
.eyebrow {
  margin: 0 0 18px;
  color: var(--pink);
  font-size: .72rem;
  font-weight: bold;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.lead { max-width: 490px; color: var(--muted); font-size: 1.05rem; }
.centered-text { margin-inline: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.actions.center { justify-content: center; }
.button {
  padding: 13px 23px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  transition: .25s ease;
}
.button:hover { border-color: var(--pink); color: var(--light-pink); transform: translateY(-2px); }
.button.primary { border: 0; background: var(--pink); color: #21151a; font-weight: bold; }
.progress {
  position: fixed;
  z-index: 5;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  gap: 5px;
}
.progress span { height: 2px; flex: 1; background: #ffffff2b; }
.progress span.active { background: var(--pink); }

/* ---------- ЭКРАН 0: ВХОД ---------- */
.stars {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#ffffffb8 1px, transparent 1.5px), radial-gradient(#e8b4b88c 1px, transparent 1.5px);
  background-size: 97px 113px, 151px 167px;
  opacity: .45;
  animation: stars-move 18s linear infinite;
  pointer-events: none;
}
.intro-glow {
  position: absolute;
  width: 75vw;
  height: 75vw;
  max-width: 100vw;
  max-height: 100vw;
  right: -20%;
  bottom: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, #6f436055, transparent 67%);
  pointer-events: none;
}
.intro .content { position: relative; }
.screen > .stars,
.screen > .intro-glow { display: none; }

/* ---------- ЭКРАН 1: ПИСЬМО ---------- */
.letter-screen { min-height: 380px; display: flex; flex-direction: column; justify-content: center; }
.letter { max-width: 640px; color: #f3e9e7; font: 1.5rem/1.55 Georgia, serif; }
.letter p { margin: 0 0 1.1em; color: inherit; }
.cursor { display: inline-block; width: 2px; height: 1.1em; background: var(--pink); }

/* ---------- ЭКРАН 2: СЧЁТЧИК ---------- */
.counter-screen { text-align: center; }
.counter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 38px 0 12px; }
.time-unit { min-width: 0; padding: 18px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.time-unit strong { display: block; color: var(--light-pink); font: 4rem/1 Georgia, serif; }
.time-unit span { color: var(--muted); font-size: .72rem; text-transform: uppercase; }

/* ---------- ЭКРАН 3: ПРИЧИНЫ ---------- */
.reasons-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 28px; }
.reason { min-width: 0; min-height: 136px; padding: 0; border: 0; border-radius: 8px; background: transparent; text-align: left; perspective: 800px; }
.reason-inner { display: block; min-height: 136px; position: relative; transform: rotateY(0deg); transform-style: preserve-3d; transition: transform .6s ease; }
.reason.flipped .reason-inner { transform: rotateY(180deg); }
.reason-front, .reason-back { position: absolute; inset: 0; padding: 18px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-align: center; backface-visibility: hidden; }
.reason-front { color: var(--pink); }
.reason-number { font: 2.8rem Georgia, serif; }
.reason-back { transform: rotateY(180deg); color: #f7e6e5; font: 1.2rem/1.25 Georgia, serif; }
.opened { color: var(--muted); font-size: .82rem; }
.surprise { display: none; margin-top: 25px; padding: 18px; border: 1px solid var(--pink); color: var(--light-pink); font: 1.3rem Georgia, serif; text-align: center; }
.surprise.visible { display: block; animation: surprise-appear .8s ease both; }

/* ---------- ЭКРАН 4: ГАЛЕРЕЯ ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.photo { min-width: 0; margin: 0; cursor: pointer; opacity: 0; transform: translateY(18px); transition: .7s ease; }
.screen.active .photo { opacity: 1; transform: translateY(0); }
.photo img { display: block; width: 100%; max-width: 100%; aspect-ratio: 1 / 1.15; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; }
.photo figcaption { padding-top: 8px; color: var(--muted); font-size: .8rem; }

/* ---------- ЭКРАН 5: ПИСЬМО В БУДУЩЕЕ ---------- */
.future-buttons { display: grid; gap: 10px; margin-top: 30px; }
.future-button { width: 100%; padding: 17px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); text-align: left; }
.future-button::after { content: '↗'; float: right; color: var(--pink); }
.message {
  max-height: 0;
  margin-top: 0;
  padding: 0 22px;
  border-left: 2px solid transparent;
  background: #e8b4b80f;
  line-height: 1.65;
  opacity: 0;
  overflow: hidden;
  transform: translateY(12px);
  visibility: hidden;
  transition: max-height .6s ease, margin-top .6s ease, padding .6s ease, border-color .6s ease, opacity .6s ease, transform .6s ease, visibility .6s ease;
}
.message.visible {
  max-height: 300px;
  margin-top: 16px;
  padding: 22px;
  border-left-color: var(--pink);
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* ---------- ЭКРАН 6: ФИНАЛ ---------- */
.final { text-align: center; }
.heart { margin: 30px auto; color: var(--pink); font-size: 5rem; animation: pulse 1.5s infinite; }
.falling-heart { position: fixed; z-index: 10; top: -40px; color: var(--light-pink); font-size: 1.4rem; animation: fall 2.6s ease-in forwards; }
.modal { position: fixed; z-index: 20; inset: 0; display: none; place-items: center; padding: 20px; background: #05050ae8; }
.modal.open { display: grid; }
.modal img { max-width: 100%; max-height: 80vh; border-radius: 8px; }
.modal-close { position: absolute; top: 22px; right: 22px; border: 0; background: none; color: white; font-size: 2rem; }

@keyframes stars-move { to { background-position: 109px 125px, 35px 57px; } }
@keyframes first-screen-appear {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes surprise-appear {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(420deg); opacity: 0; } }

@media (min-width: 650px) {
  .screen { padding: 50px 40px; }
  .reasons-grid, .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .future-buttons { grid-template-columns: repeat(2, 1fr); }
}
