/* ===== Базовые стили ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Segoe UI", "Georgia", serif;
  min-height: 100vh;
  min-height: calc(100vh - env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== Фон главной страницы (фиолетовый) ===== */
.page-main {
  background: linear-gradient(145deg, #4a1942 0%, #6b2d5c 35%, #8b3a6e 70%, #5c2a52 100%);
  background-attachment: fixed;
}

.bg-shine {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 20%, rgba(255, 182, 193, 0.15), transparent 50%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(255, 192, 203, 0.1), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Карточка ===== */
.card-wrap {
  position: relative;
  z-index: 1;
  padding: 1rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(160deg, rgba(255, 240, 245, 0.98) 0%, rgba(255, 228, 235, 0.98) 100%);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25),
              0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  position: relative;
  animation: cardAppear 0.6s ease-out;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.card-hearts {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.9; }
}

.card-title {
  color: #5c2a52;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.card-title-emoji {
  font-size: 3.84rem;
  line-height: 1;
  margin-bottom: 0.7rem;
  display: inline-block;
  animation: emojiDance 1.6s ease-in-out infinite;
}

@keyframes emojiDance {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-6px) rotate(-5deg) scale(1.04);
  }
  50% {
    transform: translateY(0) rotate(4deg) scale(1.08);
  }
  75% {
    transform: translateY(-4px) rotate(-3deg) scale(1.04);
  }
}

.card-sub {
  color: #8b3a6e;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.card-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  position: relative;
  padding: 0.5rem 0;
  width: 100%;
}

.page-main .card-actions.is-escaping::after {
  content: "";
  flex: 0 0 6rem;
}

.card-actions .btn-yes {
  position: relative;
  z-index: 1;
  margin-right: 0;
}

.page-main .card-actions .btn-yes,
.page-main .card-actions .btn-no {
  width: 6rem;
  padding-left: 0;
  padding-right: 0;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid #8b3a6e;
  outline-offset: 3px;
}

.btn-yes {
  background: linear-gradient(145deg, #e91e63, #c2185b);
  color: #fff;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4);
}

.btn-yes:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(233, 30, 99, 0.5);
}

.btn-no {
  background: linear-gradient(145deg, #9e9e9e, #757575);
  color: #fff;
  position: relative;
  z-index: 1;
}

.btn-no.is-escaping {
  position: absolute;
  transition: left 0.1s linear, top 0.1s linear;
  z-index: 2;
}

.btn-no:not(.is-escaping):hover {
  transform: scale(1.02);
}

.card-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #8b3a6e;
  min-height: 1.4em;
  opacity: 0.85;
}

.site-credit {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: #8b3a6e;
  opacity: 0.78;
}

.site-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.emoji-laugh-row {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.emoji-laugh {
  display: inline-block;
  font-size: 2.1rem;
  animation: laughBounce 0.9s ease-in-out infinite;
}

.emoji-laugh:nth-child(2) {
  animation-delay: 0.12s;
}

.emoji-laugh:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes laughBounce {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-7px) rotate(-8deg);
  }
  50% {
    transform: translateY(0) rotate(8deg);
  }
  75% {
    transform: translateY(-4px) rotate(-5deg);
  }
}

/* ===== Страница "Да" ===== */
.page-yes {
  background: linear-gradient(145deg, #880e4f 0%, #ad1457 40%, #c2185b 100%);
  background-attachment: fixed;
}

.page-yes .card {
  background: linear-gradient(160deg, rgba(255, 245, 248, 0.98), rgba(255, 228, 235, 0.98));
}

.page-yes .card-title {
  font-size: 1.6rem;
}

.page-yes .card-actions {
  justify-content: center;
}

.page-yes .btn-yes {
  font-size: 1.2rem;
  padding: 0.9rem 2rem;
}

.floating-hearts {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.float-heart {
  position: absolute;
  bottom: -12vh;
  font-size: 1.4rem;
  opacity: 0.9;
  animation: heartFlyUp linear infinite;
}

.float-heart:nth-child(1) { left: 8%; animation-duration: 7.8s; animation-delay: 0s; }
.float-heart:nth-child(2) { left: 18%; animation-duration: 6.9s; animation-delay: 1.1s; }
.float-heart:nth-child(3) { left: 29%; animation-duration: 8.7s; animation-delay: 0.7s; }
.float-heart:nth-child(4) { left: 41%; animation-duration: 7.4s; animation-delay: 1.8s; }
.float-heart:nth-child(5) { left: 53%; animation-duration: 8.2s; animation-delay: 0.4s; }
.float-heart:nth-child(6) { left: 64%; animation-duration: 7.1s; animation-delay: 1.4s; }
.float-heart:nth-child(7) { left: 74%; animation-duration: 8.9s; animation-delay: 0.9s; }
.float-heart:nth-child(8) { left: 82%; animation-duration: 7.6s; animation-delay: 1.6s; }
.float-heart:nth-child(9) { left: 90%; animation-duration: 8.3s; animation-delay: 0.5s; }
.float-heart:nth-child(10) { left: 96%; animation-duration: 6.8s; animation-delay: 1.2s; }

@keyframes heartFlyUp {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.9;
  }
  50% {
    transform: translate3d(-10px, -48vh, 0) scale(1.05) rotate(-8deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(12px, -110vh, 0) scale(1.15) rotate(10deg);
    opacity: 0;
  }
}

/* ===== Страница "Нет" (после попыток) ===== */
.page-no {
  background: linear-gradient(145deg, #4a1942 0%, #6b2d5c 100%);
  background-attachment: fixed;
}

.page-no .card-sub {
  font-size: 1rem;
}

/* ===== Адаптив ===== */
@media (max-width: 768px) {
  .card-wrap {
    padding: 1rem max(1rem, env(safe-area-inset-left));
  }

  .card {
    padding: 2rem 1.25rem;
    border-radius: 18px;
  }

  .card-title {
    font-size: 1.35rem;
  }

  .card-sub {
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
  }

  .card-hearts {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .card-wrap {
    padding: 0.75rem max(0.75rem, env(safe-area-inset-left));
  }

  .card {
    padding: 1.5rem 1rem;
    border-radius: 16px;
  }

  .card-title {
    font-size: 1.2rem;
    line-height: 1.4;
  }

  .card-title-emoji {
    font-size: 3.2rem;
  }

  .card-sub {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  .card-hearts {
    font-size: 2rem;
  }

  .card-actions {
    min-height: 92px;
    gap: 0.5rem;
  }

  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 1rem;
  }

  .card-hint {
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 15px;
  }

  .card {
    padding: 1.25rem 0.875rem;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .card-title-emoji {
    font-size: 2.8rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
  }
}
