:root {
  --cream: #FDF6EC;
  --card: #FFFDF9;
  --line: #E8DCC8;
  --accent: #C96A5A;
  --accent-dark: #A85345;
  --accent-soft: #F5C4B3;
  --ink: #4A3F35;
  --ink-soft: #8C7B6B;
  --ink-faint: #B4A796;
  --radius-card: 30px;
  --radius-item: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ---------- 背景 ---------- */

.paper {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #E8DCC8 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 78%);
}

.glow { position: fixed; border-radius: 50%; filter: blur(72px); pointer-events: none; z-index: 0; }
.glow-a { width: 320px; height: 320px; background: var(--accent-soft); opacity: 0.5; top: -120px; left: -130px; }
.glow-b { width: 360px; height: 360px; background: #F4C0D1; opacity: 0.34; bottom: -150px; right: -150px; }

.petals { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }

.petal {
  position: absolute;
  top: -32px;
  border-radius: 62% 12% 62% 62%;
  background: var(--accent-soft);
  animation: fall linear infinite;
}

@keyframes fall {
  0%   { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  100% { transform: translate3d(52px, 112vh, 0) rotate(320deg); }
}

/* ---------- 舞台 ---------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- 进度 ---------- */

.progress { display: flex; align-items: center; gap: 12px; padding: 0 6px 14px; }
.progress[hidden] { display: none; }
.progress-track { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-track i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.5s cubic-bezier(0.22, 0.68, 0.35, 1); }
.progress-text { font-size: 11px; color: var(--ink-faint); white-space: nowrap; letter-spacing: 0.04em; }

/* ---------- 卡片 ---------- */

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(232, 220, 200, 0.95);
  border-radius: var(--radius-card);
  box-shadow: 0 26px 64px rgba(74, 63, 53, 0.09), 0 2px 10px rgba(74, 63, 53, 0.04);
  padding: 30px 22px 26px;
}

.card--intro { padding-top: 196px; }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.75), transparent 42%);
  pointer-events: none;
}

/* ---------- 照片堆 ---------- */

/* 拍立得比例：照片区 3:4（竖构图人像），底部留白写字 */
.polaroid {
  position: absolute;
  top: -72px;
  left: 50%;
  width: 166px;
  height: 244px;
  transform: translateX(-50%);
  z-index: 3;
}

.ph {
  position: absolute;
  inset: 0;
  height: 244px;
  padding: 8px 8px 36px;
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 16px 32px rgba(74, 63, 53, 0.16), 0 2px 6px rgba(74, 63, 53, 0.08);
  transform-origin: 50% 60%;
}

.ph img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 2px;
  /* 统一暖调，和奶油底融合 */
  filter: saturate(0.94) contrast(1.02) sepia(0.06) brightness(1.02);
}

.ph-1 { transform: rotate(-3.4deg); z-index: 3; }
.ph-2 { transform: rotate(8deg) translate(24px, 5px) scale(0.95); z-index: 2; }
.ph-3 { transform: rotate(-11.5deg) translate(-25px, 9px) scale(0.92); z-index: 1; }

.ph .cap {
  position: absolute;
  left: 0; right: 0; bottom: 11px;
  text-align: center;
  font-size: 10px; letter-spacing: 0.16em; color: var(--ink-faint); font-style: italic;
}

.tape {
  position: absolute; top: -14px; left: 50%;
  width: 64px; height: 25px;
  transform: translateX(-50%) rotate(3.5deg);
  background: rgba(232, 220, 200, 0.72);
  box-shadow: 0 1px 3px rgba(74, 63, 53, 0.08);
  z-index: 4;
}

/* ---------- 文字 ---------- */

.view { position: relative; animation: rise 0.45s cubic-bezier(0.22, 0.68, 0.35, 1) both; }

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

.eyebrow {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin-bottom: 12px;
}

.title {
  font-size: 31px; line-height: 1.44; font-weight: 600;
  letter-spacing: 0.035em; color: var(--ink); margin-bottom: 14px;
}
.title--sm { font-size: 24px; margin-bottom: 4px; }

.q-title { font-size: 22px; font-weight: 600; letter-spacing: 0.03em; color: var(--ink); margin-bottom: 7px; }
.q-sub { font-size: 13px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 18px; }

.lede { font-size: 14px; line-height: 1.95; color: var(--ink-soft); letter-spacing: 0.01em; }

/* ---------- 图标 ---------- */

.ic { display: block; width: 100%; height: 100%; }

/* ---------- 选项 ---------- */

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

