/* ========= 基础变量与主题（壁纸） ========= */
:root {
  --radius: 16px;
}
body {
  --bg-grad: linear-gradient(160deg, #f6f6fd 0%, #f4f5fb 45%, #eef0fa 100%);
  --card: #ffffff;
  --ink: #1f2333;
  --muted: #7a8099;
  --line: #e8eaf3;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef0ff;
  --seg-bg: #f1f2f8;
  --seg-active: #ffffff;
  --topbar: rgba(255, 255, 255, .88);
  --hover-soft: #f7f8fd;
  --code-bg: #f1f2f8;
  --shadow: 0 2px 12px rgba(31, 35, 51, .06);
}
/* —— 浅色壁纸：换背景与主题色 —— */
body[data-theme="sakura"] {
  --bg-grad: linear-gradient(160deg, #fdf0f6 0%, #f8ebf4 45%, #eff0fb 100%);
  --accent: #ec4899; --accent-2: #a855f7; --accent-soft: #fdeef8;
}
body[data-theme="sky"] {
  --bg-grad: linear-gradient(160deg, #eaf5fe 0%, #edf1fd 50%, #f3f4fc 100%);
  --accent: #0284c7; --accent-2: #6366f1; --accent-soft: #e6f3fd;
}
body[data-theme="mint"] {
  --bg-grad: linear-gradient(160deg, #e9f9f2 0%, #effaf3 50%, #f0f6f8 100%);
  --accent: #0d9f6e; --accent-2: #0ea5e9; --accent-soft: #e5f7f0;
}
body[data-theme="sunset"] {
  --bg-grad: linear-gradient(160deg, #fff5ec 0%, #ffeadf 50%, #fdeef0 100%);
  --accent: #f97316; --accent-2: #ec4899; --accent-soft: #feefe6;
}
/* —— 深色壁纸：整表面翻暗 —— */
body[data-theme="starry"], body[data-theme="midnight"] {
  --card: #262a45;
  --ink: #e9ebff;
  --muted: #9aa0c6;
  --line: #3a3f66;
  --seg-bg: #31355a;
  --seg-active: #3d4270;
  --topbar: rgba(30, 33, 58, .86);
  --hover-soft: #2e3253;
  --code-bg: #31355a;
  --accent-soft: rgba(139, 92, 246, .18);
  --shadow: 0 2px 14px rgba(0, 0, 0, .35);
}
body[data-theme="starry"] {
  --bg-grad: linear-gradient(160deg, #15162b 0%, #1c1d3a 55%, #232150 100%);
  --accent: #8b5cf6; --accent-2: #6366f1;
}
body[data-theme="midnight"] {
  --bg-grad: linear-gradient(160deg, #0e1626 0%, #14203a 55%, #1a2b4d 100%);
  --accent: #38bdf8; --accent-2: #818cf8;
}

/* ========= 全局 ========= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-grad) fixed;
  color: var(--ink);
  font-size: 15px;
  transition: background .3s ease;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ========= 顶栏 ========= */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--topbar);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; overflow: hidden;
  box-shadow: 0 4px 12px rgba(31, 35, 51, .22);
}
.logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.brand-text p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #c3c7d8; }
.status .dot.ok { background: #22c07a; box-shadow: 0 0 6px rgba(34, 192, 122, .7); }
.status .dot.demo { background: #f5a623; box-shadow: 0 0 6px rgba(245, 166, 35, .7); }
.status .dot.local { background: #14b8a6; box-shadow: 0 0 6px rgba(20, 184, 166, .7); }

/* 顶栏 AI 模式快切（在线 DeepSeek ↔ 本地 Ollama） */
.mode-quick {
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
  font-size: 13px; font-weight: 600; color: var(--ink); background: var(--card);
  outline: none; cursor: pointer; max-width: 190px;
}
.mode-quick:focus { border-color: var(--accent); }

/* 顶栏余额徽章 */
.balance-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink);
  padding: 6px 13px; font-size: 12.5px; font-weight: 600;
  transition: border-color .15s, color .15s, transform .15s;
}
.balance-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.balance-chip.low { border-color: #e8a7a2; background: #fdf1ef; color: #c0392b; }

/* ========= 按钮 ========= */
.primary-btn {
  border: none; border-radius: 10px; padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 14px; font-weight: 600;
  transition: opacity .15s, transform .15s;
}
.primary-btn:hover { opacity: .9; transform: translateY(-1px); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primary-btn.small { padding: 8px 14px; font-size: 13px; }
.ghost-btn {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px;
  background: var(--card); color: var(--ink); font-size: 14px;
  transition: border-color .15s, color .15s;
}
.ghost-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }
.ghost-btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.danger-btn {
  border: none; border-radius: 8px; padding: 6px 12px;
  background: #fdecec; color: var(--danger, #e5484d); font-size: 13px; font-weight: 600;
}
.danger-btn:hover { background: #fbdcdc; }
.text-btn { border: none; background: none; color: var(--muted); font-size: 13px; }
.text-btn:hover { color: var(--accent); }
.text-btn.danger:hover { color: var(--danger, #e5484d); }
.text-btn.strong { color: var(--accent); font-weight: 600; }
.icon-btn {
  border: none; background: var(--seg-bg); border-radius: 8px;
  width: 32px; height: 32px; font-size: 14px; color: var(--muted);
}
.icon-btn:hover { background: var(--hover-soft); color: var(--ink); }

/* ========= 毛玻璃工作台：壁纸透出、文字不糊（壁纸栏可开关，body.glass-off 为关闭态） ========= */
body:not(.glass-off) .tabs,
body:not(.glass-off) .card,
body:not(.glass-off) .drawer,
body:not(.glass-off) .modal,
body:not(.glass-off) .ai-panel,
body:not(.glass-off) .theme-panel {
  background: color-mix(in srgb, var(--card) 74%, transparent);
  backdrop-filter: blur(20px) saturate(1.45);
  -webkit-backdrop-filter: blur(20px) saturate(1.45);
}
/* 输入框、下拉、分段选择器在玻璃卡上略微降不透明度，视觉更统一（仍保证可读） */
body:not(.glass-off) #inputText,
body:not(.glass-off) .cmp-ta,
body:not(.glass-off) .select,
body:not(.glass-off) .segmented {
  background: color-mix(in srgb, var(--card) 88%, transparent);
}
/* 玻璃卡上加一圈细描边，边缘在浅色壁纸上更清晰 */
body:not(.glass-off) .card,
body:not(.glass-off) .tabs {
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

/* ========= 主体布局 ========= */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px 30px; }

.tabs {
  display: flex; gap: 6px; padding: 6px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  margin-bottom: 16px; overflow-x: auto;
}
.tab {
  flex: 1; border: none; background: none; border-radius: 10px;
  padding: 11px 10px; font-size: 14.5px; color: var(--muted); font-weight: 500;
  white-space: nowrap; transition: all .15s;
}
.tab:hover:not(:disabled) { color: var(--ink); background: var(--hover-soft); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
}
.tab:disabled { opacity: .55; cursor: wait; }

.workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
  display: flex; flex-direction: column;
}

/* ========= 输入区 ========= */
.panel { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn {
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 500;
  transition: all .15s;
}
.action-btn:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.action-btn:disabled { opacity: .55; cursor: wait; }
.action-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 600;
}
.action-btn.primary:hover:not(:disabled) { opacity: .9; }
.action-btn.big { align-self: flex-start; padding: 10px 22px; }

.option-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.option-label { font-size: 13.5px; color: var(--muted); flex-shrink: 0; }

.segmented { display: inline-flex; background: var(--seg-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg {
  border: none; background: none; border-radius: 8px;
  padding: 6px 14px; font-size: 13.5px; color: var(--muted); transition: all .15s;
}
.seg:hover { color: var(--ink); }
.seg.active { background: var(--seg-active); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(31, 35, 51, .1); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 7px 15px; font-size: 13.5px; color: var(--ink); transition: all .15s;
}
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chip:disabled { opacity: .55; cursor: wait; }
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; font-weight: 600;
}

.select {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  font-size: 13.5px; color: var(--ink); background: var(--card); outline: none;
}
.select:focus { border-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* 补充要求输入行 */
.extra-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#extraReq {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px; font-size: 13.5px; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#extraReq:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
#extraReq::placeholder { color: #b6bacb; }

.textarea-wrap { flex: 1; display: flex; }
#inputText {
  flex: 1; width: 100%; min-height: 250px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  font-size: 15px; line-height: 1.85; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#inputText:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
#inputText::placeholder { color: #b6bacb; }
.input-footer { display: flex; align-items: center; gap: 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.input-footer .tip { flex: 1; text-align: center; white-space: nowrap; }
/* 文本瘦身徽章（输入区底部）：显示压缩比例与预估省下的 token */
.slim-info {
  color: #0a7d43; background: rgba(52, 199, 89, .14);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; cursor: help;
}

/* ========= 文稿对比（版本 B 输入框 + 差异高亮） ========= */
.cmp-field { display: flex; flex-direction: column; gap: 6px; }
.cmp-ta {
  width: 100%; min-height: 110px; max-height: 280px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 13.5px; line-height: 1.75; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cmp-ta:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.cmp-ta::placeholder { color: #b6bacb; }

.diff-stats {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-bottom: 10px;
  padding: 7px 12px; background: var(--seg-bg); border-radius: 10px;
}
.diff-legend { display: inline-flex; align-items: center; gap: 6px; }
.diff-legend i { display: inline-block; width: 22px; height: 10px; border-radius: 5px; }
.diff-legend .lg-del i { background: rgba(239, 68, 68, .5); }
.diff-legend .lg-ins i { background: rgba(16, 185, 129, .55); }
.diff-wrap { font-size: 13.5px; line-height: 1.9; }
.diff-line {
  padding: 2px 10px; border-radius: 7px; margin: 2px 0;
  white-space: pre-wrap; word-break: break-all; color: var(--ink);
}
.diff-line.dl { background: rgba(239, 68, 68, .12); }
.diff-line.in { background: rgba(16, 185, 129, .13); }
.diff-line.dl .dch { text-decoration: line-through; font-weight: 600; }
.diff-line.in .ich { font-weight: 600; text-decoration: underline dotted rgba(4, 120, 87, .7); text-underline-offset: 3px; }
.diff-gutter { font-size: 11.5px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }

/* ========= 结果工具栏徽章 / 字幕翻译进度 / PPT 演讲备注 ========= */
.tool-chip {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  padding: 4px 10px; background: var(--seg-bg); border-radius: 999px;
}
.tool-chip.srt-warn { color: #b45309; background: rgba(245, 158, 11, .14); }
.tool-chip.slim-ok { color: #0a7d43; background: rgba(52, 199, 89, .14); font-weight: 600; }
.subtr-box { padding: 8px 4px; }
.subtr-box .v-bar { margin: 12px 0; }

.slide-notes {
  width: 100%; min-height: 44px; resize: vertical; margin-top: 8px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; line-height: 1.7; color: var(--muted); background: var(--card); outline: none;
}
.slide-notes:focus { border-color: var(--accent); color: var(--ink); }
.slide-notes::placeholder { color: #b6bacb; }

/* ========= 结果区 ========= */
.result-card { min-height: 480px; }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.result-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600;
}
.token-usage { font-size: 12px; color: var(--muted); white-space: nowrap; }
.token-usage b { color: var(--accent); font-weight: 700; }
.result-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.result-tools .ghost-btn, .result-tools .danger-btn, .result-tools .tool-chip { white-space: nowrap; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff7e6; border: 1px solid #ffe1a8; color: #916300;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px;
  line-height: 1.6;
}

.result-body { flex: 1; overflow-y: auto; max-height: 560px; padding-right: 4px; }
.result-body .empty {
  height: 100%; min-height: 300px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); gap: 6px; text-align: center;
}
.result-body .empty-icon { font-size: 44px; opacity: .5; }
.result-body .empty-sub { font-size: 12.5px; opacity: .7; }

.result-body .md { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.md p { margin: 0 0 12px; line-height: 1.95; }
.md h3 { margin: 16px 0 10px; font-size: 16px; color: var(--ink); }
.md ul, .md ol { margin: 0 0 12px 22px; line-height: 1.95; }
.md li { margin-bottom: 4px; }
.md code {
  background: var(--code-bg); border-radius: 5px; padding: 2px 6px;
  font-size: 13px; color: var(--accent);
}
.md pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 12px; overflow-x: auto;
}
.md pre code { background: none; padding: 0; color: var(--ink); font-size: 12.5px; line-height: 1.7; }
.md table {
  border-collapse: collapse; width: 100%; margin: 0 0 12px;
  font-size: 13px; line-height: 1.7;
}
.md th, .md td {
  border: 1px solid var(--line); padding: 7px 10px; text-align: left;
  vertical-align: top; word-break: break-word;
}
.md th { background: var(--code-bg); font-weight: 600; color: var(--ink); }
.md tr:nth-child(even) td { background: color-mix(in srgb, var(--code-bg) 55%, transparent); }
.md .stream-cursor {
  display: inline-block; width: 8px; height: 17px; margin-left: 2px;
  background: var(--accent); border-radius: 2px; vertical-align: -3px;
  animation: blink .9s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.result-error {
  background: #fdecec; border: 1px solid #f8c9cb; color: #b3261e;
  border-radius: 12px; padding: 16px; font-size: 14px; line-height: 1.8;
}
.result-error .err-title { font-weight: 700; margin-bottom: 6px; }

/* 追问微调栏 */
.followups {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.fu-chip {
  border: 1px solid transparent; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; transition: all .15s;
}
.fu-chip:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.fu-chip:disabled { opacity: .5; cursor: wait; }

/* ========= 壁纸栏 ========= */
.theme-panel {
  position: fixed; top: 72px; right: 24px; z-index: 35;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 18, 35, .18); padding: 14px;
  animation: pop .18s ease; max-width: calc(100vw - 32px);
}
.theme-head { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.theme-grid { display: flex; gap: 9px; flex-wrap: wrap; max-height: 44vh; overflow-y: auto; padding-right: 2px; }
.theme-swatch {
  border: 2px solid var(--line); background: none; border-radius: 12px;
  padding: 6px 6px 5px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: all .15s; width: 74px;
}
.theme-swatch i { display: block; width: 100%; height: 38px; border-radius: 8px; background-size: cover; background-position: center; }
.theme-swatch { position: relative; }

/* —— 自定义壁纸：上传入口 + 悬停删除 —— */
.theme-upload i {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--muted); background: var(--seg-bg);
  border: 1.5px dashed var(--line);
}
.theme-upload:hover i { border-color: var(--accent); color: var(--accent); }
.sw-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: rgba(15, 18, 35, .6); color: #fff;
  font-size: 10px; line-height: 18px; text-align: center; display: none;
}
.theme-swatch:hover .sw-del { display: block; }
.sw-del:hover { background: #e5484d; }

/* —— 插画壁纸：固定背景层 + 浓度可调 —— */
#bgLayer {
  position: fixed; inset: 0; z-index: -1;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  opacity: var(--wp-opacity, .45);
  transition: opacity .25s ease;
  pointer-events: none;
}
body:not([data-theme^="photo"]):not([data-theme^="custom"]) #bgLayer { display: none; }
body[data-theme="photo-sakura"] #bgLayer { background-image: url(assets/wallpapers/wp1.jpg); }
body[data-theme="photo-window"] #bgLayer { background-image: url(assets/wallpapers/wp2.jpg); }
body[data-theme="photo-star"]   #bgLayer { background-image: url(assets/wallpapers/wp3.jpg); }
body[data-theme="photo-kimono"] #bgLayer { background-image: url(assets/wallpapers/wp4.jpg); }
body[data-theme="photo-train"]  #bgLayer { background-image: url(assets/wallpapers/wp5.jpg); }
body[data-theme="photo-splash"] #bgLayer { background-image: url(assets/wallpapers/wp6.jpg); }
body[data-theme="photo-sea"]    #bgLayer { background-image: url(assets/wallpapers/wp7.jpg); }
/* 插画壁纸各自的主题色（卡片保持浅色以保证可读性） */
body[data-theme="photo-sakura"] { --accent: #ec4899; --accent-2: #a855f7; --accent-soft: #fdeef8; }
body[data-theme="photo-window"] { --accent: #38bdf8; --accent-2: #818cf8; --accent-soft: #eff8ff; }
body[data-theme="photo-star"]   { --accent: #6366f1; --accent-2: #8b5cf6; --accent-soft: #eef0ff; }
body[data-theme="photo-kimono"] { --accent: #a855f7; --accent-2: #ec4899; --accent-soft: #f8f2ff; }
body[data-theme="photo-train"]  { --accent: #f59e0b; --accent-2: #f97316; --accent-soft: #fff7e6; }
body[data-theme="photo-splash"] { --accent: #06b6d4; --accent-2: #0ea5e9; --accent-soft: #ecfdff; }
body[data-theme="photo-sea"]    { --accent: #0ea5e9; --accent-2: #6366f1; --accent-soft: #e6f3fd; }

.wp-opacity-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.wp-opacity-row input[type="range"] {
  flex: 1; height: 6px; appearance: none; -webkit-appearance: none;
  border-radius: 999px; background: var(--seg-bg); outline: none; cursor: pointer;
}
.wp-opacity-row input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 2px solid #fff; box-shadow: 0 1px 5px rgba(31, 35, 51, .3);
}
.wp-opacity-row #wpOpacityVal { font-size: 12px; color: var(--accent); font-weight: 600; min-width: 34px; text-align: right; }
.theme-swatch span { font-size: 11.5px; color: var(--muted); }
.theme-swatch:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch.active span { color: var(--accent); font-weight: 600; }

/* ========= AI 小助手 ========= */
.ai-fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 45;
  width: 60px; height: 60px; border-radius: 50%;
  padding: 0; border: 3px solid var(--accent);
  background: #fff; overflow: visible;
  box-shadow: 0 8px 24px rgba(31, 35, 51, .3);
  transition: transform .18s ease;
  animation: fabPulse 2.6s ease infinite;
}
#aiFabImg {
  display: block; width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  font-size: 26px; line-height: 56px; text-align: center;
}
.ai-fab:hover { transform: scale(1.08) rotate(-5deg); animation-play-state: paused; }
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(31, 35, 51, .3), 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 8px 24px rgba(31, 35, 51, .3), 0 0 0 12px transparent; }
}
.ai-fab-dot {
  position: absolute; top: 3px; right: 3px; width: 11px; height: 11px;
  border-radius: 50%; background: #f59e0b; border: 2px solid #fff;
}
.ai-panel {
  position: fixed; right: 28px; bottom: 96px; z-index: 46;
  width: 370px; max-width: calc(100vw - 40px); height: 540px; max-height: 72vh;
  background: var(--card); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 18, 35, .3);
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.ai-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.ai-head-avatar {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover;
  border: 2px solid var(--accent-soft); flex-shrink: 0;
}
.ai-head-text { flex: 1; min-width: 0; }
.ai-head-title { font-size: 15px; font-weight: 700; }
.ai-sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }

.ai-tips { padding: 10px 12px 4px; max-height: 168px; overflow-y: auto; flex-shrink: 0; }
.tip-card {
  display: flex; align-items: flex-start; gap: 7px;
  background: var(--seg-bg); border-radius: 10px;
  padding: 8px 10px; margin-bottom: 8px;
  font-size: 12.5px; line-height: 1.65; color: var(--ink);
}
.tip-icon { flex-shrink: 0; }
.tip-act {
  border: none; background: none; color: var(--accent); font-weight: 700;
  font-size: 12px; white-space: nowrap; padding: 0 2px; flex-shrink: 0;
}
.tip-act:hover { text-decoration: underline; }

.ai-chat { flex: 1; overflow-y: auto; padding: 12px 14px 6px; }
.ai-msg {
  max-width: 86%; padding: 9px 13px; border-radius: 13px;
  font-size: 13.5px; line-height: 1.75; margin-bottom: 10px; word-break: break-word;
}
.ai-msg.ai {
  display: flex; align-items: flex-end; gap: 7px;
  background: none; padding: 0; max-width: 92%;
}
.ai-msg-avatar {
  width: 27px; height: 27px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--line); flex-shrink: 0; background: #fff;
  align-self: flex-end; margin-bottom: 2px;
}
.ai-msg.ai .ai-bubble {
  background: var(--seg-bg); color: var(--ink); border-radius: 13px;
  border-top-left-radius: 4px; padding: 9px 13px; word-break: break-word;
}
.ai-msg.ai p { margin: 0 0 6px; }
.ai-msg.ai p:last-child { margin-bottom: 0; }
.ai-msg.ai ul, .ai-msg.ai ol { margin: 2px 0 6px 18px; }
.ai-msg.user {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; margin-left: auto; border-top-right-radius: 4px;
}
.ai-msg.user p { margin: 0; }
.ai-inputrow {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line);
}
#aiInput {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 13px; font-size: 13.5px; color: var(--ink); background: var(--card); outline: none;
}
#aiInput:focus { border-color: var(--accent); }
#aiInput::placeholder { color: #b6bacb; }

/* ========= 历史抽屉 ========= */
.drawer-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 35, .45); z-index: 40;
  animation: fadeIn .2s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw;
  background: var(--card); z-index: 41;
  /* 阴影只在打开时出现：关闭时抽屉停在屏幕外，常驻投影会在视口右缘留下一条暗带 */
  box-shadow: none;
  transform: translateX(100%); transition: transform .25s ease, box-shadow .25s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); box-shadow: -8px 0 30px rgba(15, 18, 35, .18); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 16.5px; }
.drawer-head-actions { display: flex; align-items: center; gap: 10px; }
.history-list { flex: 1; overflow-y: auto; }
.history-empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.history-item {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .15s; position: relative;
}
.history-item:hover { background: var(--hover-soft); }
.history-item.active { background: var(--accent-soft); }
.hi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.hi-badge {
  font-size: 11.5px; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 2px 9px; font-weight: 600; white-space: nowrap;
}
.hi-time { font-size: 11.5px; color: var(--muted); opacity: .75; }
.hi-del {
  margin-left: auto; border: none; background: none; color: var(--muted); opacity: .4;
  font-size: 13px; padding: 2px 4px; border-radius: 6px; opacity: 0; transition: all .15s;
}
.history-item:hover .hi-del { opacity: 1; }
.hi-del:hover { color: var(--danger, #e5484d); background: #fdecec; }
.hi-text {
  font-size: 13px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ========= 设置弹窗 ========= */
.modal-mask { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal {
  width: 480px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 18px; padding: 24px;
  box-shadow: 0 20px 60px rgba(15, 18, 35, .25); animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 18px; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.field input[type="text"], .field input[type="password"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; outline: none; transition: border-color .15s;
  background: var(--card); color: var(--ink);
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; }
.key-row .icon-btn { height: auto; width: 42px; }
/* 设置弹窗：余额 / 用量行 */
.balance-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.balance-detail { flex: 1; font-size: 13px; color: var(--ink); line-height: 1.7; word-break: break-all; }
.balance-detail .bd-warn { color: #c0392b; font-weight: 600; }
.hint-link { font-size: 12.5px; color: var(--accent); text-decoration: none; display: inline-block; margin-top: 6px; }
.hint-link:hover { text-decoration: underline; }
.field.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; }
.field.checkbox input { margin-top: 3px; accent-color: var(--accent); }
.modal-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.modal-foot .primary-btn { padding: 10px 30px; }
.privacy { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }

/* 双模式：字段说明 / 本地模型检测状态 */
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.7; word-break: break-all; }
.field-hint a { color: var(--accent); text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }
.field-hint code {
  font-family: Consolas, Menlo, monospace; font-size: 11.5px;
  background: rgba(99, 102, 241, .1); border-radius: 5px; padding: 1px 6px; color: var(--accent);
}
.field-hint.det-ok { color: #15803d; font-weight: 600; }
.field-hint.det-err { color: #b91c1c; }
.field-hint.det-warn { color: #b45309; }

/* 长文本 · 切换本地模型提示弹窗 */
.lh-text { font-size: 14px; line-height: 1.8; margin-bottom: 10px; }
.lh-actions { display: flex; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.lh-actions .primary-btn { flex: 1; min-width: 200px; }
.lh-actions .ghost-btn { flex: 1; min-width: 150px; }

/* ========= Toast / 页脚 ========= */
.toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(31, 35, 51, .92); color: #fff; font-size: 13.5px;
  padding: 10px 22px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 60; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { text-align: center; font-size: 12px; color: var(--muted); opacity: .75; margin-top: 24px; }

/* ========= 响应式（手机端排版优化） ========= */
@media (max-width: 900px) {
  /* 布局：单列工作台 + 更紧凑的留白（minmax(0,1fr) 防止宽表格把卡片撑出屏幕） */
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .result-card { min-height: 380px; }
  .card { padding: 14px; }
  .container { padding: 10px 12px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .panel { gap: 8px; margin-bottom: 10px; }

  /* 顶栏：收紧高度，隐藏次要信息 */
  .topbar { padding: 10px 14px; }
  .brand-text p { display: none; }
  .status { display: none; }
  .logo { width: 36px; height: 36px; border-radius: 10px; }
  .brand-text h1 { font-size: 17px; }
  .topbar-actions { gap: 6px; }
  .topbar .ghost-btn, .topbar .primary-btn { padding: 7px 10px; font-size: 13px; }
  .balance-chip { padding: 5px 10px; font-size: 12px; }
  .mode-quick { max-width: 128px; font-size: 12px; padding: 7px 6px; }
  /* 功能标签：固定宽度横向轻扫，隐藏滚动条 */
  .tabs { padding: 5px; gap: 4px; margin-bottom: 12px; }
  .tab { flex: 0 0 auto; padding: 9px 13px; font-size: 13.5px; }
  .tabs::-webkit-scrollbar { display: none; }

  /* 输入区：16px 防 iOS 聚焦缩放；隐藏桌面快捷键提示 */
  #inputText { min-height: 170px; font-size: 16px; }
  .cmp-ta { font-size: 16px; }
  .input-footer { gap: 10px; font-size: 12px; }
  .input-footer .tip { display: none; }
  .extra-row { gap: 8px; }
  #extraReq { font-size: 16px; min-width: 0; flex: 1; }

  /* 结果区：工具行允许换行，结果文字排版放大行距 */
  .result-header { flex-wrap: wrap; }
  .result-tools { flex-wrap: wrap; justify-content: flex-end; }
  .result-tools .ghost-btn, .result-tools .danger-btn { white-space: nowrap; }
  .result-body { max-height: none; }
  .md p, .md ul, .md ol { line-height: 1.85; }
  .md p { margin-bottom: 10px; }
  .md { overflow-wrap: anywhere; }
  .md h3 { font-size: 15.5px; margin: 14px 0 8px; }
  .md code { font-size: 13.5px; }
  /* 宽表格转为横向轻扫，不再撑破卡片 */
  .md table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
  .md th, .md td { padding: 6px 9px; }

  /* 弹层：贴边铺满宽度 */
  .modal { padding: 18px 16px; }
  .drawer { width: 86vw; }
  .ai-panel { right: 12px; left: 12px; width: auto; bottom: 88px; height: min(62vh, 540px); }
  .ai-fab { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .theme-panel { right: 12px; left: 12px; max-width: none; }
  .followups { gap: 6px; }
}

/* ========= 视频一键剪辑 ========= */
.video-workspace { margin-top: 0; gap: 14px; }
.v-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.v-head h2 { font-size: 18px; }
.v-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.v-drop {
  border: 2px dashed var(--line); border-radius: 14px;
  padding: 42px 20px; text-align: center; color: var(--muted);
  cursor: pointer; transition: all .15s; background: var(--hover-soft);
}
.v-drop:hover, .v-drop.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.v-drop-icon { font-size: 40px; margin-bottom: 8px; opacity: .65; }
.v-drop-sub { font-size: 12.5px; opacity: .8; margin-top: 5px; }

.v-filebar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.v-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px;
  font-size: 13px; background: var(--card); cursor: pointer; transition: border-color .15s;
}
.v-file:hover { border-color: var(--accent); }
.v-file.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.v-file-order {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 6px; font-size: 11px; flex-shrink: 0;
  background: var(--seg-bg); color: var(--muted);
}
.v-file.active .v-file-order { background: var(--accent); color: #fff; }
.v-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.v-file em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.v-file.active em { color: var(--accent); opacity: .8; }
.v-file-move, .v-file-del {
  border: none; background: var(--seg-bg); border-radius: 6px;
  width: 21px; height: 21px; font-size: 10px; line-height: 1; color: var(--muted); flex-shrink: 0;
}
.v-file-move:hover { background: var(--accent-soft); color: var(--accent); }
.v-file-del:hover { background: #fdecec; color: #e5484d; }

.v-main { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-top: 14px; }
.v-left { display: flex; flex-direction: column; gap: 13px; min-width: 0; }
#vPlayer { width: 100%; max-height: 400px; border-radius: 12px; background: #000; outline: none; }
.v-meta { font-size: 12.5px; color: var(--muted); line-height: 1.6; word-break: break-all; }
.v-trim, .v-speed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v-trim label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.v-time {
  width: 86px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 13px; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s;
}
.v-time:focus { border-color: var(--accent); }
.v-range-info { font-size: 12.5px; color: var(--accent); font-weight: 600; }

.v-right { min-width: 0; }
.v-ops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.v-op {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 13px 14px;
  transition: all .15s;
}
.v-op:hover:not(.off) { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 3px 12px rgba(31, 35, 51, .1); }
.v-op.off { opacity: .42; cursor: not-allowed; }
.v-op-icon { font-size: 20px; }
.v-op-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.v-op-desc { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

.v-progress { margin-top: 14px; }
.v-progress-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13.5px; color: var(--ink); }
.v-bar { height: 8px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.v-bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s ease;
}
.v-bar i.indeterminate { width: 34% !important; animation: vSlide 1.1s ease-in-out infinite; }
@keyframes vSlide { from { transform: translateX(-110%); } to { transform: translateX(330%); } }

.v-result {
  margin-top: 14px; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; background: var(--hover-soft);
}
.v-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.v-result-meta { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 120px; }
.v-result video, .v-result img { max-width: 100%; max-height: 420px; border-radius: 10px; display: block; margin: 0 auto; }
.v-result audio { width: 100%; }
.v-foot-note { margin-top: 13px; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ========= 录音转写 · 多媒体创作全链路 ========= */
.au-workspace { margin-top: 0; gap: 14px; }
.au-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.au-head h2 { font-size: 18px; }
.au-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* 四步链路指示 */
.au-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.au-step {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  background: var(--card); white-space: nowrap;
}
.au-step i {
  font-style: normal; width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; background: var(--seg-bg); flex-shrink: 0;
}
.au-step.now { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.au-step.now i { background: var(--accent); color: #fff; }
.au-step.done { color: #15803d; border-color: #bbf7d0; }
.au-step.done i { background: #22c07a; color: #fff; }
.au-step-arrow { font-style: normal; color: var(--muted); font-size: 11px; opacity: .6; }

.au-main { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; margin-top: 14px; }
.au-left { display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.au-right { min-width: 0; }

/* 转写引擎状态行 */
.au-engine { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); flex-wrap: wrap; }
.au-engine .spacer { flex: 1; }
.au-engine-dot { width: 9px; height: 9px; border-radius: 50%; background: #c3c7d8; flex-shrink: 0; }
.au-engine-dot.ok { background: #22c07a; box-shadow: 0 0 6px rgba(34, 192, 122, .7); }
.au-engine-dot.err { background: #e5484d; box-shadow: 0 0 6px rgba(229, 72, 77, .6); }
.au-engine-dot.unknown { background: #f5a623; }
.au-engine-help {
  border: 1px solid var(--line); border-radius: 12px; background: var(--hover-soft);
  padding: 10px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.8;
}
.au-engine-help summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.au-engine-help ol { margin: 8px 0 4px; padding-left: 20px; }
.au-engine-help a { color: var(--accent); text-decoration: none; }
.au-engine-help code {
  font-family: Consolas, Menlo, monospace; font-size: 11.5px;
  background: rgba(99, 102, 241, .1); border-radius: 5px; padding: 1px 6px; color: var(--accent);
}
.au-engine-help p { margin-top: 6px; }

/* 音频来源：拖放区 + 录音行 */
.au-drop {
  border: 2px dashed var(--line); border-radius: 14px;
  padding: 30px 18px; text-align: center; color: var(--muted);
  cursor: pointer; transition: all .15s; background: var(--hover-soft);
}
.au-drop:hover, .au-drop.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.au-drop-icon { font-size: 34px; margin-bottom: 6px; opacity: .65; }
.au-drop p { font-size: 13.5px; }
.au-drop-sub { font-size: 12px !important; opacity: .8; margin-top: 4px; }
.au-record-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.au-rec-timer {
  font-family: Consolas, Menlo, monospace; font-size: 14px; font-weight: 600;
  color: #e5484d; min-width: 46px;
}
.au-src-info { font-size: 12.5px; color: var(--muted); word-break: break-all; flex: 1; min-width: 120px; }

/* 选项行 + 转写按钮 + 进度 */
.au-opt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.au-base { flex: 1; min-width: 170px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink); background: var(--card); outline: none; }
.au-base:focus { border-color: var(--accent); }
.au-go { width: 100%; padding: 12px; font-size: 15px; }
.au-progress { margin-top: 2px; }
.au-progress-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13.5px; color: var(--ink); }

/* 转写结果 */
.au-empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.au-empty-icon { font-size: 42px; margin-bottom: 10px; opacity: .6; }
.au-empty p { font-size: 14px; }
.au-empty-sub { font-size: 12.5px !important; margin-top: 6px; opacity: .8; }
.au-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.au-meta { font-size: 12.5px; color: var(--muted); }
.au-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.au-text {
  width: 100%; min-height: 260px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  font-size: 13.5px; line-height: 1.8; color: var(--ink);
  background: var(--card); outline: none; font-family: inherit;
}
.au-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.au-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.au-actions .primary-btn { flex: 1; min-width: 180px; }
.au-actions-2 { margin-top: 8px; }
.au-hint { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ========= 提示词库 & 模板包（变现核心模块） ========= */
.pk-workspace { margin-top: 0; gap: 12px; }
.pk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pk-head h2 { font-size: 18px; }
.pk-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.pk-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pk-stats { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pk-stats b { color: var(--accent); }

.pk-main { display: grid; grid-template-columns: 190px 1fr; gap: 16px; margin-top: 12px; }
.pk-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pk-search {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
  font-size: 13px; color: var(--ink); background: var(--card); outline: none; width: 100%;
}
.pk-search:focus { border-color: var(--accent); }
.pk-cats { display: flex; flex-direction: column; gap: 6px; }
.pk-cat {
  text-align: left; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; color: var(--ink); background: var(--card);
  cursor: pointer; transition: all .15s;
}
.pk-cat:hover { border-color: var(--accent); color: var(--accent); }
.pk-cat.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pk-side-hint { font-size: 11.5px; color: var(--muted); line-height: 1.7; }

.pk-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: start; min-width: 0; }
.pk-empty { grid-column: 1 / -1; text-align: center; padding: 50px 16px; color: var(--muted); font-size: 14px; line-height: 2; }
.pk-empty-sub { font-size: 12.5px; opacity: .8; }
.pk-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
  background: var(--card); display: flex; flex-direction: column; gap: 7px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pk-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(31, 35, 51, .09); transform: translateY(-1px); }
.pk-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pk-card-title { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.pk-cat-badge {
  flex-shrink: 0; font-size: 10.5px; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.pk-card-desc { font-size: 12.5px; color: var(--ink); opacity: .85; line-height: 1.6; }
.pk-card-body {
  font-size: 12px; color: var(--muted); line-height: 1.6;
  border-left: 3px solid var(--line); padding-left: 9px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pk-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.pk-card-meta { font-size: 11px; color: var(--muted); }
.pk-card-acts { display: inline-flex; align-items: center; gap: 6px; }
.pk-act {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 4px 9px; font-size: 12px; color: var(--ink); cursor: pointer; transition: all .15s;
}
.pk-act:hover { border-color: var(--accent); color: var(--accent); }
.pk-act.use {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; font-weight: 600; padding: 5px 13px;
}
.pk-act.use:hover { opacity: .9; }

/* 弹窗内编辑区 */
.pk-edit-body {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; line-height: 1.7; color: var(--ink); background: var(--card);
  outline: none; resize: vertical; font-family: inherit; min-height: 170px;
}
.pk-edit-body:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.pk-use-desc { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; line-height: 1.6; }
.pk-use-foot { justify-content: flex-start; }
.pk-use-foot .primary-btn { min-width: 150px; }

/* ========= 批量处理（任务队列） ========= */
.bt-workspace { margin-top: 0; gap: 14px; }
.bt-head h2 { font-size: 18px; }
.bt-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.bt-ops { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bt-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.bt-add-row { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.bt-drop {
  flex: 1; min-width: 260px; border: 2px dashed var(--line); border-radius: 12px;
  padding: 18px 16px; text-align: center; color: var(--muted); font-size: 13px;
  cursor: pointer; transition: all .15s; background: var(--hover-soft);
}
.bt-drop:hover, .bt-drop.drag { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.bt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.bt-empty { text-align: center; padding: 34px 12px; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: 12px; }
.bt-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px;
  background: var(--card); font-size: 13px;
}
.bt-item.done { border-color: #bbf7d0; background: rgba(34, 192, 122, .06); }
.bt-item.fail { border-color: #f3c1c1; background: rgba(229, 72, 77, .05); }
.bt-item.running, .bt-item.transcribing { border-color: var(--accent); background: var(--accent-soft); }
.bt-idx {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--seg-bg); font-size: 11px; color: var(--muted);
}
.bt-name { font-weight: 600; color: var(--ink); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-kind { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bt-size { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bt-status { font-size: 12px; color: var(--ink); white-space: nowrap; }
.bt-item.done .bt-status { color: #15803d; font-weight: 600; }
.bt-item.fail .bt-status { color: #b91c1c; }
.bt-item-acts { margin-left: auto; display: inline-flex; gap: 6px; }
.bt-error { flex-basis: 100%; font-size: 12px; color: #b91c1c; padding-left: 30px; }
.bt-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.bt-foot .spacer { flex: 1; }
.bt-progress-text { font-size: 12.5px; color: var(--muted); }

/* ========= 答辩模拟 ========= */
.df-workspace { margin-top: 0; gap: 14px; }
.df-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.df-head h2 { font-size: 18px; }
.df-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.df-round {
  font-size: 13px; color: var(--accent); font-weight: 600; white-space: nowrap;
  border: 1px solid var(--accent); border-radius: 999px; padding: 4px 14px; background: var(--accent-soft);
}
.df-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.df-setup .primary-btn { width: 100%; padding: 12px; font-size: 15px; }

.df-chat {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 430px; overflow-y: auto; padding: 4px 2px; margin-bottom: 12px;
}
.df-msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; }
.df-msg.student { align-self: flex-end; align-items: flex-end; }
.df-msg.judge { align-self: flex-start; align-items: flex-start; }
.df-who { font-size: 11.5px; color: var(--muted); }
.df-bubble {
  border-radius: 14px; padding: 11px 14px; font-size: 13.5px; line-height: 1.75;
  word-break: break-word;
}
.df-msg.judge .df-bubble { background: var(--accent-soft); border: 1px solid rgba(99, 102, 241, .18); border-top-left-radius: 4px; }
.df-msg.student .df-bubble { background: var(--hover-soft); border: 1px solid var(--line); border-top-right-radius: 4px; }
.df-bubble .md p { margin-bottom: 8px; }
.df-bubble .md p:last-child { margin-bottom: 0; }

.df-inputrow { display: flex; gap: 10px; align-items: flex-end; }
.df-input {
  flex: 1; min-height: 76px; max-height: 180px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-size: 13.5px; line-height: 1.7; color: var(--ink); background: var(--card);
  outline: none; font-family: inherit;
}
.df-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.df-input-acts { display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.df-input-acts .primary-btn { white-space: nowrap; }

/* ========= PPT 生成：幻灯片编辑器 ========= */
.slide-list { display: flex; flex-direction: column; gap: 12px; }
.slide-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); }
.slide-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.slide-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.slide-title {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 14px; font-weight: 600; color: var(--ink); background: var(--card); outline: none;
}
.slide-title:focus { border-color: var(--accent); }
.slide-del { border: none; background: var(--seg-bg); border-radius: 7px; width: 27px; height: 27px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.slide-del:hover { background: #fdecec; color: #e5484d; }
.slide-bullets {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.8; color: var(--ink); background: var(--card); outline: none;
}
.slide-bullets:focus { border-color: var(--accent); }
.slide-bullets::placeholder { color: #b6bacb; }
.slide-add {
  border: 1.5px dashed var(--line); background: none; border-radius: 12px;
  padding: 11px; width: 100%; font-size: 13.5px; color: var(--muted); transition: all .15s;
}
.slide-add:hover { border-color: var(--accent); color: var(--accent); }
.ppt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ppt-toolbar .spacer { flex: 1; }

@media (max-width: 900px) {
  .v-main { grid-template-columns: 1fr; }
  .au-main { grid-template-columns: 1fr; }
  .au-steps { display: none; }
  .pk-main { grid-template-columns: 1fr; }
  .pk-cats { flex-direction: row; flex-wrap: wrap; }
  .pk-list { grid-template-columns: 1fr; }

  /* —— 顶栏：模式下拉缩短 + 按钮只留图标（文字由 .btn-t 承载，窄屏隐藏） —— */
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar-actions { flex-wrap: wrap; }
  .topbar .ghost-btn, .topbar .primary-btn { padding: 8px 10px; }
  .topbar .btn-t { display: none; }
  .mode-quick { max-width: 96px; padding: 8px 5px; font-size: 12px; }

  /* —— 设置 / 弹窗：收紧留白，长提示更易读 —— */
  .modal { padding: 18px 15px; }
  .modal-mask { padding: 10px; }
  .lh-actions .primary-btn, .lh-actions .ghost-btn { min-width: 0; }

  /* —— 答辩模拟：输入框整行，按钮排其下 —— */
  .df-inputrow { flex-direction: column; align-items: stretch; }
  .df-input { min-height: 84px; }
  .df-input-acts { flex-direction: row; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .df-input-acts .primary-btn { padding: 9px 14px; }

  /* —— 批量：任务类型不换行，横向轻扫；任务名加宽 —— */
  #btOpSeg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  #btOpSeg .seg { white-space: nowrap; flex: 0 0 auto; }
  .bt-name { max-width: 58%; }

  /* —— 长表格（审校/对比/分镜）横向轻扫，不撑破屏幕 —— */
  .result-body .md table, #resultBody .md table { display: block; overflow-x: auto; white-space: nowrap; }
  .md { overflow-wrap: anywhere; }

  /* —— 提示词卡片：操作按钮更易点 —— */
  .pk-card-acts { width: 100%; justify-content: flex-end; }
  .v-ops { grid-template-columns: repeat(2, 1fr); }
}

/* ========= 拖拽导入高亮 / 历史搜索 ========= */
.input-card.dragover { outline: 2px dashed var(--accent); outline-offset: -6px; }
.history-search { padding: 0 16px 10px; }
.history-search input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s;
}
.history-search input:focus { border-color: var(--accent); }

/* ========= 毛玻璃开关行 ========= */
.glass-row { padding: 12px 2px 2px; }
.glass-row .chip { width: 100%; text-align: left; }
