:root {
  --cream: #fff8f0;
  --peach: #ffe1cf;
  --rose: #f08a7e;
  --terra: #c8553d;
  --brown: #4a2f27;
  --gold: #e9b44c;
  --card: #fffdf9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--brown);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 200, 170, .55), transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(240, 138, 126, .25), transparent 50%),
    linear-gradient(180deg, #fff4e8 0%, #ffe6d6 100%);
  background-attachment: fixed;
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ---------- Screens ---------- */
.screen {
  display: none;
  position: relative;
  min-height: 100svh;
  max-width: 520px;
  margin: 0 auto;
  padding: 56px 22px 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.screen.active { display: flex; animation: screenIn .7s ease both; }
#sTimeline { justify-content: flex-start; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3, .hand-big { font-family: 'Caveat', cursive; color: var(--terra); line-height: 1.05; }
h1 { font-size: clamp(44px, 12vw, 64px); }
h2 { font-size: clamp(36px, 10vw, 48px); }
h3 { font-size: 30px; margin-bottom: 18px; }
.hand-big { font-size: 34px; margin-top: 28px; }

.lead { font-size: 19px; line-height: 1.55; margin-top: 16px; }
.sub { font-size: 16px; opacity: .7; margin-top: 8px; }

.btn {
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  border: none;
  border-radius: 999px;
  padding: 16px 34px;
  background: var(--terra);
  color: #fff;
  box-shadow: 0 8px 20px rgba(200, 85, 61, .35);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  user-select: none;
}
.btn:active { transform: scale(.96); }
.btn.ghost { background: #fff; color: var(--terra); box-shadow: 0 6px 16px rgba(74, 47, 39, .12); }

.link-btn {
  margin-top: 36px;
  background: none;
  border: none;
  font: inherit;
  color: var(--brown);
  opacity: .5;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- 1. Timeline ---------- */
.scroll-hint {
  margin-top: 26px;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .55;
  animation: bob 1.6s ease-in-out infinite;
}

.timeline {
  position: relative;
  width: 100%;
  margin: 36px 0 30px;
  padding-left: 50px;
  text-align: left;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 20px; top: 0; bottom: 0;
  width: 3px;
  background: repeating-linear-gradient(to bottom, var(--rose) 0 10px, transparent 10px 18px);
}
.traveler {
  position: absolute;
  left: 4px;
  top: 0;
  font-size: 30px;
  z-index: 3;
  transition: top .2s linear;
  filter: drop-shadow(0 3px 4px rgba(74, 47, 39, .25));
}
.traveler.walking { animation: bob .5s ease-in-out infinite; }

.tl-year {
  position: relative;
  font-family: 'Caveat', cursive;
  font-size: 32px;
  color: var(--terra);
  margin: 30px 0 14px;
}
.tl-year small { font-family: 'Nunito'; font-size: 14px; opacity: .6; color: var(--brown); margin-left: 6px; }
.tl-year::before {
  content: '';
  position: absolute;
  left: -36px; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--terra);
  transform: translateY(-50%);
  box-shadow: 0 0 0 5px var(--peach);
}

.tl-item { margin-bottom: 26px; }
.polaroid {
  background: #fff;
  padding: 10px 10px 14px;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(74, 47, 39, .15);
  transform: rotate(var(--rot));
}
.ph img, .ph-empty {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
}
.ph-empty {
  background: linear-gradient(135deg, var(--peach), #ffc9b9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 54px;
}
.ph-empty small { font-size: 14px; opacity: .6; margin-top: 6px; }
.cap { font-family: 'Caveat', cursive; font-size: 25px; margin-top: 8px; line-height: 1.1; }
.cap .date {
  display: block;
  font-family: 'Nunito';
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  margin-bottom: 2px;
}

.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Gift ---------- */
.gift-stage {
  position: relative;
  width: 100%;
  min-height: 300px;
  margin: 24px 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gift {
  font-size: 150px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  filter: drop-shadow(0 14px 22px rgba(200, 85, 61, .35));
  animation: bob 1.8s ease-in-out infinite;
}
.gift.shake { animation: giftShake .45s ease; }
.gift.open { animation: giftOpen .6s ease forwards; pointer-events: none; }
@keyframes giftShake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-14deg) scale(1.05); }
  40% { transform: rotate(12deg) scale(1.08); }
  60% { transform: rotate(-8deg) scale(1.05); }
  80% { transform: rotate(5deg); }
}
@keyframes giftOpen {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.3) rotate(-6deg); opacity: 1; }
  100% { transform: scale(0) rotate(20deg); opacity: 0; }
}

.gift-reveal { animation: popIn .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes popIn {
  from { opacity: 0; transform: scale(.3); }
  to { opacity: 1; transform: none; }
}
.cat { position: relative; display: inline-block; }
.cat-face { font-size: 150px; line-height: 1; display: block; animation: catTilt 2.4s ease-in-out infinite; }
.cat-flower {
  position: absolute;
  right: -28px;
  bottom: -10px;
  font-size: 80px;
  transform-origin: bottom left;
  animation: offer 1.6s ease-in-out infinite;
}
@keyframes catTilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes offer {
  0%, 100% { transform: rotate(-10deg) translateX(0); }
  50% { transform: rotate(6deg) translateX(-10px) translateY(-8px); }
}
.gift-reveal .hand-big { margin-top: 18px; }

/* ---------- 2. Story ---------- */
.floaters { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.floaters span {
  position: absolute;
  bottom: -60px;
  font-size: 30px;
  opacity: .5;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  from { transform: translateY(0) rotate(0); }
  to { transform: translateY(-115svh) rotate(30deg); }
}
.story { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 22px; margin-bottom: 36px; }
.story p { font-size: 20px; line-height: 1.55; }
.story .accent { font-family: 'Caveat', cursive; font-size: 34px; color: var(--terra); line-height: 1.15; }
.line { opacity: 0; animation: fadeUp 1s ease forwards; animation-delay: var(--d); position: relative; z-index: 1; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 3. Love ---------- */
.big-heart { font-size: 96px; margin-bottom: 18px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.answers { display: flex; gap: 16px; justify-content: center; margin-top: 40px; }
#yesBtn { transition: transform .25s ease; }
#noBtn { transition: left .25s ease, top .25s ease; z-index: 10; }
#noBtn.runaway { position: fixed; }

/* ---------- 4. Key ---------- */
.lock-area {
  position: relative;
  width: 100%;
  height: 52svh;
  min-height: 340px;
  margin-top: 10px;
}
.heart-lock {
  position: absolute;
  left: 50%; top: 8%;
  transform: translateX(-50%);
  transition: transform .3s ease;
}
.heart-lock .heart { font-size: 140px; display: block; line-height: 1; filter: drop-shadow(0 10px 20px rgba(200, 85, 61, .35)); }
.heart-lock .lock {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  font-size: 46px;
  transition: transform .8s ease, opacity .8s ease;
}
.heart-lock.near { transform: translateX(-50%) scale(1.1); }
.heart-lock.unlocked .heart { animation: pulse 1s ease-in-out infinite; }
.heart-lock.unlocked .lock { transform: translate(60px, -160px) rotate(60deg); opacity: 0; }

.key {
  position: absolute;
  left: 50%; bottom: 6%;
  margin-left: -36px;
  font-size: 64px;
  width: 72px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  animation: wiggle 2s ease-in-out infinite;
}
.key.dragging { animation: none; cursor: grabbing; }
.key.back { transition: transform .4s ease; }
.key.gone { transition: opacity .4s ease; opacity: 0; pointer-events: none; }
@keyframes wiggle { 0%, 100% { rotate: -8deg; } 50% { rotate: 8deg; } }

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 26px 20px;
  box-shadow: 0 14px 34px rgba(74, 47, 39, .14);
  width: 100%;
}
.quiz { display: none; animation: screenIn .6s ease both; }
.quiz.show { display: block; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-opt { padding: 14px 10px; font-size: 16px; }
.quiz-opt.wide { grid-column: 1 / -1; }
.quiz-opt:disabled { opacity: .45; }
.quiz-opt.picked { opacity: 1; background: #fde3e3; color: #d23c3c; text-decoration: line-through; }
.wrong { margin-top: 22px; animation: shake .5s ease; }
.wrong-title { font-size: 26px; font-weight: 800; color: #d23c3c; margin-bottom: 10px; }
.wrong p { font-size: 18px; line-height: 1.5; margin-bottom: 8px; }
.wrong .btn { margin-top: 12px; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* ---------- 5. Battle ---------- */
.round-pill {
  margin-top: 14px;
  background: var(--terra);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 999px;
}
.vs-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 20px; }
.vs { font-family: 'Caveat', cursive; font-size: 34px; color: var(--rose); }
.place-card {
  width: 100%;
  font: inherit;
  color: inherit;
  border: 3px solid transparent;
  background: var(--card);
  border-radius: 24px;
  padding: 22px 18px;
  box-shadow: 0 12px 28px rgba(74, 47, 39, .13);
  cursor: pointer;
  transition: transform .3s ease, opacity .3s ease, border-color .3s ease;
  animation: screenIn .45s ease both;
}
.place-card:active { transform: scale(.98); }
.place-card .emoji { font-size: 52px; line-height: 1; }
.place-card .name { font-size: 22px; font-weight: 800; margin-top: 8px; }
.place-card .desc { font-size: 15px; opacity: .7; margin-top: 4px; }
.place-card.chosen { transform: scale(1.04); border-color: var(--terra); }
.place-card.lost { opacity: .3; transform: scale(.94); }

/* ---------- 6. Winner ---------- */
.winner {
  margin-top: 24px;
  width: 100%;
  background: var(--card);
  border-radius: 28px;
  padding: 32px 20px;
  border: 3px solid var(--gold);
  animation: glow 2s ease-in-out infinite;
}
.winner .emoji { font-size: 84px; line-height: 1; }
.winner .name { font-size: 30px; font-weight: 800; margin-top: 12px; }
.winner .desc { font-size: 17px; opacity: .75; margin-top: 6px; }
.winner .btn { margin-top: 20px; display: inline-block; text-decoration: none; }
@keyframes glow {
  0%, 100% { box-shadow: 0 12px 30px rgba(233, 180, 76, .35); }
  50% { box-shadow: 0 12px 50px rgba(233, 180, 76, .75); }
}

/* ---------- Counters & first message ---------- */
.counters { display: flex; gap: 12px; margin-top: 16px; }
.counters div {
  background: var(--card);
  border-radius: 18px;
  padding: 12px 18px;
  box-shadow: 0 8px 20px rgba(74, 47, 39, .1);
  display: flex;
  flex-direction: column;
}
.counters b { font-size: 28px; color: var(--terra); line-height: 1.1; }
.counters span { font-size: 13px; opacity: .65; }

.tl-start { position: relative; margin: 6px 0 10px; }
.tl-start::before {
  content: '';
  position: absolute;
  left: -36px; top: 8px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--terra);
}
.tl-start-date { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .55; margin-bottom: 8px; }
.bubble {
  display: inline-block;
  background: #fff;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 6px 16px rgba(74, 47, 39, .1);
  font-size: 16px;
}
.tl-start-cap { font-family: 'Caveat', cursive; font-size: 24px; margin-top: 8px; line-height: 1.15; }

/* ---------- Live ticker ---------- */
.ticker-title {
  margin-top: 30px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .6;
}
.ticker { display: flex; gap: 6px; margin-top: 10px; width: 100%; max-width: 340px; }
.tick {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 2px 8px;
  box-shadow: 0 6px 16px rgba(74, 47, 39, .1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tick b { font-size: 24px; color: var(--terra); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tick span { font-size: 11px; opacity: .65; }
.tick:last-child b { animation: pulse 1s ease-in-out infinite; }
.bubble + .bubble { margin-top: 6px; }
.bubble { max-width: 92%; line-height: 1.35; }

/* ---------- Voice message ---------- */
.bubble.voice { padding: 10px 14px 12px; }
.voice-row { display: flex; align-items: center; gap: 10px; }
.voice-play {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--terra);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 22px; }
.wave i { flex: 1; max-width: 4px; border-radius: 2px; background: #e8c4b8; transition: background .15s; }
.wave i.on { background: var(--terra); }
.voice-time { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
.transcript {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #ecd5cc;
  font-size: 15px;
  line-height: 1.4;
  font-style: italic;
}
.transcript::before { content: 'Расшифровка: '; font-style: normal; font-size: 12px; opacity: .5; display: block; margin-bottom: 2px; }

.plan-b { margin-top: 28px; font-size: 16px; line-height: 1.5; opacity: .75; }
#s6 .link-btn { margin-top: 18px; }
