/* ═══════════════ CSS 变量 ═══════════════ */
:root {
  --cream: #FFFBF4;
  --pink: #FFB5B5;
  --pink-light: #FFD6D6;
  --pink-dark: #FF8A8A;
  --mint: #B5EAD7;
  --brown: #5D4E37;
  --brown-dark: #4A3728;
  --brown-light: #8B7E6B;
  --brown-lighter: #B8A99A;
  --white: #FFFFFF;
  --shadow: 0 4px 16px rgba(107, 91, 79, 0.07);
  --shadow-lg: 0 8px 32px rgba(107, 91, 79, 0.10);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* ═══════════════ 基础重置 ═══════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--cream);
  color: var(--brown);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 20% 10%, #FFF5EB 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, #FFECEC 0%, transparent 50%),
    var(--cream);
}

/* ═══════════════ 页面容器 ═══════════════ */
.page {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  padding: 28px 20px 40px;
  animation: pageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page.active { display: flex; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════ 首页花草 Emoji ═══════════════ */
.emoji-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 4px;
  z-index: 1;
}

.emoji-big {
  font-size: 72px;
  line-height: 1;
  display: inline-block;
}

.bounce-1 { animation: emojiBounce 1.6s ease-in-out infinite; }
.bounce-2 { animation: emojiBounce 1.6s ease-in-out 0.3s infinite; }

@keyframes emojiBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40%      { transform: translateY(-10px) scale(1.08); }
  60%      { transform: translateY(0) scale(1); }
  80%      { transform: translateY(-4px) scale(1.03); }
}

/* 委屈/疑惑状态 */
.emoji-hero.confused .emoji-big {
  animation: emojiTilt 0.4s ease-in-out infinite alternate;
}
.emoji-hero.crying .emoji-big {
  animation: emojiShrink 1.2s ease-in-out infinite;
}

@keyframes emojiTilt {
  from { transform: rotate(-8deg); }
  to   { transform: rotate(8deg); }
}
@keyframes emojiShrink {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.9); }
}

/* ═══════════════ 分隔 ═══════════════ */
.heart-divider {
  font-size: 18px;
  letter-spacing: 8px;
  margin: 8px 0 18px;
  animation: pulse 2s ease-in-out infinite;
  z-index: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}

/* ═══════════════ 问题文字 ═══════════════ */
.invite-question {
  font-size: 25px;
  font-weight: 700;
  text-align: center;
  line-height: 1.7;
  color: var(--brown);
  z-index: 1;
  margin-bottom: 28px;
}

.invite-question .word {
  display: inline-block;
  animation: wordPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.invite-question .word:nth-child(1) { animation-delay: 0.1s; }
.invite-question .word:nth-child(2) { animation-delay: 0.3s; }
.invite-question .word:nth-child(3) { animation-delay: 0.5s; }

@keyframes wordPop {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════ 按钮基础 ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 50px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.94); }

.btn-yes {
  width: 220px;
  padding: 16px 32px;
  font-size: 22px;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: white;
  box-shadow: 0 6px 24px rgba(255, 181, 181, 0.45);
  letter-spacing: 2px;
}
.btn-yes:hover {
  box-shadow: 0 8px 32px rgba(255, 181, 181, 0.6);
  transform: translateY(-2px);
}
.btn-yes:active { box-shadow: 0 4px 16px rgba(255, 181, 181, 0.35); }

.btn-no {
  width: 140px;
  padding: 12px 24px;
  font-size: 16px;
  background: #F2EDE5;
  color: var(--brown-light);
  box-shadow: 0 2px 8px rgba(107, 91, 79, 0.06);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-no.shrinking { animation: btnShake 0.4s ease-in-out; }

@keyframes btnShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}

.btn-submit {
  width: 100%;
  padding: 18px;
  font-size: 20px;
  background: linear-gradient(135deg, var(--pink), var(--pink-dark));
  color: white;
  box-shadow: 0 6px 24px rgba(255, 181, 181, 0.4);
  letter-spacing: 2px;
  margin-top: 8px;
}
.btn-submit:hover {
  box-shadow: 0 8px 32px rgba(255, 181, 181, 0.55);
  transform: translateY(-2px);
}
.btn-submit:disabled { opacity: 0.6; pointer-events: none; }

