/* ============================================================
 * 见字 · style.css —— 「纸白」视觉
 * 极简 · 高级 · 清新：暖纸底、墨色文字、青瓷点缀、大量留白。
 * 结构：变量 → 基础 → 背景 → 公共件（按钮/选项/开关/toast）
 *       → 编辑器 → 播放器（开场/内容/蛋糕/信笺）→ 动画 → 适配
 * 动画只用 transform / opacity / Canvas / filter，不触发布局。
 * ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  color-scheme: light;
  /* 主题色：默认素笺，card 页由 themes.js 按配置覆盖 */
  --bg-0: #f8f7f3;
  --bg-1: #f3f1ea;
  --bg-2: #ebe8df;
  --accent: #5f7d72;
  --accent-2: #b98f6e;
  --grad-title: linear-gradient(180deg, #3a3d34 0%, #22241f 100%);

  --ink: #232520;
  --ink-soft: rgba(35, 37, 32, .72);
  --ink-faint: rgba(35, 37, 32, .64);
  --hairline: rgba(35, 37, 32, .12);
  --hairline-strong: rgba(35, 37, 32, .26);
  --surface: #ffffff;

  --radius: 12px;
  --shadow-soft: 0 1px 2px rgba(30, 32, 26, .05), 0 10px 30px rgba(30, 32, 26, .07);
  --shadow-pop: 0 16px 40px rgba(30, 32, 26, .12);

  --settle: cubic-bezier(.24, .9, .28, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);

  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "FZKai-Z03S", serif;
  --font-song: "Songti SC", "Noto Serif SC", "STSong", "STZhongsong", "SimSun", serif;
  --font-hei: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "MiSans", "Microsoft YaHei UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* hidden 属性必须永远生效（.btn 等作者 display 规则会盖过 UA 的 hidden 规则） */
[hidden] { display: none !important; }
/* 浏览器原生部件也属于设计：细滚动条 + 主题色光标 */
/* 滚动条跟随主题墨色：夜帖等深色主题下不再是一条隐形的轨道 */
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 32%, transparent) transparent; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; }
a { color: inherit; }
::selection { background: rgba(95, 125, 114, .22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ============================================================
 * 背景层：纸白渐变 + 极淡噪点
 * ============================================================ */
.bg {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;
  background: linear-gradient(172deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
  transition: filter 1.2s ease;
}
/* 吹灭蜡烛后的暖意提亮 */
body.lit .bg { filter: brightness(1.025) saturate(1.05); }

/* 全局极淡纸纹：内联 SVG feTurbulence，不引外部文件 */
.noise {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 200;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* toast 提示（替代 alert） */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  z-index: 210;
  transform: translateX(-50%) translateY(10px);
  padding: 12px 22px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 13.5px;
  letter-spacing: .03em;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s var(--settle);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
 * 公共组件：按钮 / 选项 / 开关
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: transform .25s var(--settle), border-color .22s ease,
    box-shadow .3s ease, background .25s ease, color .22s ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(35, 37, 32, .4);
  box-shadow: 0 8px 22px rgba(30, 32, 26, .09);
}
.btn:active { transform: scale(.98); box-shadow: none; }
.btn-primary {
  border-color: transparent;
  background: var(--ink);
  color: var(--bg-0);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(34, 36, 31, .22);
}
.btn-primary:hover {
  color: var(--bg-0);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(34, 36, 31, .24);
}
.btn-sm { padding: 10px 18px; font-size: 13px; border-radius: 10px; }
.btn-lg { width: 100%; padding: 16px 24px; font-size: 15px; letter-spacing: .08em; }
/* 头部等低噪音场景：文字按钮，悬停才显形 */
.btn-text {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}
.btn-text:hover {
  border-color: var(--hairline);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.btn-text:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }

/* 单选胶囊 */
.pill { position: relative; display: inline-block; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: block;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13.5px;
  letter-spacing: .06em;
  transition: all .22s var(--ease-out);
}
.pill input:checked + span {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}
.pill span:hover { border-color: var(--hairline-strong); }
.pill span:active { transform: scale(.97); }
.pill input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch .slider {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 999px;
  background: rgba(35, 37, 32, .12);
  transition: background .3s ease;
}
.switch .slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .3s var(--settle);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(20px); }

/* ============================================================
 * 编辑器页（index.html）
 * ============================================================ */
.editor-page { min-height: 100vh; }

/* 左侧竖排字标：宽屏可见 */
.rail { display: none; }
@media (min-width: 1200px) {
  .rail {
    display: flex;
    position: fixed;
    left: 30px; top: 0; bottom: 0;
    z-index: 2;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 34px 0;
  }
  .rail-brand {
    writing-mode: vertical-rl;
    font-family: var(--font-song);
    font-size: 18px;
    letter-spacing: .5em;
    color: var(--ink-faint);
  }
  .rail-meta {
    writing-mode: vertical-rl;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .4em;
    color: rgba(35, 37, 32, .25);
  }
  .page { padding-left: 100px; }
}

.page { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* 入场编排：品牌 → 标语 → 页签 → 内容，一列缓慢升起（一次性） */
.site-head, .tabs, .pane.p-active { animation: riseIn .7s var(--ease-out) backwards; }
.site-head { animation-delay: .05s; }
.tabs { animation-delay: .16s; }
.pane.p-active { animation-delay: .26s; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 品牌标记：一笔画就的见字，悬停时轻轻绽开 */
.brand-row { display: flex; align-items: center; }
.brand-mark {
  display: inline-flex;
  margin-right: 14px;
  color: var(--accent);
  transition: transform .8s var(--settle);
}
.brand:hover .brand-mark { transform: rotate(22deg); }
.brand-mark svg { display: block; }
.brand-mark path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: strokeDraw 1.4s var(--ease-out) .35s forwards;
}

.site-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 42px 26px 30px;
}
.site-head h1 {
  font-family: var(--font-song);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.2vw, 1.85rem);
  letter-spacing: .24em;
  color: var(--ink);
  white-space: nowrap;
}
.site-head p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: .14em;
}
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.head-actions .btn { padding: 10px 16px; font-size: 13px; }

.editor-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4px 26px 56px;
}

/* 导航栏页签：吸顶，每个页签一个功能 */
.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 12px 2px;
  margin-bottom: 26px;
  background: linear-gradient(180deg, var(--bg-0) 78%, rgba(248, 247, 243, 0));
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  font-size: 14px;
  letter-spacing: .12em;
  cursor: pointer;
  user-select: none;
  transition: color .2s ease, background .2s ease, box-shadow .25s ease, transform .2s var(--settle);
}
.tab:hover { color: var(--ink); }
.tab:active { transform: scale(.96); }
.tab.p-active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface);
  border-color: rgba(35, 37, 32, .28);
  box-shadow: var(--shadow-soft);
}
.tab-no {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  color: var(--accent);
  margin-right: 7px;
  letter-spacing: .05em;
}

.tab-panes { min-width: 0; }
.pane { display: none; }
.pane.p-active { display: block; animation: paneIn .45s var(--ease-out) .12s backwards; }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.pane-head { margin-bottom: 24px; }
.pane-head h3 {
  font-family: var(--font-song);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .12em;
  color: var(--ink);
}
.pane-head p { margin-top: 7px; font-size: 12.5px; color: var(--ink-faint); letter-spacing: .06em; }

/* 灵感页：成品模板网格。九套固定 3×3——任何宽度都不出现孤行 */
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tpl-grid .tpl-card { width: auto; }

.tpl-card {
  flex: none;
  width: 158px;
  padding: 10px 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform .25s var(--settle), border-color .22s ease, box-shadow .3s ease;
}
.tpl-grid .tpl-card { width: auto; flex: 1 1 auto; }
.tpl-card:hover {
  transform: translateY(-3px);
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-soft);
}
.tpl-card:active { transform: translateY(-1px) scale(.99); }
.tpl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* 命中反馈：手气/套用后闪一下，指明来源 */
.tpl-card.tpl-hit { animation: tplHit .9s var(--ease-out); }
@keyframes tplHit {
  0% { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(95, 125, 114, .16); }
  100% { border-color: var(--hairline); box-shadow: none; }
}
/* 灵感卡的画布预览：真实粒子效果的一帧/悬停实况 */
.tpl-sw {
  position: relative;
  display: block;
  width: 100%;
  height: 84px;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(35, 37, 32, .06);
}
.tpl-sw canvas {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}
.tpl-name { display: block; font-size: 13.5px; color: var(--ink); letter-spacing: .06em; font-weight: 600; }
.tpl-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: .08em;
}

/* 双栏 */
.editor-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 44px;
  align-items: start;
}

/* 表单 */
.field { display: flex; flex-direction: column; gap: 9px; margin-bottom: 24px; }
.field > label {
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: .16em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field .count { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; }
.field input[type="text"], .field textarea, .link-box input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  letter-spacing: .02em;
  outline: none;
  caret-color: var(--accent);
  transition: border-color .22s ease, box-shadow .22s ease;
}
.field textarea { resize: vertical; min-height: 112px; line-height: 1.95; }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 125, 114, .14);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(35, 37, 32, .5); }

.sub-label {
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: .16em;
  margin: 26px 0 12px;
}
.sub-tip { font-size: 11px; letter-spacing: .04em; color: rgba(35, 37, 32, .56); margin-left: 8px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 9px; }

/* 粒子密度滑杆：填充轨道由 JS 写入 --fill 百分比 */
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row input[type="range"] {
  flex: 1;
  max-width: 320px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--hairline) var(--fill, 50%));
  outline: none;
}
.slider-row input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(30, 32, 26, .2);
  transition: transform .2s var(--settle);
}
.slider-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider-row input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.2); }
.slider-row input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink);
  cursor: pointer;
}
.slider-val { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); min-width: 40px; }

/* 颜色色板 */
.swatch-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sw-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(35, 37, 32, .15);
  cursor: pointer;
  transition: transform .2s var(--settle), box-shadow .2s ease;
  padding: 0;
}
.sw-dot:hover { transform: scale(1.12); }
.sw-dot:active { transform: scale(1.04); }
.sw-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sw-dot.sel { box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--ink); }
.sw-auto {
  background: linear-gradient(135deg, var(--accent) 50%, var(--accent-2) 50%);
  width: auto;
  border-radius: 999px;
  padding: 0 12px;
  height: 26px;
  font-size: 11px;
  color: var(--ink);
  letter-spacing: .08em;
}
.sw-custom {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px dashed var(--hairline-strong);
  background: conic-gradient(#c98d84, #c9b99a, #9db5a8, #6e7ba3, #a37a9e, #c98d84);
  cursor: pointer;
  padding: 0;
  transition: transform .2s var(--settle);
}
.sw-custom:hover { transform: scale(1.12); }
.sw-custom.sel { box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--ink); }
.sw-custom::-webkit-color-swatch-wrapper { padding: 2px; }
.sw-custom::-webkit-color-swatch { border: none; border-radius: 50%; }

/* 主题卡片：九款固定 3×3，「特刊」不再孤悬在第四行 */
.theme-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .22s ease, box-shadow .25s ease, transform .2s var(--settle);
}
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card .sw {
  width: 22px; height: 22px;
  border-radius: 7px;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(35, 37, 32, .08);
}
.theme-card .sw-name { font-size: 13.5px; color: var(--ink-soft); letter-spacing: .08em; }
.theme-card:hover { border-color: var(--hairline-strong); }
.theme-card:active { transform: scale(.98); }
.theme-card input:focus-visible ~ .sw-name {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
.theme-card input:checked ~ .sw { box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1px rgba(35, 37, 32, .08); }
.theme-card input:checked ~ .sw-name { color: var(--ink); font-weight: 600; }
.theme-card:has(input:checked) { border-color: var(--ink); box-shadow: var(--shadow-soft); }

.music-block { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.music-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: .04em;
  text-align: right;
  word-break: break-all;
}

/* 寄出方式网格：七种方式，末张跨整行作收束，不落单 */
.send-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 431px) {
  .send-item:last-child {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 18px;
  }
  .send-item:last-child .send-name { flex: none; }
  .send-item:last-child .send-desc { flex: 1; }
  .send-item:last-child .btn { margin-top: 0; width: auto; white-space: nowrap; }
}
.send-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px 20px 18px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
}
.send-item .btn { margin-top: 14px; width: 100%; }
/* 键盘焦点进入卡片时整卡亮起，视线不用在按钮间找 */
.send-item:focus-within { border-color: rgba(95, 125, 114, .55); box-shadow: 0 0 0 3px rgba(95, 125, 114, .12); }
.send-name { font-size: 15px; color: var(--ink); letter-spacing: .1em; font-weight: 600; }
.send-desc { font-size: 12px; color: var(--ink-faint); letter-spacing: .03em; line-height: 1.75; flex: 1; }
.send-item input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .22s ease, box-shadow .22s ease;
}
.send-item input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(95, 125, 114, .14); }


