:root {
  --bg: #0d1117;
  --panel: #161b26;
  --panel-2: #1c2331;
  --line: #2a3346;
  --text: #e6eaf2;
  --muted: #8b94a7;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(124, 92, 255, .12), transparent),
    radial-gradient(900px 400px at 10% -5%, rgba(79, 140, 255, .10), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; backdrop-filter: blur(8px);
  background: rgba(13, 17, 23, .8); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 17px; color: #fff;
}
.badge {
  font-size: 11px; color: var(--ok); border: 1px solid rgba(62, 207, 142, .4);
  padding: 2px 8px; border-radius: 999px; font-weight: 500;
}
.nav { display: flex; gap: 6px; flex: 1; }
.nav-item {
  padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--muted); cursor: pointer;
}
.nav-item.active { color: var(--text); background: var(--panel-2); }
.nav-item:hover { color: var(--text); }
.env-pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }

/* 布局 */
.layout {
  display: grid; grid-template-columns: minmax(380px, 520px) 1fr;
  gap: 24px; padding: 28px; max-width: 1400px; margin: 0 auto;
  align-items: start;
}
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

/* 上传区 */
.dropzone {
  border: 2px dashed #3a4761; border-radius: var(--radius);
  padding: 42px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; outline: none;
}
.dropzone:hover, .dropzone:focus, .dropzone.drag {
  border-color: var(--accent); background: rgba(79, 140, 255, .06);
}
.dz-icon { color: var(--accent); margin-bottom: 14px; }
.dz-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.dz-sub { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.dz-note { font-size: 12px; color: var(--ok); }

/* 链接输入 */
.linkrow { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.linkrow .input { flex: 1; min-width: 0; }

/* 文件卡片 */
.filecard {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-top: 16px;
}
.fc-icon { font-size: 26px; }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* 设置 */
.settings { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.settings-title { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lbl { font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; color: var(--muted); padding: 7px 14px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.seg-btn small { opacity: .7; font-size: 11px; margin-left: 2px; }
.seg-btn.active { background: var(--accent); color: #fff; }
.select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; min-width: 200px;
}
.switch {
  width: 46px; height: 26px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; position: relative; transition: background .2s;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--muted); transition: all .2s;
}
.switch[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-pressed="true"] .knob { left: 23px; background: #fff; }
.llm-box {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.llm-tip { font-size: 12px; color: var(--muted); }
.input {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }

/* 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 14px; font-size: 15px; }

/* 占位 */
.placeholder { text-align: center; padding: 60px 20px; }
.ph-icon { font-size: 46px; margin-bottom: 16px; }
.ph-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.ph-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.ph-list {
  list-style: none; display: inline-block; text-align: left;
  font-size: 14px; color: var(--muted); line-height: 2;
}

/* 进度 */
.progress-card { padding: 8px 4px; }
.pc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pc-title { font-size: 15px; font-weight: 700; }
.pc-msg { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pc-pct { margin-left: auto; font-size: 22px; font-weight: 700; color: var(--accent); }
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px; transition: width .4s ease;
}

/* 结果 */
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.rc-title { font-size: 17px; font-weight: 700; }
.rc-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 10px 16px; font-size: 14px; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.textview {
  white-space: pre-wrap; line-height: 1.9; font-size: 14px;
  max-height: 480px; overflow-y: auto; padding: 4px;
}
.textview.md { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; }
.segview { max-height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.seg-item { display: flex; gap: 12px; background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.seg-time { font-family: Consolas, monospace; font-size: 12px; color: var(--accent); white-space: nowrap; padding-top: 2px; }
.seg-speaker { color: var(--accent-2); font-weight: 600; margin-right: 6px; }
.seg-text { flex: 1; font-size: 14px; line-height: 1.7; }

/* 错误 */
.error-card { text-align: center; padding: 50px 20px; }
.ec-title { font-size: 17px; font-weight: 700; color: var(--err); margin-bottom: 10px; }
.ec-msg { font-size: 13px; color: var(--muted); margin-bottom: 20px; word-break: break-all; }

.hidden { display: none !important; }

/* toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 20px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
