:root {
  --bg: #faf9f7;
  --panel: #ffffff;
  --border: #e8e6e3;
  --text: #1f2328;
  --muted: #8a8f98;
  --accent: #d97706;
  --accent-dark: #b45309;
  --ok: #16a34a;
  --err: #dc2626;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.app {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}
.sidebar {
  width: 220px;
  flex: none;
  position: sticky;
  top: 16px;
  padding-left: 16px;
}
.new-task { width: 100%; }
.task-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.task-item {
  position: relative;
  padding: 8px 26px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.task-item:hover { border-color: var(--accent); }
.task-item.active { border-color: var(--accent); background: #fff7ed; }
.task-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.task-del {
  position: absolute;
  top: 5px; right: 5px;
  border: none; background: transparent;
  color: var(--muted); font-size: 15px; line-height: 1;
  cursor: pointer; padding: 2px 5px; border-radius: 5px;
}
.task-del:hover { color: var(--err); background: #fef2f2; }
.main { flex: 1; min-width: 0; }
.key-hint { margin-top: 4px; }
.key-hint a { color: var(--accent-dark); }

@media (max-width: 700px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; position: static; padding: 0 16px; align-self: stretch; }
  .task-list { flex-direction: row; flex-wrap: wrap; }
  .task-item { min-width: 150px; flex: 1; }
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 12px; font-size: 18px;
}
.header h1 { font-size: 20px; margin: 0; }
.tagline { margin: 0; font-size: 13px; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  max-width: 860px;
  margin: 14px auto;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step {
  width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 13px;
  flex: none;
}

.hint { font-size: 13px; color: var(--muted); margin: 6px 0; }

.optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: #f5f5f4;
  border-radius: 6px;
  padding: 2px 8px;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
  max-height: 460px;
  overflow-y: auto;
}
.frame-item {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
}
.frame-item img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.frame-item .ft {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
}
.frame-item .fc {
  position: absolute;
  top: 6px; left: 6px;
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.frame-item.checked { border-color: var(--accent); }
.frame-item .done-tag {
  position: absolute;
  top: 4px; right: 6px;
  font-size: 11px;
  color: #4ade80;
  background: rgba(0,0,0,.55);
  border-radius: 4px;
  padding: 0 5px;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(255, 255, 255, .88);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-overlay-inner {
  border: 3px dashed var(--accent);
  border-radius: 18px;
  padding: 48px 72px;
  font-size: 20px;
  color: var(--accent-dark);
  background: #fff7ed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(31, 35, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  width: min(760px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal-box h3 { margin: 0 0 6px; font-size: 16px; }
#mdEditor {
  width: 100%;
  min-height: 280px;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  margin-top: 8px;
}
#mmPreviewWrap { margin-top: 10px; }
#mmPreview {
  margin-top: 8px;
  height: 340px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
#mmPreview svg { width: 100%; height: 100%; }
.modal-actions { margin-top: 14px; justify-content: flex-end; }

.visual {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
  max-height: 320px;
  overflow-y: auto;
}
.visual .vline {
  display: flex;
  gap: 12px;
  padding: 7px 16px;
  font-size: 14px;
}
.visual .vline .ts {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  flex: none;
  font-size: 13px;
  padding-top: 1px;
}
.visual .vline .vtext { white-space: pre-wrap; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: #fff7ed;
}
.drop-zone.compact { padding: 10px 16px; }
.drop-zone.compact .drop-icon,
.drop-zone.compact .hint { display: none; }
.drop-zone.compact p { margin: 0; font-size: 13px; }
.drop-icon { font-size: 34px; }
.drop-zone p { margin: 6px 0; }

.file-info {
  margin-top: 12px;
  font-size: 14px;
  padding: 10px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn.mini { padding: 3px 10px; font-size: 12px; border-radius: 7px; }

.export-hint { margin-top: 10px; }
.export-hint summary {
  color: #2563eb;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
}
.export-hint summary:hover { text-decoration: underline; }
.export-hint p {
  margin: 8px 0 2px;
  font-size: 13px;
  color: var(--muted);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

.status { font-size: 13px; color: var(--muted); }
.status.error { color: var(--err); }
.ok { color: var(--ok); font-size: 13px; }

.transcript {
  margin-top: 14px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
}
.transcript .line {
  display: flex;
  gap: 12px;
  padding: 7px 16px;
  font-size: 14px;
}
.transcript .line:hover { background: #fafaf9; }
.transcript .ts {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  flex: none;
  font-size: 13px;
  padding-top: 1px;
}
.transcript .speaker {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  background: #f5f5f4;
  border-radius: 6px;
  padding: 1px 8px;
  height: fit-content;
}

.summary { margin-top: 14px; font-size: 14px; }
.summary h3 { font-size: 15px; margin: 16px 0 8px; }
.summary ul { margin: 6px 0; padding-left: 20px; }
.summary .chapter { display: flex; gap: 10px; padding: 4px 0; }
.summary .chapter .ts { color: var(--accent-dark); flex: none; font-variant-numeric: tabular-nums; }

.settings label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 4px;
}
.settings input[type="password"],
.settings input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.settings .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  margin-top: 16px;
}

.chat { margin-bottom: 12px; max-height: 340px; overflow-y: auto; }
.chat .msg {
  padding: 10px 14px;
  border-radius: 10px;
  margin: 8px 0;
  font-size: 14px;
  white-space: pre-wrap;
}
.chat .msg.q { background: #fff7ed; border: 1px solid #fed7aa; }
.chat .msg.a { background: #f8fafc; border: 1px solid var(--border); }

.ask-row { margin-top: 6px; align-items: flex-end; }
.ask-row textarea {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  max-height: 150px;
  overflow-y: auto;
}

.footer {
  max-width: 860px;
  margin: 20px auto 40px;
  padding: 0 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* 视频来源引导 */
.guide {
  margin-top: 12px;
  border: 1px dashed #f59e0b;
  border-radius: 10px;
  background: #fffbeb;
  padding: 10px 14px;
  font-size: 13px;
}
.guide summary {
  cursor: pointer;
  font-weight: 600;
  color: #92400e;
  user-select: none;
}
.guide-steps { margin: 10px 0 6px; padding-left: 20px; line-height: 1.9; color: #451a03; }
.guide-link { margin: 0 6px; text-decoration: none; }
.guide-tip { margin: 8px 0 2px; color: #92400e; font-size: 12px; line-height: 1.6; }
#rsStatus.ok { color: #16a34a; }
#rsStatus.err { color: #b45309; }
