:root {
  --bg: #FFF3EA;
  --ink: #3A1722;
  --muted: #A4808C;
  --soft: #6B3B49;
  --rose: #E23E63;
  --rose-deep: #A81B42;
  --gold: #E5A93D;
  --line: rgba(58, 23, 34, 0.10);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-quart: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: var(--tg-viewport-stable-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
}

input, textarea {
  user-select: text;
  font-size: 16px;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(70% 40% at 50% 0%, rgba(255, 150, 178, 0.38), transparent 70%),
    radial-gradient(55% 38% at 92% 86%, rgba(229, 169, 61, 0.20), transparent 72%),
    radial-gradient(50% 36% at 4% 74%, rgba(226, 62, 99, 0.14), transparent 72%);
}

.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 20px 6px;
  z-index: 10;
}

.brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1;
}

.counter b {
  font-size: 16px;
  font-weight: 700;
}

.counter__total {
  font-size: 12px;
  color: var(--muted);
}

.progress {
  flex-shrink: 0;
  height: 3px;
  margin: 2px 20px 0;
  border-radius: 99px;
  background: rgba(58, 23, 34, 0.08);
  overflow: hidden;
}

.progress[hidden] {
  display: none;
}

#pbar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--gold));
  transform: scaleX(0.07);
  transform-origin: left center;
  transition: transform 380ms var(--ease-quart);
}

.app-viewport {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.view[hidden] {
  display: none;
}

.view__pad {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px calc(26px + var(--safe-bottom));
}

.card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 22px 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 40px rgba(168, 27, 66, 0.12);
}

.card.is-in {
  animation: cardIn 320ms var(--ease-out) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.99); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.badge {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  background: #FFE3E8;
  color: var(--rose-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  margin: 12px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.18;
  color: var(--ink);
}

.desc {
  margin: 8px 0 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--soft);
}

.content {
  margin-top: 14px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid rgba(226, 62, 99, 0.22);
  border-radius: 14px;
  background: #FFF7F4;
  color: #4A1B2A;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 200ms var(--ease-out),
    border-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.opt:active {
  transform: scale(0.98);
  transition-duration: 80ms;
}

.opt.is-on {
  border-color: transparent;
  background: linear-gradient(135deg, #F0577A, var(--rose));
  color: #FFFFFF;
}

@media (hover: hover) {
  .opt:hover {
    border-color: rgba(226, 62, 99, 0.45);
  }
}

.field {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid rgba(58, 23, 34, 0.14);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  text-align: center;
  outline: none;
  transition: border-color 200ms var(--ease-out);
}

.field::placeholder {
  color: #BFA6AE;
}

.field:focus {
  border-color: var(--rose);
}

.main-btn {
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #F0577A, var(--rose));
  color: #FFFFFF;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(226, 62, 99, 0.28);
  transition: transform 160ms var(--ease-out), opacity 200ms var(--ease-out);
}

.main-btn:active {
  transform: scale(0.97);
  transition-duration: 80ms;
}

.final-box {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.final-box .main-btn {
  flex: 1;
  width: auto;
  margin-top: 0;
}

.no-btn {
  flex: 1;
  height: 50px;
  border: 0;
  border-radius: 16px;
  background: #EFE3E6;
  color: #7A5A63;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  will-change: transform;
  transition: transform 220ms var(--ease-out), background-color 200ms var(--ease-out),
    color 200ms var(--ease-out);
}

.no-btn.is-yes {
  background: linear-gradient(135deg, #F0577A, var(--rose));
  color: #FFFFFF;
  transform: translate3d(0, 0, 0);
}

.toast {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  z-index: 80;
  max-width: 86vw;
  padding: 11px 16px;
  border-radius: 999px;
  background: #3A1722;
  color: #FFF6F0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 26px rgba(58, 23, 34, 0.24);
  opacity: 0;
  transform: translate3d(-50%, -14px, 0) scale(0.96);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 220ms var(--ease-out);
}

.toast.is-shown {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
}

.lead {
  margin: 0;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.22;
  color: var(--ink);
}

.lead em {
  font-style: italic;
  font-weight: 500;
  color: var(--rose-deep);
}

.stage {
  position: relative;
  width: min(74vw, 292px);
  aspect-ratio: 1 / 1;
  margin: 10px 0 2px;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring__track {
  fill: none;
  stroke: rgba(58, 23, 34, 0.08);
  stroke-width: 8;
}

.ring__fill {
  fill: none;
  stroke: var(--rose);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 704;
  stroke-dashoffset: 704;
  transition: stroke-dashoffset 420ms var(--ease-quart);
}

.heart {
  width: 62%;
  aspect-ratio: 100 / 92;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 18px 26px rgba(168, 27, 66, 0.28));
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  will-change: transform;
}

.heart svg {
  display: block;
  width: 100%;
  height: 100%;
  animation: breathe 3.4s ease-in-out infinite;
  transform-origin: 50% 60%;
}

.heart.is-gone {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.hint {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.pop {
  position: fixed;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 45;
  will-change: transform, opacity;
}

.finale {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  background: radial-gradient(80% 60% at 50% 38%, #FFFBF7 0%, #FFE6E1 100%);
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
}

.finale[hidden] {
  display: none;
}

.finale.is-in {
  opacity: 1;
}

.finale__word {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(68px, 21vw, 116px);
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.ch {
  display: inline-block;
  opacity: 0;
}

.ch-heart {
  width: 0.74em;
  height: 0.74em;
  margin: 0 0.02em;
  align-self: center;
  opacity: 0;
  filter: drop-shadow(0 10px 18px rgba(168, 27, 66, 0.3));
}

.finale.is-in .ch {
  animation: chIn 620ms var(--ease-quart) both;
}

.finale.is-in #chVE {
  animation-delay: 90ms;
}

.finale.is-in .ch-heart {
  animation: heartIn 720ms var(--ease-quart) 150ms both;
}

.finale__text {
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 21px;
  color: #7C4553;
  opacity: 0;
}

.finale.is-in .finale__text {
  animation: fadeUp 520ms var(--ease-out) 420ms both;
}

.finale__whisper {
  margin: 14px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 17px;
  letter-spacing: 0.16em;
  color: #8A5563;
  opacity: 0;
}

.finale.is-in .finale__whisper {
  animation: whisperIn 1800ms var(--ease-out) 900ms both;
}

@keyframes whisperIn {
  from { opacity: 0; transform: translate3d(0, 8px, 0); letter-spacing: 0.24em; }
  to { opacity: 0.92; transform: translate3d(0, 0, 0); letter-spacing: 0.16em; }
}

@keyframes chIn {
  from { opacity: 0; transform: translate3d(0, 22px, 0) scale(0.94); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes heartIn {
  from { opacity: 0; transform: scale(0.4) rotate(-12deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  display: block;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .heart svg { animation: none; }
}