.link-box { display: flex; gap: 9px; margin-top: 16px; }
.link-box input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}
.tip {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.9;
  color: #6f5732;
  letter-spacing: .03em;
}
.tip b { font-family: var(--font-mono); font-weight: 600; }

/* 网页祝福邮件预览 */
.mail-preview-label { margin-top: 34px; }
#mailPreview {
  width: 100%;
  height: 560px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: #f4f2ec;
  display: block;
}

/* 信笺页占位符示意：一张小纸样，把「空白页」变成可对照的说明 */
.letter-demo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  margin-top: 32px;
  animation: riseIn .6s var(--ease-out) .18s backwards;
}
.ld-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--ink-faint);
}
.ld-paper {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: min(370px, 100%);
  padding: 26px 26px 24px;
  border: 1px dashed var(--hairline-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.ld-token {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: #4c6a60;
  background: rgba(95, 125, 114, .1);
  border: 1px solid rgba(95, 125, 114, .3);
  border-radius: 8px;
  padding: 4px 10px;
}
.ld-title {
  font-family: var(--font-song);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .16em;
  color: rgba(35, 37, 32, .78);
}
.ld-lines { display: flex; flex-direction: column; gap: 9px; margin: 2px 0; }
.ld-lines i {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(35, 37, 32, .13), rgba(35, 37, 32, .05));
}
.ld-lines i:nth-child(1) { width: 94%; }
.ld-lines i:nth-child(2) { width: 79%; }
.ld-lines i:nth-child(3) { width: 86%; }
.ld-note { font-size: 11.5px; letter-spacing: .05em; color: var(--ink-faint); }

/* 手机壳预览 */
.preview-col { position: sticky; top: 78px; display: flex; flex-direction: column; align-items: center; }
.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 399px;
  margin-bottom: 12px;
}
.preview-cap-inline {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .14em;
}
.phone {
  position: relative;
  width: 399px; height: 764px;
  border-radius: 54px;
  padding: 12px;
  background: linear-gradient(155deg, #eae7df, #dcd8cd);
  border: 1px solid rgba(35, 37, 32, .18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    0 24px 60px rgba(30, 32, 26, .14);
  overflow: hidden;
}
/* 侧键：让"设备"更可信 */
.phone::before, .phone::after {
  content: '';
  position: absolute;
  right: -2px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: rgba(35, 37, 32, .28);
}
.phone::before { top: 176px; height: 56px; }
.phone::after { top: 248px; height: 34px; }
.phone iframe {
  width: 375px; height: 740px;
  border: 0;
  border-radius: 42px;
  background: var(--bg-0);
  transform-origin: 0 0;
  display: block;
}
.phone-notch {
  position: absolute;
  top: 19px; left: 50%;
  transform: translateX(-50%);
  width: 104px; height: 24px;
  border-radius: 12px;
  background: #d3d0c7;
  z-index: 2;
  pointer-events: none;
}
.preview-cap {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .2em;
}

.site-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 40px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .24em;
}
.foot-dot { color: var(--accent); }

/* ============================================================
 * 播放器页（card.html）
 * ============================================================ */
.card-page { overflow: hidden; }

/* 粒子层：替换元素不会因 inset:0 自动拉伸，必须显式给满尺寸 */
#fx {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* 舞台：内容超出可竖向滚动，margin:auto 保证居中且不被裁顶 */
.stage {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  -webkit-overflow-scrolling: touch;
}
.stage-inner {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 540px;
  padding: calc(64px + env(safe-area-inset-top)) 28px calc(92px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* 称呼：竖排悬于右上，字多时转横排细线 */
.to-line {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  right: 20px;
  writing-mode: vertical-rl;
  max-height: 46vh;
  overflow: hidden;
  font-family: var(--font-song);
  font-size: .95rem;
  letter-spacing: .4em;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
.to-line.show { opacity: .95; transform: none; }
.to-line.vlong {
  position: static;
  writing-mode: horizontal-tb;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  max-height: none;
  font-size: .92rem;
  letter-spacing: .3em;
  text-indent: .3em;
  margin-bottom: 6px;
}
.to-line.vlong::before, .to-line.vlong::after {
  content: '';
  width: 36px; height: 1px;
  background: var(--hairline-strong);
}

/* 标题块：逐字弹出 + 题下细线 */
.title-block { display: flex; flex-direction: column; align-items: center; margin-bottom: 16px; }
.card-title {
  font-weight: 600;
  font-size: clamp(2.1rem, 9.5vw, 3.5rem);
  line-height: 1.35;
  letter-spacing: .12em;
  max-width: 100%;
  /* 折行时均衡行长：别让「都在」这类尾巴单独悬一行 */
  text-wrap: balance;
}
/* 称呼竖排悬于右上时，标题块给右缘留出通道（竖排字 + 间隙 ≈ 80px），
 * 长标题折行也不会撞进竖排称呼里。
 * 约束落在 title-block（fit-content 收缩盒）而非标题自身：
 * 百分比 max-width 若压在标题上，会按收缩后的天然宽度折算，
 * 反把本来一行的短标题挤成两行 */
.to-line:not(.vlong) ~ .title-block { max-width: calc(100% - 80px); }
/* 窄视口下舞台与右上角的「跳过」芯片同占一角：
 * 称呼下移到芯片之后，首字不再被胶囊盖住 */
@media (max-width: 732px) {
  .to-line:not(.vlong) { top: calc(62px + env(safe-area-inset-top)); }
}
/* 三种卡面字体 */
body[data-font="kai"] .card-title, body[data-font="kai"] .card-msg, body[data-font="kai"] .signature, body[data-font="kai"] .to-line { font-family: var(--font-kai); }
body[data-font="song"] .card-title, body[data-font="song"] .card-msg, body[data-font="song"] .signature, body[data-font="song"] .to-line { font-family: var(--font-song); }
body[data-font="hei"] .card-title, body[data-font="hei"] .card-msg, body[data-font="hei"] .signature, body[data-font="hei"] .to-line { font-family: var(--font-hei); font-weight: 700; letter-spacing: .14em; }

.card-title .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px) scale(.55);
  background-image: var(--grad-title);
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: chIn .65s var(--settle) forwards;
}
.card-title .ch.noanim { animation: none; opacity: 1; transform: none; }
@keyframes chIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.title-stroke {
  width: min(220px, 56%);
  height: 12px;
  margin-top: 6px;
  color: var(--accent);
  opacity: 0;
  transition: opacity .5s ease;
  overflow: visible;
}
.title-stroke path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.title-stroke.draw { opacity: .75; }
.title-stroke.draw path { animation: strokeDraw 1.1s var(--ease-out) forwards; }
@keyframes strokeDraw { to { stroke-dashoffset: 0; } }

/* 花点分隔 */
.orn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 22px;
  opacity: 0;
  transition: opacity .8s ease .2s;
}
.orn.show { opacity: 1; }
.orn i { width: 40px; height: 1px; background: var(--hairline-strong); }
.orn b { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* 祝福语：素文本 */
.msg-wrap {
  width: 100%;
  max-width: 410px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
  margin-bottom: 10px;
}
.msg-wrap.show { opacity: 1; transform: none; }
.card-msg {
  white-space: pre-line;
  font-size: clamp(1rem, 4.1vw, 1.1rem);
  line-height: 2.2;
  letter-spacing: .05em;
  color: var(--ink-soft);
  min-height: 1.2em;
}
.caret {
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 2px;
  vertical-align: -.14em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.caret.off { display: none; }
@keyframes blink { 50% { opacity: 0; } }

/* 署名行 */
.sign-row {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 18px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.sign-row.show { opacity: 1; transform: none; }
.sign-dash { width: 28px; height: 1px; background: var(--hairline-strong); }
.signature {
  font-size: clamp(1rem, 4.4vw, 1.2rem);
  letter-spacing: .16em;
  color: var(--ink);
}
/* 一点青瓷：署名旁的小圆环 */
.seal {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(1.6);
}
.seal.stamped { animation: sealIn .5s var(--settle) forwards; }
@keyframes sealIn {
  0%  { opacity: 0; transform: scale(1.8); }
  62% { opacity: 1; transform: scale(.85); }
  100% { opacity: 1; transform: scale(1); }
}

/* 结尾按钮 */
.end-actions {
  display: flex;
  gap: 14px;
  margin-top: 34px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .8s var(--ease-out), transform .8s var(--settle);
}
.end-actions.show { opacity: 1; transform: none; pointer-events: auto; }

/* 互动提示 */
.hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(32px + env(safe-area-inset-bottom));
  z-index: 30;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink-faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}
.hint.show { opacity: 1; animation: hintPulse 2.2s ease-in-out .6s infinite; }
@keyframes hintPulse { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }
/* 结尾按钮浮出后，它们才是这屏的主角：
 * 底部的赠心提示与左下角帖号一并让位（蛋糕卡内容高过视口时会正好撞在同一区域） */
body.ended .hint { animation: none; opacity: 0; }
body.ended .edition { opacity: 0; }

/* 帖号：左下角小字 */
.edition {
  position: fixed;
  left: 20px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 30;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--ink-faint);
  pointer-events: none;
  transition: opacity .6s ease;
}

/* 顶部小件：跳过 / 音乐 */
.chip {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--ink-soft);
  font-size: 12.5px;
  letter-spacing: .12em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 10px rgba(30, 32, 26, .06);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease, transform .3s var(--settle), color .22s ease;
}
.chip.show { opacity: 1; pointer-events: auto; }
.chip:active { transform: scale(.94); }
.chip-skip { right: 16px; }
.chip-mute { left: 16px; }
.chip-mute .note { font-size: 14px; color: var(--accent); }
.chip-mute.off { color: var(--ink-faint); }
.chip-mute.off .note { opacity: .35; }
.chip-mute.off::after {
  content: '';
  position: absolute;
  left: 11px; right: 11px; top: 50%;
  height: 1px;
  background: var(--ink-faint);
  transform: rotate(-8deg);
}

/* 点屏幕赠心（内联 SVG，随调色板着色） */
.heart {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 8px rgba(95, 125, 114, .3));
  animation: heartFloat var(--dur, 1.5s) var(--ease-out) forwards;
}
.heart svg { width: 100%; height: auto; display: block; }
@keyframes heartFloat {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  18%  { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px) * .2), -55%) scale(1.15); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 130px)) scale(.85); }
}

/* 主题色晕：每套主题的专属氛围光。
 * 编辑器页未设 --wash，用自己的两抹极淡色晕（跟随强调色）+ 缓慢漂移。 */
.bg::before {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(70% 50% at 88% -4%, var(--wash, transparent), transparent 70%),
    radial-gradient(55% 42% at 0% 104%, var(--wash, transparent), transparent 72%);
  pointer-events: none;
}
.editor-page .bg::before {
  --wash-soft: rgba(95, 125, 114, .07);
  --wash-warm: rgba(185, 143, 110, .06);
  background:
    radial-gradient(58% 44% at 86% -6%, var(--wash-soft), transparent 70%),
    radial-gradient(52% 44% at 2% 106%, var(--wash-warm), transparent 72%);
  animation: washDrift 26s ease-in-out infinite alternate;
}
@keyframes washDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2.4%, 1.8%, 0) scale(1.06); }
}

