/* cutflow 工作台 · 移动优先样式
   品牌色：香槟金 #d8b75f / 深松绿 #1f3b32（AURAI 色板）
   原则：手指友好（点击区 ≥44px）、无横向滚动、视频内联播放、表单控件原生。 */
:root {
  --gold: #d8b75f;
  --gold-d: #b8973c;
  --pine: #1f3b32;
  --pine-l: #2f5748;
  --ink: #1f2329;
  --ink-2: #4e5969;
  --ink-3: #8a9099;
  --line: #e5e6eb;
  --bg: #f6f7f9;
  --card: #fff;
  --ok: #00a86b;
  --warn: #d97706;
  --err: #c0392b;
  --info: #2b6de5;
  --r: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  overflow-x: hidden;
}
a { color: var(--info); }

/* ---------- 顶栏 ---------- */
header.app {
  position: sticky; top: 0; z-index: 30; background: var(--pine); color: #fff;
  padding: 10px 14px 0; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topline { display: flex; align-items: center; gap: 8px; }
/* 品牌名不许换行；窄屏把副标题藏掉，免得把右上角按钮挤成竖排 */
.brand { font-weight: 600; letter-spacing: .3px; white-space: nowrap; flex: 0 1 auto;
         overflow: hidden; text-overflow: ellipsis; }
.brand small { font-weight: 400; opacity: .7; margin-left: 5px; font-size: 11px; }
.topline .grow { flex: 1; min-width: 6px; }
.chip-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #fff;
  border-radius: 999px; padding: 7px 11px; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex: 0 0 auto; font-family: inherit;
}
.chip-btn.warn { background: rgba(216,183,95,.2); border-color: var(--gold); color: var(--gold); }
@media (max-width: 480px) {
  .brand small { display: none; }
}

.tplbar { display: flex; align-items: center; gap: 8px; padding: 8px 0 10px; }
.tplbar label { font-size: 12px; opacity: .8; white-space: nowrap; }
.tplbar select {
  flex: 1; min-width: 0; padding: 9px 10px; border-radius: 8px; border: none;
  font-size: 14px; background: rgba(255,255,255,.95); color: var(--ink);
}

/* ---------- 标签页 ---------- */
nav.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 20; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 0 6px;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  flex: 0 0 auto; border: none; background: none; padding: 12px 14px; font-size: 14px;
  color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.tabs button.active { color: var(--pine); border-bottom-color: var(--gold); font-weight: 600; }
nav.tabs button .dot {
  display: inline-block; min-width: 17px; height: 17px; line-height: 17px; border-radius: 99px;
  background: var(--gold); color: #fff; font-size: 10px; padding: 0 5px; margin-left: 5px;
}