.opt {
  display: flex; align-items: center; gap: 9px;
  height: 62px; padding: 0 11px;
  background: #FAF3E9;
  border: 1px solid transparent;
  border-radius: 16px;
  font-family: inherit; font-size: 13px; font-weight: 400;
  color: var(--ink); text-align: left; cursor: pointer;
  transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}
.opt:active { transform: scale(0.975); }
.opt.is-on { background: #F7E4DA; border-color: var(--accent); }

.opt-ic {
  flex: none;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.92;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.opt.is-on .opt-ic { opacity: 1; transform: scale(1.06); }

.opt-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { display: flex; flex-direction: column; gap: 8px; }
.opt--row { height: 56px; width: 100%; }
.opt--row .opt-ic { width: 28px; height: 28px; }
.opt-mark { flex: none; font-size: 13px; color: var(--accent); }

/* ---------- 自由输入 ---------- */

.free { margin-top: 12px; }

.free-btn {
  width: 100%; height: 44px;
  border: 1px dashed #E0D2BE; border-radius: 14px;
  background: transparent; color: var(--ink-faint);
  font-family: inherit; font-size: 12px; letter-spacing: 0.05em;
  cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease;
}
.free-btn:hover { border-color: var(--accent); color: var(--accent); }

.free-field { display: flex; gap: 8px; }
.free-field[hidden] { display: none; }

.free-input {
  flex: 1; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: #FFFFFF; font-family: inherit; font-size: 16px;
  color: var(--ink); outline: none; transition: border-color 0.2s ease;
}
.free-input:focus { border-color: var(--accent); }
.free-input::placeholder { color: #C9BCAB; font-size: 13px; }

.free-ok {
  width: 66px; height: 46px; border: none; border-radius: 14px;
  background: var(--accent); color: #FFF9F2;
  font-family: inherit; font-size: 13px; cursor: pointer;
}

.free--on {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: #F7E4DA; border: 1px solid var(--accent); border-radius: 14px;
}
.free-tag { flex: 1; font-size: 13px; color: var(--ink); word-break: break-all; }
.free-link {
  flex: none; background: none; border: none; padding: 0;
  color: var(--ink-soft); font-size: 12px; font-family: inherit;
  text-decoration: underline; cursor: pointer;
}

/* ---------- 留言 ---------- */

.note-input {
  width: 100%; margin-top: 14px; min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: #FFFFFF;
  font-family: inherit; font-size: 16px; color: var(--ink); line-height: 1.7;
  resize: none; outline: none; transition: border-color 0.2s ease;
}
.note-input:focus { border-color: var(--accent); }
.note-input::placeholder { color: #C9BCAB; font-size: 13px; }

/* ---------- 按钮 ---------- */

.actions { display: flex; gap: 10px; margin-top: 26px; }

.btn {
  position: relative; height: 54px;
  border-radius: var(--radius-item); border: 1px solid transparent;
  font-family: inherit; font-size: 16px; font-weight: 500; letter-spacing: 0.05em;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1),
              box-shadow 0.3s ease, background-color 0.25s ease;
  will-change: transform;
}

.btn-primary {
  flex: 1.35; background: var(--accent); color: #FFF9F2;
  box-shadow: 0 4px 0 var(--accent-dark), 0 12px 26px rgba(201, 106, 90, 0.28);
}
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--accent-dark), 0 6px 14px rgba(201, 106, 90, 0.2);
}

.btn-ghost { flex: 1; background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:active { background: #FAF3E9; }

.btn-sm { height: 46px; font-size: 14px; flex: 1; }

.nav { display: flex; gap: 10px; margin-top: 20px; }

.hint { margin-top: 16px; text-align: center; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.05em; }

.link-btn {
  background: none; border: none; padding: 0;
  color: var(--ink-faint); font-size: 12px; font-family: inherit;
  text-decoration: underline; cursor: pointer;
}

/* ---------- 结果 ---------- */

.rc-date { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.08em; margin-bottom: 2px; }

.receipt {
  margin-top: 18px; padding: 16px 16px 14px;
  background: #FAF3E9; border-radius: 18px;
}

.rc-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0;
  border-bottom: 1px dashed #E5D8C4;
}
.rc-row:last-of-type { border-bottom: none; }

.rc-k { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.06em; flex: none; }
.rc-v { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); min-width: 0; }
.rc-v b { font-weight: 500; }
.rc-v em { font-style: normal; color: #C9BCAB; }
.rc-ic { width: 20px; height: 20px; flex: none; display: block; }

.rc-note {
  margin-top: 10px; padding-top: 12px;
  border-top: 1px dashed #E5D8C4;
  font-size: 13px; color: var(--ink-soft); line-height: 1.8;
}

.strip {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 18px; padding: 0 4px;
}
.strip figure {
  flex: 1; background: #FFFFFF; padding: 4px 4px 14px; border-radius: 4px;
  box-shadow: 0 8px 18px rgba(74, 63, 53, 0.12);
  margin: 0;
}
.strip figure:nth-child(1) { transform: rotate(-2.6deg) translateY(3px); }
.strip figure:nth-child(2) { transform: rotate(1.4deg); }
.strip figure:nth-child(3) { transform: rotate(-1.8deg) translateY(4px); }
.strip img {
  display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 2px;
  filter: saturate(0.94) contrast(1.02) sepia(0.06) brightness(1.02);
}

/* ---------- 提交成功 ---------- */

.view--done { text-align: center; padding-top: 6px; }

.done-ic {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 50%; background: #FBEDE6;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(201, 106, 90, 0.16);
}
.done-ic svg { width: 31px; height: 31px; }
.done-txt {
  margin-top: 10px; font-size: 14px; line-height: 1.9; color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.view--done .strip { margin-top: 26px; }

@media (prefers-reduced-motion: no-preference) {
  .done-ic { animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  @keyframes pop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
  }
}

/* ---------- 发送失败兜底 ---------- */

.fallback {
  margin-top: 16px; padding: 14px 16px;
  border: 1px dashed rgba(201, 106, 90, 0.4);
  border-radius: 16px; background: #FDF1EC;
}
.fb-t { font-size: 13px; font-weight: 600; color: #A85345; }
.fb-d { margin-top: 6px; font-size: 12px; line-height: 1.7; color: #96705F; }
.fb-pre {
  margin: 12px 0; padding: 12px; border-radius: 10px;
  background: #FFFFFF; font-size: 12px; line-height: 1.85; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  font-family: inherit; user-select: all;
}

/* ---------- 出图弹层 ---------- */

.shot {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(74, 63, 53, 0.74);
  opacity: 0; visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.shot.on { opacity: 1; visibility: visible; }

.shot-box {
  width: 100%; max-width: 360px; max-height: 100%;
  display: flex; flex-direction: column; gap: 14px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.34s cubic-bezier(0.22, 0.68, 0.35, 1);
}
.shot.on .shot-box { transform: none; }

.shot-box img {
  display: block; width: 100%; max-height: 62vh; object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.3);
  background: #FDF6EC;
}
.shot-tip { text-align: center; font-size: 12px; color: #F3E7D8; letter-spacing: 0.05em; }
.shot-actions { display: flex; gap: 10px; }
.shot-actions .btn-ghost { border-color: rgba(255, 253, 249, 0.4); color: #FFF9F2; }

/* ---------- 页脚 ---------- */

.foot {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding-top: 24px;
  font-size: 11px; letter-spacing: 0.16em; color: #C9BCAB; font-style: italic;
}
.foot-line { width: 26px; height: 1px; background: #E3D7C6; }

/* ---------- 爱心迸发 ---------- */

.burst {
  position: fixed; pointer-events: none; font-size: 15px; line-height: 1;
  color: var(--accent); z-index: 90;
  /* 位移由 JS 的 Web Animations 逐帧计算，这里只负责定位基准 */
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

/* 星星用暖金，和陶土红的爱心区分开，一冷一暖层次才出得来 */
.burst--star {
  color: #E3A85C;
  text-shadow: 0 0 6px rgba(227, 168, 92, 0.5);
}

/* 选中瞬间轻轻弹一下，让"点到了"这件事有物理感 */
.opt.is-on { animation: optPop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes optPop {
  0%   { transform: scale(1); }
  42%  { transform: scale(1.045); }
  100% { transform: scale(1); }
}

/* ---------- 适配 ---------- */

@media (max-width: 360px) {
  .title { font-size: 27px; }
  .q-title { font-size: 20px; }
  .card { padding: 26px 18px 22px; }
  .card--intro { padding-top: 182px; }
  .stage { padding-left: 14px; padding-right: 14px; }
  .btn { font-size: 15px; }
  .polaroid { width: 152px; height: 226px; top: -66px; }
  .ph { height: 226px; padding: 8px 8px 32px; }
  .opt { height: 58px; font-size: 12.5px; gap: 7px; }
  .opt-ic { width: 26px; height: 26px; }
}

/* 高屏幕上照片可以再探出去一点，画面更松 */
@media (min-height: 820px) and (min-width: 361px) {
  .card--intro { padding-top: 202px; }
  .polaroid { top: -78px; }
}

@media (prefers-reduced-motion: reduce) {
  .petal { display: none; }
  .view { animation: none; }
  .btn { transition: none; }
  .burst { display: none; }
  .opt.is-on { animation: none; }
  .progress-track i { transition: none; }
}
