/* ============ 变量与基础 ============ */
:root {
  --pink: #FF7EAA;
  --pink-strong: #FF5E9A;
  --pink-light: #FFB7D1;
  --pink-pale: #FFE3EE;
  --pink-deep: #D14E83;
  --cream: #FFF6EA;
  --ink: #7A4457;
  --ink-soft: #B08797;
  --card-radius: 42px;
  --header-h: 44px;
  --ease-pop: cubic-bezier(.34, 1.35, .5, 1);
  --ease-smooth: cubic-bezier(.22, .61, .36, 1);
}

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

html,
body {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 88% -12%, rgba(255, 201, 219, .55), transparent 62%),
    radial-gradient(900px 620px at -12% 112%, rgba(255, 224, 178, .48), transparent 56%),
    linear-gradient(165deg, #FFF9FA 0%, #FFEFF5 48%, #FFDFEB 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============ 背景装饰 ============ */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-decor svg {
  position: absolute;
  display: block;
}

.deco-circle-1 {
  width: 230px;
  height: 230px;
  top: 7%;
  left: -78px;
  animation: spin 40s linear infinite;
}

.deco-circle-2 {
  width: 310px;
  height: 310px;
  bottom: 5%;
  right: -118px;
  animation: spin 52s linear infinite reverse;
}

.deco-dashed-heart {
  width: 150px;
  height: 150px;
  bottom: 16%;
  left: -58px;
  animation: spin 48s linear infinite;
  opacity: .75;
}

.deco-heart-1 {
  width: 28px;
  height: 28px;
  top: 14%;
  right: 11%;
  animation: floatY 6s ease-in-out infinite;
}

.deco-heart-2 {
  width: 18px;
  height: 18px;
  top: 58%;
  right: 6%;
  animation: floatY 7s ease-in-out infinite 1.1s;
}

.deco-heart-3 {
  width: 15px;
  height: 15px;
  top: 44%;
  left: 7%;
  animation: floatY 5.5s ease-in-out infinite .6s;
}

.deco-sparkle-1 {
  width: 24px;
  height: 24px;
  top: 23%;
  left: 17%;
  animation: twinkle 3.2s ease-in-out infinite;
}

.deco-sparkle-2 {
  width: 16px;
  height: 16px;
  top: 11%;
  left: 44%;
  animation: twinkle 2.7s ease-in-out infinite .8s;
}

.deco-sparkle-3 {
  width: 28px;
  height: 28px;
  bottom: 21%;
  right: 9%;
  animation: twinkle 3.8s ease-in-out infinite .4s;
}

.deco-sparkle-4 {
  width: 15px;
  height: 15px;
  bottom: 33%;
  left: 31%;
  animation: twinkle 2.9s ease-in-out infinite 1.2s;
}

/* ============ 顶部 44px 标题栏 ============ */
.app-header {
  position: relative;
  z-index: 30;
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-right, 0px));
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 126, 170, .16);
}

.header-heart {
  flex: none;
  width: 20px;
  height: 20px;
  animation: spin 16s linear infinite;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--pink-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ 步骤进度 ============ */
.progress {
  position: relative;
  z-index: 25;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 6px;
}

.progress ol {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--pink-pale);
  border: 1px solid rgba(255, 126, 170, .28);
  transition: all .35s var(--ease-smooth);
}

.progress-dot.is-active {
  width: 28px;
  background: linear-gradient(90deg, var(--pink), var(--pink-light));
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(255, 110, 160, .42);
}

/* ============ 舞台与步骤切换 ============ */
.stage {
  position: relative;
  z-index: 10;
  flex: 1;
  min-height: 0;
}

.step {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(.985);
  transition:
    opacity .5s var(--ease-smooth),
    transform .5s var(--ease-smooth),
    visibility 0s linear .5s;
  pointer-events: none;
  outline: none;
}

.step.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
  pointer-events: auto;
  z-index: 2;
}

.step-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 126, 170, .4) transparent;
}

