/* ===== Палитра и базовое ===== */
:root {
  --bg-1: #fff6f3;
  --bg-2: #ffeef0;
  --pink: #ec5f7e;
  --pink-soft: #f7a8b8;
  --pink-deep: #d64d6b;
  --ink: #5a4a4f;
  --ink-soft: #9a8a8f;
  --card: #ffffff;
  --radius: 26px;
  --shadow: 0 18px 50px rgba(214, 77, 107, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% -10%, var(--bg-1), var(--bg-2) 70%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;   /* safe — высокий контент не обрезается сверху на мобилке */
  padding: 16px;
  overflow-x: hidden;
}

/* ===== Фон: падающие сердца ===== */
#hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.fall-heart {
  position: absolute;
  top: -8vh;
  will-change: transform, opacity;
  user-select: none;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: 1;
}

@keyframes fall {
  0%   { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: var(--max-op, 0.85); }
  90%  { opacity: var(--max-op, 0.85); }
  100% { transform: translateY(112vh) translateX(var(--drift, 30px)) rotate(var(--spin, 60deg)); opacity: 0; }
}

/* ===== Верхний баннер-уведомление ===== */
.notif {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 460px);
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(214, 77, 107, 0.18);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1.2);
}
.notif.show { transform: translateX(-50%) translateY(0); }
.notif-icon { font-size: 18px; }

/* ===== Экраны ===== */
#app {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  display: grid;
  place-items: center;
}

.screen {
  grid-area: 1 / 1;
  width: 100%;
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.screen.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ===== Карточка ===== */
.card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px 34px;
  text-align: center;
  animation: cardIn 0.5s ease;
}
.card-wide { max-width: 420px; }

@keyframes cardIn {
  from { transform: translateY(10px); opacity: 0.4; }
  to   { transform: none; opacity: 1; }
}

/* ===== Персонажи / арт ===== */
.character {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.character .art { width: 100%; max-width: 240px; height: auto; overflow: visible; }
.character.hugger .art { max-width: 180px; }
.character img { width: 100%; max-width: 220px; height: auto; }

/* idle-покачивание парочки (экран 1) */
.bob { transform-box: fill-box; transform-origin: center bottom; }
.bob-a { animation: bobA 3.2s ease-in-out infinite; }
.bob-b { animation: bobB 3.6s ease-in-out infinite; }
@keyframes bobA { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-4px) rotate(1deg); } }
@keyframes bobB { 0%,100% { transform: translateY(0) rotate(1deg); } 50% { transform: translateY(-4px) rotate(-1deg); } }

.give-heart {
  transform-box: fill-box;
  transform-origin: center;
  animation: beat 1s ease-in-out infinite;
}
@keyframes beat {
  0%,100% { transform: scale(1); }
  25% { transform: scale(1.18); }
  40% { transform: scale(0.96); }
}

/* анимация чубзика с сердцем (экран 2) — нестатичный */
.float { transform-box: fill-box; transform-origin: center bottom; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50%     { transform: translateY(-8px) rotate(2deg); }
}
.hug-heart-shape {
  transform-box: fill-box;
  transform-origin: center;
  animation: beat 0.95s ease-in-out infinite;
}

/* ===== Тексты ===== */
.ask {
  font-family: "Comfortaa", "Nunito", sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--pink);
  margin: 14px 0 20px;
  line-height: 1.35;
}
.ask.center { margin-bottom: 6px; }
.ask.thanks { color: var(--pink-deep); }
.sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }

/* ===== Кнопки ===== */
.btn-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 56px;
}
.btn {
  font-family: "Nunito", sans-serif;
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-yes {
  background: linear-gradient(135deg, var(--pink-soft), var(--pink));
  color: #fff;
  font-size: 17px;
  padding: 14px 40px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(236, 95, 126, 0.4);
}
.btn-yes:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 26px rgba(236, 95, 126, 0.5); }
.btn-yes:active { transform: translateY(0) scale(0.98); }
.btn-yes.wide { width: 100%; margin-top: 8px; }

.btn-no {
  background: #e8e4e6;
  color: #8a8085;
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 6px 14px rgba(120, 110, 115, 0.25);
  transition: left 0.32s cubic-bezier(.22,.61,.36,1),
              top 0.32s cubic-bezier(.22,.61,.36,1),
              background 0.2s;
}
.btn-no:hover { background: #ded9db; }
.btn-no .no-x { font-weight: 800; opacity: 0.75; }
.btn-no.runaway {
  position: fixed;
  z-index: 40;
  margin: 0;                 /* при бегстве сбрасываем смещения, left/top задаёт JS */
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid #f0dfe2;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  margin-top: 22px;
}
.btn-ghost:hover { color: var(--pink); border-color: var(--pink-soft); }

/* ===== Форма (экран 2) ===== */
.form { text-align: left; margin-top: 6px; }
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 6px;
  padding-left: 4px;
}
.field input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 12px 14px;
  border: 2px solid #f1e4e7;
  border-radius: 14px;
  background: #fffafb;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  outline: none;
  border-color: var(--pink-soft);
  box-shadow: 0 0 0 4px rgba(247, 168, 184, 0.25);
}
.hint { color: var(--pink-deep); font-size: 13px; margin: -6px 0 10px; padding-left: 4px; }
.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ===== Сетка блюд (экран 3) ===== */
.food-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
.food {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: #fffafb;
  border: 2px solid #f1e4e7;
  border-radius: 18px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.food:hover {
  transform: translateY(-3px);
  border-color: var(--pink-soft);
  box-shadow: 0 10px 20px rgba(236, 95, 126, 0.18);
  background: #fff;
}
.food:active { transform: scale(0.97); }
.food.chosen { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(247,168,184,0.3); }
.food-emoji { font-size: 38px; line-height: 1; }
.food-name { font-size: 14px; font-weight: 700; color: var(--ink); }

/* ===== Финал (экран 4) ===== */
.final-emoji { font-size: 64px; line-height: 1; margin-bottom: 6px; animation: pop 0.6s ease; }
.final-shrek {
  width: 104px;
  height: 104px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(214, 77, 107, 0.22);
  background: #eaf3df;
  animation: pop 0.6s ease;
}
.shrek-img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.final-text { color: var(--ink); font-size: 16px; line-height: 1.6; margin: 6px 0 0; }
.final-text strong { color: var(--pink-deep); }

/* кнопка "Цём" с котиками-обнимашками (финал v1) */
.btn-cem {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  background: linear-gradient(135deg, var(--pink-soft), var(--pink));
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 10px 14px 10px 22px;   /* котики справа → меньше отступ справа */
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(236, 95, 126, 0.4);
}
.btn-cem:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 26px rgba(236, 95, 126, 0.5); }
.btn-cem:active { transform: scale(0.97); }
.cem-cats { display: inline-flex; align-items: center; }
.cem-img { height: 30px; width: auto; display: block; }
.cem-art { width: 44px; height: 31px; display: none; }       /* по умолчанию ждём cats.png */
.cem-cats.no-img .cem-img { display: none; }
.cem-cats.no-img .cem-art { display: block; }                /* картинки нет — рисованный фолбэк */

