:root {
  --cream: #fff7ef;
  --paper: #fffdf8;
  --rose: #d94d75;
  --rose-dark: #8e2444;
  --coral: #f0827d;
  --ink: #3a2830;
  --muted: #7c6570;
  --sage: #6e8d7c;
  --gold: #d9a94f;
  --line: rgba(142, 36, 68, 0.16);
  --shadow: 0 22px 58px rgba(92, 40, 50, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.9) 0 13%, transparent 14%),
    linear-gradient(135deg, rgba(217, 169, 79, 0.14), transparent 32%),
    linear-gradient(180deg, #fff3ef 0%, #fffaf3 52%, #edf5ef 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  width: min(100vw, 480px);
  height: 100svh;
  min-height: 620px;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.1)),
    repeating-linear-gradient(90deg, rgba(217, 77, 117, 0.055) 0 1px, transparent 1px 34px);
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 28px;
  padding: calc(26px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  pointer-events: none;
  transition: opacity 360ms ease, transform 360ms ease;
}

.screen.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  pointer-events: none;
}

.top-copy,
.letter,
.video-heading {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--sage);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  color: var(--rose-dark);
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-weight: 700;
  line-height: 1.12;
}

h1 {
  max-width: 9em;
  margin-inline: auto;
  font-size: clamp(34px, 10vw, 48px);
  text-align: center;
}

h2 {
  font-size: clamp(30px, 8vw, 42px);
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
}

.gift-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.gift-box {
  position: relative;
  width: 158px;
  height: 150px;
  border: 0;
  background: transparent;
  cursor: pointer;
  animation: breathe 2.7s ease-in-out infinite;
}

.gift-body,
.gift-lid,
.gift-band {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
}

.gift-body {
  bottom: 8px;
  width: 136px;
  height: 94px;
  border-radius: 12px 12px 22px 22px;
  background: linear-gradient(145deg, #ff8aa5, #de4f78);
  box-shadow: var(--shadow);
}

.gift-lid {
  bottom: 101px;
  width: 152px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffd1dc, #f06c8e);
}

.gift-band {
  bottom: 8px;
  width: 28px;
  height: 129px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.82);
}

.gift-box::before,
.gift-box::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 52px;
  height: 40px;
  border: 12px solid #d94d75;
  border-radius: 50% 50% 46% 46%;
}

.gift-box::before {
  left: 28px;
  transform: rotate(-26deg);
}

.gift-box::after {
  right: 28px;
  transform: rotate(26deg);
}

.decor-ribbon {
  position: absolute;
  top: 68px;
  right: -24px;
  width: 130px;
  height: 130px;
  border: 16px solid rgba(217, 169, 79, 0.18);
  border-radius: 999px;
  transform: rotate(24deg);
}

.choice-stack,
.dinner-options,
.quiz-grid,
.final-actions,
.wish-form {
  position: relative;
  z-index: 1;
}

.choice-stack {
  display: grid;
  gap: 14px;
}

.primary-btn,
.secondary-btn,
.quiz-grid button,
.dinner-card {
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn {
  padding: 15px 18px;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--coral));
  box-shadow: 0 14px 28px rgba(217, 77, 117, 0.26);
  font-weight: 700;
}

.secondary-btn {
  padding: 14px 18px;
  color: var(--rose-dark);
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
}

.primary-btn:active,
.secondary-btn:active,
.quiz-grid button:active,
.dinner-card:active {
  transform: scale(0.98);
}

.runaway {
  position: relative;
}

.runaway.is-shaking {
  animation: shake 420ms ease;
}

.runaway.is-escaped {
  transform: translateX(34px) rotate(2deg);
}

.runaway.is-locked {
  color: rgba(142, 36, 68, 0.62);
  background: rgba(255, 253, 248, 0.58);
}

