/* ==========================================================================
   中秋祝福页 · 样式
   配色：夜空深蓝 + 月光金 + 灯笼橘红
   ========================================================================== */

:root {
  --gold: #ffd77a;
  --gold-soft: #ffe9b0;
  --gold-deep: #d9a441;
  --orange: #ff9a4d;
  --red: #e2453c;

  --bg: #070a1e;
  --panel: rgba(20, 26, 58, 0.62);
  --panel-solid: #141a3a;
  --border: rgba(255, 226, 170, 0.18);
  --border-strong: rgba(255, 226, 170, 0.34);

  --text: #fdf6e6;
  --text-soft: rgba(253, 246, 230, 0.76);
  --text-dim: rgba(253, 246, 230, 0.5);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --dock-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
               "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------ 夜空背景 ------------------------------ */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #131a3f 0%, #070a1e 62%, #04060f 100%);
}
.sky canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
#sky { z-index: 1; }
#lanterns { z-index: 2; }
#fireworks { z-index: 3; }

.moon-hint {
  position: absolute;
  left: 50%;
  top: calc(30% + clamp(70px, 12vmin, 150px));
  transform: translate(-50%, 10px);
  z-index: 4;
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--gold-soft);
  background: rgba(12, 16, 38, 0.55);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.moon-hint.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 内容层 ------------------------------ */
.stage {
  position: relative;
  z-index: 10;
  padding-bottom: calc(var(--dock-h) + var(--safe-b) + 24px);
}

/* ------------------------------ 首屏 ------------------------------ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 90px 22px 80px;
}
.hero-kicker {
  margin: 0 0 10px;
  font-size: 0.86rem;
  letter-spacing: 0.36em;
  text-indent: 0.36em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 215, 122, 0.5);
}
.hero-title {
  margin: 0 0 14px;
  font-size: clamp(2.6rem, 11vw, 5.2rem);
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-indent: 0.08em;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff 8%, var(--gold) 55%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 200, 90, 0.4));
}
.hero-sub {
  margin: 0 0 34px;
  font-size: clamp(0.95rem, 3.4vw, 1.15rem);
  color: var(--text-soft);
  letter-spacing: 0.05em;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.tap-hint {
  margin: 26px 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  transition: opacity 0.4s ease;
}
.tap-hint.is-hidden { opacity: 0; }

.scroll-down {
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-h) + var(--safe-b) + 18px);
  transform: translateX(-50%);
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--gold);
  border: 1px solid var(--border-strong);
  background: rgba(12, 16, 38, 0.4);
  text-decoration: none;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease;
  min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn-ico { font-size: 1.05em; line-height: 1; }

.btn-main {
  background: linear-gradient(135deg, #ffe08a, var(--gold) 45%, var(--orange));
  color: #3a2606;
  box-shadow: 0 12px 32px rgba(255, 190, 80, 0.32);
}
.btn-main:hover { box-shadow: 0 16px 40px rgba(255, 190, 80, 0.45); }

.btn-ghost {
  background: rgba(255, 236, 190, 0.08);
  color: var(--text);
  border-color: var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(255, 236, 190, 0.16); }

/* ------------------------------ 面板 ------------------------------ */
.panel {
  width: min(680px, calc(100% - 32px));
  margin: 0 auto 26px;
  padding: 26px 24px 24px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.panel-title .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px 2px rgba(255, 215, 122, 0.7);
}

/* ------------------------------ 表单 ------------------------------ */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}
.counter { font-variant-numeric: tabular-nums; }

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(8, 11, 28, 0.55);
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.6;
  transition: border-color 0.2s, background 0.2s;
}
.field textarea { resize: vertical; min-height: 62px; }
.field input::placeholder,
.field textarea::placeholder { color: rgba(253, 246, 230, 0.32); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(8, 11, 28, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 215, 122, 0.16);
}