/* 彩蛋：屏幕震动 */
body.do-shake { animation: shakeH .68s ease-in-out; }
@keyframes shakeH {
  10%, 90% { transform: translate(-1px, 0); }
  20%, 80% { transform: translate(2px, -1px); }
  30%, 50%, 70% { transform: translate(-4px, 1px); }
  40%, 60% { transform: translate(4px, 1px); }
}

/* 彩蛋：弹窗雨（自绘小窗，全部可关） */
.mini-pop {
  position: fixed;
  z-index: 75;
  width: 196px;
  padding: 12px 30px 13px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-pop);
  animation: popIn .35s var(--settle);
}
.mini-pop.bye { opacity: 0; transform: scale(.85) translateY(6px); transition: .25s ease; }
.mini-pop b {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .2em;
  margin-bottom: 5px;
}
.mini-pop span { display: block; font-size: 14px; color: var(--ink); line-height: 1.6; letter-spacing: .03em; }
.mini-pop .x {
  position: absolute; top: 6px; right: 8px;
  font-style: normal; font-size: 15px; color: var(--ink-faint);
  cursor: pointer; padding: 2px 7px; border-radius: 6px;
}
.mini-pop .x:hover { background: rgba(35, 37, 32, .07); color: var(--ink); }
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.8); }
  to   { opacity: 1; transform: none; }
}

/* 彩蛋：祝福弹幕 */
.danmaku {
  position: fixed;
  left: 100%;
  z-index: 45;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: .16em;
  opacity: .85;
  pointer-events: none;
  animation: danmakuMove linear forwards;
 
}
@keyframes danmakuMove {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100vw - 100%)); }
}

/* 彩蛋：跑路红包按钮 */
.run-btn {
  position: fixed;
  z-index: 75;
  transform: translate(-50%, -50%);
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg-0);
  font-size: 14.5px;
  letter-spacing: .06em;
  border: none;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(34, 36, 31, .28);
  transition: left .3s var(--settle), top .3s var(--settle), opacity .3s ease, transform .3s ease;
}
.run-btn.tired { background: var(--accent); }
.run-btn.bye { opacity: 0; transform: translate(-50%, -50%) scale(.6); }

/* ============================================================
 * 开场：信封（通用场景）
 * ============================================================ */
.open-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  /* 跟随贺卡底色（自定义背景色也成立），fallback 到纸白 */
  background: rgba(248, 247, 243, .9);
  background: color-mix(in srgb, var(--bg-0) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: opacity .6s ease;
}
.open-overlay.gone { opacity: 0; pointer-events: none; }
.open-inner { display: flex; flex-direction: column; align-items: center; }
.open-hint {
  margin-top: 30px;
  font-size: 12px;
  letter-spacing: .46em;
  text-indent: .46em;
  color: var(--ink-faint);
  animation: openHint 1.9s ease-in-out infinite;
}
@keyframes openHint { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
/* 开场浮层里也放帖号，收卡人第一眼就知道这是"专属于 TA 的一张" */
.open-edition {
  position: fixed;
  left: 20px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 51;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--ink-faint);
  pointer-events: none;
  transition: opacity .4s ease;
}
.open-overlay.gone ~ .open-edition { opacity: 0; }

/* 开场底下的一方浅影：紧贴信封/礼盒之下，让它们"落在"纸面上而不是飘着 */
.open-ground {
  width: min(276px, 66vw);
  height: 22px;
  /* 紧贴物体：上浮动画最多抬 8px，影子在 20~28px 间徘徊 */
  margin-top: 20px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(30, 32, 26, .13), rgba(30, 32, 26, 0) 72%);
  animation: groundBreath 3.4s ease-in-out infinite;
}
@keyframes groundBreath {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(.86); opacity: .7; }
}

/* 信封结构：背板 → 信纸 → 前袋 → 封口盖 */
.env {
  position: relative;
  width: min(320px, 78vw);
  height: calc(min(320px, 78vw) * .64);
  perspective: 900px;
  animation: envFloat 3.4s ease-in-out infinite;
  filter: drop-shadow(0 24px 50px rgba(30, 32, 26, .14));
}
@keyframes envFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.env-back {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbf9f3, #efebe0);
  box-shadow:
    inset 0 0 0 1px rgba(35, 37, 32, .1),
    inset 0 -14px 26px rgba(30, 32, 26, .04);
}
.env-letter {
  position: absolute;
  left: 13%; bottom: 7%;
  width: 74%; height: 72%;
  border-radius: 6px;
  background: #ffffff;
  color: #4a483f;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  z-index: 1;
  transition: transform .8s var(--settle) .15s;
  box-shadow: 0 -6px 24px rgba(30, 32, 26, .1), inset 0 0 0 1px rgba(35, 37, 32, .06);
}
.env-letter-to {
  font-family: var(--font-song);
  font-size: 16px;
  letter-spacing: .22em;
  text-indent: .22em;
}
.env-letter-sub { margin-top: 9px; font-family: var(--font-mono); font-size: 8px; letter-spacing: .5em; text-indent: .5em; opacity: .5; }
.env.open .env-letter { transform: translateY(-54%); }

.env-pocket {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 64%;
  background: linear-gradient(180deg, #f6f2e7, #ece7d8);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 10px 10px;
  z-index: 2;
  /* 前袋斜线上的柔和投影，让"袋"立体可读 */
  filter: drop-shadow(0 -3px 5px rgba(30, 32, 26, .1));
}
.env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  /* 盖片下缘做成与前袋中缝一致的 V 形，闭合时完全遮住信纸 */
  height: 69.5%;
  background: linear-gradient(180deg, #fffefb, #f3efe2);
  clip-path: polygon(0 0, 100% 0, 100% 52%, 50% 100%, 0 52%);
  transform-origin: top center;
  z-index: 3;
  transition: z-index 0s .4s;
  /* 盖片 V 缘的细影，闭口时轮廓可读 */
  filter: drop-shadow(0 3px 4px rgba(30, 32, 26, .12));
}
.env.open .env-flap { animation: flapOpen .65s var(--ease-out) forwards; }
.env.opened .env-flap { z-index: 0; } /* 翻上去后压到信纸底下 */
@keyframes flapOpen { to { transform: rotateX(180deg); } }

/* 封口小圆印：一枚青瓷"火漆"，坐在盖片 V 尖（独立于盖片，避免被裁形） */
.env-seal {
  position: absolute;
  left: 50%; top: 69.5%;
  transform: translate(-50%, -50%);
  display: block;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 0 3px 10px rgba(30, 32, 26, .2), inset 0 0 0 2px rgba(255, 255, 255, .65);
  z-index: 4;
  transition: opacity .3s ease;
}
.env.open .env-seal { opacity: 0; }

/* ============================================================
 * 开场：礼盒（生日·圣诞场景）
 * ============================================================ */
.gift {
  position: relative;
  width: 210px; height: 208px;
  animation: envFloat 3.4s ease-in-out infinite;
}
.gift-glow {
  position: absolute;
  left: 50%; top: 55%;
  transform: translate(-50%, -50%) scale(.55);
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122, 150, 140, .3) 0%, transparent 62%);
  opacity: 0;
  transition: opacity .5s ease, transform .5s var(--settle);
  pointer-events: none;
}
.gift.open .gift-glow { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }

.gift-box {
  position: absolute;
  bottom: 0; left: 25px;
  width: 160px; height: 112px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, 0) 34%),
    linear-gradient(160deg, #f0eadc, #ded6c2);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .6),
    inset -8px 0 18px rgba(30, 32, 26, .05),
    0 18px 44px rgba(30, 32, 26, .16);
}
.gift-ribbon-v {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7e998f, #b9cabf 42%, #9db4a9 58%, #7e998f);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.gift-lid {
  position: absolute;
  bottom: 102px; left: 13px;
  width: 184px; height: 42px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 46%),
    linear-gradient(160deg, #f6f2e8, #e7e0cf);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    0 10px 24px rgba(30, 32, 26, .16);
  z-index: 3;
  transition: transform .6s var(--settle), opacity .5s ease .1s;
}
.gift-ribbon-l {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7e998f, #b9cabf 42%, #9db4a9 58%, #7e998f);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
/* 蝴蝶结：结心 + 两枚实心缎面环自结心向上翘 + 两根下垂飘带。
 * 环是实心渐变（不是空心圈）——空心双圆并排会读成一副眼镜 */
.gift-bow {
  position: absolute;
  top: -17px; left: 50%;
  transform: translateX(-50%);
  width: 17px; height: 17px;
  border-radius: 50%;
  background: linear-gradient(150deg, #b9cabf, #7e998f);
  z-index: 4;
  box-shadow: 0 2px 4px rgba(30, 32, 26, .18);
}
.gift-bow::before, .gift-bow::after {
  content: '';
  position: absolute;
  top: -8px;
  width: 34px; height: 23px;
  background: linear-gradient(155deg, #c9d6cd 0%, #93aa9f 55%, #7e998f 100%);
  box-shadow:
    inset 2px 3px 5px rgba(255, 255, 255, .42),
    inset -2px -3px 5px rgba(30, 32, 26, .12),
    0 2px 5px rgba(30, 32, 26, .16);
}
.gift-bow::before { right: 8px; transform: rotate(-44deg); border-radius: 56% 56% 52% 52%; }
.gift-bow::after { left: 8px; transform: rotate(44deg); border-radius: 56% 56% 52% 52%; }
/* 结下两根飘带：从结后探出、垂向外下方，尾端低于环底 */
.gift-bow i {
  position: absolute;
  top: 12px;
  width: 8px; height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, #8aa39a, #77908a);
  box-shadow: 0 2px 3px rgba(30, 32, 26, .14);
}
.gift-bow i:first-child { left: -3px; transform: rotate(30deg); }
.gift-bow i:last-child { right: -3px; transform: rotate(-30deg); }

.gift.shake { animation: giftShake .5s ease-in-out, envFloat 3.4s ease-in-out infinite; }
@keyframes giftShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-5deg); }
  40% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); }
  80% { transform: rotate(3deg); }
}
.gift.open .gift-lid {
  transform: translate(-24px, -148px) rotate(26deg);
  opacity: 0;
}

/* 场景互斥：生日/圣诞用礼盒开场，生日独有蛋糕；其余信封 */
body:not(.has-gift) .gift, body:not(.has-cake) .cake-wrap { display: none; }
body.has-gift .env { display: none; }

/* ============================================================
 * 生日蛋糕 + 蜡烛
 * ============================================================ */
.cake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  /* 蜡烛在蛋糕顶部：给祝福语末行与火苗之间留出一口气 */
  margin-top: 40px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease-out), transform .6s var(--settle);
}
.cake-wrap.show { opacity: 1; transform: none; }

