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

:root {
  --bg: #F6F1E8;
  --card: #FFFFFF;
  --field: #F3EDE1;
  --line: #E6DAC3;
  --text: #3E2C1C;
  --sub: #8A7863;
  --gold: #C8A24E;
  --gold-2: #B8893B;
  --brown: #46331F;
  --accent: #C8A24E;
  --btn-a: #C8A24E;
  --btn-b: #B8893B;
  /* 标准化状态色：成功 / 失败 / 排队 / 上传中 / 过期 */
  --ok: #2E9E5B;
  --err: #D9534F;
  --pending: #8A7863;
  --upload: #3E9CC9;
  --muted: #A89884;
  /* 卡片柔和投影 */
  --shadow: 0 10px 26px rgba(120, 90, 40, .12);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image: repeating-linear-gradient(135deg, rgba(200,162,78,.05) 0 2px, transparent 2px 46px);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.page { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 18px 16px 32px; }

.hidden { display: none !important; }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 40px 28px; box-shadow: var(--shadow); }
.logo-box {
  width: 64px; height: 64px; background: var(--brown); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.logo-box span { color: var(--gold); font-size: 32px; font-weight: 900; }
.login-title { text-align: center; font-size: 24px; letter-spacing: 2px; color: var(--text); margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--gold-2); font-size: 13px; margin-bottom: 26px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.field input {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 13px 14px; font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--btn-a); }

.login-msg { margin-top: 14px; text-align: center; font-size: 13px; color: var(--err); min-height: 18px; }

/* ===== 按钮 ===== */
.btn-primary {
  position: relative; overflow: hidden;
  border: none; cursor: pointer; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  font-weight: 700; font-size: 16px; padding: 14px 20px; width: 100%;
}
.btn-primary.busy { background: #D8C9A8; }
.btn-progress {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(255,255,255,.35);
}
.btn-progress.done { background: var(--ok); }
#btnLabel { position: relative; z-index: 1; }
.brand-line { text-align: center; color: var(--sub); font-size: 13px; margin-top: 14px; }
.btn-primary.lg { padding: 16px 20px; font-size: 17px; }
.btn-primary:active { opacity: .88; transform: scale(.985); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary.busy:disabled { opacity: 1; }
.btn-primary.busy-green { background: var(--ok); color: #ffffff; }
.btn-primary.busy-green:disabled { opacity: 1; cursor: default; }
/* 生成主按钮：空闲可点时金色暖光呼吸；变绿生成中 / 置灰不可点自动停闪 */
@keyframes btnGlow {
  0%, 100% { border-color: rgba(200,162,78,.95); box-shadow: 0 0 0 0 rgba(200,162,78,.45); }
  50% { border-color: rgba(200,162,78,.35); box-shadow: 0 0 0 9px rgba(200,162,78,0); }
}
#runBtn:not(.busy-green):not(:disabled) {
  border: 1.5px solid rgba(200,162,78,.95);
  animation: btnGlow 1.4s ease-in-out infinite;
}

/* ===== 顶栏 ===== */
.topbar { position:relative; margin: 4px 0 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: 1px; display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1 1 100%; width: 100%; }
.topbar-title { color: var(--text); font-weight: 800; letter-spacing: 1px; line-height: 1.2; }
.topbar-rule { width: 120px; height: 2px; border: none; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.topbar-slogan { font-size: 12px; font-weight: 700; color: var(--gold-2); letter-spacing: 1px; }

/* ===== 预览 ===== */
.preview-card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  min-height: 380px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.preview-empty { text-align: center; color: var(--sub); }
.ph-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--field);
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--btn-b);
}
.preview-video { width: 100%; height: 100%; max-height: 460px; object-fit: contain; }
.preview-dur {
  position: absolute; right: 14px; bottom: 12px; background: rgba(30,20,10,.6);
  border-radius: 8px; padding: 3px 10px; font-size: 12px; color: #fff;
}

/* ===== 标签 ===== */
.tags { display: flex; gap: 10px; margin: 14px 0 4px; }
.tag {
  background: rgba(200,162,78,.16); color: var(--brown); border-radius: 14px;
  padding: 7px 14px; font-size: 13px;
}