.step-inner {
  width: min(100%, 560px);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============ 卡片 ============ */
.card {
  position: relative;
  width: 100%;
  padding: 30px 26px;
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8FA 70%, #FFF2F7 100%);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow:
    0 24px 60px rgba(255, 110, 160, .16),
    0 6px 18px rgba(255, 110, 160, .10);
  transition: transform .35s var(--ease-smooth), box-shadow .35s var(--ease-smooth);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px) scale(1.012);
    box-shadow:
      0 30px 70px rgba(255, 110, 160, .22),
      0 8px 22px rgba(255, 110, 160, .14);
  }
}

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--pink);
  margin-bottom: 10px;
}

.step-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--pink-deep);
  text-align: center;
  margin-bottom: 10px;
  outline: none;
}

.step-sub {
  font-size: 15px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.7;
  margin-bottom: 20px;
}

.surprise-text {
  font-size: 17px;
  line-height: 1.9;
  color: var(--ink);
  text-align: center;
}

.surprise-text strong {
  color: var(--pink-deep);
}

/* ============ Step 1 背景 Emoji ============ */
.emoji-scene {
  position: relative;
  height: 84px;
  margin-bottom: 8px;
}

.float-emoji {
  position: absolute;
  animation: floatY 4.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(255, 110, 160, .18));
}

.e1 { left: 6%; top: 20%; font-size: 38px; }
.e2 { right: 7%; top: 8%; font-size: 32px; animation-delay: .7s; }
.e3 { left: 22%; bottom: 2%; font-size: 25px; animation-delay: 1.1s; }
.e4 { right: 24%; bottom: 0; font-size: 30px; animation-delay: .3s; }
.e5 { left: 43%; top: 0; font-size: 44px; animation-delay: .5s; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform .28s var(--ease-pop),
    box-shadow .28s var(--ease-smooth),
    background .28s var(--ease-smooth),
    border-color .28s var(--ease-smooth),
    filter .18s ease,
    left .45s var(--ease-pop),
    top .45s var(--ease-pop);
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 30px rgba(255, 95, 154, .34);
  }
}

.btn:active {
  filter: brightness(.94) saturate(1.06);
}

.btn:focus-visible {
  outline: 3px solid var(--pink-strong);
  outline-offset: 3px;
}

.btn-yes {
  background: linear-gradient(135deg, #FF6FA8 0%, #FF9DC2 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(255, 95, 154, .38);
  transform-origin: center;
  will-change: transform;
}

.btn-yes.is-loved {
  animation: heartbeat .85s ease-in-out 2;
}

.btn-no {
  background: #fff;
  color: var(--pink-deep);
  border: 2px solid var(--pink-light);
  box-shadow: 0 10px 22px rgba(255, 126, 170, .18);
}

.btn-no.is-fleeing {
  position: fixed;
  z-index: 120;
  margin: 0;
  box-shadow: 0 14px 30px rgba(255, 95, 154, .32);
}

.flee-layer .btn-no {
  pointer-events: auto;
}

@media (hover: hover) {
  .btn-no:not(.is-fleeing):hover {
    animation: wobble .35s ease;
  }
}

.btn-ghost {
  background: #fff;
  color: var(--pink-deep);
  border: 2px solid var(--pink-light);
}

.btn-continue,
.btn-next {
  background: linear-gradient(135deg, #FF6FA8, #FF9DC2);
  color: #fff;
  box-shadow: 0 12px 26px rgba(255, 95, 154, .32);
}

.btn-continue {
  width: 100%;
  margin-top: 22px;
}

.btn-download {
  text-decoration: none;
  background: linear-gradient(135deg, #FFB15E, #FF8F9E);
  color: #fff;
  box-shadow: 0 12px 26px rgba(255, 145, 110, .34);
}

/* ============ Step 1 问答区 ============ */
.ask-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  min-height: 58px;
}

.hint-live {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
  margin-top: 12px;
  min-height: 1.2em;
}

.yes-feedback {
  color: var(--pink-deep);
  font-weight: 700;
}

/* ============ 导航行 ============ */
.nav-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.nav-row .btn {
  flex: 0 0 auto;
}

/* ============ Step 2 表单 ============ */
.field {
  margin-top: 16px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pink-deep);
  margin-bottom: 8px;
}

.field-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  border: 2px solid var(--pink-pale);
  background: #fff;
  font-size: 17px;
  color: var(--ink);
  color-scheme: light;
  transition: border-color .25s var(--ease-smooth), box-shadow .25s var(--ease-smooth);
}