.cake { position: relative; width: 190px; height: 132px; cursor: pointer; }
.cake-plate {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 214px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(35, 37, 32, .1), rgba(35, 37, 32, .03));
  box-shadow: 0 8px 24px rgba(30, 32, 26, .1);
}
.cake-bottom {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 176px; height: 60px;
  border-radius: 12px 12px 10px 10px;
  background: linear-gradient(180deg, #f2cdd3, #e5aeb8);
}
.cake-top {
  position: absolute;
  bottom: 62px; left: 50%;
  transform: translateX(-50%);
  width: 136px; height: 46px;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8ecd2, #eedcb2);
}
.icing {
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  width: 142px; height: 18px;
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: inset 0 0 0 1px rgba(35, 37, 32, .05);
}
.icing::after {
  content: '';
  position: absolute;
  top: 12px; left: 16px;
  width: 13px; height: 16px;
  border-radius: 0 0 8px 8px;
  background: #fffdf8;
  box-shadow: 32px -3px 0 #fffdf8, 64px 0 0 #fffdf8, 92px -2px 0 #fffdf8;
}
.candle {
  position: absolute;
  bottom: 106px;
  width: 9px; height: 32px;
  border-radius: 4px 4px 2px 2px;
  background: repeating-linear-gradient(48deg, #fffdf8 0 4px, var(--accent) 4px 9px);
  box-shadow: 0 2px 6px rgba(30, 32, 26, .18);
}
.candle::before {
  content: '';
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 7px;
  border-radius: 1px;
  background: #6b5544;
}
.flame {
  position: absolute;
  display: block;
  top: -25px; left: 50%;
  margin-left: -7.5px;
  width: 15px; height: 22px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 72%, #fffbe6 0 22%, #ffd166 52%, #ff9d4d 80%, rgba(255, 130, 60, 0) 82%);
  box-shadow: 0 0 16px 5px rgba(255, 190, 100, .5);
  transform-origin: 50% 92%;
  animation: flick .38s ease-in-out infinite alternate;
}
@keyframes flick {
  from { transform: scale(1) skewX(0deg); }
  to   { transform: scale(1.06, .9) skewX(4deg); }
}
.candle.out .flame { animation: blowOut .3s ease-in forwards; }
@keyframes blowOut {
  to { transform: scale(.05, .02) skewX(18deg); opacity: 0; }
}
.smoke {
  position: absolute;
  display: block;
  top: -34px; left: 50%;
  margin-left: -4.5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(120, 130, 125, .5);
  filter: blur(3px);
  opacity: 0;
  pointer-events: none;
}
.candle.out .smoke { animation: smokeUp 1.6s ease-out forwards; animation-delay: var(--sd, 0s); }
@keyframes smokeUp {
  0%   { opacity: 0; transform: translateY(0) scale(.5); }
  22%  { opacity: .7; }
  100% { opacity: 0; transform: translateY(-60px) scale(2.4); }
}

.btn-blow { padding: 13px 34px; letter-spacing: .16em; opacity: 0; transform: translateY(8px); pointer-events: none; }
.btn-blow.show { opacity: 1; transform: none; pointer-events: auto; }

/* ============================================================
 * 自定义信笺
 * ============================================================ */
.letter-wrap { display: none; width: 100%; }
body.letter-mode .to-line,
body.letter-mode .title-block,
body.letter-mode .orn,
body.letter-mode .msg-wrap,
body.letter-mode .cake-wrap,
body.letter-mode .photo-wrap,
body.letter-mode .sign-row,
body.letter-mode .fortune { display: none !important; }
body.letter-mode .letter-wrap { display: block; }
#letterWrap {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
#letterWrap.show { opacity: 1; transform: none; }
#letterFrame {
  width: 100%;
  height: min(72vh, 640px);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  display: block;
  box-shadow: var(--shadow-soft);
}

/* ============================================================
 * 照片：拍立得式一张（可选）
 * ============================================================ */
.photo-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
  opacity: 0;
  transform: translateY(14px) rotate(-4deg) scale(.96);
  transition: opacity .7s var(--ease-out), transform .7s var(--settle);
}
.photo-wrap.show { opacity: 1; transform: translateY(0) rotate(-1.6deg) scale(1); }
.photo {
  width: min(300px, 82%);
  background: #fffdf8;
  padding: 10px 10px 12px;
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(35, 37, 32, .06),
    0 14px 34px rgba(30, 32, 26, .18);
  cursor: zoom-in;
  transition: transform .35s var(--settle);
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}
.photo.zoomed { transform: scale(1.05); cursor: zoom-out; }
/* 多张照片：右上角页码角标 */
.photo { position: relative; }
.photo-count {
  position: absolute;
  top: 18px; right: 18px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(35, 37, 32, .62);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
/* 换页：旧照片淡出微缩再浮回，swap 类由 JS 每次重新触发 */
@keyframes photoSwap {
  0%   { opacity: 1; transform: scale(1); }
  38%  { opacity: 0; transform: scale(.97); }
  39%  { opacity: 0; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
.photo.swap img { animation: photoSwap .5s var(--ease-out); }
/* 自定义信笺模式下照片让位 */
body.letter-mode .photo-wrap { display: none; }

/* ============================================================
 * 语音祝福（编辑器录制）
 * ============================================================ */
.btn-rec { position: relative; }
.btn-rec.rec { color: #a83a2a; border-color: rgba(168, 58, 42, .45); }
.btn-rec.rec::before {
  content: '';
  position: absolute;
  top: -3px; right: -3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #c0392b;
  animation: recPulse 1.1s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}
.rec-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }

/* ============================================================
 * 手写署名（编辑器手写板 + 播放端笔迹回放）
 * ============================================================ */
.signpad {
  position: relative;
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.signpad canvas {
  display: block;
  width: 100%;
  height: 110px;
  touch-action: none;
  cursor: crosshair;
}
.signpad .signpad-hint {
  position: absolute;
  top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  text-align: center;
  font-size: 12px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: rgba(35, 37, 32, .42);
  pointer-events: none;
}
.signpad.dirty .signpad-hint { display: none; }
.signpad-tools { display: flex; gap: 9px; margin-top: 9px; align-items: center; }

/* 播放端：署名笔迹画布（与编辑器手写板同比例，笔迹不变形） */
.sign-canvas {
  display: block;
  width: min(230px, 58vw);
  height: auto;
  aspect-ratio: 340 / 110;
}

/* ============================================================
 * 帖号签语：结尾浮现的一句
 * ============================================================ */
.fortune {
  margin-top: 16px;
  font-size: 12px;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--ink-faint);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.fortune.show { opacity: 1; transform: none; }
.fortune b { font-family: var(--font-mono); font-weight: 600; font-size: 10.5px; letter-spacing: .14em; color: var(--accent); margin-right: .5em; }

/* 编辑器寄出页：签语预览 */
.fortune-link {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.fortune-link b {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--accent);
  margin-right: 8px;
}

/* 编辑器内容页：多张照片缩略条 */
.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.photo-cell {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  animation: cellIn .35s var(--ease-out);
}
@keyframes cellIn {
  from { opacity: 0; transform: translateY(6px) scale(.9); }
  to   { opacity: 1; transform: none; }
}
.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-cell button {
  position: absolute;
  top: 2px; right: 2px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: rgba(35, 37, 32, .66);
  color: #fff;
  font-size: 12px;
  line-height: 19px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s ease;
}
.photo-cell:hover button, .photo-cell button:focus-visible { opacity: 1; }

/* 编辑器寄出页：定时开启时间选择（复用 field 输入样式） */
.field input[type="datetime-local"] {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  letter-spacing: .04em;
}
.field input[type="datetime-local"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 125, 114, .14);
}
.field input[type="datetime-local"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }

/* ============================================================
 * 求签：签筒摇两下，抽出这张卡的帖号签语
 * ============================================================ */
.oracle {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
  -webkit-user-select: none;
  user-select: none;
}
.oracle.show { opacity: 1; transform: none; }
.oracle-cup {
  position: relative;
  width: 46px;
  height: 62px;
  /* 竹筒：上宽下窄，圆角收口 */
  background: linear-gradient(100deg, #cbb58e 0%, #e6d7b6 34%, #c4ad84 100%);
  border-radius: 8px 8px 12px 12px / 6px 6px 14px 14px;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, .55),
    inset 0 -6px 10px rgba(90, 70, 40, .22),
    0 8px 18px rgba(30, 32, 26, .16);
  transition: transform .3s var(--settle);
}
/* 筒口 */
.oracle-cup::before {
  content: '';
  position: absolute;
  top: -3px; left: 0; right: 0;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8a744f, #b8a075);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35);
}
/* 竹节 */
.oracle-cup::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 58%;
  height: 5px;
  background: linear-gradient(180deg, rgba(120, 96, 58, .38), rgba(255, 255, 255, .4));
  border-radius: 3px;
}
.o-stick {
  position: absolute;
  left: 50%;
  bottom: 74%;
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: #f6efdd;
  box-shadow: inset 0 0 0 1px rgba(120, 96, 58, .35);
  transform-origin: bottom center;
  z-index: -1;
  opacity: 0;
  transition: opacity .3s ease;
}
.o-stick.s1 { transform: rotate(-16deg); }
.o-stick.s2 { transform: rotate(3deg); }
.o-stick.s3 { transform: rotate(15deg); }
.o-stick.o-main {
  bottom: 82%;
  height: 30px;
  background: linear-gradient(180deg, #fffdf6, #f0e6cf);
}
/* 摇动：签在筒里哗啦（transform 同时带动里面的签） */
.oracle-cup.shaking { animation: cupShake .42s var(--settle); }
@keyframes cupShake {
  0%, 100% { transform: rotate(0); }
  22% { transform: rotate(-9deg) translateX(-3px); }
  48% { transform: rotate(8deg) translateX(3px); }
  74% { transform: rotate(-5deg); }
}
.oracle-cup.shaking .o-stick { opacity: 1; }
/* 抽出：主签探出头 */
.oracle-cup.drawn .o-main {
  opacity: 1;
  bottom: 96%;
  background: linear-gradient(180deg, #fffef9, #f7efd9);
  box-shadow: inset 0 0 0 1px rgba(120, 96, 58, .4), 0 4px 10px rgba(30, 32, 26, .14);
  transition: bottom .5s var(--settle);
}
.oracle-hint {
  margin-top: 12px;
  font-size: 11.5px;
  letter-spacing: .2em;
  text-indent: .2em;
  color: var(--ink-faint);
  transition: opacity .3s ease;
}

/* ============================================================
 * 密语解锁：开场浮层里的验证框
 * ============================================================ */
.lock-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(320px, 84vw);
  margin-top: 30px;
}
.lock-box input {
  width: 100%;
  padding: 13px 18px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  letter-spacing: .12em;
  text-align: center;
  transition: border-color .22s ease, box-shadow .22s ease;
}
.lock-box input::placeholder { color: rgba(35, 37, 32, .5); letter-spacing: .06em; }
.lock-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 125, 114, .16);
}
.lock-box input.bad { border-color: #c0392b; animation: badShake .4s var(--settle); }
@keyframes badShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-7px); }
  46% { transform: translateX(6px); }
  72% { transform: translateX(-4px); }
}
.lock-box .btn { min-width: 120px; }
.lock-tip {
  font-size: 11.5px;
  letter-spacing: .16em;
  text-indent: .16em;
  color: var(--ink-faint);
}

/* ============================================================
 * 定时开启：到点前盖在最上面的倒计时门
 * ============================================================ */
.time-gate {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 60; /* 盖过开场浮层(50)：没到点连信封都碰不到 */
  display: none;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg-0) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.time-gate.show { display: grid; animation: gateIn .6s var(--ease-out); }
@keyframes gateIn { from { opacity: 0; } to { opacity: 1; } }
.tg-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
}
.tg-mark {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--ink-faint);
}
.tg-title {
  margin-top: 18px;
  font-family: var(--font-song);
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  letter-spacing: .18em;
  color: var(--ink);
}
.tg-when {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--accent);
}
.tg-count { display: flex; gap: 10px; margin-top: 26px; }
.tg-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  padding: 12px 8px 9px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.tg-cell b {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tg-cell i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .2em;
  text-indent: .2em;
  color: var(--ink-faint);
}
.tg-note {
  margin-top: 26px;
  font-size: 11.5px;
  letter-spacing: .14em;
  color: var(--ink-faint);
  animation: openHint 1.9s ease-in-out infinite;
}

/* ============================================================
 * 祝福语分页工具（编辑器）
 * ============================================================ */
.msg-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: -14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.msg-tools .tip-inline {
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(35, 37, 32, .56);
  margin-left: auto;
}

/* ============================================================
 * 实体贺卡：打印排面（屏幕上隐藏，打印时独占）
 * ============================================================ */