/* ===== Карточка заведения (финал v1) ===== */
.venue {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  text-decoration: none;
  margin: 14px 0 4px;
  padding: 12px;
  border: 2px solid #f1e4e7;
  border-radius: 18px;
  background: #fffafb;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.venue:hover {
  transform: translateY(-2px);
  border-color: var(--pink-soft);
  box-shadow: 0 10px 20px rgba(236, 95, 126, 0.18);
}
.venue-photo {
  position: relative;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffe3ea, #ffd0c9);
  display: grid;
  place-items: center;
}
.venue-photo-ph { font-size: 30px; }
.venue-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.venue-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.venue-name { font-weight: 800; font-size: 16px; color: var(--ink); }
.venue-meta { font-size: 12.5px; color: var(--ink-soft); }
.venue-addr { font-size: 12.5px; color: var(--ink-soft); }
.venue-link { font-size: 13px; font-weight: 700; color: var(--pink); margin-top: 3px; }

/* ===== Burst-сердечки (экран 3 → 4) ===== */
#burst-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;          /* сердечки за краем экрана обрезаются, страница не растягивается */
  pointer-events: none;
}
.burst-heart {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
  animation: burst 1.1s ease-out forwards;
  font-size: 26px;
}
@keyframes burst {
  0%   { transform: translate(0,0) scale(0.3); opacity: 1; }
  100% { transform: translate(var(--bx), var(--by)) scale(var(--bs,1.2)) rotate(var(--br,40deg)); opacity: 0; }
}

/* ===== Фоновая музыка ===== */
.bgm-toggle {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 70;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(214, 77, 107, 0.25);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.15s, opacity 0.2s;
}
.bgm-toggle:hover { transform: scale(1.08); }
.bgm-toggle.muted { opacity: 0.55; }

/* ===== Поп-ап после "Да" ===== */
.popup {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(40, 15, 25, 0.5);
  backdrop-filter: blur(3px);
  animation: popupFade 0.2s ease;
}
.popup.open { display: flex; }
@keyframes popupFade { from { opacity: 0; } to { opacity: 1; } }
.popup-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(214, 77, 107, 0.35);
  padding: 30px 26px 26px;
  text-align: center;
  cursor: pointer;
  animation: popupIn 0.32s cubic-bezier(.2,.8,.2,1.4);
}
@keyframes popupIn { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.popup-text {
  font-family: "Comfortaa", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 21px;
  color: var(--pink-deep);
  line-height: 1.4;
  margin: 4px 0 22px;
}

/* ===== Адаптив (мобилка) ===== */
@media (max-width: 600px) {
  body { padding: 12px; }
  .card { padding: 24px 18px 28px; }
  .ask { font-size: 19px; margin: 12px 0 18px; }
  .sub { font-size: 14px; }
  .character .art { max-width: 200px; }
  .character.hugger .art { max-width: 150px; }
  .btn-yes { font-size: 16px; padding: 13px 32px; }
  .btn-no { font-size: 15px; padding: 13px 24px; }
  .btn-row { gap: 14px; }
  .field input { font-size: 16px; padding: 12px 14px; }   /* 16px — без авто-зума на iOS */
  .hint { font-size: 13px; }
  .food-emoji { font-size: 34px; }
  .food-name { font-size: 14px; }
  .final-shrek { width: 96px; height: 96px; }
  .final-text { font-size: 15px; }
  .venue { gap: 12px; padding: 11px; }
  .venue-photo { width: 66px; height: 66px; }
  .venue-name { font-size: 15px; }
  .venue-meta, .venue-addr { font-size: 12px; }
  .venue-link { font-size: 13px; }
  .btn-cem { font-size: 15px; gap: 8px; padding: 10px 14px 10px 18px; }
  .cem-img { height: 28px; }
  .cem-art { width: 42px; height: 30px; }
}

/* ===== Уважение к reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  .bob-a, .bob-b, .float, .give-heart, .hug-heart-shape, .final-emoji { animation: none !important; }
  .screen { transition: opacity 0.2s ease; transform: none; }
}
