/* ========== 设计令牌（商业化一致风格） ========== */
:root {
  --bg-base: #0c1222;
  --bg-elevated: #141b2d;
  --bg-card: rgba(20, 27, 45, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-muted: rgba(148, 163, 184, 0.25);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.15);
  --warn: #eab308;
  --warn-soft: rgba(234, 179, 8, 0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --space-unit: 8px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 背景层次 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.08), transparent),
              linear-gradient(180deg, var(--bg-base) 0%, #111827 50%, var(--bg-base) 100%);
  pointer-events: none;
  z-index: -1;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 2) calc(var(--space-unit) * 4);
}

/* ========== 页头 ========== */
.header {
  text-align: center;
  margin-bottom: calc(var(--space-unit) * 3);
  padding: calc(var(--space-unit) * 2.5) var(--space-unit);
}
.header-title {
  margin: 0 0 var(--space-unit) 0;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.header .subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ========== 区块与卡片 ========== */
.section { margin-bottom: calc(var(--space-unit) * 2); }
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 2.5);
  box-shadow: var(--shadow-card);
}
.section-title {
  margin: 0 0 calc(var(--space-unit) * 1.5) 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: var(--space-unit);
  border-bottom: 1px solid var(--border-subtle);
}

/* ========== 上传区 ========== */
.upload-section .section-title { margin-bottom: var(--space-unit); }
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-muted);
  border-radius: var(--radius-md);
  padding: calc(var(--space-unit) * 2.5);
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  margin-bottom: var(--space-unit);
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.file-input {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  overflow: hidden;
}
.file-label {
  display: block;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.upload-zone .file-label:hover { color: var(--text-primary); }

.hint {
  margin: var(--space-unit) 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.multi-upload {
  margin-top: var(--space-unit);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-unit);
  align-items: center;
}
.multi-upload .btn { margin: 0; }
.folder-hint { margin-top: calc(var(--space-unit) / 2); }
.file-names {
  margin: var(--space-unit) 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ========== 选项区：行与控件 ========== */
.options {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-unit) * 1.5);
}
.option-group {
  margin-bottom: calc(var(--space-unit) / 2);
}
.option-group:last-child { margin-bottom: 0; }
.option-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: calc(var(--space-unit) * 1.5);
  align-items: center;
  min-height: 36px;
}
.option-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
}
.option-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-unit);
}
.input-select,
.input-number {
  padding: 6px 10px;
  font-size: 0.875rem;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  min-width: 200px;
}
.input-number { min-width: 72px; width: 72px; }
.input-select:focus,
.input-number:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.option-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge-success {
  background: var(--success-soft);
  color: #4ade80;
}
.badge-warn {
  background: var(--warn-soft);
  color: #facc15;
}

/* 复选框选项 */
.option-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-unit);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.option-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.option-check-label { flex: 1; line-height: 1.45; }
.option-desc {
  margin: 4px 0 0 26px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.option-group-sub {
  padding-left: var(--space-unit);
  border-left: 3px solid var(--accent-soft);
}

/* 转化建议折叠 */
.option-tips {
  margin-top: calc(var(--space-unit) * 1.5);
  padding: var(--space-unit) calc(var(--space-unit) * 1.5);
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.option-tips summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.option-tips[open] summary { margin-bottom: var(--space-unit); }
.option-tips ul {
  margin: 0 0 0 1rem;
  padding-left: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-muted);
}
.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--text-muted);
}

.submit-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-unit);
}
.submit-section .btn-primary { font-size: 0.95rem; padding: 12px 24px; }
.storage-dir-name { font-size: 0.8rem; color: var(--text-muted); }

/* ========== 转换状态 ========== */
.progress-section {
  padding: calc(var(--space-unit) * 2);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.progress-box .progress-title {
  margin: 0 0 var(--space-unit) 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.progress-box .progress-text { margin: 0; font-size: 0.9rem; color: var(--text-primary); }
.progress-box .progress-path { margin: var(--space-unit) 0 0 0; font-size: 0.85rem; }
.progress-path-link {
  color: #7dd3fc;
  text-decoration: underline;
  cursor: pointer;
}
.progress-box .hint {
  color: #e8b86d;
  font-size: 0.85rem;
  margin-top: var(--space-unit);
  padding: var(--space-unit);
  background: rgba(232, 184, 109, 0.1);
  border-radius: var(--radius-sm);
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 34, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loading-content {
  text-align: center;
  color: var(--text-primary);
  padding: calc(var(--space-unit) * 3);
}
.loading-text { font-size: 1rem; margin: 0 0 var(--space-unit) 0; }
.loading-progress { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.loading-hint { margin-top: var(--space-unit); font-size: 0.85rem; color: var(--text-muted); }

/* ========== 页脚 ========== */
.footer {
  margin-top: calc(var(--space-unit) * 3);
  padding: calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 2);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer p { margin: 0; }
.footer p + p { margin-top: 4px; }

/* ========== 消息与工具 ========== */
.flashes { list-style: none; padding: 0; margin: 0 0 var(--space-unit) 0; }
.flash {
  padding: var(--space-unit) calc(var(--space-unit) * 1.5);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-unit);
  font-size: 0.875rem;
}
.flash.error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.flash.message { background: var(--accent-soft); color: #93c5fd; }

.hidden { display: none !important; }
/* ========== 移动端适配 ========== */
@media screen and (max-width: 480px) {
  :root { --space-unit: 6px; }
  body { font-size: 14px; }
  .wrap { padding: 12px 9px 24px; }
  .header { margin-bottom: 16px; padding: 8px 3px; }
  .header-title { font-size: 1.35rem; }
  .header .subtitle { font-size: 0.8rem; }
  .section-card { padding: 16px; border-radius: 10px; }
  .section-title { font-size: 1rem; margin-bottom: 12px; }
  .upload-zone { padding: 16px; min-height: 100px; }
  .file-label { font-size: 0.9rem; padding: 6px; }
  .hint { font-size: 0.75rem; }
  .multi-upload { flex-direction: column; gap: 6px; }
  .multi-upload .btn { width: 100%; justify-content: center; }
  .options { gap: 12px; }
  .option-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .option-label { font-size: 0.9rem; }
  .option-controls { width: 100%; flex-wrap: wrap; gap: 4px; }
  .input-select, .input-number { width: 100%; font-size: 0.9rem; padding: 8px 10px; }
  .option-check { font-size: 0.85rem; }
  .option-check input[type="checkbox"] { width: 16px; height: 16px; }
  .option-desc { font-size: 0.75rem; margin-left: 24px; }
  .submit-section { flex-direction: column; align-items: stretch; }
  .submit-section .btn-primary { width: 100%; font-size: 1rem; padding: 14px 20px; }
  .storage-dir-name { text-align: center; font-size: 0.75rem; }
  .progress-section { padding: 12px; }
  .progress-box .progress-title, .progress-box .progress-text { font-size: 0.85rem; }
  .footer { padding: 8px 12px; font-size: 0.7rem; }
  .loading-overlay { padding: 16px; }
  .loading-text { font-size: 0.9rem; }
  .folder-hint, #folderBtn { display: none; }
}
@media screen and (max-width: 360px) {
  .header-title { font-size: 1.2rem; }
  .section-card { padding: 12px; }
  .badge { font-size: 0.65rem; padding: 1px 6px; }
}