main { padding: 12px 12px 90px; max-width: 980px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; margin-bottom: 10px;
}
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h2.sec { font-size: 15px; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
h2.sec:first-child { margin-top: 4px; }
h2.sec .cnt { font-size: 12px; font-weight: 400; color: var(--ink-3); }

button.btn {
  border: none; border-radius: 9px; padding: 10px 14px; font-size: 14px; cursor: pointer;
  background: var(--pine); color: #fff; min-height: 42px;
}
button.btn.gold { background: var(--gold); color: #3a2f0c; }
button.btn.ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
button.btn.danger { background: #fff; color: var(--err); border: 1px solid #f0c4bd; }
button.btn.sm { padding: 7px 10px; font-size: 12px; min-height: 34px; }
button.btn:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=number], select, textarea {
  padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px;
  background: #fff; color: var(--ink); font-family: inherit; min-height: 42px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
input[type=color] {
  width: 46px; height: 42px; padding: 2px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff;
}
label.fld { display: block; font-size: 12px; color: var(--ink-2); margin: 10px 0 4px; }
label.inline { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
label.inline input[type=checkbox] { width: 20px; height: 20px; }

.badge {
  display: inline-block; font-size: 11px; border-radius: 6px; padding: 2px 7px;
  background: #eef1f5; color: var(--ink-2); margin-right: 4px; white-space: nowrap;
}
.badge.gold { background: #faf3e0; color: #8a6d1f; }
.badge.green { background: #e2f5ec; color: #0d7a52; }
.badge.blue { background: #e6eefc; color: #1c50ad; }
.badge.red { background: #fdeceb; color: var(--err); }
.badge.muted { background: #f2f3f5; color: var(--ink-3); }

video { width: 100%; border-radius: 10px; background: #000; display: block; }
audio { width: 100%; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.list-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; margin-bottom: 8px;
}
.list-item.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(216,183,95,.25); }
.empty { color: var(--ink-3); font-size: 13px; padding: 18px 4px; text-align: center; }

/* ---------- 进度 / 提示 ---------- */
.progress { height: 8px; background: #eceef1; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-d)); width: 0; transition: width .2s; }
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 74px; z-index: 60; display: flex;
  flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 12px;
}
.toast {
  background: rgba(31,35,41,.94); color: #fff; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; max-width: 92%; box-shadow: 0 6px 20px rgba(0,0,0,.2); word-break: break-all;
}
.toast.err { background: rgba(192,57,43,.96); }
.toast.ok { background: rgba(0,140,90,.96); }

.logbox {
  background: #10151a; color: #cfe3d8; font-family: ui-monospace, Consolas, monospace;
  font-size: 11px; line-height: 1.6; border-radius: 10px; padding: 10px; max-height: 240px;
  overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.logbox .err { color: #ff9c92; }
.logbox .ok { color: #86e0b0; }

/* ---------- 任务条（底部悬浮） ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--pine);
  color: #fff; padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  display: none; align-items: center; gap: 10px; box-shadow: 0 -2px 12px rgba(0,0,0,.18);
}
.dock.show { display: flex; }
.dock .txt { flex: 1; min-width: 0; font-size: 12px; }
.dock .bar { height: 5px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.dock .bar > i { display: block; height: 100%; background: var(--gold); width: 0; }

/* ---------- 音色卡 ---------- */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.vcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; }
.vcard .vname { font-weight: 600; font-size: 14px; }
.vcard .vid { font-size: 11px; color: var(--ink-3); word-break: break-all; margin: 2px 0 8px; }
.vcard .verr { font-size: 11px; color: var(--err); margin-top: 7px; line-height: 1.5; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(20,24,28,.55);
  display: none; align-items: flex-end; justify-content: center;
}
.modal.show { display: flex; }
.modal .sheet {
  background: #fff; width: 100%; max-width: 720px; border-radius: 16px 16px 0 0;
  max-height: 88vh; overflow: auto; padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
}
.modal .sheet h3 { margin: 0 0 10px; font-size: 16px; }
pre.code {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font-size: 11px; line-height: 1.6; overflow: auto; max-height: 300px;
  white-space: pre-wrap; word-break: break-all;
}
/* ---------- 字幕配色 ---------- */
.colorline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.ctag { font-size: 12px; color: var(--ink-2); flex: 0 0 auto; min-width: 28px; }
/* 预设色块：不依赖系统取色器，微信内置浏览器里也能点（iOS 的 input[type=color] 在部分 WebView 里点不开） */
.sw {
  width: 28px; height: 28px; min-height: 28px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(0,0,0,.2); cursor: pointer; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.sw.sel { box-shadow: 0 0 0 2px var(--gold), inset 0 0 0 1px rgba(255,255,255,.35); }
input[type=color].pick {
  width: 34px; height: 30px; min-height: 30px; padding: 1px; border-radius: 8px; flex: 0 0 auto;
}
.hexin {
  width: 96px; flex: 0 0 auto; min-height: 34px; padding: 6px 8px; font-size: 13px;
  font-family: ui-monospace, Consolas, "Courier New", monospace; text-transform: lowercase;
}
/* 窄屏：色块那行放不下 hex 输入框时，让它**独占整行**（比孤零零一个 96px 靠左更好点、更易输入） */
@media (max-width: 480px) {
  .hexin { flex: 1 1 100%; width: auto; }
}
/* 预览块：固定中灰底模拟视频画面 —— 用纯黑底会让"黑边"看不出来，
   而且会掩盖「黑字黑底」这类 bug（2026-10-06 的根因就因此肉眼不可见）。
   文字色 = 主色；描边由 JS 用 8 向 text-shadow 画（更接近 libass 的先描边后填充）。 */
.swatch-preview {
  background: #5a5a5a;
  border-radius: 10px; padding: 16px 10px; text-align: center;
  font-size: 26px; font-weight: 700; letter-spacing: 1px;
  margin-top: 8px; min-width: 150px;
  transition: color .12s linear, text-shadow .12s linear;
}
.colorvals {
  font-size: 12px; color: var(--ink-3); margin-top: 5px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}
.dirty-dot { color: var(--warn); font-size: 12px; font-weight: 600; }
.dirty-ok { color: var(--ok); font-size: 12px; }

/* ---------- 模版预览 / 编辑（弹层内） ---------- */
.kv2 { display: grid; grid-template-columns: 88px 1fr; gap: 5px 10px; font-size: 13px; }
.kv2 .k { color: var(--ink-3); }
.kv2 .v { color: var(--ink); word-break: break-all; white-space: pre-wrap; }
.bpblock { padding: 9px 0; border-top: 1px dashed var(--line); }
.bpblock:first-child { border-top: 0; padding-top: 0; }
.bplabel { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.bplist { margin: 5px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.75; color: var(--ink); }
.bplist li { margin: 0; }
.bptext { margin: 5px 0 0; font-size: 13px; line-height: 1.75; color: var(--ink); white-space: pre-wrap; }
.req { color: var(--err); font-size: 11px; margin-left: 4px; }

@media (min-width: 720px) {
  main { padding: 16px 16px 90px; }
  .modal { align-items: center; }
  .modal .sheet { border-radius: 16px; }
}

/* 音色试听：等待秒数 / 兜底播放器（2026-10-06 随 app.js 的 playVoice 重写一起加） */
.vcard .verr .vmsg { display: block; }
.vcard .verr audio { display: block; width: 100%; height: 34px; margin-top: 6px; }