.toast {
  min-height: 30px;
  color: var(--rose-dark);
  font-size: 15px;
  text-align: center;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quiz-grid button {
  padding: 14px 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 10px 22px rgba(92, 40, 50, 0.08);
}

.quiz-grid button[data-answer="right"] {
  color: var(--rose-dark);
  border-color: rgba(217, 77, 117, 0.34);
}

.quiz-grid button.is-used {
  color: rgba(58, 40, 48, 0.46);
  background: rgba(217, 213, 208, 0.72);
  border-color: rgba(124, 101, 112, 0.18);
  box-shadow: none;
}

.quiz-grid button.is-used::after {
  content: "已选过";
  display: block;
  margin-top: 3px;
  color: rgba(124, 101, 112, 0.74);
  font-size: 12px;
  font-weight: 600;
}

.quiz-grid button:disabled {
  cursor: not-allowed;
}

.dinner-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.dinner-card {
  display: grid;
  gap: 5px;
  padding: 18px;
  text-align: left;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px rgba(92, 40, 50, 0.1);
}

.dinner-card span {
  color: var(--rose-dark);
  font-size: 20px;
  font-weight: 800;
}

.dinner-card small {
  color: var(--muted);
  font-size: 14px;
}

.letter-screen {
  align-content: center;
}

.letter {
  padding: 28px 24px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.letter-lines {
  display: grid;
  gap: 12px;
  margin: 20px 0 24px;
}

.letter-lines p {
  opacity: 0;
  transform: translateY(8px);
}

.screen.is-active .letter-lines p {
  animation: lineIn 520ms ease forwards;
}

.screen.is-active .letter-lines p:nth-child(2) {
  animation-delay: 420ms;
}

.screen.is-active .letter-lines p:nth-child(3) {
  animation-delay: 840ms;
}

.screen.is-active .letter-lines p:nth-child(4) {
  animation-delay: 1260ms;
}

.reveal-btn {
  width: 100%;
  opacity: 0;
}

.screen.is-active .reveal-btn {
  animation: lineIn 520ms ease 1900ms forwards;
}

.video-screen {
  align-content: start;
  gap: 16px;
}

.video-heading {
  padding-top: 4px;
  text-align: center;
}

.video-heading h2 {
  font-size: clamp(28px, 7vw, 38px);
}

.video-frame {
  position: relative;
  z-index: 1;
  overflow: hidden;
  width: 100%;
  height: min(72svh, 720px);
  min-height: 470px;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255, 247, 239, 0.72), rgba(255, 240, 235, 0.9)),
    #fff0eb;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
}

.final-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wish-form {
  display: grid;
  gap: 14px;
}

.wish-form textarea {
  width: 100%;
  min-height: 138px;
  resize: none;
  padding: 16px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
  box-shadow: 0 12px 26px rgba(92, 40, 50, 0.08);
}

.wish-form textarea:focus {
  border-color: rgba(217, 77, 117, 0.5);
}

.result-app {
  overflow-y: auto;
}

.result-panel {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  padding: 28px 24px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.result-panel h1 {
  margin: 0;
  text-align: left;
  font-size: clamp(30px, 8vw, 42px);
}

.result-note {
  margin-top: 12px;
}

.result-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.result-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(255, 247, 239, 0.78);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.result-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-item strong {
  color: var(--rose-dark);
  font-size: 17px;
  line-height: 1.48;
}

.result-empty {
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 247, 239, 0.78);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.6;
}

.result-actions {
  display: grid;
  gap: 12px;
}

.secondary-link {
  display: grid;
  min-height: 52px;
  place-items: center;
  padding: 14px 18px;
  color: var(--rose-dark);
  text-decoration: none;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.heart-burst {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 3;
  width: 10px;
  height: 10px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.heart-burst span {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--rose);
  transform: rotate(45deg);
  animation: floatHeart 820ms ease-out forwards;
}

.heart-burst span::before,
.heart-burst span::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: inherit;
}

.heart-burst span::before {
  left: -7px;
}

.heart-burst span::after {
  top: -7px;
}

.heart-burst span:nth-child(1) {
  --x: -68px;
  --y: -64px;
}

.heart-burst span:nth-child(2) {
  --x: 62px;
  --y: -58px;
  background: var(--coral);
}

.heart-burst span:nth-child(3) {
  --x: -42px;
  --y: 44px;
  background: var(--gold);
}

.heart-burst span:nth-child(4) {
  --x: 54px;
  --y: 42px;
  background: var(--sage);
}

@keyframes breathe {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-9px) rotate(-1deg);
  }
  42% {
    transform: translateX(8px) rotate(1deg);
  }
  64% {
    transform: translateX(-5px);
  }
  82% {
    transform: translateX(4px);
  }
}

@keyframes lineIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatHeart {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(45deg) scale(0.7);
  }
}

@media (min-width: 420px) {
  .dinner-options {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-height: 700px) {
  .app {
    min-height: 100svh;
  }

  .screen {
    gap: 18px;
    padding-inline: 20px;
  }

  p {
    font-size: 15px;
    line-height: 1.58;
  }

  .letter {
    padding: 22px 20px;
  }

  .letter-lines {
    gap: 8px;
    margin: 14px 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