/* 快捷祝福语 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-family: inherit;
  color: var(--text-soft);
  background: rgba(255, 236, 190, 0.07);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.14s;
}
.chip:hover { background: rgba(255, 215, 122, 0.18); color: var(--text); }
.chip:active { transform: scale(0.96); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.micro {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  min-height: 1.2em;
}

/* ------------------------------ 习俗卡片 ------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.card {
  padding: 16px 15px;
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 28, 0.45);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.card-icon { font-size: 1.5rem; line-height: 1; display: block; margin-bottom: 8px; }
.card-name { margin: 0 0 6px; font-size: 1rem; letter-spacing: 0.04em; }
.card-desc { margin: 0; font-size: 0.85rem; color: var(--text-soft); line-height: 1.7; }

/* ------------------------------ 诗词 ------------------------------ */
.poems { display: grid; gap: 12px; }
.poem {
  margin: 0;
  padding: 18px 18px 15px;
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 28, 0.45);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-deep);
}
.poem-quote {
  margin: 0 0 10px;
  font-size: clamp(1rem, 3.6vw, 1.18rem);
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--gold-soft);
}
.poem-cap {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.poem-note {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-soft);
}

/* ------------------------------ 页脚 ------------------------------ */
.foot {
  width: min(680px, calc(100% - 32px));
  margin: 40px auto 0;
  padding: 26px 20px;
  text-align: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 215, 122, 0.12), rgba(255, 154, 77, 0.06));
  border: 1px solid var(--border);
}
.foot-line {
  margin: 0;
  font-size: clamp(0.98rem, 3.6vw, 1.15rem);
  letter-spacing: 0.05em;
  color: var(--gold-soft);
}

/* ------------------------------ 底部工具条 ------------------------------ */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(12, 16, 38, 0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--shadow);
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 66px;
  padding: 7px 4px 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.14s;
}
.dock-btn span { font-size: 1.32rem; line-height: 1.2; }
.dock-btn em { font-style: normal; font-size: 0.68rem; letter-spacing: 0.04em; }
.dock-btn:hover { background: rgba(255, 215, 122, 0.14); color: var(--gold-soft); }
.dock-btn:active { transform: scale(0.94); }

/* ------------------------------ 贺卡弹窗 ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 16, 0.82);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: min(420px, 100%);
  padding: 22px 20px 20px;
  border-radius: 22px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 236, 190, 0.07);
  color: var(--text-soft);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { background: rgba(255, 236, 190, 0.16); }
.modal-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
}
.card-preview {
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.card-preview canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.theme-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.theme-chip {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text-soft);
  background: rgba(255, 236, 190, 0.07);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s;
}
.theme-chip.is-active {
  color: #3a2606;
  background: linear-gradient(135deg, #ffe08a, var(--gold));
  border-color: transparent;
  font-weight: 700;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ------------------------------ Toast ------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + var(--safe-b) + 22px);
  z-index: 70;
  transform: translate(-50%, 16px);
  padding: 11px 22px;
  border-radius: 999px;
  max-width: 88vw;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(20, 26, 58, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .panel { padding: 22px 17px 20px; border-radius: 16px; }
  .hero { padding: 74px 18px 70px; }
  .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  .row-actions .btn { flex: 1 1 100%; justify-content: center; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card { padding: 13px 12px; }
  .card-desc { font-size: 0.8rem; }
  .dock-btn { width: 60px; }
  .dock-btn span { font-size: 1.2rem; }
  .modal-card { padding: 20px 15px 17px; }
}
@media (max-width: 360px) {
  .cards { grid-template-columns: 1fr; }
}

/* 横屏时首屏别太高 */
@media (orientation: landscape) and (max-height: 520px) {
  .hero { min-height: auto; padding: 60px 20px 50px; }
  .scroll-down { display: none; }
}

/* 打印 */
@media print {
  .sky, .dock, .toast, .modal, .scroll-down { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .foot { background: #fff; border-color: #ddd; box-shadow: none; }
  .hero-title { color: #8a5a00; -webkit-text-fill-color: #8a5a00; filter: none; }
}