.field-input:hover {
  border-color: var(--pink-light);
}

.field-input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 126, 170, .18);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ============ Step 3 美食网格 ============ */
.food-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.food-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 16px 6px 14px;
  border-radius: 22px;
  background: #fff;
  border: 2px solid var(--pink-pale);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform .28s var(--ease-pop),
    background .28s var(--ease-smooth),
    border-color .28s var(--ease-smooth),
    box-shadow .28s var(--ease-smooth),
    color .28s var(--ease-smooth),
    filter .18s ease;
}

.food-emoji {
  font-size: 30px;
  line-height: 1;
}

.food-name {
  font-size: 15px;
  font-weight: 700;
}

@media (hover: hover) {
  .food-item:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--pink-light);
  }
}

.food-item:active {
  filter: brightness(.96);
}

.food-item:focus-visible {
  outline: 3px solid var(--pink-strong);
  outline-offset: 3px;
}

.food-item.is-selected {
  background: linear-gradient(135deg, #FF6FA8, #FFA1C4);
  border-color: transparent;
  color: #fff;
  transform: scale(1.04);
  box-shadow: 0 12px 26px rgba(255, 95, 154, .35);
}

/* ============ Step 4 摘要与分享图 ============ */
.summary-card {
  margin-top: 4px;
  border-radius: 28px;
  background: #fff;
  border: 2px dashed rgba(255, 126, 170, .35);
  padding: 20px 20px 10px;
  box-shadow: 0 8px 20px rgba(255, 110, 160, .10);
}

.summary-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 4px;
}

.summary-row + .summary-row {
  border-top: 2px dashed rgba(255, 126, 170, .22);
}

.summary-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--pink);
}

.summary-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--pink-deep);
  word-break: break-word;
}

.submit-row {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.submit-row .btn {
  min-width: 210px;
}

.submit-status {
  margin-top: 0;
  font-weight: 600;
  color: var(--pink-deep);
}

.btn[disabled] {
  opacity: .65;
  cursor: default;
}

/* ============ 逃跑测量层 / Toast / 爱心粒子 ============ */
.flee-layer {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(16px);
  max-width: calc(100vw - 48px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: var(--pink-deep);
  border: 1.5px solid var(--pink-pale);
  box-shadow: 0 12px 30px rgba(255, 95, 154, .28);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s var(--ease-pop);
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.heart-burst {
  position: fixed;
  z-index: 210;
  pointer-events: none;
  animation: burstUp 1.6s ease-out forwards;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #FFF3F7;
  color: var(--pink-deep);
  font-size: 16px;
  text-align: center;
}

/* ============ 动画 ============ */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes twinkle {
  0%, 100% {
    opacity: .35;
    transform: scale(.8) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.15) rotate(18deg);
  }
}

@keyframes wobble {
  0%, 100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-5deg) translateX(-2px);
  }
  75% {
    transform: rotate(5deg) translateX(2px);
  }
}

@keyframes heartbeat {
  0%, 100% {
    box-shadow: 0 12px 26px rgba(255, 95, 154, .38);
  }
  30% {
    box-shadow: 0 18px 42px rgba(255, 95, 154, .58);
  }
  60% {
    box-shadow: 0 8px 18px rgba(255, 95, 154, .30);
  }
}

@keyframes burstUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(.4);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -130px) scale(1.35) rotate(16deg);
  }
}

/* ============ 小屏适配 ============ */
@media (max-width: 480px) {
  .card {
    padding: 26px 18px;
  }

  .step-title {
    font-size: 23px;
  }

  .header-title {
    font-size: 14px;
  }

  .surprise-text {
    font-size: 16px;
  }

  .food-item {
    padding: 13px 4px 11px;
  }

  .food-emoji {
    font-size: 26px;
  }

  .food-name {
    font-size: 14px;
  }

  .summary-value {
    font-size: 18px;
  }
}

/* ============ 减弱动态效果 ============ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .header-heart,
  .deco-circle,
  .deco-dashed-heart,
  .deco-heart,
  .deco-sparkle,
  .float-emoji {
    animation: none !important;
  }

  .btn-yes.is-loved {
    animation: none !important;
  }
}
