/* ============================================================
   拍拍 · 浅色主题（v15）
   设计基准：微信 / 支付宝 / iOS 分组页的通用浅色体系
   - 页面底 70%：极浅灰 #F2F3F7；卡片：纯白 + 轻投影
   - 文字：标题 #1F1F28 / 正文 #5C6070 / 辅助 #75798B，不用纯黑
   - 品牌色（紫）只用于按钮、强调、选中态，不做大面积底色
   - 所有文字/底色组合满足 WCAG ≥ 4.5:1（正文）
   ============================================================ */
:root {
  --bg: #F2F3F7;
  --card: #FFFFFF;
  --card-soft: #F7F8FC;
  --ink: #1F1F28;          /* 标题近黑 */
  --ink-soft: #5C6070;     /* 正文，白底 6.5:1 */
  --ink-faint: #6B6F80;    /* 辅助小字，白底 5:1 */
  --line: #E4E6EF;         /* 分割线 */
  --line-strong: #D5D9E6;  /* 输入框/按钮描边 */
  --brand: #7C4DFF;        /* 品牌紫（描边/强调） */
  --brand-deep: #6438E8;   /* 品牌深紫（按钮底，白字 6:1；作文字 6.3:1） */
  --brick: #B45309;        /* 拍砖金（深琥珀，白底文字 5:1） */
  --brick-border: #D97706; /* 拍砖金描边（装饰用） */
  --brick-soft: #FFF4E6;   /* 金色浅底 */
  --brick-bright: #92400E; /* 金底上的深字 */
  --praise: #047857;       /* 表扬绿（白底文字 5.2:1） */
  --praise-soft: #E7F6EF;
  --danger: #DC2626;
  --ok: #15803D;
  --live: #E11D48;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(17, 24, 39, 0.08);
  --shadow-pop: 0 12px 36px rgba(17, 24, 39, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }

.step { display: none; animation: fadein .35s ease; }
.step.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }

/* ---------- 顶部按钮条（首页"退出" / 子页面统一"← 返回"） ---------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}
.topbar-btn {
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.topbar-btn:hover { background: var(--card-soft); }
.topbar-btn:active { background: var(--line); }

/* ---------- Hero / 模式 ---------- */
.hero { text-align: center; padding: 14px 8px 12px; }
.logo {
  display: inline-block; font-weight: 800; font-size: 22px; letter-spacing: 2px;
  background: linear-gradient(135deg, #7C4DFF, #A855F7); color: #fff;
  padding: 6px 16px; border-radius: 999px; margin-bottom: 8px;
}
.hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; color: var(--ink); }
.hero .hl { color: var(--brand-deep); }
.lead { font-size: 16px; color: var(--ink-soft); font-weight: 600; }
.sub { font-size: 12px; color: var(--ink-faint); margin-top: 8px; }

.mode-cards { display: grid; gap: 14px; margin: 24px 0 18px; }
.mode-card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 22px; cursor: pointer; transition: .18s; box-shadow: var(--shadow);
}
.mode-card:hover { transform: translateY(-2px); }
.mode-card.brick:hover { border-color: var(--brick-border); }
.mode-card.praise:hover { border-color: var(--praise); }
.mode-emoji { font-size: 40px; margin-bottom: 8px; }
.mode-card h2 { font-size: 22px; margin-bottom: 4px; color: var(--ink); }
.mode-card p { color: var(--ink-soft); font-size: 14px; margin-bottom: 10px; }

.fineprint { font-size: 11px; color: var(--ink-faint); text-align: center; }

/* 首页底部备案号（合规要求）。内容由服务端注入，见 app.py 的 _icp_html()。
   样式刻意做得极轻，避免抢首页视觉；链接指向工信部备案系统。 */
.site-icp { font-size: 11px; color: var(--ink-faint); text-align: center; margin-top: 10px; line-height: 1.5; }
.site-icp a { color: var(--ink-faint); text-decoration: none; }
.site-icp a:hover { text-decoration: underline; }

/* ---------- 步骤标题 ---------- */
.step-title { font-size: 22px; font-weight: 800; margin: 10px 0 4px; color: var(--ink); }
.step-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }

