/* 童小宝配音 /peiyin
   两条硬要求决定了这里的写法：
   1) 这套样式要同时跑在 PC 和移动端（页面 display=both），所以不用固定 px 排版，
      全部用 clamp + 百分比，390px 到 1440px 之间都不该出现横向滚动条。
   2) 片段要贴进 LightSNS 的自定义页面里，外层还有主站的 header/footer 和它自己的
      .card / .btn 之类通用类名，所以所有选择器都收在 .txb-dub 下面。 */

.txb-dub {
  --dub-ink: #2b1d12;
  --dub-dim: #8a7561;
  --dub-line: #efe3d4;
  --dub-brand: #ff7a3d;
  --dub-brand-d: #e8621f;
  --dub-bg: #fffaf4;
  --dub-warm: #fff1e2;
  --dub-ok: #3f9b62;
  --dub-bad: #d9534f;

  max-width: 760px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 34px) clamp(10px, 3vw, 20px) 48px;
  color: var(--dub-ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

.txb-dub *,
.txb-dub *::before,
.txb-dub *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------- 头部 */
.txb-dub .dub-head {
  text-align: center;
  padding: clamp(6px, 2vw, 18px) 0 clamp(14px, 3vw, 22px);
}

.txb-dub .dub-ava {
  width: clamp(104px, 26vw, 150px);
  height: clamp(104px, 26vw, 150px);
  margin: 0 auto clamp(10px, 2vw, 16px);
  border-radius: 50%;
  overflow: hidden;
  background: var(--dub-warm);
  box-shadow: 0 10px 28px rgba(255, 122, 61, .22), 0 0 0 5px #fff, 0 0 0 7px #ffe6d2;
  animation: dub-breathe 3.6s ease-in-out infinite;
}

.txb-dub .dub-ava img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes dub-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.015); }
}

@media (prefers-reduced-motion: reduce) {
  .txb-dub .dub-ava { animation: none; }
}

.txb-dub h1.dub-title {
  margin: 0 0 6px;
  font-size: clamp(21px, 5.2vw, 27px);
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.3;
  color: var(--dub-ink);
}

.txb-dub .dub-sub {
  margin: 0;
  font-size: clamp(12.5px, 3.2vw, 14px);
  color: var(--dub-dim);
  line-height: 1.7;
}

/* ---------------------------------------------------------------- 价格小字 */
.txb-dub .dub-note {
  margin: -6px 0 clamp(12px, 2.5vw, 16px);
  text-align: center;
  font-size: clamp(11.5px, 2.9vw, 12.5px);
  line-height: 1.7;
  color: #a3907e;
}