.print-sheet { display: none; }
@media print {
  body.printing > :not(.print-sheet) { display: none !important; }
  body.printing { background: #fff; }
  .print-sheet { display: block; }
  .ps-page {
    page-break-after: always;
    width: 148mm;
    height: 200mm;
    margin: 8mm auto;
    padding: 18mm 16mm;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
    color: #232520;
  }
  .ps-mark { font-size: 10pt; letter-spacing: .5em; text-indent: .5em; color: #8a8676; }
  .ps-title {
    margin-top: auto;
    font-size: 26pt;
    font-weight: 600;
    letter-spacing: .3em;
    text-indent: .3em;
  }
  .ps-to { margin-top: 10mm; font-size: 11pt; letter-spacing: .35em; color: #6a675c; }
  .ps-cover-foot { margin-top: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 7.5pt; letter-spacing: .3em; color: #a5a196; }
  .ps-inner { justify-content: center; gap: 10mm; }
  .ps-msg {
    font-size: 13pt;
    line-height: 2.3;
    letter-spacing: .12em;
    white-space: pre-line;
    text-align: center;
  }
  .ps-from { font-size: 11.5pt; letter-spacing: .25em; }
  .ps-from::before { content: '—— '; color: #a5a196; }
  .ps-line { width: 40mm; height: .4mm; background: #c9b99a; }
}

/* ============================================================
 * 响应式 + 动效偏好
 * ============================================================ */
/* 宽屏：贺卡舞台更有存在感（标题更大、版心更宽、正文更舒展） */
@media (min-width: 1024px) {
  .stage-inner { max-width: 640px; }
  .card-title { font-size: clamp(3.5rem, 5.2vw, 4.4rem); }
  .card-msg { font-size: 1.18rem; max-width: 470px; margin-left: auto; margin-right: auto; }
  .signature { font-size: 1.32rem; }
  .to-line { font-size: 1.02rem; top: calc(30px + env(safe-area-inset-top)); right: 40px; }
  .cake { transform: scale(1.12); transform-origin: bottom center; }
  /* 桌面上信封有 320px，礼盒原尺寸 210px 显得怯场：
   * 用独立的 scale 属性放大（不占布局、也不干扰 envFloat 的 transform 动画），
   * 提示语随之下移，保持呼吸感 */
  .gift { scale: 1.3; }
  /* scale 不占布局：礼盒放大后盒底向下探出 (208×1.3−208)/2 ≈ 31px，影子让出这段再贴 */
  body.has-gift .open-ground { margin-top: 52px; }
  .open-hint { font-size: 12.5px; }
}

@media (max-width: 920px) {
  .editor-cols { grid-template-columns: 1fr; gap: 30px; }
  /* 表单在前、预览在后：编辑时不必每次翻页都先越过 760px 的手机壳 */
  .preview-col { position: static; padding-top: 2px; }
  .site-head { padding-top: 30px; align-items: center; }
  .preview-bar { margin-top: 2px; }
  /* 页签可横滑时右缘渐隐，提示还有下一页 */
  .tabs {
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
}

@media (max-width: 430px) {
  .editor-main { padding: 0 16px 36px; }
  .tab { padding: 10px 16px; font-size: 13.5px; }
  .site-head { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .site-head h1 { font-size: 1.4rem; letter-spacing: .16em; }
  .site-head p { font-size: 12px; letter-spacing: .1em; }
  .head-actions .btn { padding: 9px 12px; font-size: 12.5px; }
  .send-grid { grid-template-columns: 1fr; }
  .stage-inner { padding-left: 20px; padding-right: 20px; }
  .to-line { right: 14px; }
  #letterFrame { height: 66vh; }
  /* 窄屏：品牌独占一行（标语不折行），动作按钮排到下一行 */
  .site-head { flex-wrap: wrap; }
  .head-actions { width: 100%; justify-content: flex-end; gap: 2px; margin-top: -4px; }
}

/* 尊重 prefers-reduced-motion：关闭装饰性动画，只保留必要过渡 */
@media (prefers-reduced-motion: reduce) {
  .env, .gift, .flame, .open-hint, .hint.show, .caret { animation: none !important; }
  .card-title .ch { animation-duration: .01ms; animation-delay: 0ms !important; }
  .heart { display: none; }
  body.do-shake { animation: none !important; }
  .danmaku { display: none; }
  .title-stroke { opacity: .75; }
  .title-stroke path { stroke-dashoffset: 0; }
  .editor-page .bg::before, .open-ground, .brand-mark path, .btn-rec.rec::before { animation: none !important; }
  .site-head, .tabs, .pane.p-active, .letter-demo { animation: none !important; }
  .photo-wrap, .fortune { opacity: 1 !important; transform: none !important; }
  /* 新增交互件同样退场动画，只留瞬时状态变化 */
  .oracle { opacity: 1 !important; transform: none !important; }
  .oracle-cup.shaking { animation: none !important; }
  .oracle-cup.drawn .o-main { transition: none !important; }
  .photo.swap img { animation: none !important; }
  .lock-box input.bad { animation: none !important; }
  .time-gate.show { animation: none !important; }
  .tg-note { animation: none !important; }
  .photo-cell { animation: none !important; }
  /* 网红效果包：装饰性动画在减少动态偏好下全部退场 */
  .doodle path { animation-duration: .01ms !important; animation-delay: 0ms !important; }
  [data-theme="neon"] .stage-inner::after { animation: none !important; }
  .gs-thumb { animation: none !important; }
  .bb-lid, .bb-q { transition-duration: .01ms !important; }
  * { transition-duration: .15s !important; }
}

/* ============================================================
 * 电脑横屏版式（data-layout = scroll 横卷 / folding 屏风）
 * card.html 的 stage-col 两列只在宽屏媒体查询里成为真实分栏；
 * 竖屏下 display:contents 不产生任何盒子，排版与无包裹时完全一致，
 * 手机或竖向窗口打开横屏卡会整体回退为经典竖屏排版。
 * ============================================================ */
.stage-col { display: contents; }

/* ---------- 编辑器预览壳：电脑横屏版式换成显示器（浏览器窗） ---------- */
.phone.monitor {
  width: 1052px; height: 688px;
  padding: 34px 14px 14px;
  border-radius: 16px;
}
.phone.monitor::before, .phone.monitor::after { content: none; }
.phone.monitor .phone-notch { display: none; }
.phone.monitor::before {
  content: '';
  position: absolute;
  top: 13px; left: 16px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(35, 37, 32, .22);
  box-shadow: 15px 0 0 rgba(35, 37, 32, .15), 30px 0 0 rgba(35, 37, 32, .15);
}
.phone.monitor iframe {
  width: 1024px; height: 640px;
  border-radius: 6px;
}

/* ---------- 灵感模板卡：电脑端徽标 ---------- */
.tpl-card { position: relative; }
.tpl-badge {
  position: absolute;
  top: 16px; right: 18px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .16em;
  text-indent: .16em;
  color: var(--ink-soft);
  pointer-events: none;
}

/* ---------- 宽屏媒体查询：窄屏/竖窗不生效，自动回退竖屏 ---------- */
@media (min-width: 880px) and (orientation: landscape) {
  /* 共同底座：整屏左右两栏，左"封面"右"内容" */
  body[data-layout="scroll"] .stage-inner,
  body[data-layout="folding"] .stage-inner {
    max-width: 1160px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(56px, 7vw, 128px);
    padding: clamp(40px, 6vh, 76px) clamp(48px, 6vw, 92px);
    text-align: left;
  }
  body[data-layout="scroll"] .stage-col,
  body[data-layout="folding"] .stage-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
  }
  /* 称呼已入流，标题不再给它让出右上通道 */
  body[data-layout="scroll"] .to-line ~ .title-block,
  body[data-layout="folding"] .to-line ~ .title-block { max-width: 100%; }

  /* 称呼：从右上竖排改为入流横排（保留双细线的仪式感） */
  body[data-layout="scroll"] .to-line,
  body[data-layout="folding"] .to-line {
    position: static;
    writing-mode: horizontal-tb;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    max-height: none;
    overflow: visible;
    font-size: 1rem;
    letter-spacing: .32em;
    margin-bottom: 14px;
  }
  body[data-layout="scroll"] .to-line::before,
  body[data-layout="scroll"] .to-line::after,
  body[data-layout="folding"] .to-line::before,
  body[data-layout="folding"] .to-line::after {
    content: '';
    width: 36px; height: 1px;
    background: var(--hairline-strong);
  }

  /* 正文列：占满栏宽，字号整体升档 */
  body[data-layout="scroll"] .msg-wrap,
  body[data-layout="folding"] .msg-wrap {
    max-width: none;
    width: 100%;
    margin-bottom: 20px;
  }
  body[data-layout="scroll"] .card-msg,
  body[data-layout="folding"] .card-msg {
    max-width: none;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    line-height: 2.15;
  }
  body[data-layout="scroll"] .photo-wrap,
  body[data-layout="folding"] .photo-wrap { justify-content: flex-start; margin: 8px 0 16px; }
  body[data-layout="scroll"] .photo,
  body[data-layout="folding"] .photo { width: min(320px, 86%); }
  body[data-layout="scroll"] .cake-wrap,
  body[data-layout="folding"] .cake-wrap { align-items: flex-start; }
  body[data-layout="scroll"] .oracle,
  body[data-layout="folding"] .oracle { align-items: flex-start; }

  /* ---------- 横卷：左封面（称呼+大标题+金线），右正文 ---------- */
  body[data-layout="scroll"] .stage-inner > .stage-col:first-child {
    align-items: flex-start;
    text-align: left;
  }
  body[data-layout="scroll"] .title-block { align-items: flex-start; margin-bottom: 18px; }
  body[data-layout="scroll"] .card-title {
    font-size: clamp(2.6rem, 4.2vw, 4rem);
    line-height: 1.3;
    text-align: left;
  }
  body[data-layout="scroll"] .title-stroke { width: min(240px, 72%); }

  /* ---------- 屏风：左栏竖排题字，右栏横排正文 ---------- */
  body[data-layout="folding"] .stage-inner > .stage-col:first-child {
    align-items: center;
    text-align: center;
  }
  body[data-layout="folding"] .title-block { align-items: center; margin-bottom: 22px; }
  body[data-layout="folding"] .card-title {
    writing-mode: vertical-rl;
    font-size: clamp(2.3rem, 3.8vw, 3.6rem);
    line-height: 1.42;
    letter-spacing: .3em;
    max-height: min(56vh, 470px);
    margin-top: 6px;
  }
  body[data-layout="folding"] .title-stroke { width: min(180px, 52%); margin-top: 16px; }

  /* 自定义信笺模式：左栏整体退场，信笺占满整幅 */
  body.letter-mode[data-layout="scroll"] .stage-inner,
  body.letter-mode[data-layout="folding"] .stage-inner { max-width: 960px; }
  body.letter-mode[data-layout="scroll"] .stage-inner > .stage-col:first-child,
  body.letter-mode[data-layout="folding"] .stage-inner > .stage-col:first-child { display: none; }
}

/* ============================================================
 * 网红效果大礼包（全部纯本地、有界、可关）
 * ============================================================ */

/* ---------- 简笔涂鸦：标题上方一笔一笔画出来 ---------- */
.doodle {
  width: min(120px, 30vw);
  margin-bottom: 4px;
  overflow: visible;
}
.doodle path {
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.doodle.draw .doodle-star { animation: doodleDraw 1s var(--ease-out) forwards; }
.doodle.draw .doodle-line-l { animation: doodleDraw .7s var(--ease-out) .8s forwards; }
.doodle.draw .doodle-line-r { animation: doodleDraw .7s var(--ease-out) 1.15s forwards; }
@keyframes doodleDraw { to { stroke-dashoffset: 0; } }
body[data-layout="scroll"] .doodle { align-self: flex-start; }

/* ---------- 标题流光烫金：一道金光周期性扫过每个字 ---------- */
body.title-shine .card-title .ch {
  /* 双层背景：上层是来回扫的金光（大部分时间透明），下层始终是主题渐变，
   * 否则扫光走过后字就没了 */
  background-image:
    linear-gradient(115deg,
      transparent 30%,
      rgba(255,243,214,.95) 45%,
      rgba(212,165,90,.9) 50%,
      rgba(255,243,214,.95) 55%,
      transparent 70%),
    var(--grad-title) !important;
  background-size: 260% 100%, 100% 100% !important;
  /* 入场（chIn）先跑完，流光再接管扫光 */
  animation: chIn .65s var(--settle) forwards, goldSweep 3.6s ease-in-out 1.1s infinite;
}
@keyframes goldSweep {
  0%   { background-position: 130% 0, 50% 0; }
  55%  { background-position: -70% 0, 50% 0; }
  100% { background-position: -70% 0, 50% 0; }
}

/* ---------- 开场·刮刮卡 ---------- */
.scratch-card {
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 24px 60px rgba(30, 32, 26, .16);
}
.scratch-under {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 18px;
}
.scratch-to { font-family: var(--font-song); font-size: .95rem; letter-spacing: .3em; color: var(--ink-soft); }
.scratch-to b { color: var(--ink); font-weight: 600; }
.scratch-title {
  font-family: var(--font-song);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--ink);
}
.scratch-sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--ink-faint);
}
.scratch-cv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}
/* 刮刮卡模式：信封/礼盒/底影让位 */
body.open-scratch .env, body.open-scratch .gift, body.open-scratch .open-ground { display: none; }
body.open-scratch .open-hint { margin-top: 26px; }

/* ---------- 开场·拂晓雾 ---------- */
.fog-cv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: grab;
  touch-action: none;
  z-index: 3;
}
body.open-fog .env, body.open-fog .gift, body.open-fog .open-ground { display: none; }
body.open-fog .open-inner > *:not(.fog-cv) { visibility: hidden; }
body.open-fog .open-hint { visibility: visible; margin-top: 26px; }

/* ---------- 开启门槛·滑动解锁 ---------- */
.gate-slider {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 55; /* 盖过开场浮层(50)，被定时门(60)盖住 */
  display: grid;
  place-content: center;
  gap: 18px;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .5s ease;
}
.gate-slider.done { opacity: 0; pointer-events: none; }
.gs-track {
  position: relative;
  width: min(280px, 74vw);
  height: 56px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.gs-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 0;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}
.gs-thumb {
  position: absolute;
  top: 4px; left: 4px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  letter-spacing: -.18em;
  box-shadow: 0 4px 14px rgba(30, 32, 26, .24);
  transition: transform .15s var(--settle);
}
.gs-track:active .gs-thumb { transform: scale(1.06); }
.gs-tip {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink-faint);
}

/* ---------- 收尾互动·拆盲盒皮肤 ---------- */
.blindbox { position: relative; display: none; width: 70px; height: 60px; cursor: inherit; }
body.oracle-box .oracle-cup { display: none; }
body.oracle-box .blindbox { display: block; }
.bb-body {
  position: absolute;
  left: 5px; right: 5px; bottom: 0;
  height: 38px;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 42%, color-mix(in srgb, var(--accent) 55%, #fff) 42%, color-mix(in srgb, var(--accent) 55%, #fff) 58%, transparent 58%),
    linear-gradient(160deg, #f3ecdd, #ddd2ba);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 8px 18px rgba(30,32,26,.16);
}
.bb-lid {
  position: absolute;
  left: 0; right: 0; bottom: 34px;
  height: 15px;
  border-radius: 5px;
  background: linear-gradient(160deg, #f8f2e5, #e6dcc6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 8px rgba(30,32,26,.14);
  transform-origin: 80% 100%;
  transition: transform .45s var(--settle), opacity .4s ease;
  z-index: 2;
}
.bb-q {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  font-family: var(--font-song);
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  opacity: .9;
  transition: transform .45s var(--settle) .1s, opacity .3s ease;
}
.blindbox.shaking { animation: bbWiggle .42s var(--settle); }
@keyframes bbWiggle {
  0%, 100% { transform: rotate(0); }
  22% { transform: rotate(-7deg) translateY(-2px); }
  48% { transform: rotate(6deg); }
  74% { transform: rotate(-4deg) translateY(-1px); }
}
.blindbox.drawn .bb-lid { transform: translateY(-26px) rotate(-14deg); opacity: 0; }
.blindbox.drawn .bb-q { transform: translateX(-50%) translateY(-22px) scale(1.25); opacity: 0; }
/* 盲盒下的彩带碎屑：抽出时撒一点 */
.blindbox.drawn::after {
  content: '';
  position: absolute;
  left: 50%; top: 0;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: -14px -6px 0 var(--accent-2), 13px -10px 0 var(--accent), -6px -16px 0 var(--accent-2), 8px -20px 0 var(--accent);
  animation: bbConfetti .8s var(--ease-out) forwards;
}
@keyframes bbConfetti {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(0, -34px) scale(1.15); }
}

/* ---------- 彩蛋·电子木鱼 ---------- */
.muyu {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.muyu-fish {
  position: relative;
  width: 56px; height: 42px;
  border-radius: 50% 50% 46% 46% / 62% 62% 40% 40%;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(255,255,255,.4), transparent 46%),
    linear-gradient(165deg, #dcb387, #a97d50);
  box-shadow:
    inset 0 -5px 9px rgba(90, 58, 28, .3),
    inset 0 2px 3px rgba(255, 255, 255, .5),
    0 6px 16px rgba(30, 32, 26, .2);
}
/* 鱼口：一道弯月木缝 */
.muyu-fish::before {
  content: '';
  position: absolute;
  left: 50%; top: 46%;
  width: 22px; height: 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(74, 48, 22, .55);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.muyu.hit .muyu-fish { animation: muyuHit .32s var(--settle); }
@keyframes muyuHit {
  0% { transform: scale(1); }
  38% { transform: scale(.88, .8) translateY(2px); }
  100% { transform: scale(1); }
}
.muyu-count {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-faint);
}
.muyu-plus {
  position: absolute;
  left: 50%; top: -6px;
  transform: translateX(-50%);
  font-family: var(--font-song);
  font-size: 13px;
  color: var(--accent);
  pointer-events: none;
  animation: muyuPlus 1s var(--ease-out) forwards;
}
@keyframes muyuPlus {
  0% { opacity: 0; transform: translate(-50%, 4px); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px); }
}

/* ---------- 彩蛋·锦鲤游屏 ---------- */
.koi {
  position: fixed;
  left: 0; top: 0;
  width: 126px; height: 54px;
  color: #d96c4f;
  z-index: 44;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(30, 32, 26, .22));
  will-change: transform;
}
.koi-tail {
  transform-origin: 8% 50%;
  animation: koiTail .5s ease-in-out infinite alternate;
}
@keyframes koiTail {
  from { transform: rotate(-9deg) skewY(2deg); }
  to   { transform: rotate(9deg) skewY(-2deg); }
}
.koi-spark {
  position: fixed;
  width: 5px; height: 5px;
  border-radius: 50%;
  z-index: 43;
  pointer-events: none;
  animation: koiSpark 1s ease-out forwards;
}
@keyframes koiSpark {
  0% { opacity: .95; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx, 0), var(--sy, -14px)) scale(.2); }
}

/* ---------- 彩蛋·屏幕碎裂 ---------- */
.crack {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 70;
  pointer-events: none;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}
.crack path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.crack.show path { animation: crackDraw .38s ease-out forwards; }
.crack.show path:nth-of-type(2) { animation-delay: .12s; }
.crack.bye { opacity: 0; transition: opacity .5s ease; }
@keyframes crackDraw { to { stroke-dashoffset: 0; } }

/* ---------- 彩蛋·表情包雨 ---------- */
.emoji-fall {
  position: fixed;
  top: -9%;
  z-index: 72;
  pointer-events: none;
  line-height: 1;
  animation: emojiFall var(--dur, 3.4s) linear forwards;
}
@keyframes emojiFall {
  0%   { transform: translate(0, 0) rotate(0); }
  28%  { transform: translate(var(--sw, 12px), 30vh) rotate(9deg); }
  60%  { transform: translate(calc(var(--sw, 12px) * -1), 64vh) rotate(-8deg); }
  100% { transform: translate(0, 112vh) rotate(5deg); }
}

/* ---------- 随音乐律动：底部频谱条 ---------- */
.spectrum {
  position: fixed;
  left: 50%; bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(300px, 62vw);
  height: 32px;
  z-index: 30;
  pointer-events: none;
  opacity: .85;
}

/* ---------- 主题专属：霓虹（灯牌辉光 + 跑马灯框） ---------- */
[data-theme="neon"] .card-title .ch {
  background-image: none;
  color: #ffd9ec;
  text-shadow:
    0 0 6px rgba(255, 110, 169, .9),
    0 0 20px rgba(255, 110, 169, .55),
    0 0 46px rgba(70, 227, 255, .3);
  /* 入场（chIn）照常跑完，1 秒后再接管为霓虹频闪 */
  animation: chIn .65s var(--settle) forwards, neonFlicker 4.2s linear 1.1s infinite;
}
@keyframes neonFlicker {
  0%, 100% { opacity: 1; }
  91% { opacity: 1; }
  92% { opacity: .72; }
  93% { opacity: 1; }
  96% { opacity: .86; }
  97% { opacity: 1; }
}
[data-theme="neon"] .stage-inner::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1.5px dashed rgba(255, 110, 169, .4);
  pointer-events: none;
  animation: neonMarquee 2.6s linear infinite;
}
@keyframes neonMarquee {
  0%, 100% { box-shadow: 0 0 10px rgba(255,110,169,.14), inset 0 0 10px rgba(70,227,255,.08); }
  50% { box-shadow: 0 0 22px rgba(255,110,169,.3), inset 0 0 16px rgba(70,227,255,.16); }
}
[data-theme="neon"] .seal { border-color: var(--accent-2); }
[data-theme="neon"] .title-stroke { color: var(--accent-2); }