/* ---------- 上传 ---------- */
.upload-box {
  background: var(--card); border: 2px dashed var(--line-strong); border-radius: var(--radius);
  min-height: 260px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; position: relative; text-align: center;
}
.upload-hint { padding: 20px; }
.upload-hint p { color: var(--ink-soft); font-size: 14px; }
.upload-note { font-size: 12px; margin-top: 6px; color: var(--ink-faint); }

/* 人脸框引导：未上传时显示虚线圆 + 头像剪影，提示用户把脸放进圆圈里 */
.face-guide {
  width: 130px; height: 130px; border-radius: 50%;
  border: 2.5px dashed var(--brick-border);
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 16px;
  background: radial-gradient(circle at center, #FFFFFF 0%, #F2EFE9 100%);
  position: relative;
}
.face-guide::before {
  /* 内圈虚线，强化"把脸放这里"的视觉引导 */
  content: ""; position: absolute; inset: 12px;
  border: 1px dashed rgba(0,0,0,.18); border-radius: 50%;
}
.face-icon { font-size: 60px; opacity: .55; line-height: 1; }

/* 选中照片后：上传框变圆形，强制脸居中 */
.upload-box.has-photo {
  width: 240px; height: 240px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--brick-border);
}
.upload-box.has-photo #photo-preview { border-radius: 50%; }
.upload-box.has-photo::after {
  content: "✓ 已就位"; position: absolute; top: 6px; right: 6px;
  background: var(--brick-border); color: #4A3200; font-size: 12px;
  padding: 3px 10px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
#photo-preview { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.consent { margin: 16px 0; }

/* ---------- 按钮 ---------- */
.btn-row { display: flex; gap: 12px; margin-top: 20px; }
.btn {
  flex: 1; padding: 14px 18px; border: none; border-radius: 14px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: .15s; font-family: inherit;
}
.btn.primary { background: var(--brand-deep); color: #fff; }
.btn.primary:disabled {
  background: var(--brand-deep);
  color: rgba(255,255,255,.75);
  border: 1.5px solid rgba(255,255,255,.35);
  cursor: not-allowed;
  opacity: .55;
}
.btn.ghost { background: var(--card); color: var(--ink-soft); border: 1.5px solid var(--line-strong); }
.btn.ghost:disabled {
  background: var(--card-soft);
  color: #A2A6B5;
  border: 1.5px dashed var(--line-strong);
  cursor: not-allowed;
  opacity: .9;
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:disabled {
  background: #FDECEC;
  color: var(--danger);
  border: 1.5px dashed rgba(220,38,38,.4);
  cursor: not-allowed;
  opacity: .7;
}
.btn:hover:not(:disabled) { opacity: .9; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 20px; }
.field > label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.field input[type=text] {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line-strong); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: var(--card); color: var(--ink);
}
.field input::placeholder { color: #A2A6B5; }
.field input:focus { outline: none; border-color: var(--brand); }
.custom-input { margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--card); cursor: pointer; font-size: 14px; transition: .15s; user-select: none;
  color: var(--ink);
}
.chip.selected { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }
/* 方言锁：免费版只开放普通话，其余方言需激活码解锁。
   只降透明度 + 加锁标记，不改颜色。 */
.chip.locked { opacity: .45; }
.chip.locked::after { content: " 🔒"; font-size: 11px; }

/* ---------- 解锁提示条（免费版 / 方言锁） ----------
   设计约束：
     ① 醒目但不跳脱：金/紫渐变浅底 + 深字，白底可读；
     ② 必须在文档流内 —— 不用 fixed 悬浮；
     ③ 深色文字压浅金底，对比度达标。 */
.lock-note {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(217, 119, 6, .45);
  background: linear-gradient(135deg, #FFF7E0, #F3EDFF);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: lockNoteIn .38s ease both;
}
@keyframes lockNoteIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

/* 缓慢扫过的一道柔光：足够让人注意到，但不闪烁、不打断阅读（约 4 秒一轮） */
.lock-note::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: lockSweep 4.2s ease-in-out 1.2s infinite;
  pointer-events: none;
}
@keyframes lockSweep {
  0%        { left: -60%; }
  55%, 100% { left: 120%; }
}

.lock-note-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 19px; line-height: 1;
  background: rgba(217, 119, 6, .14);
  border: 1px solid rgba(217, 119, 6, .35);
  animation: lockPulse 2.6s ease-in-out infinite;
}
@keyframes lockPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .25); }
  50%      { box-shadow: 0 0 0 7px rgba(217, 119, 6, 0); }
}