.btn-no-sm {
  width: auto;
  padding: 10px 20px;
  font-size: 14px;
  background: #F2EDE5;
  color: var(--brown-light);
  border-radius: 50px;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-no-sm:active { transform: scale(0.95); }

/* ═══════════════ 邀请页按钮布局 ═══════════════ */
.invite-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

/* ═══════════════ 底部装饰 ═══════════════ */
.bottom-deco {
  margin-top: auto;
  padding-top: 32px;
  font-size: 22px;
  letter-spacing: 12px;
  opacity: 0.35;
  z-index: 0;
}

/* ═══════════════ 页面二：表单 ═══════════════ */
.form-header {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 20px;
  z-index: 1;
}

.emoji-med {
  font-size: 48px;
  line-height: 1;
  animation: emojiBounce 2s ease-in-out infinite;
}

.speech-bubble {
  display: inline-block;
  background: white;
  padding: 10px 18px;
  border-radius: 20px 20px 20px 6px;
  border: 1.5px solid #ECE5D8;
  font-size: 15px;
  font-weight: 600;
  color: var(--brown);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.form-card {
  width: 100%;
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px 20px 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid #F5F0E8;
  z-index: 1;
}

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--brown);
  margin-bottom: 10px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #F0E8DD;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--brown);
  background: #FFFDF9;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 181, 181, 0.15);
}

.form-date, .form-time {
  display: inline-block;
  width: calc(50% - 6px);
}
.form-date { margin-right: 12px; }

.select-row { display: flex; gap: 10px; }
.select-row .form-select { flex: 1; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%238B7E6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}
.form-textarea::placeholder { color: var(--brown-lighter); }

.back-link { margin-top: 20px; z-index: 1; }
.back-link a {
  color: var(--brown-light);
  font-size: 14px;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.back-link a:hover { opacity: 1; }

/* ═══════════════ 页面三：成功页 ═══════════════ */
.success-emoji-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
}

.emoji-huge {
  font-size: 80px;
  line-height: 1;
  display: inline-block;
  animation: successBounce 0.7s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate;
}
.emoji-huge:nth-child(2) { animation-delay: 0.2s; }

@keyframes successBounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-12px) scale(1.05); }
}

.success-msg { text-align: center; margin-top: 32px; }

.success-text {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--brown);
}

.success-emoji {
  font-size: 40px;
  margin-top: 16px;
  animation: emojiPop 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes emojiPop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

.auto-redirect {
  margin-top: 40px;
  font-size: 13px;
  color: var(--brown-lighter);
}

/* ═══════════════ 弹窗 ═══════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}
.modal-overlay.show { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(74, 55, 40, 0.18);
  max-width: 340px;
  width: 100%;
  animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.pity-emoji {
  font-size: 42px;
  letter-spacing: 4px;
  margin-bottom: 8px;
  animation: emojiShrink 1.5s ease-in-out infinite;
}

.pity-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--brown);
  line-height: 1.6;
  margin: 8px 0 24px;
}

.pity-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ═══════════════ Toast ═══════════════ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--brown);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════════ 响应式 ═══════════════ */
@media (min-width: 768px) {
  .page { padding: 40px 24px 60px; }
  .invite-question { font-size: 30px; }
  .btn-yes { width: 260px; font-size: 24px; }
  .emoji-big { font-size: 90px; }
  .emoji-huge { font-size: 100px; }
}

/* ═══════════════ 选择框 ═══════════════ */
optgroup {
  font-weight: 700;
  color: var(--brown-light);
  font-size: 13px;
  font-style: normal;
}
option {
  font-weight: 400;
  color: var(--brown);
  padding: 8px;
}

/* ═══════════════ 滚动条 ═══════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E0D5C8; border-radius: 4px; }

::selection { background: var(--pink-light); color: var(--brown); }