/* 两段各自成块，窄屏换行时不会把「字」孤零零甩到第二行 */
.txb-dub .dub-note span { display: inline-block; }
.txb-dub .dub-note span + span::before { content: '·'; margin: 0 6px; color: #c9b6a3; }
.txb-dub .dub-note b { color: var(--dub-brand-d); font-weight: 700; }

/* ---------------------------------------------------------------- 主卡片 */
.txb-dub .dub-card {
  border: 1px solid var(--dub-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(180, 140, 100, .09);
  overflow: hidden;
}

.txb-dub .dub-tags {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: clamp(10px, 2.5vw, 14px);
  background: var(--dub-bg);
  border-bottom: 1px solid var(--dub-line);
}

.txb-dub .dub-tag {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 9px 2px;
  border: 1px solid #f0ddc9;
  border-radius: 10px;
  background: #fff;
  color: #6b523c;
  font-size: clamp(12.5px, 3.2vw, 13.5px);
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}

.txb-dub .dub-tag:hover { border-color: var(--dub-brand); color: var(--dub-brand-d); background: #fff8f2; }
.txb-dub .dub-tag:active { transform: scale(.94); }

.txb-dub .dub-tag.on {
  background: var(--dub-brand);
  border-color: var(--dub-brand);
  color: #fff;
}

.txb-dub .dub-ta {
  display: block;
  width: 100%;
  min-height: clamp(150px, 30vw, 200px);
  margin: 0;
  padding: clamp(12px, 3vw, 16px);
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: vertical;
  background: #fff;
  color: var(--dub-ink);
  font-family: inherit;
  font-size: clamp(14px, 3.6vw, 15.5px);
  line-height: 1.85;
  -webkit-appearance: none;
}

.txb-dub .dub-ta::placeholder { color: #bfae9c; }

/* 底部一行：左统计、右按钮。窄屏自动折成两行 */
.txb-dub .dub-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: clamp(10px, 2.5vw, 13px) clamp(12px, 3vw, 16px);
  border-top: 1px solid var(--dub-line);
  background: var(--dub-bg);
}

.txb-dub .dub-stat {
  flex: 1 1 190px;
  min-width: 0;
  font-size: clamp(12px, 3vw, 12.8px);
  color: var(--dub-dim);
  line-height: 1.7;
}

.txb-dub .dub-stat .n { color: var(--dub-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.txb-dub .dub-stat .t { color: var(--dub-brand-d); font-weight: 700; font-variant-numeric: tabular-nums; }
.txb-dub .dub-stat .warn { color: var(--dub-bad); font-weight: 700; }

.txb-dub .dub-wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(12px, 3vw, 12.8px);
  color: var(--dub-dim);
  white-space: nowrap;
}

.txb-dub .dub-wallet b {
  color: var(--dub-ink);
  font-variant-numeric: tabular-nums;
}

.txb-dub .dub-wallet a {
  color: var(--dub-brand-d);
  text-decoration: none;
  border-bottom: 1px dashed #f3b489;
  padding-bottom: 1px;
}

/* 免费试听：次要按钮，贴在「开始配音」左边。不能做成同样重的主色，
   否则用户会看到两个「主按钮」，反而不知道该点哪个 */
.txb-dub .dub-free {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 11px 15px;
  border: 1px solid #f5c8a4;
  border-radius: 12px;
  background: #fff6ee;
  color: #c2560f;
  font-size: clamp(13px, 3.3vw, 14px);
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, transform .12s ease;
}

.txb-dub .dub-free:hover { background: #ffe9d7; border-color: #efb489; }
.txb-dub .dub-free:active { transform: translateY(1px); }
.txb-dub .dub-free[disabled] {
  background: #f7f1ea;
  border-color: #e9ded3;
  color: #b5a596;
  cursor: not-allowed;
}

.txb-dub .dub-go {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 26px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff8b52, var(--dub-brand));
  color: #fff;
  font-size: clamp(14px, 3.6vw, 15px);
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 122, 61, .3);
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}

.txb-dub .dub-go:hover { filter: brightness(1.04); box-shadow: 0 8px 20px rgba(255, 122, 61, .36); }
.txb-dub .dub-go:active { transform: translateY(1px); }
.txb-dub .dub-go[disabled] {
  background: #e8dcd1;
  color: #a99684;
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}

/* 窄屏：按钮占满一行，指头好点 */
@media (max-width: 520px) {
  /* 15 个口气 5 列 3 行刚好铺满，换 4 列会剩个孤零零的第三行 */
  .txb-dub .dub-tags { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .txb-dub .dub-tag { padding: 9px 0; font-size: 12.5px; border-radius: 9px; }
  .txb-dub .dub-ta { resize: none; }
  /* 手机上统计独占一行，余额与按钮同排——按钮于是真的落在右下角，
     和「右下角最后是开始配音」的要求一致；挤成一行会让按钮跑到左边 */
  /* 手机上分三行：统计、余额、按钮。
     统计和余额各占一行看着松，但两行都塞进一行时（余额 7 位数 + 两个按钮）
     按钮必然被挤到第三行、还贴在左边 —— 那就不叫「右下角」了。 */
  .txb-dub .dub-stat { flex: 1 1 100%; order: 1; font-size: 12px; }
  .txb-dub .dub-wallet { flex: 1 1 100%; order: 2; font-size: 12px; gap: 4px; }
  .txb-dub .dub-free { order: 3; margin-left: auto; padding: 10px 12px; font-size: 12.5px; }
  .txb-dub .dub-go { flex: 0 0 auto; order: 4; padding: 10px 16px; font-size: 13.5px; }
}

/* ---------------------------------------------------------------- 结果区 */
.txb-dub .dub-out {
  margin-top: clamp(14px, 3vw, 20px);
  border: 1px solid var(--dub-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(180, 140, 100, .09);
  overflow: hidden;
  display: none;
}

.txb-dub .dub-out.on { display: block; }

.txb-dub .dub-out-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--dub-line);
  background: var(--dub-bg);
  font-size: 13.5px;
  font-weight: 700;
  color: #6b523c;
}

.txb-dub .dub-out-h .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dub-brand);
  flex: 0 0 auto;
}

.txb-dub .dub-out-h.run .dot { animation: dub-pulse 1s ease-in-out infinite; }
.txb-dub .dub-out-h.ok .dot { background: var(--dub-ok); }
.txb-dub .dub-out-h.bad .dot { background: var(--dub-bad); }

@keyframes dub-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

.txb-dub .dub-out-b { padding: 14px 16px 16px; }

.txb-dub .dub-bar {
  height: 6px;
  border-radius: 4px;
  background: #f2e6da;
  overflow: hidden;
  margin: 0 0 8px;
}

.txb-dub .dub-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #ffb37d, var(--dub-brand));
  transition: width .35s ease;
}

.txb-dub .dub-msg {
  font-size: 13px;
  color: var(--dub-dim);
  line-height: 1.7;
}

.txb-dub .dub-msg.bad { color: var(--dub-bad); }

.txb-dub .dub-player {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.txb-dub .dub-player audio {
  flex: 1 1 260px;
  width: 100%;
  min-width: 0;
  height: 40px;
}

.txb-dub .dub-dl {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  padding: 11px 20px;
  border-radius: 11px;
  background: var(--dub-warm);
  border: 1px solid #ffd9bd;
  color: var(--dub-brand-d);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.txb-dub .dub-dl:hover { background: #ffe8d6; }

.txb-dub .dub-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #a3907e;
  line-height: 1.7;
}

.txb-dub .dub-meta .dub-warn { color: #c9782e; }

/* ---------------------------------------------------------------- 提示条 */
.txb-dub .dub-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 9999;
  max-width: min(88vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(43, 29, 18, .92);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.6;
  text-align: center;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.txb-dub .dub-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 未识别标记高亮：写在预览条里，提示「这个括号不会被念成语气」 */
.txb-dub .dub-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--dub-bad);
  display: none;
}

.txb-dub .dub-hint.on { display: block; }

/* ---------------------------------------------------------------- 让开主站悬浮件
   主站的 AI 客服球（.txb-fab）和它的问候气泡固定在右侧，屏宽不到 900px 时
   正好压在口气按钮和文本框上——用户点「生气」会点到客服。
   这一页是「输入 → 生成 → 下载」的专注页，窄屏下把它们收起来；
   PC 端右侧留白够（容器 760 居中），不挡，保留入口。 */
@media (max-width: 899px) {
  /* 不能拿 body.route-page-14 当前缀：移动端模板的 body 只有一个 ls-mobile，
     那个类名是 PC 模板才有的。本文件只在 /peiyin 引入，直接写类名即可。 */
  body .txb-fab,
  body .txb-tip,
  body #lsFloatMenu { display: none !important; }
}