/* 已解锁态：绿色调 —— 同一条提示栏的"完成时"版本，让「已解锁」用户也能
   看到状态（而不是一片空白，被误认为旧版/功能缺失）。 */
.lock-note.unlocked {
  border-color: rgba(22, 130, 90, .45);
  background: linear-gradient(135deg, #E9F9F0, #EAF3FF);
}
.lock-note.unlocked .lock-note-icon {
  background: rgba(22, 130, 90, .12);
  border-color: rgba(22, 130, 90, .35);
  animation: none;
}
.lock-note.unlocked::after { animation: none; }   /* 完成态不扫光，保持安静 */

.lock-note-body { flex: 1 1 auto; min-width: 0; }
.lock-note-title { font-size: 13.5px; font-weight: 700; line-height: 1.45; color: var(--ink); }
.lock-note-title .em { color: var(--brick); }
.lock-note-sub { font-size: 12px; line-height: 1.5; color: var(--ink-soft); margin-top: 2px; }

.lock-note-cta {
  flex: 0 0 auto;
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700;
  color: #4a3200;                       /* 浅金底：显式深色字 */
  background: linear-gradient(135deg, #FFD966, #FFC93C);
  padding: 9px 14px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(217, 119, 6, .25);
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.lock-note-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(217, 119, 6, .38); }
.lock-note-cta:active { transform: translateY(0) scale(.97); }

/* 窄屏放不下时按钮整行铺开，避免文字被挤成两行、边缘参差 */
@media (max-width: 380px) {
  .lock-note { flex-wrap: wrap; }
  .lock-note-cta { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .lock-note, .lock-note::after, .lock-note-icon { animation: none !important; }
}

.level-cards { display: grid; gap: 10px; }
.level-card {
  padding: 14px 16px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--card); cursor: pointer; transition: .15s;
}
.level-card .lv-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.level-card .lv-desc { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
/* 选中态统一：白底 + 品牌色粗边 + 深色文字 */
.level-card.selected { border-color: var(--brand-deep); background: var(--card); }
.level-card.hot.selected { border-color: var(--danger); background: #FFF7F7; }

.warn {
  background: var(--brick-soft); color: #92400E; padding: 10px 12px; border-radius: 10px;
  font-size: 12px; margin-top: 8px; border: 1px solid rgba(217,119,6,.28);
}

/* ---------- 冷静页 ---------- */
.calm-box { text-align: center; padding: 40px 16px; }
.calm-box h2 { font-size: 24px; margin-bottom: 14px; color: var(--ink); }
.calm-box p { color: var(--ink-soft); margin-bottom: 10px; }
.calm-sub { font-size: 14px; }
.countdown { font-size: 72px; font-weight: 800; color: var(--brand-deep); margin: 20px 0; }
.calm-note { font-size: 14px; margin-top: 16px; color: var(--ink-faint); }

/* ---------- 内容较少的页面（乱拍/正经拍二级页、冷静页）：内容垂直居中，
   消除"返回按钮以下一大片空白"的头重脚轻观感 ---------- */
#step-chaos.active, #step-focus.active, #step-calm.active {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 60px - env(safe-area-inset-bottom));
  min-height: calc(100dvh - 60px - env(safe-area-inset-bottom));
}
#step-chaos.active > .step-title,
#step-focus.active > .step-title,
#step-calm.active > .calm-box { margin-top: auto; }
#step-chaos.active::after,
#step-focus.active::after,
#step-calm.active::after { content: ""; margin-top: auto; }

/* ---------- 怼脸体验（一屏自适应：顶栏 + 视频 + 进度/停止按钮始终同屏可见） ---------- */
#step-experience.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 60px - env(safe-area-inset-bottom));   /* 60px = #app 上下内边距 */
  height: calc(100dvh - 60px - env(safe-area-inset-bottom));  /* 支持 dvh 的浏览器用动态视口 */
}
.video-stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.video-frame {
  position: relative; width: 100%; max-width: 400px; max-height: 100%; aspect-ratio: 9 / 16; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; box-shadow: var(--shadow);
}
#exp-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kenburns {
  position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.55) 100%);
  animation: kb 18s ease-in-out infinite alternate;
}
@keyframes kb { from { transform: scale(1.02); } to { transform: scale(1.16) translate(1.5%, -1.5%); } }
.vignette { position: absolute; inset: 0; pointer-events: none; }