/* ---------- 主题专属：车票（票面 + 打孔边） ---------- */
[data-theme="ticket"] .stage-inner {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(74, 53, 36, .14);
  position: relative;
}
[data-theme="ticket"] .stage-inner::before,
[data-theme="ticket"] .stage-inner::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-0);
  border: 1px solid var(--hairline-strong);
  transform: translateY(-50%);
}
[data-theme="ticket"] .stage-inner::before { left: -12px; }
[data-theme="ticket"] .stage-inner::after { right: -12px; }
[data-theme="ticket"] .to-line { color: var(--accent); }
[data-theme="ticket"] .card-title { letter-spacing: .2em; }

/* ---------- 主题专属：特刊（头版双线框 + 加重标题） ---------- */
[data-theme="paper"] .stage-inner {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--hairline-strong);
  box-shadow: 0 18px 44px rgba(29, 31, 26, .1);
}
[data-theme="paper"] .stage-inner::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--hairline-strong);
  pointer-events: none;
}
[data-theme="paper"] .card-title {
  font-weight: 800;
  letter-spacing: .16em;
}
[data-theme="paper"] .to-line { color: var(--accent); }
[data-theme="paper"] .orn i { background: var(--accent); height: 1.5px; }

/* ---------- 编辑器：细节开关列表 ---------- */
.switch-list { display: flex; flex-direction: column; gap: 11px; margin-bottom: 24px; }
.switch-list .sw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  letter-spacing: .05em;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 9px 12px;
  margin: -9px -12px;
  border-radius: 10px;
  transition: background .2s ease;
}
.switch-list .sw-row:hover { background: color-mix(in srgb, var(--surface) 62%, transparent); box-shadow: inset 0 0 0 1px var(--hairline); }
.switch-list .sw-row .sw-text { display: flex; align-items: baseline; flex-wrap: wrap; }
.switch-list .sw-row .sw-tip { font-size: 10.5px; color: var(--ink-faint); letter-spacing: .04em; margin-left: 8px; }
/* 开关本体：行内直排（结构同 .switch，省一层嵌套 label） */
.sw-row { position: relative; }
.sw-row > input { position: absolute; opacity: 0; pointer-events: none; }
.sw-row > .slider {
  position: relative;
  display: inline-block;
  flex: none;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: rgba(35, 37, 32, .12);
  transition: background .3s ease;
}
.sw-row > .slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .3s var(--settle);
}
.sw-row > input:checked + .slider { background: var(--accent); }
.sw-row > input:checked + .slider::after { transform: translateX(20px); }
.sw-row > input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 样式页签：大组之间的呼吸分隔线 */
.sub-label.rule {
  border-top: 1px solid var(--hairline);
  padding-top: 24px;
  margin-top: 28px;
}

