:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f6f5f1;
  --text: #2b2b2b;
  --muted: #8c8c84;
  --border: #ecebe6;
  --border-strong: #dedcd4;
  --accent: #f3a9c4;        /* 柔和粉 */
  --accent-soft: #fde7ef;
  --accent-2: #f6dd8e;      /* 柔和黄 */
  --accent-2-soft: #fbf3d6;
  --accent-strong: #e681a8;
  --danger: #d96a6a;
  --success: #6fae7e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 24px rgba(40, 38, 32, 0.06);
  --shadow-sm: 0 2px 8px rgba(40, 38, 32, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  text-align: center;
  padding: 34px 16px 18px;
}
.app-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.app-header .subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* 环境变量横幅 */
.env-banner {
  max-width: 880px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  background: var(--accent-2-soft);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius-sm);
  color: #7a6516;
  font-size: 13.5px;
  text-align: center;
  line-height: 1.5;
}
.env-banner code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12.5px;
}

/* 标签页 */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px auto 4px;
  flex-wrap: wrap;
}
.tab {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-weight: 500;
}
.tab:hover { border-color: var(--accent); }
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  max-width: 880px;
  margin: 18px auto 40px;
  padding: 0 16px;
}

.format-hint {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}

/* 拖拽区 */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  outline: none;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.dropzone-inner .dz-title { margin: 0; font-size: 16px; }
.dropzone-inner .dz-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.link-btn {
  border: none;
  background: none;
  color: var(--accent-strong);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* 选项区 */
.options { margin: 16px 0 6px; }
.opt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.opt-label { font-size: 13.5px; color: var(--text); min-width: 140px; }
.opt-row input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--accent-strong); }
.opt-value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 36px; text-align: right; }
.opt-row select {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
}

/* 操作按钮 */
.actions {
  display: flex;
  gap: 10px;
  margin: 16px 0 8px;
  flex-wrap: wrap;
}
.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.16s ease;
  font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-ghost { color: var(--muted); }

/* 整体进度 */
.overall-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 18px;
}
.overall-progress .bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.overall-progress .bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}
.overall-text { font-size: 13px; color: var(--muted); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* 文件列表 */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.empty-hint { text-align: center; color: var(--muted); font-size: 13.5px; margin: 22px 0; }

.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease;
}
.file-item.done { border-color: #cfe6d4; }
.file-item.failed { border-color: #f0cfcf; }
.file-item.invalid { border-color: #f0cfcf; background: #fdf6f6; }

.file-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.file-info { display: flex; flex-direction: column; min-width: 0; }
.file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.file-size { font-size: 12px; color: var(--muted); }

.file-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.target-select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.file-status {
  font-size: 12.5px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}
.file-status.status-converting { background: var(--accent-2-soft); color: #7a6516; }
.file-status.status-done { background: #e4f1e8; color: #3f7a51; }
.file-status.status-error { background: #f7e3e3; color: var(--danger); }

.btn-sm {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn-sm.btn-remove:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm:disabled { opacity: 0.45; cursor: not-allowed; }

.file-progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--border);
}
.file-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}
.file-warning {
  margin-top: 9px;
  font-size: 12.5px;
  color: #9a6b1f;
  background: var(--accent-2-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

/* 页脚 */
.app-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 10px 16px 30px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 28, 24, 0.42); }
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  width: min(760px, 92vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 18px; overflow: auto; background: var(--surface-2); }
.modal-body .muted { color: var(--muted); text-align: center; padding: 20px 0; }

.preview-img { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: var(--radius-sm); }
.preview-video { width: 100%; max-height: 64vh; border-radius: var(--radius-sm); background: #000; }
.preview-iframe { width: 100%; height: 70vh; border: none; border-radius: var(--radius-sm); background: #fff; }
.preview-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 0;
  max-height: 70vh;
  overflow: auto;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #2b2b2b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 60;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* 响应式 */
@media (max-width: 640px) {
  .file-main { flex-direction: column; align-items: flex-start; }
  .file-controls { width: 100%; }
  .file-name { max-width: 100%; }
  .actions .btn { flex: 1; text-align: center; }
}
