:root {
  --bg: #f7f3ee;
  --ink: #2f2926;
  --muted: #8c8178;
  --line: #ebe2d8;
  --brand: #d95570;
  --brand-dark: #bd3d59;
  --brand-soft: #fff0f3;
  --panel: #ffffff;
  --shadow: 0 16px 40px rgba(91, 63, 46, 0.09);
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 205, 214, 0.45), transparent 42%),
    radial-gradient(circle at 92% 18%, rgba(255, 227, 180, 0.4), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.page {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f27a91, #d95570);
  color: #fff;
  box-shadow: 0 6px 16px rgba(217, 85, 112, 0.28);
  flex: 0 0 auto;
}
.brand-mark svg { width: 21px; height: 21px; }

.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }

.back-link {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.hero { text-align: center; padding: 24px 8px 30px; }
.hero-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 16px;
}
.hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: 1px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.entry-list { display: grid; gap: 14px; }

.entry-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.entry-card:active { transform: scale(0.985); }
.entry-card:hover { box-shadow: 0 20px 48px rgba(91, 63, 46, 0.14); }
.entry-icon {
  width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 16px;
  display: grid; place-items: center;
}
.entry-icon svg { width: 27px; height: 27px; }
.entry-icon.write { background: #fff0f3; color: #d95570; }
.entry-icon.read { background: #eef6ff; color: #4a7fc1; }
.entry-text h2 { margin: 0 0 3px; font-size: 17px; }
.entry-text p { margin: 0; font-size: 13px; color: var(--muted); }
.entry-arrow { margin-left: auto; color: #cbbdb2; font-size: 21px; }

.tips {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed #e2d4c6;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 12.5px;
  color: #7d7167;
}
.tips b { color: var(--ink); }

.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-size: 12px;
  color: var(--muted);
}
.step {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.step.active { color: var(--brand); border-color: #f3c4ce; background: var(--brand-soft); font-weight: 600; }
.step-num {
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f0e9e2; font-size: 10px;
}
.step.active .step-num { background: var(--brand); color: #fff; }
.step-line { width: 14px; height: 1px; background: #dfd4ca; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.panel-title {
  margin: 0 0 4px;
  font-size: 17px;
  display: flex; align-items: center; gap: 8px;
}
.panel-title::before {
  content: ""; width: 4px; height: 17px; border-radius: 3px;
  background: linear-gradient(#f27a91, #d95570);
}
.panel-hint { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.theme-item {
  position: relative;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 4px 10px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-item:active { transform: scale(0.96); }
.theme-item.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(217, 85, 112, 0.12);
}
.theme-icon { width: 40px; height: 40px; margin: 0 auto 6px; display: grid; place-items: center; }
.theme-icon svg { width: 34px; height: 34px; }
.theme-name { font-size: 12px; color: #5d534c; }
.theme-item.selected .theme-name { color: var(--brand); font-weight: 600; }
.theme-check {
  display: none;
  position: absolute; top: 5px; right: 5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.theme-item.selected .theme-check { display: block; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field label span { color: var(--brand); }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fdfbf9;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}
.field input:focus, .field textarea:focus {
  border-color: #e69aab;
  box-shadow: 0 0 0 3px rgba(217, 85, 112, 0.09);
  background: #fff;
}
.field textarea { resize: vertical; min-height: 130px; line-height: 1.75; }
.field-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted); }
.field-meta .over { color: var(--brand); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.chip {
  border: 1px solid #f0d8de;
  background: #fff7f9;
  color: #a4566a;
  border-radius: 999px;
  font-size: 11.5px;
  padding: 5px 10px;
}

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(100deg, #f0758d, #d95570);
  box-shadow: 0 10px 22px rgba(217, 85, 112, 0.26);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.primary-btn:active { transform: scale(0.985); }
.primary-btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.secondary-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 16px;
  font-size: 14px;
  color: #6d6159;
  background: #fff;
}
.secondary-btn:active { background: #faf6f1; }

.message-box {
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.message-box.show { display: block; }
.message-box.error { background: #fff0f1; color: #b3374b; border: 1px solid #f6ccd3; }
.message-box.info { background: #f2f7ff; color: #456ba0; border: 1px solid #d3e2f7; }

/* ---------- 贺卡本体 ---------- */
.greeting-card {
  --wash1: rgba(255, 143, 168, 0.33);
  --wash2: rgba(255, 214, 165, 0.55);
  --accent: #d95570;
  --paper: #fffaf6;
  --inkcard: #583a40;
  --frame: rgba(217, 85, 112, 0.22);
  --stamp: rgba(217, 85, 112, 0.55);
  --footink: rgba(88, 58, 64, 0.72);
  position: relative;
  width: 100%;
  min-height: 440px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 12%, var(--wash2), transparent 42%),
    radial-gradient(circle at 8% 88%, var(--wash1), transparent 45%),
    var(--paper);
  color: var(--inkcard);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 45px rgba(85, 55, 45, 0.16);
}
.greeting-card::before {
  content: "";
  position: absolute; inset: 9px;
  border: 1px solid var(--frame);
  border-radius: 16px;
  pointer-events: none;
}
.theme-birthday { --wash1:rgba(255,135,168,.32); --wash2:rgba(255,212,154,.55); --accent:#e04f78; --paper:#fff9f5; --inkcard:#603b47; --frame:rgba(224,79,120,.22); --stamp:rgba(224,79,120,.5); --footink:rgba(96,59,71,.72); }
.theme-christmas { --wash1:rgba(111,174,134,.3); --wash2:rgba(242,184,165,.45); --accent:#c64146; --paper:#fffbf5; --inkcard:#3d5142; --frame:rgba(198,65,70,.22); --stamp:rgba(198,65,70,.5); --footink:rgba(61,81,66,.72); }
.theme-valentine { --wash1:rgba(255,157,179,.42); --wash2:rgba(255,194,207,.6); --accent:#d63b63; --paper:#fff8fa; --inkcard:#633641; --frame:rgba(214,59,99,.22); --stamp:rgba(214,59,99,.5); --footink:rgba(99,54,65,.72); }
.theme-newyear { --wash1:rgba(244,182,109,.35); --wash2:rgba(242,217,166,.65); --accent:#c7433f; --paper:#fffaf1; --inkcard:#664229; --frame:rgba(199,67,63,.22); --stamp:rgba(199,67,63,.5); --footink:rgba(102,66,41,.72); }
.theme-thanks { --wash1:rgba(241,201,135,.32); --wash2:rgba(246,220,189,.6); --accent:#c17a3c; --paper:#fffcf6; --inkcard:#5e4b34; --frame:rgba(193,122,60,.22); --stamp:rgba(193,122,60,.5); --footink:rgba(94,75,52,.72); }
.theme-general { --wash1:rgba(169,188,230,.32); --wash2:rgba(244,215,191,.55); --accent:#6b7fbc; --paper:#fbfaff; --inkcard:#3f4763; --frame:rgba(107,127,188,.22); --stamp:rgba(107,127,188,.5); --footink:rgba(63,71,99,.72); }

.card-decor {
  position: absolute;
  top: 14px; right: 16px;
  width: 108px; height: 108px;
  color: var(--accent);
  opacity: 0.9;
  pointer-events: none;
}
.card-decor svg { width: 100%; height: 100%; }
.card-kicker {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--accent);
  font-weight: 700;
  position: relative;
}
.card-title {
  position: relative;
  margin: 16px 0 18px;
  font-size: 34px;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 800;
}
.card-to { position: relative; margin: 0 0 4px; font-size: 14px; }
.card-to b { font-size: 16px; color: var(--accent); }
.card-message {
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.95;
  margin-top: 12px;
  flex: 1;
}
.card-foot {
  position: relative;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px dashed var(--frame);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 12px;
  color: var(--footink);
}
.card-sign { font-weight: 600; font-size: 13px; }
.card-stamp {
  position: absolute;
  right: 22px; bottom: 82px;
  width: 54px; height: 54px;
  border: 2px solid var(--frame);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px;
  color: var(--stamp);
  transform: rotate(-14deg);
  pointer-events: none;
}

/* ---------- 查询页 ---------- */
.phone-row { display: flex; gap: 10px; }
.phone-row input { flex: 1; min-width: 0; }
.phone-row .primary-btn { width: auto; padding: 0 20px; flex: 0 0 auto; }

.reveal-wrap { perspective: 1200px; }
.reveal-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.envelope {
  position: relative;
  width: 100%;
  min-height: 440px;
  border-radius: 22px;
  background: linear-gradient(145deg, #f3dfd4, #e8c9ba);
  box-shadow: 0 18px 40px rgba(95, 62, 45, 0.16);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  border: none;
  width: 100%;
  padding: 0;
}
.envelope::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, transparent 49%, rgba(255,255,255,.34) 50%, transparent 51%);
}
.envelope-inner { text-align: center; position: relative; z-index: 1; }
.seal {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e56d83, #c9415d);
  box-shadow: 0 8px 20px rgba(170, 55, 80, 0.35), inset 0 0 0 4px rgba(255,255,255,.22);
  display: grid; place-items: center;
  color: #fff;
}
.seal svg { width: 32px; height: 32px; }
.envelope-inner strong { display: block; font-size: 18px; color: #7a5142; }
.envelope-inner span { display: block; font-size: 12px; color: #a37b69; margin-top: 5px; }

.card-stage { display: none; }
.card-stage.open { display: block; animation: cardIn 0.65s cubic-bezier(.2,.8,.25,1) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) rotateX(-14deg) scale(0.94); }
  to { opacity: 1; transform: none; }
}
.envelope.hidden { display: none; }

.result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.result-head h2 { margin: 0; font-size: 17px; }
.result-head span { font-size: 12px; color: var(--muted); }
.card-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.card-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: #776b62;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
}
.card-tab.active { background: var(--brand-soft); border-color: #f0bfca; color: var(--brand); font-weight: 600; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.empty-state { text-align: center; padding: 38px 18px; }
.empty-state svg { width: 60px; height: 60px; color: #d8c8bd; }
.empty-state h3 { margin: 14px 0 6px; font-size: 17px; }
.empty-state p { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.empty-state .secondary-btn { width: auto; padding: 10px 24px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: rgba(47, 41, 38, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer-note { text-align: center; font-size: 11px; color: #b1a59b; margin-top: 26px; }

@media (max-width: 360px) {
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .greeting-card { padding: 22px 18px 18px; min-height: 400px; }
  .card-title { font-size: 29px; }
}