/* 活照片：呼吸式缩放 + 微转头 + 上下浮动（默认动态效果） */
#exp-photo.alive {
  animation: alive-breathe 3.6s ease-in-out infinite;
  transform-origin: 50% 44%;
  will-change: transform;
}
@keyframes alive-breathe {
  0%, 100% { transform: scale(1.0) rotate(0deg) translateY(0); }
  50% { transform: scale(1.035) rotate(0.6deg) translateY(-3px); }
}
/* 数字人视频（铺满画面） */
.avatar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 配音生成中遮罩（音画同步：就绪后画面与声音同时开始）——盖在照片上，深色遮罩保留 */
.exp-loading {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55);
}
.exp-loading-inner { color: #fff; font-size: 15px; letter-spacing: 1px; animation: exp-pulse 1.2s ease-in-out infinite; }
@keyframes exp-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* 自动播放被拦截时的「点击开始播放」兜底层——盖在照片上，深色遮罩保留 */
.tap-play {
  position: absolute; inset: 0; z-index: 31;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .6); cursor: pointer;
}
.tap-play-inner { text-align: center; color: #fff; padding: 20px; }
.tap-play-icon { font-size: 46px; margin-bottom: 10px; animation: tap-bounce 1.4s ease-in-out infinite; }
.tap-play-text { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.tap-play-sub { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 6px; }
@keyframes tap-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* 水印条：自带深色底，压在照片或白底上都可读 */
.watermark-bar {
  position: absolute; top: 0; left: 0; right: 0; padding: 8px 10px; font-size: 14px;
  color: rgba(255,255,255,.92); background: rgba(0,0,0,.45); text-align: center; letter-spacing: .5px;
  z-index: 5;
}
/* 字幕条：自带深色底白字，压在照片或白底上都可读 */
.subtitle {
  position: absolute; bottom: 60px; left: 16px; right: 16px; padding: 14px 16px;
  background: rgba(20,20,28,.72); color: #fff; font-size: 17px; border-radius: 12px;
  min-height: 56px; display: flex; align-items: center; justify-content: center; text-align: center;
  transition: opacity .25s;
}
.exp-controls { max-width: 400px; margin: 14px auto 0; flex-shrink: 0; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
#exp-progress-fill { display: block; height: 100%; width: 0; background: var(--brand-deep); transition: width .3s; }
.exp-meta { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.exp-controls .btn { max-width: 200px; }

/* ---------- 复盘 ---------- */
.review-step {
  background: var(--card); border-radius: var(--radius); padding: 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.review-step h3 { font-size: 17px; margin-bottom: 2px; color: var(--ink); }
.review-step .rs-sub { font-size: 12px; color: var(--ink-faint); margin-bottom: 12px; }
.review-step .rs-body { font-size: 14px; color: var(--ink); margin-bottom: 14px; }
.tip {
  background: #EAF3FF; border-left: 3px solid #3B82F6; padding: 10px 12px;
  border-radius: 8px; font-size: 12px; color: #1D4ED8; margin-top: 12px;
}
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* 选项药丸：白底深字；选中紫底白字 */
.opt {
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--card); cursor: pointer; font-size: 13px; color: var(--ink);
}
.opt.selected { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }
textarea.rs-text {
  width: 100%; min-height: 80px; padding: 12px; border: 1.5px solid var(--line-strong);
  border-radius: 12px; font-size: 14px; font-family: inherit; resize: vertical;
  background: var(--card); color: var(--ink);
}
.rec-btn { margin-top: 10px; }
.btn-sm { padding: 10px 16px; border: none; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-sm.rec { background: var(--danger); color: #fff; }
.btn-sm.rec.stop { background: #4B5563; }
.btn-sm.ghost { background: var(--card); color: var(--ink-soft); border: 1.5px solid var(--line-strong); }
.audio-replay { margin-top: 10px; }

.line-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px;
  font-size: 14px; background: var(--card); color: var(--ink);
}
.line-item .badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; margin-right: 6px; font-weight: 700; }
.badge.fact { background: var(--praise-soft); color: var(--praise); }
.badge.view { background: var(--brick-soft); color: #92400E; }
.badge.exagg { background: #FDECEC; color: #B91C1C; }

/* ---------- 结束 ---------- */
.end-box { text-align: center; padding: 40px 8px; }
.end-box h2 { font-size: 26px; margin-bottom: 12px; color: var(--ink); }
.end-box p { color: var(--ink-soft); margin-bottom: 20px; }
.growth { text-align: left; background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 20px; }
.growth .g-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.growth .g-row.cur { color: var(--brand-deep); font-weight: 700; }
.export-note { font-size: 14px; color: var(--ink-soft); margin-top: 14px; line-height: 1.6; }

/* ---------- 信封动效（生成完成时揭幕仪式，自带红底，保持不变） ---------- */
.envelope-overlay {
  position: fixed; inset: 0; background: rgba(15, 15, 25, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.envelope-overlay.open { opacity: 1; pointer-events: auto; }
.envelope {
  width: 260px; height: 180px; position: relative;
  transform: translateY(40px) scale(.9); opacity: 0;
  transition: transform .5s cubic-bezier(.18,.89,.32,1.28), opacity .35s;
}
.envelope-overlay.open .envelope { transform: translateY(0) scale(1); opacity: 1; }
.envelope-body {
  position: absolute; left: 0; right: 0; bottom: 0; height: 130px;
  background: linear-gradient(180deg, #d63a3a 0%, #b62424 100%);
  border-radius: 8px; box-shadow: var(--shadow-pop);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 1px;
}
.envelope-body::before {
  /* 信封左边纹理（装饰） */
  content: ""; position: absolute; left: 16px; top: 50%;
  width: 28px; height: 2px; background: rgba(255,255,255,.25);
  box-shadow: 0 -8px 0 rgba(255,255,255,.25), 0 8px 0 rgba(255,255,255,.25);
}
.envelope-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 70px;
  background: #e84747;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center; transition: transform .6s ease;
  z-index: 2;
}
.envelope-overlay.revealed .envelope-flap { transform: rotateX(180deg); }
.envelope-text {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center;
  color: #fff; font-size: 18px; font-weight: 800;
  opacity: 0; transition: opacity .4s .4s; pointer-events: none;
}
.envelope-overlay.revealed .envelope-text { opacity: 1; }
.envelope-sub {
  position: absolute; left: 0; right: 0; top: 55%; text-align: center;
  color: rgba(255,255,255,.85); font-size: 13px; opacity: 0;
  transition: opacity .4s .6s; pointer-events: none;
}
.envelope-overlay.revealed .envelope-sub { opacity: 1; }

/* ---------- 分享引导卡片 ---------- */
.share-card {
  position: fixed; left: 50%; bottom: -100%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 420px;
  background: var(--card); border-radius: var(--radius);
  padding: 22px 20px 16px; box-shadow: var(--shadow-pop);
  z-index: 180; transition: bottom .45s cubic-bezier(.18,.89,.32,1.28);
  text-align: center;
}
.share-card.open { bottom: 16px; }
.share-emoji { font-size: 36px; margin-bottom: 4px; }
.share-title { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.share-desc { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.5; }
.share-text {
  width: 100%; min-height: 64px; padding: 10px 12px; font-size: 13px;
  border: 1.5px dashed var(--brick-border); border-radius: 10px;
  background: var(--card-soft); color: var(--ink); resize: none;
  font-family: inherit; line-height: 1.5; margin-bottom: 10px;
}
.share-actions { display: flex; gap: 8px; justify-content: center; }
.share-actions .btn { padding: 10px 16px; font-size: 14px; flex: 1; }
.share-tip { font-size: 11px; color: var(--ink-faint); margin-top: 10px; }

/* ---------- 我的拍拍历史 ---------- */
.streak-bar {
  background: linear-gradient(135deg, #FFF5E0, #FFE6F0);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(217,119,6,.18);
}
.streak-bar .streak-emoji { font-size: 28px; }
.streak-bar .streak-text { font-size: 13px; color: #4A3B2A; line-height: 1.5; }
.streak-bar .streak-text b { color: #B45309; font-size: 16px; }
.history-actions {
  display: flex; gap: 6px; margin-bottom: 16px;
  flex-wrap: wrap; justify-content: center;
}
.history-actions .btn { padding: 8px 12px; font-size: 12px; flex: 1; min-width: 90px; }
.history-actions .file-btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
  position: relative;
}
.history-item .hi-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-faint); margin-bottom: 6px;
}
.history-item .hi-mode {
  font-weight: 700; font-size: 13px;
}
/* 模式标签色与全局语义色统一：拍砖=金、拍马屁=表扬绿（同 --praise） */
.history-item .hi-mode.critique { color: var(--brick); }
.history-item .hi-mode.praise { color: var(--praise); }
.history-item .hi-meta { font-size: 11px; color: var(--ink-faint); }
.history-item .hi-lines { font-size: 13px; color: var(--ink); line-height: 1.5; }
.history-item .hi-del {
  position: absolute; top: 8px; right: 8px; background: transparent;
  border: none; color: var(--ink-faint); font-size: 14px; cursor: pointer;
  padding: 2px 6px; opacity: .8;
}
.history-item .hi-del:hover { color: var(--danger); opacity: 1; }
.history-empty {
  text-align: center; color: var(--ink-soft); padding: 40px 20px;
  font-size: 14px; line-height: 1.7;
}

/* ---------- 情绪周报 ---------- */
.weekly-link {
  display: inline-block;
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .15s;
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
}
.weekly-link:hover, .weekly-link:active { color: var(--brand-deep); }

.report-modal {
  position: fixed; inset: 0; background: rgba(15,15,25,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 220; opacity: 0; pointer-events: none; transition: opacity .3s;
  padding: 20px;
}
.report-modal.open { opacity: 1; pointer-events: auto; }
.report-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 24px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: var(--shadow-pop);
  animation: reportPop .35s cubic-bezier(.18,.89,.32,1.28);
  color: var(--ink);
}
@keyframes reportPop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.report-emoji { font-size: 48px; margin-bottom: 6px; }
.report-title { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.report-range { font-size: 12px; color: var(--ink-faint); margin-bottom: 16px; }
.report-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px;
}
.report-stats .stat {
  background: var(--card-soft); border-radius: 12px; padding: 12px 8px;
}
.report-stats .stat-num { font-size: 24px; font-weight: 800; color: var(--brand-deep); }
.report-stats .stat-label { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.report-quote {
  background: var(--brick-soft); border-left: 3px solid var(--brick-border);
  padding: 10px 12px; text-align: left; font-size: 13px;
  border-radius: 0 8px 8px 0; margin: 12px 0; line-height: 1.5;
  color: #6B4A12;
}
.report-quote .quote-label { font-size: 11px; color: var(--ink-faint); margin-bottom: 4px; }
.report-summary {
  font-size: 13px; color: var(--ink); line-height: 1.6;
  background: var(--card-soft); padding: 10px 12px; border-radius: 10px;
}

/* ---------- 台词编辑 ---------- */
.edit-line {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
}
.edit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.edit-del { background: transparent; border: none; color: var(--ink-faint); font-size: 15px; cursor: pointer; padding: 2px 6px; }
.edit-del:hover { color: var(--danger); }
.edit-text {
  width: 100%; min-height: 60px; padding: 10px 12px; border: 1.5px solid var(--line-strong);
  border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical;
  background: var(--card-soft); color: var(--ink);
}
.edit-text:focus { outline: none; border-color: var(--brand); background: var(--card); }
.edit-add {
  width: 100%; padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 12px;
  background: transparent; color: var(--brand-deep); font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.edit-add:hover { border-color: var(--brand); }

/* ---------- 动态效果选择 ---------- */
.fx-field { margin: 22px 0 8px; padding-top: 18px; border-top: 1px dashed var(--line-strong); }
.fx-field > label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.fx-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-card {
  border: 2px solid var(--line); border-radius: 14px; padding: 14px 12px;
  background: var(--card); cursor: pointer; transition: .15s;
}
.fx-card .fx-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.fx-card .fx-desc { font-size: 11px; color: var(--ink-soft); line-height: 1.45; }
/* 选中态统一：白底 + 品牌色粗边 + 深色文字 */
.fx-card.selected { border-color: var(--brand-deep); background: var(--card); }
.fx-card.selected .fx-name { color: var(--brand-deep); }

.mode-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px; color: var(--ink-faint); font-size: 12px;
}
.mode-divider::before, .mode-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mode-divider span { white-space: nowrap; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(31,31,40,.92); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .3s; z-index: 999; max-width: 90%;
}
#toast.show { opacity: 1; }

/* ---------- 首页大卡片 ---------- */
/* 首页 footer（免责+链接+备案号）吸底：内容不足一屏时把余量分摊掉，
   而不是让备案号下面拖一截突兀的空。内容超高时自动退化成正常流。
   分摊规则（弹性，双向安全）：
   - 卡片与卡间距都有 min（矮屏compact）和 max（高屏舒展）两端约束
   - 矮屏：长不到上限，保持卡 74 / 间距 14，绝不把 footer 顶出屏幕
   - 高屏：先长卡片（最多 120），再长间距（最多约 30），剩余才交给底部 */
#step-mode.active {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 32px - env(safe-area-inset-bottom));
}
#step-mode .fineprint { margin-top: auto; padding-top: 10px; }
.home-buttons {
  display: flex; flex-direction: column; gap: 14px; justify-content: space-between;
  margin: 18px 0 14px;
  flex: 1 1 auto; max-height: 440px;
}
.home-btn {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 14px 22px; border: none; border-radius: 999px; cursor: pointer;
  text-align: left; font-family: inherit; transition: transform .12s;
  box-shadow: var(--shadow); min-height: 74px;
  flex: 1 1 auto; max-height: 120px;
}
.home-btn:active { transform: scale(.97); }
/* 乱拍：白底 + 橙→粉渐变描边（渐变彩底上白字达不到 4.5:1，
   统一改白卡深字，与正经拍卡片一致，品牌色留在描边和图标上） */
.home-btn.chaos {
  background: linear-gradient(var(--card), var(--card)) padding-box,
              linear-gradient(135deg, #FF7A2F, #FF4D6D) border-box;
  border: 2.5px solid transparent;
  color: var(--ink);
}
.home-btn.focus { background: var(--card); color: var(--ink); border: 2.5px solid var(--line); }
.home-icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.home-body { flex: 1; }
.home-title { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.home-desc { font-size: 13px; margin-top: 2px; }
.home-btn.chaos .home-desc,
.home-btn.focus .home-desc { color: var(--ink-soft); }

/* LIVE 红点（呼吸循环） */
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(225,29,72,.5); flex-shrink: 0;
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225,29,72,.5); }
  70% { box-shadow: 0 0 0 8px rgba(225,29,72,0); }
  100% { box-shadow: 0 0 0 0 rgba(225,29,72,0); }
}

/* ---------- 乱拍播放页 ---------- */
.chaos-stage {
  display: flex; flex-direction: column; align-items: center;
  min-height: 70vh; padding: 16px 4px 24px; text-align: center;
}
.chaos-top { width: 100%; margin-bottom: 24px; }
.chaos-live { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chaos-live-text { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: .5px; }
.chaos-persona {
  font-size: 13px; color: var(--ink-soft);
  background: #ECEEF5; padding: 6px 14px; border-radius: 999px; display: inline-block;
}

/* 台词气泡：白底深字 */
.bubble {
  position: relative; width: 100%; max-width: 360px;
  background: var(--card); color: var(--ink); border-radius: 24px;
  padding: 28px 24px; margin: 12px 0 4px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.bubble::after {
  content: ""; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 14px solid var(--card);
}
.bubble-text { font-size: 24px; line-height: 1.6; font-weight: 700; word-break: break-word; }
.bubble-sign { font-size: 13px; color: var(--ink-faint); margin-top: 12px; }

/* 音波条（5 根，错峰跳动，仅播放中） */
.soundwave { display: flex; align-items: flex-end; gap: 4px; height: 32px; margin: 20px 0 6px; }
.soundwave span {
  width: 5px; height: 8px; border-radius: 3px; background: #B9A8F5;
  transition: height .2s;
}
.soundwave.playing span { animation: wave 1s ease-in-out infinite; }
.soundwave.playing span:nth-child(1) { animation-delay: 0s; }
.soundwave.playing span:nth-child(2) { animation-delay: .15s; }
.soundwave.playing span:nth-child(3) { animation-delay: .3s; }
.soundwave.playing span:nth-child(4) { animation-delay: .45s; }
.soundwave.playing span:nth-child(5) { animation-delay: .6s; }
@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 30px; }
}

.chaos-loading { font-size: 14px; color: var(--ink-soft); margin: 16px 0; }

.chaos-controls { display: flex; align-items: center; gap: 20px; margin-top: 16px; }
.chaos-play-btn {
  width: 76px; height: 76px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand-deep); color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: var(--shadow); transition: transform .12s; flex-shrink: 0;
}
.chaos-play-btn:active { transform: scale(.94); }
.chaos-back-btn {
  padding: 12px 16px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--card); color: var(--ink-soft); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.chaos-back-btn:active { transform: scale(.96); background: var(--card-soft); }

/* 播放被系统拦截时的「点击继续」遮罩（全屏，点任意处续播） */
.chaos-tap {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,15,25,.5); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chaos-tap.hidden { display: none; }
.chaos-tap-inner {
  padding: 18px 34px; border-radius: 999px; background: var(--card); color: var(--ink);
  font-size: 17px; font-weight: 800; box-shadow: var(--shadow-pop);
}

/* ---------- 热线链接 ---------- */
.hotline-link { color: var(--brick); font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* 尊重 reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .live-dot, .soundwave.playing span { animation: none; }
}

/* ---------- 肖像授权：状态 + 弹窗 ---------- */
.consent-status {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  background: var(--card-soft); border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 13px; color: var(--ink-soft);
  margin-bottom: 10px;
}
.consent-status .consent-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  flex-shrink: 0;
}
.consent-status.done { border-color: rgba(21,128,61,.45); color: var(--ok); }
.consent-status.done .consent-dot { background: var(--ok); }
#btn-consent { width: 100%; }

.modal { display: none; position: fixed; inset: 0; z-index: 100; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,15,25,0.5); }
.modal-card {
  position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--card); color: var(--ink); border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(24px + env(safe-area-inset-bottom)); animation: slideup .28s ease;
  box-shadow: var(--shadow-pop);
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 19px; font-weight: 800; margin-bottom: 8px; color: var(--ink); }
.modal-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; line-height: 1.7; }
.modal-sub b { color: var(--brick); }

.consent-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.consent-opt {
  background: var(--card-soft); border: 2px solid var(--line); border-radius: 16px;
  padding: 16px 12px; cursor: pointer; text-align: left; color: var(--ink);
  transition: .15s; font-family: inherit;
}
.consent-opt.self:hover { border-color: var(--ok); }
.consent-opt.other:hover { border-color: var(--brick-border); }
.opt-emoji { font-size: 30px; margin-bottom: 6px; }
.opt-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.opt-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

.consent-detail { margin-top: 16px; }
.detail-box {
  background: var(--card-soft); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 14px; font-size: 13px; line-height: 1.8; color: var(--ink-soft);
}
.detail-box b { color: var(--ink); }
.detail-warn { color: var(--brick); margin: 10px 0; }
.detail-note { font-size: 12px; color: var(--ink-faint); }

/* ---------- 全程 AI 角标（乱拍/语音合成页） ---------- */
.ai-badge {
  display: inline-block; font-size: 13px; padding: 5px 12px; border-radius: 999px;
  background: var(--card-soft); border: 1px solid var(--line-strong); color: var(--ink-soft);
  letter-spacing: .5px; margin: 8px 0 4px;
}

/* ---------- 隐私政策入口 + 内容 ---------- */
.privacy-entry { text-align: center; margin-top: 8px; }
.privacy-link { color: var(--brand-deep); font-size: 12px; text-decoration: underline; cursor: pointer; }
.privacy-body { font-size: 13px; color: var(--ink-soft); line-height: 1.8; }
.privacy-body p { margin-bottom: 8px; }
.privacy-body ul { padding-left: 18px; }
.privacy-body li { margin-bottom: 6px; }
.privacy-body b { color: var(--ink); }