/* ---------- 品质打磨 ---------- */
/* 文字选区跟随强调色（全站一致的一处小讲究） */
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
/* 单选胶囊：键盘焦点环（radio 本体视觉隐藏） */
.pill:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 预览壳切换/缩放时平滑变形（显示器壳 ↔ 手机壳、窗口缩放） */
.phone {
  transition: width .45s var(--ease-out), height .45s var(--ease-out), border-radius .45s var(--ease-out);
}
.phone iframe { transition: transform .45s var(--ease-out); }
/* 拖拽窗口期间由 editor.js 加上：连续 resize 下不跑过渡（详见 editor.js resize 监听） */
.phone.no-morph, .phone.no-morph iframe { transition: none; }
/* 刮刮卡：硬币刮层光标（自绘 SVG，随系统缩放） */
.scratch-cv {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><circle cx="14" cy="14" r="11" fill="%23e8e2d2" stroke="%23a89a7c" stroke-width="2.4"/><circle cx="14" cy="14" r="6.5" fill="none" stroke="%23c9b99a" stroke-width="1.6"/></svg>') 14 14, crosshair;
}
/* 滑块门槛：圆钮未被拖动前轻轻呼吸，示意可以拖动 */
.gs-thumb { animation: gsPulse 1.9s ease-in-out infinite; }
.gs-track:active .gs-thumb, .gate-slider.dragged .gs-thumb { animation: none; }
@keyframes gsPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(30, 32, 26, .24), 0 0 0 0 color-mix(in srgb, var(--accent) 34%, transparent); }
  50% { box-shadow: 0 4px 14px rgba(30, 32, 26, .24), 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* 刮开的涂层/拂开的雾：完成时整层淡出 */
.scratch-cv.cleared, .fog-cv.cleared {
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
/* 一次性粒子爆发层（金粉/彩带礼炮/解锁烟花） */
.burst-cv {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 65;
  pointer-events: none;
}

/* ============================================================
 * 开启门槛·描红解锁：制作者的笔迹铺成浅底，照着描出来开门
 * ============================================================ */
.gate-trace {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 55; /* 与滑动门槛同层：盖过开场浮层(50)，被定时门(60)盖住 */
  display: grid;
  place-content: center;
  gap: 18px;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .5s ease;
}
.gate-trace.done { opacity: 0; pointer-events: none; }
.gt-pad {
  position: relative;
  width: min(360px, 86vw);
  aspect-ratio: 340 / 110; /* 与录制板同比例，笔迹不变形 */
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 24px 60px rgba(30, 32, 26, .14);
  overflow: hidden;
}
.gt-under, .gt-cv {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.gt-cv { cursor: crosshair; touch-action: none; }
.gt-tip {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink-faint);
}

/* ============================================================
 * 开启门槛·照片拼图：轻触两块交换，拼回完整的照片
 * ============================================================ */
.gate-jigsaw {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 55;
  display: grid;
  place-content: center;
  gap: 18px;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .5s ease;
}
.gate-jigsaw.done { opacity: 0; pointer-events: none; }
.jz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(300px, 76vw);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  outline: 1px solid var(--hairline-strong);
  box-shadow: 0 24px 60px rgba(30, 32, 26, .18);
}
/* 三列无间隙拼满：每块用 background-size 300% 精确取到照片的三分之一 */
.jz-tile {
  background-size: 300% 300%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bg-0) 72%, transparent);
  transition: transform .18s var(--settle), box-shadow .18s ease, filter .2s ease;
}
.jz-tile:hover { filter: brightness(1.06); }
.jz-tile.pick {
  transform: scale(.92);
  box-shadow: inset 0 0 0 2px var(--accent);
  filter: brightness(1.08);
  z-index: 2;
}
.jz-grid.solved .jz-tile {
  cursor: default;
  box-shadow: inset 0 0 0 1px transparent;
  animation: jzPop .45s var(--settle);
}
@keyframes jzPop {
  0% { transform: scale(.94); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.jz-tip {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink-faint);
}

/* ============================================================
 * 开场·许愿天灯：写一句心愿，放一盏灯上天，贺卡才开始
 * ============================================================ */
body.open-wish .env, body.open-wish .gift, body.open-wish .open-ground { display: none; }
body.open-wish .open-hint { visibility: hidden; }
.wish-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(320px, 78vw);
  padding: 26px 22px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 24px 60px rgba(30, 32, 26, .14);
  animation: envFloat 3.4s ease-in-out infinite;
}
.wish-title {
  font-family: var(--font-song);
  font-size: 1.02rem;
  letter-spacing: .2em;
  text-indent: .2em;
  color: var(--ink);
}
.wish-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--bg-0);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  letter-spacing: .06em;
  text-align: center;
}
.wish-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.wish-box .btn { min-width: 140px; }
.wish-skip {
  background: none;
  border: none;
  padding: 4px 6px;
  font: inherit;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink-faint);
  cursor: pointer;
}
.wish-skip:hover { color: var(--ink-soft); }
/* 升空的天灯：主体是暖色灯身，main 那盏载着心愿文字 */
.wish-lantern {
  position: fixed;
  z-index: 52; /* 开场浮层(50)之上：浮层淡出时灯还在升 */
  pointer-events: none;
  animation: wishRise 3.6s linear forwards;
  filter: drop-shadow(0 10px 30px rgba(255, 179, 92, .35));
}
.wish-lantern i {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.32;
  background: linear-gradient(180deg, #ffe7bd, #ffb35c 55%, #c97b3d);
  clip-path: polygon(10% 16%, 50% 0%, 90% 16%, 74% 100%, 26% 100%);
  animation: wishSway 2.4s ease-in-out infinite alternate;
}
.wish-lantern i::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 7%;
  width: 16%; height: 9%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #fff6df;
  box-shadow: 0 0 12px 4px rgba(255, 214, 140, .9);
  animation: wishFlicker 1.1s ease-in-out infinite;
}
.wish-lantern .wl-text {
  position: absolute;
  top: 44%; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  font-family: var(--font-song);
  font-size: 11px;
  letter-spacing: .12em;
  color: #6e4218;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
  box-sizing: border-box;
}
@keyframes wishRise {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  8%   { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateY(-76vh) scale(.8); opacity: 0; }
}
@keyframes wishSway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes wishFlicker { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ============================================================
 * 照片玩法：滤镜 / 刮刮乐涂层 / 双图对比
 * ============================================================ */
/* 老照片：泛黄 + 边缘暗角；黑白：去色提对比 */
.photo.fx-old img,
.fx-old .cmp-img { filter: sepia(.45) saturate(.72) contrast(.94) brightness(1.03); }
.photo.fx-mono img,
.fx-mono .cmp-img { filter: grayscale(1) contrast(1.06); }
.photo.fx-old::after {
  content: '';
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 12px;
  border-radius: 3px;
  background: radial-gradient(120% 120% at 50% 42%, transparent 58%, rgba(60, 42, 20, .2) 100%);
  pointer-events: none;
}
.cmp-box.fx-old::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 6px;
  background: radial-gradient(120% 120% at 50% 42%, transparent 58%, rgba(60, 42, 20, .2) 100%);
  pointer-events: none;
  z-index: 3;
}
/* 刮刮乐涂层：盖在照片上，刮够自动揭走 */
.photo-scratch-cv {
  position: absolute;
  top: 10px; left: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 22px);
  border-radius: 3px;
  touch-action: none;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><circle cx="14" cy="14" r="11" fill="%23e8e2d2" stroke="%23a89a7c" stroke-width="2.4"/><circle cx="14" cy="14" r="6.5" fill="none" stroke="%23c9b99a" stroke-width="1.6"/></svg>') 14 14, crosshair;
}
.photo-scratch-cv.cleared {
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
/* 双图对比：左右两张照片，中间一枚把手，拖动擦开 */
.photo-cmp {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.cmp-box {
  position: relative;
  width: min(320px, 82%);
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #fffdf8;
  box-shadow:
    inset 0 0 0 1px rgba(35, 37, 32, .06),
    0 14px 34px rgba(30, 32, 26, .18);
  cursor: ew-resize;
  touch-action: none;
}
.cmp-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* 上层（前）按把手位置裁开，里层图片始终保持整个盒子的宽度 */
.cmp-top {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 50%;
  overflow: hidden;
}
.cmp-top .cmp-img { width: auto; } /* JS 会按盒宽写死，防止跟随父级收窄 */
.cmp-handle {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  transform: translateX(-1px);
  background: rgba(255, 253, 248, .95);
  box-shadow: 0 0 8px rgba(30, 32, 26, .35);
  pointer-events: none;
  z-index: 2;
}
.cmp-handle i {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 2px 10px rgba(30, 32, 26, .3);
}
.cmp-handle i::before, .cmp-handle i::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 6px; height: 6px;
  border-top: 1.8px solid var(--accent);
  border-right: 1.8px solid var(--accent);
}
.cmp-handle i::before { left: 7px; transform: translateY(-50%) rotate(-135deg); }
.cmp-handle i::after { right: 7px; transform: translateY(-50%) rotate(45deg); }
.cmp-tag {
  position: absolute;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(35, 37, 32, .55);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-indent: .18em;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cmp-tag-l { left: 10px; }
.cmp-tag-r { right: 10px; }
.cmp-tip {
  font-size: 11px;
  letter-spacing: .24em;
  text-indent: .24em;
  color: var(--ink-faint);
}

/* ============================================================
 * 编辑器：引用式回礼提示条 / 照片玩法选项 / 描红录制板
 * ============================================================ */
.quote-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -8px 0 20px;
  padding: 9px 8px 9px 14px;
  border: 1px dashed var(--hairline-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.quote-actions { display: flex; gap: 2px; flex: none; }
.photo-opts { margin-top: 12px; }
.photo-fx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.photo-fx-label {
  flex: none;
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.trace-rec { margin-top: 12px; }

/* ============================================================
 * 兑换码授权：头部状态条 + 兑换弹窗（商业版）
 * ============================================================ */
.lic-chip { letter-spacing: .04em; }
.lic-chip.is-pro { color: var(--accent, #5f7d72); border-color: currentColor; }
.lic-mask {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(30, 28, 24, .42);
  backdrop-filter: blur(4px);
}
.lic-mask[hidden] { display: none; }
.lic-box {
  width: 100%; max-width: 420px;
  background: var(--bg-0, #f8f7f3);
  border: 1px solid rgba(120, 105, 80, .22);
  border-radius: 18px;
  padding: 26px 24px 18px;
  box-shadow: 0 24px 70px rgba(30, 24, 12, .28);
  animation: licIn .22s ease-out;
}
@keyframes licIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lic-box h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: .08em; color: var(--ink, #232520); }
.lic-sub { margin: 0 0 16px; font-size: 12.5px; line-height: 1.7; color: rgba(35, 37, 32, .58); }
.lic-box input {
  width: 100%; padding: 12px 14px;
  font-size: 15px; letter-spacing: .1em; text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace;
  background: #fff; color: var(--ink, #232520);
  border: 1px solid rgba(120, 105, 80, .28); border-radius: 12px;
  outline: none;
}
.lic-box input:focus { border-color: var(--accent, #5f7d72); }
.lic-msg { min-height: 20px; margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: rgba(35, 37, 32, .6); }
.lic-msg.ok { color: var(--accent, #5f7d72); }
.lic-msg.bad { color: #a8453a; }
.lic-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.lic-reset {
  display: block; margin: 14px auto 0; padding: 4px 6px;
  font-size: 11.5px; color: rgba(35, 37, 32, .38);
  background: none; border: 0; cursor: pointer;
}
.lic-reset:hover { color: rgba(35, 37, 32, .62); }
@media (max-width: 430px) {
  .head-actions .lic-chip { font-size: 12px; padding: 8px 10px; }
}

/*
/* ============================================================
 * 步骤导航（上一步 / 下一步）
 * ============================================================ */
.step-nav {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 14px 0 16px;
  border-top: 1px solid var(--line-1, rgba(120, 105, 80, .16));
  background: var(--bg-0, #f8f7f3);
  box-shadow: 0 -12px 20px -12px rgba(35, 30, 20, .18);
  border-radius: 12px 12px 0 0;
}
.step-nav .btn { min-width: 108px; }
.step-nav .btn:disabled { opacity: .38; cursor: not-allowed; }
.step-pos { font-size: 12px; letter-spacing: .1em; white-space: nowrap; color: var(--ink-3, rgba(35, 37, 32, .5)); }
.pane[hidden] { display: none !important; }
@media (max-width: 720px) {
  .step-nav { position: sticky; bottom: 0; background: var(--bg-0, #f8f7f3); padding: 12px 0 14px; z-index: 20; }
  .step-nav .btn { min-width: 92px; }
}

/* 未解锁：寄出页签上锁 */
.tab.is-locked { opacity: .5; }
.tab.is-locked::after {
  content: "\1F512";
  margin-left: 5px;
  font-size: 10px;
  letter-spacing: 0;
}
.tab.is-locked:hover { opacity: .72; }
/* ============================================================================
 * 改版皮肤：印刷风（2026-12）—— 纵向步骤栏 + 硬边墨线 + 朱砂强调
 * 只覆盖变量与关键组件，不改动贺卡播放端（card.html 用 themes.js 自己的配色）
 * ========================================================================== */
:root {
  --bg-0: #f1f0e9;
  --bg-1: #ecebe3;
  --bg-2: #e3e2d9;
  --accent: #c8372c;
  --accent-2: #14140f;
  --grad-title: none;
  --ink: #14140f;
  --ink-soft: rgba(20, 20, 15, .74);
  --ink-faint: rgba(20, 20, 15, .58);
  --hairline: rgba(20, 20, 15, .14);
  --hairline-strong: rgba(20, 20, 15, .42);
  --surface: #ffffff;
  --radius: 4px;
  --shadow-soft: 0 1px 0 rgba(20, 20, 15, .06);
  --shadow-pop: 6px 6px 0 rgba(20, 20, 15, .88);
}
/* 噪点、纸纹、竖排字标：一律退场 */
.noise { display: none; }
.rail { display: none !important; }
body.editor-page .bg { background: var(--bg-0); }

/* ---------- 顶部：压成一条窄横栏 ---------- */
.site-head {
  max-width: 1280px;
  padding: 24px 26px 18px;
  align-items: center;
  border-bottom: 1px solid var(--ink);
}
.site-head h1 {
  font-family: var(--font-hei);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  letter-spacing: .04em;
  line-height: 1;
}
.brand-mark { color: var(--accent); margin-right: 10px; }
.brand:hover .brand-mark { transform: none; }
.brand-mark path { animation: none; stroke-dashoffset: 0; }
.site-head p {
  margin-top: 6px;
  font-size: 11.5px;
  letter-spacing: .2em;
  color: var(--ink-faint);
  text-transform: none;
}
.head-actions { gap: 2px; }
.head-actions .btn {
  padding: 8px 12px;
  font-size: 12.5px;
  letter-spacing: .06em;
  border-color: transparent;
  background: transparent;
}
.head-actions .btn:hover { border-color: var(--ink); background: var(--surface); box-shadow: none; }
.head-actions .lic-chip { border: 1px solid var(--ink); }

/* ---------- 三栏：步骤栏 / 编辑区 / 预览 ---------- */
.editor-main { max-width: 1280px; padding: 22px 26px 64px; }
.editor-cols {
  grid-template-columns: 196px minmax(0, 1fr) auto;
  gap: 34px;
  align-items: start;
}
.step-rail {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 16px 14px 14px;
  border-radius: 4px;
  background: var(--ink);
  color: #f1f0e9;
  box-shadow: 5px 5px 0 rgba(200, 55, 44, .9);
}
.tabs {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
}
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: rgba(241, 240, 233, .58);
  font-family: var(--font-hei);
  font-size: 13px;
  letter-spacing: .1em;
  text-align: left;
  transition: color .2s ease, background .2s ease;
}
.tab:hover { color: #f1f0e9; background: rgba(241, 240, 233, .07); }
.tab:active { transform: none; }
.tab-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px; height: 19px;
  margin: 0;
  border: 1px solid rgba(241, 240, 233, .3);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0;
  color: inherit;
  flex: none;
}
.tab-label { flex: 1; }
.tab-tick {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 1px;
  background: transparent;
}
.tab.p-active {
  background: #f1f0e9;
  color: var(--ink);
  font-weight: 700;
  border: 0;
  box-shadow: none;
}
.tab.p-active .tab-no {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab.p-active .tab-tick { background: var(--accent); }
.tab.is-locked { opacity: .38; }
.tab.is-locked::after {
  content: "\1F512";
  margin-left: 2px;
  font-size: 10px;
  letter-spacing: 0;
}

/* 步骤导航住进左栏底部 */
.step-nav {
  position: static;
  display: block;
  margin: 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid rgba(241, 240, 233, .24);
  border-radius: 0;
  background: none;
  box-shadow: none;
  gap: 0;
}
.step-pos {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: rgba(241, 240, 233, .5);
  text-align: left;
}
.step-btns { display: flex; gap: 6px; }
.step-btns .btn {
  flex: 1;
  min-width: 0;
  padding: 9px 8px;
  font-size: 12.5px;
  letter-spacing: .04em;
}
.step-btns .btn:disabled { opacity: .3; }
.step-rail .btn-ghost {
  border: 1px solid rgba(241, 240, 233, .32);
  background: transparent;
  color: #f1f0e9;
  box-shadow: none;
}
.step-rail .btn-ghost:hover {
  border-color: #f1f0e9;
  background: rgba(241, 240, 233, .1);
  color: #fff;
  transform: none;
  box-shadow: none;
}
.step-rail .btn-primary {
  border: 1px solid #f1f0e9;
  background: #f1f0e9;
  color: var(--ink);
  box-shadow: none;
}
.step-rail .btn-primary:hover {
  background: #fff;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
.step-rail .btn-primary:disabled { background: transparent; color: rgba(241, 240, 233, .3); border-color: rgba(241, 240, 233, .18); }

/* ---------- 表单：直角、墨线、无柔光 ---------- */
.pane-head { margin-bottom: 22px; }
.pane-head h3 {
  font-family: var(--font-hei);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: .02em;
  padding-left: 11px;
  border-left: 3px solid var(--accent);
  line-height: 1.2;
}
.pane-head p { font-size: 12px; letter-spacing: .1em; color: var(--ink-faint); margin-top: 8px; padding-left: 14px; }
.sub-label {
  margin: 24px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--hairline);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--ink);
}
.sub-tip { font-weight: 400; letter-spacing: .04em; color: var(--ink-faint); }
.field > label { font-size: 12px; letter-spacing: .14em; color: var(--ink-faint); }
.field input[type="text"], .field textarea, .link-box input {
  border: 1px solid var(--hairline-strong);
  border-radius: 2px;
  padding: 12px 13px;
  box-shadow: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(200, 55, 44, .16);
}
.btn { box-shadow: none; }
.btn:hover { transform: none; border-color: var(--ink); box-shadow: 3px 3px 0 rgba(20, 20, 15, .16); }
.btn-primary { background: var(--ink); color: #f1f0e9; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 预览：手机壳拆掉，改成一张带硬投影的纸卡 ---------- */
.preview-col { position: sticky; top: 20px; align-items: flex-end; }
.preview-bar { max-width: 100%; margin-bottom: 10px; justify-content: flex-end; }
.preview-cap { letter-spacing: .16em; }
.phone:not(.monitor) {
  width: 377px; height: 742px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: 9px 9px 0 rgba(20, 20, 15, .82);
  overflow: hidden;
}
.phone:not(.monitor)::before, .phone:not(.monitor)::after { content: none; }
.phone:not(.monitor) .phone-notch { display: none; }
.phone:not(.monitor) iframe { width: 375px; height: 740px; border-radius: 5px; }
/* 预览卡上方加一条极细的“装订线” */
.preview-col .preview-bar .btn { font-size: 11.5px; padding: 7px 10px; }

/* ---------- 响应式：窄屏把步骤栏翻成一条横向条 ---------- */
@media (max-width: 1180px) {
  .editor-cols { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .step-rail {
    position: static;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    box-shadow: 3px 3px 0 rgba(200, 55, 44, .9);
  }
  .tabs { flex-direction: row; margin: 0; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { width: auto; flex: none; padding: 8px 12px; }
  .tab-label { flex: none; }
  .tab-tick { display: none; }
  .step-nav { margin: 0; padding: 0; border: 0; flex: none; }
  .step-pos { display: none; }
  .step-btns { gap: 6px; }
  .step-btns .btn { min-width: 74px; padding: 8px 10px; }
  .preview-col { align-items: center; }
  .preview-bar { justify-content: center; }
}
@media (max-width: 720px) {
  .editor-main { padding: 16px 16px 48px; }
  .site-head { padding: 18px 16px 14px; }
  .step-btns .btn { min-width: 66px; font-size: 12px; }
}

/* ============================================================================
 * 改版细节对齐：卡片、胶囊、寄出通道全部走方角墨线
 * ========================================================================== */
.tpl-card {
  border-radius: 3px;
  border-color: rgba(20, 20, 15, .22);
  transition: transform .2s var(--ease-out), border-color .2s ease, box-shadow .2s ease;
}
.tpl-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 rgba(20, 20, 15, .16);
}
.tpl-sw, .tpl-sw canvas { border-radius: 2px; }
.tpl-badge { border-radius: 2px; letter-spacing: .12em; }

.send-item {
  border-radius: 3px;
  border-color: rgba(20, 20, 15, .2);
}
.send-item:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(200, 55, 44, .22);
}
.send-item input[type="text"] { border-radius: 2px; border-color: var(--hairline-strong); }
.send-item input[type="text"]:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(200, 55, 44, .16); }
.link-box input { border-radius: 2px; border-color: var(--hairline-strong); }

.pill span {
  border-radius: 3px;
  border-color: rgba(20, 20, 15, .2);
  font-size: 13px;
  letter-spacing: .04em;
}
.pill input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: #f1f0e9;
  box-shadow: none;
}
.pill span:hover { border-color: var(--ink); }

/* 内容列限宽：单栏时表单不至于拉成一整屏 */
.tab-panes { max-width: 800px; }

/* 未解锁的寄出页签：换成可读的中文标记 */
.tab.is-locked::after {
  content: "未解锁";
  margin-left: 2px;
  padding: 1px 5px;
  border: 1px solid rgba(241, 240, 233, .34);
  border-radius: 2px;
  font-family: var(--font-hei);
  font-size: 9.5px;
  letter-spacing: .08em;
  color: rgba(241, 240, 233, .72);
}
.step-btns .btn:disabled { opacity: .45; }

/* 窄屏：步骤栏竖排回来，四个页签铺成一行 */
@media (max-width: 720px) {
  .step-rail { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    overflow: visible;
    width: 100%;
  }
  .tab {
    justify-content: center;
    gap: 5px;
    padding: 9px 4px;
    font-size: 12px;
    letter-spacing: .04em;
  }
  .tab-no { width: 16px; height: 16px; font-size: 9.5px; }
  .tab.is-locked::after { content: "锁"; }
  .step-nav {
    padding-top: 10px;
    border-top: 1px solid rgba(241, 240, 233, .2);
  }
  .step-pos { display: block; margin-bottom: 8px; }
  .step-btns .btn { padding: 9px 10px; }
}