/* ===== 分区 ===== */
.block { margin-top: 22px; }
.block-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.block-title em { font-style: normal; font-weight: 400; color: var(--sub); font-size: 12px; margin-left: 6px; }

.textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); padding: 14px; font-size: 15px; line-height: 1.6; resize: none; outline: none;
  font-family: inherit;
}
.textarea:focus { border-color: var(--btn-a); }
.textarea-small { font-size: 12.5px; line-height: 1.55; padding: 10px 26px 10px 12px; min-height: 150px; overflow-y: auto; scrollbar-width: none; }
.textarea-small::-webkit-scrollbar { display: none; }
.script-scroll { position: relative; }
.sb-track { position: absolute; right: 6px; top: 10px; bottom: 10px; width: 16px; border-radius: 9px; background: rgba(30,20,10,.10); }
.sb-thumb { position: absolute; left: 2px; right: 2px; border-radius: 9px; background: rgba(30,20,10,.55); min-height: 72px; cursor: grab; touch-action: none; }
.sb-track.hidden { display: none; }

/* ===== 卡片墙 ===== */
.card-wall { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.card-wall::-webkit-scrollbar { display: none; }

.card {
  position: relative; flex: 0 0 auto; width: 104px; height: 156px; border-radius: 14px;
  background: var(--field); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card.square { height: 104px; }
.card video, .card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.card .audio-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--sub); font-size: 13px; text-align: center;
  background: linear-gradient(135deg, #EFE6D3, #E2D5BA);
}
.card .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.card .play.clickable { pointer-events: auto; cursor: pointer; z-index: 4; }
.card .play::after {
  content: ""; border-left: 15px solid var(--brown); border-top: 9px solid transparent;
  border-bottom: 9px solid transparent; margin-left: 4px;
}
.card .play.is-playing { background: var(--gold); }
/* 播放中：三角切换为暂停双竖杠，再点暂停回到三角 */
.card .play.is-playing::after {
  border: none; margin-left: 0; width: 16px; height: 20px;
  background: linear-gradient(90deg, var(--brown) 0 5px, transparent 5px 11px, var(--brown) 11px 16px);
}
.card .name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 8px;
  background: linear-gradient(to top, rgba(30,20,10,.8), transparent);
  color: #fff; font-size: 12px; text-align: center;
}
.card .remove {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(30,20,10,.6); color: #fff; border: none; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3;
}
.card .use-badge {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  background: rgba(58,46,30,.82); color: #F6E8C8;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 9px;
}
/* 已使用并消耗的底片：灰色占位卡，不可点选、不可删除 */
.card.used-deleted { background: #ECE7DC; border: 1px dashed #C9BFA8; box-shadow: none; }
.card.used-deleted .used-deleted-ph {
  position: absolute; left: 10px; right: 10px; top: 22px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: #9A8F78; font-size: 12px; font-weight: 700; line-height: 1.5;
}
.card.used-deleted .name { background: none; color: #9A8F78; padding: 8px; bottom: 6px; }
.card-video-overlay {
  position: absolute; inset: 0; z-index: 6; background: #000; border-radius: inherit;
}
.card-video-overlay video { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-video-overlay .ov-close {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(30,20,10,.6); color: #fff; border: none; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 7;
}

.add-card {
  flex: 0 0 auto; width: 104px; height: 156px; border-radius: 14px; border: 1.5px dashed var(--gold);
  background: var(--card); color: var(--sub); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.add-card.square { height: 104px; }
.add-card .plus {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brown); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 300;
}
.add-card span { font-size: 12px; color: var(--brown); font-weight: 700; }

/* 卡片上传状态遮罩 */
.card-mask {
  position: absolute; inset: 0; background: rgba(30,20,10,.45);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; text-align: center; padding: 4px; z-index: 2;
  pointer-events: none;
}
/* 上传中：边框+光晕呼吸脉动；完成/失败卡片不带 is-uploading，动画自动停止 */
@keyframes uploadPulse {
  0%, 100% { border-color: rgba(62,156,201,.9); box-shadow: 0 0 0 0 rgba(62,156,201,.35); }
  50% { border-color: rgba(62,156,201,.3); box-shadow: 0 0 0 7px rgba(62,156,201,0); }
}
.card.is-uploading { border: 1.5px solid var(--upload); animation: uploadPulse 1.4s ease-in-out infinite; }
.card.is-uploading .card-mask { background: rgba(62,156,201,.18); }
.card.is-error { border: 1.5px solid var(--err); }
.card-mask.err { color: #E88A87; }
.card-badge {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 2;
  background: rgba(30,20,10,.72); color: var(--gold); font-size: 11px; line-height: 1.3;
  text-align: center; padding: 5px 6px; border-radius: 8px;
}

/* ===== 店铺素材分类分组 ===== */
.mat-cat { margin-bottom: 18px; }
.mat-cat-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 8px; }
.mat-cat-label { font-size: 14px; font-weight: 800; color: var(--text); }
.mat-cat-count { font-size: 12px; color: var(--sub); }
/* 每组一行三张，竖长卡，与真人素材墙同款 */
.mat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; overflow: visible; padding-bottom: 6px; }
.mat-grid .card, .mat-grid .add-card { width: 100%; flex: none; height: 156px; }

/* ===== 语音条 ===== */
.voice-thumb {
  flex: 0 0 auto; width: 72px; height: 72px; border-radius: 12px;
  object-fit: cover; background: var(--field); display: block;
}
.voice-bar {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
}
.voice-play {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--btn-a); color: #fff; font-size: 15px; cursor: pointer;
}
.voice-time { flex: 0 0 auto; font-size: 14px; color: var(--text); min-width: 84px; }
.voice-progress { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.voice-progress-in { height: 100%; width: 0; background: var(--btn-a); border-radius: 3px; }
.voice-remove {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: none;
  background: var(--line); color: var(--text); font-size: 16px; cursor: pointer;
}

/* ===== 状态 ===== */
.status-box {
  margin-top: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; font-size: 14px; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 12px;
}
.status-box.ok { color: var(--ok); }
.status-box.err {
  color: var(--err); background: rgba(217,83,79,.08); border: 1px solid rgba(217,83,79,.3);
}
.status-box.err .status-ic {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(217,83,79,.18); color: var(--err);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; margin-top: 1px;
}
.status-box.err strong { color: var(--err); font-weight: 700; }
.status-box .link { display: inline-block; margin-top: 10px; color: var(--btn-b); }

/* ===== 底部操作 ===== */
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 26px; }
.action-hint { flex: 0 1 auto; max-width: 38%; color: var(--sub); font-size: 11px; line-height: 1.35; }
.action-row .btn-primary { flex: 1 1 auto; }
.balance-line { width: 100%; text-align: center; margin-top: 10px; }

/* 生成按钮 + 点数余额（成片列表下方） */
.gen-block { margin-top: 20px; }
.gen-block .btn-primary { width: 100%; }

/* ===== 客服微信入口与弹窗 ===== */
.ghost-line { margin-top: 12px; text-align: center; }
.ghost-link {
  border: 1.5px solid var(--upload); background: rgba(62,156,201,.1);
  color: var(--upload); border-radius: 12px; padding: 10px 22px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  animation: uploadPulse 1.4s ease-in-out infinite;
}
.cs-line { width: 100%; text-align: center; margin-top: 10px; }
.cs-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 10px 26px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.modal-mask {
  position: fixed; inset: 0; background: rgba(30,20,10,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  position: relative; background: #fff; border-radius: 20px; padding: 22px;
  width: 100%; max-width: 320px; text-align: center;
}
.modal-close {
  position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border: none;
  background: #eee; border-radius: 50%; font-size: 18px; color: #333; cursor: pointer; line-height: 1;
}
.modal-qr { width: 100%; max-width: 260px; aspect-ratio: 1 / 1; object-fit: contain; display: block; margin: 0 auto; }
.confirm-msg { font-size: 16px; font-weight: 600; color: var(--brown); margin-bottom: 22px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 12px; }
.confirm-btn { flex: 1; padding: 12px 0; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.confirm-btn.cancel { background: #F0EBE0; color: var(--sub); }
.confirm-btn.ok { background: var(--gold); color: #fff; }

/* ===== 看视频领点弹窗 ===== */
.reward-card { max-width: 340px; padding: 20px 18px; }
.reward-close { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; border: none; background: #F0EBE0; border-radius: 50%; font-size: 18px; color: var(--sub); cursor: pointer; line-height: 1; }
.reward-title { font-size: 18px; font-weight: 800; color: var(--brown); margin-bottom: 14px; }
.reward-video { width: 100%; aspect-ratio: 9 / 16; max-height: 52vh; background: #000; border-radius: 14px; object-fit: contain; display: block; }
.reward-tip { margin-top: 12px; font-size: 13px; color: var(--sub); line-height: 1.5; }

/* ===== 批量成片结果墙 ===== */
.result-wall { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.result-wall::-webkit-scrollbar { display: none; }
.result-card { position: relative; flex: 0 0 calc((100% - 10px) / 2); min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
/* 排队中 / 生成中：与素材上传中同一套蓝色呼吸脉动，出片后自动停闪 */
.result-card.is-pending { border-color: var(--upload); animation: uploadPulse 1.4s ease-in-out infinite; }
.r-cover { position: relative; z-index: 0; aspect-ratio: 3 / 4; background: #2A2118; }
.r-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%; background: rgba(30,20,10,.45);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; pointer-events: auto; z-index: 10;
}
.r-cover img, .r-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.r-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 24px; }
.r-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 10px 2px; font-size: 14px; font-weight: 700; color: var(--text); }
.r-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-body { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 44px 10px 10px; font-size: 12px; color: var(--pending); min-height: 30px; }
.r-body-main { min-width: 0; }
.r-dl {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  background: var(--btn-a); color: #fff; font-weight: 700; font-size: 11px;
  padding: 4px 9px; border-radius: 999px; text-decoration: none; white-space: nowrap;
}
.result-card.err .r-body { color: var(--err); }
.result-card.expired .r-body { color: var(--muted); }
.result-card.expired .r-ph { color: var(--muted); }
.r-del {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(30,20,10,.72); color: #fff; border: 1px solid rgba(255,255,255,.35);
  font-size: 19px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ===== 成片全选 / 批量下载 ===== */
.result-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; width: 100%; }
.r-select-all { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 16px; cursor: pointer; }
.r-select-all input { width: 20px; height: 20px; accent-color: var(--btn-a); }
.r-dl-btn.active { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #fff; }
.r-toolbar-tip { color: var(--sub); font-size: 12px; width: 100%; text-align: right; }
.r-check {
  position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid rgba(30,20,10,.35); background: rgba(30,20,10,.6); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
  z-index: 15; cursor: pointer;
}
.result-card.on { border-color: var(--btn-a); }
.result-card.on .r-check { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); border-color: var(--btn-a); color: #fff; }
.r-check.disabled { opacity: .28; pointer-events: none; }

/* ===== 顶栏：余额 / 后台入口 ===== */
.topbar-right { position:absolute; right:0; top:50%; transform:translateY(-50%); display: flex; align-items: center; gap: 10px; }
.balance-box { font-size: 13px; font-weight: 700; color: var(--gold-2); }
.admin-entry {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ===== 管理员后台 ===== */
body.admin-mode .block:not(#adminView) { display: none !important; }
.admin-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.admin-panel h3 { font-size: 14px; margin: 0 0 10px; color: var(--text); }
.admin-form { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-form input {
  flex: 1 1 45%; min-width: 130px; background: var(--field); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px;
}
.btn-primary.sm, .btn-sm {
  border: none; border-radius: 10px; padding: 10px 14px; font-size: 13px;
  font-weight: 700; cursor: pointer; background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  color: #fff;
}
.btn-sm { background: var(--field); color: var(--text); padding: 7px 10px; }
.link-btn { border: none; background: none; color: var(--btn-b); font-size: 13px; cursor: pointer; margin-left: 8px; }
.admin-table { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.admin-row-info { min-width: 0; }
.au-name { font-size: 14px; font-weight: 700; color: var(--text); }
.au-sub { font-size: 12px; color: var(--sub); margin-top: 3px; }
.admin-row-ops { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ===== 口播稿克隆（AI 仿写）===== */
.block-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.block-title-row .block-title { margin-bottom: 0; }

.fold-head { cursor: pointer; }
.fold-head-right { display: flex; align-items: center; gap: 10px; }
.fold-summary { font-size: 12px; font-weight: 700; color: var(--gold-2); }
.material-fold:not(.collapsed) .fold-summary { display: none; }
.fold-toggle { display: inline-flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.fold-toggle .fold-arrow { font-size: 12px; }
.material-fold.collapsed .fold-body { display: none; }
.block-sub { margin-top: 18px; }
.fold-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fold-check input { width: 20px; height: 20px; accent-color: var(--btn-a); }
.fold-check .block-title { margin-bottom: 0; }

/* 外层大分类：素材库 A-J（默认收起，点击标题栏展开/收起） */
.big-lib-fold {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.big-lib-fold .block-title { font-weight: 800; font-size: 16px; }
.big-lib-fold .fold-body { padding-top: 14px; }
.big-lib-fold .fold-body > .block { margin-top: 0; }
.big-lib-fold .fold-body > .block + .block { margin-top: 16px; }
.rewrite-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.rewrite-btn {
  white-space: normal; text-align: center; line-height: 1.4; padding: 9px 12px;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #fff;
}
.rewrite-btn:disabled {
  background: #E53935; color: #FFFFFF; opacity: 1; cursor: not-allowed;
}
.rewrite-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.rewrite-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; gap: 14px; align-items: center; cursor: pointer;
}
.rewrite-item.on { border-color: var(--btn-a); background: rgba(200,162,78,.08); }
.rewrite-check {
  width: 66px; height: 66px; border-radius: 50%; flex: none; margin-left: auto;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: transparent;
}
.rewrite-check.on {
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  border-color: transparent; color: #fff;
}
.rewrite-body { flex: 1; min-width: 0; }
.rewrite-text { font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.rewrite-text[contenteditable="true"] { outline: none; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
.rewrite-text[contenteditable="true"]:focus { background: rgba(200,162,78,.1); }
.rewrite-tag { font-size: 12px; font-weight: 700; color: var(--btn-b); margin-bottom: 6px; letter-spacing: .5px; }
.rewrite-tip { font-size: 12px; color: var(--sub); padding: 4px 2px; }
.rewrite-tip.err { color: var(--err); }

/* ===== 店铺语音口述录音模块 ===== */
.vn-card { background: var(--field); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px; box-shadow: var(--shadow); }
.vn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.vn-icon { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.vn-title { font-size: 17px; font-weight: 800; color: var(--text); flex: 1 1 auto; }
.vn-tag { font-size: 12px; font-weight: 700; color: var(--gold-2); background: rgba(200,162,78,.16); border-radius: 999px; padding: 5px 12px; }
.vn-desc { font-size: 13px; color: var(--sub); line-height: 1.6; margin-bottom: 16px; }

.vn-rec { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.vn-rec-dot { position: relative; width: 64px; height: 64px; border-radius: 50%; border: none; cursor: pointer; background: linear-gradient(135deg, var(--gold), var(--gold-2)); flex: none; display: flex; align-items: center; justify-content: center; }
.vn-rec-dot span { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: block; }
.vn-rec-dot.recording { background: linear-gradient(135deg, #D9534F, #B23A37); }
.vn-rec-dot.recording span { border-radius: 6px; width: 18px; height: 18px; }
.vn-rec-info { min-width: 0; }
.vn-timer { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.vn-tip { font-size: 13px; color: var(--text); margin-top: 4px; }
.vn-tip-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }

.vn-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.vn-btn { flex: 1 1 auto; border-radius: 14px; padding: 13px 16px; font-size: 15px; font-weight: 700; cursor: pointer; border: 1px solid transparent; }
.vn-btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; }
.vn-btn.ghost { background: var(--card); border-color: var(--line); color: var(--text); }
.vn-btn:disabled { opacity: .45; cursor: not-allowed; }

.vn-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.vn-item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.vn-item-top { display: flex; align-items: center; gap: 12px; }
.vn-play { flex: none; width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--field); color: var(--brown); font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.vn-play.is-playing { background: var(--gold); color: #fff; }
.vn-wave { flex: 1 1 auto; display: flex; align-items: center; gap: 3px; height: 24px; }
.vn-wave i { display: block; width: 3px; border-radius: 2px; background: var(--gold); height: 8px; }
.vn-dur { font-size: 14px; color: var(--text); font-weight: 700; flex: none; min-width: 48px; text-align: right; }
.vn-op { flex: none; font-size: 13px; font-weight: 700; cursor: pointer; background: none; border: none; }
.vn-op.again { color: var(--text); }
.vn-op.del { color: var(--err); }
.vn-text { margin-top: 8px; font-size: 12px; color: var(--sub); line-height: 1.5; }
.vn-text b { color: var(--gold-2); font-weight: 700; }
.vn-empty { text-align: center; color: var(--sub); font-size: 13px; padding: 10px 0; }

.vn-extract-row { margin-bottom: 14px; }
.vn-extract-row .vn-btn { width: 100%; }

.vn-profile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.vn-profile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vn-profile-title { font-weight: 800; color: var(--brown); font-size: 15px; }
.vn-profile-empty { font-size: 12px; color: var(--sub); }
.vn-profile-grid { display: flex; flex-direction: column; gap: 12px; }
.vn-pf-row { display: flex; flex-direction: column; gap: 5px; }
.vn-pf-cap { font-size: 12px; font-weight: 700; color: var(--gold-2); }
.vn-pf-input { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 14px; color: var(--text); box-sizing: border-box; }
.vn-pf-input:focus { outline: none; border-color: var(--gold); }
.vn-pf-area { resize: vertical; min-height: 320px; line-height: 1.6; font-family: inherit; }
.vn-profile-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.vn-profile-actions .vn-btn { flex: 0 0 auto; padding: 11px 20px; }
.vn-profile-saved { font-size: 13px; font-weight: 700; color: var(--gold-2); }

.vn-foot { background: rgba(200,162,78,.12); border: 1px solid rgba(200,162,78,.25); border-radius: 14px; padding: 12px 14px; font-size: 12px; color: var(--gold-2); line-height: 1.6; }

/* ===== 录音配音区 ===== */
.record-block { margin-top: 22px; }
.record-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.record-btn {
  background: var(--card); border: 1.5px solid var(--gold); color: var(--brown);
  border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.record-btn.recording { background: var(--err); border-color: var(--err); color: #fff; }
.record-timer { font-size: 15px; font-weight: 700; color: var(--sub); font-variant-numeric: tabular-nums; }
.record-wall { display: flex; flex-direction: column; gap: 10px; }
.record-item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.record-info { flex: 1 1 auto; min-width: 0; }
.record-name { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.record-play {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--field); color: var(--brown); font-size: 14px; cursor: pointer; flex: 0 0 auto;
}
.record-play.is-playing { background: var(--gold); border-color: var(--gold); color: #fff; }
.record-play:disabled { opacity: .5; cursor: not-allowed; }
.record-del {
  background: none; border: 1px solid var(--line); color: var(--sub); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; cursor: pointer; flex: 0 0 auto;
}
.record-del:active { opacity: .8; }

.record-row { flex-wrap: wrap; }
.record-btn.file { background: var(--gold); border-color: var(--gold); color: #fff; }
.record-btn.file:active { opacity: .9; }

/* 声音匹配素材库：一行三个、左右横滑 */
.voice-lib-wall { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.voice-lib-wall::-webkit-scrollbar { display: none; }
.voice-lib-card {
  flex: 0 0 calc((100% - 20px) / 3); min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.voice-lib-card.off { opacity: .55; }
.vc-check-row { display: flex; align-items: center; gap: 6px; }
.vc-check { width: 18px; height: 18px; accent-color: var(--gold); flex: 0 0 auto; }
.vc-name { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.3; word-break: break-all; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vc-meta { font-size: 11px; color: var(--sub); }
.vc-ops { display: flex; align-items: center; gap: 8px; }
.vc-play { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--field); color: var(--brown); font-size: 12px; cursor: pointer; flex: 0 0 auto; }
.vc-play.is-playing { background: var(--gold); border-color: var(--gold); color: #fff; }
.vc-play:disabled { opacity: .5; cursor: not-allowed; }
.vc-del { background: none; border: 1px solid var(--line); color: var(--sub); border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; }
