/* doc-splitter 样式（M5 提前项）：
 * 参考 nyaa-tools 设计系统（tool-scope 冷调蓝紫系），令牌本地自持（零外部依赖，不用 Font Awesome CDN）。
 * 图标全部内联 SVG（stroke 线条风）。 */

:root {
  --bg-page: #f4f6fc;
  --accent: #7c8cec;
  --accent-deep: #5468e0;
  --accent-light: #e8edfa;
  --accent-soft: #f3f6fd;
  --purple: #a78bfa;
  --border: #e6eaf7;
  --border-strong: #ccd6ef;
  --focus-ring: rgba(84, 104, 224, .22);
  --shadow-soft: 0 4px 16px rgba(84, 104, 224, .14);
  --shadow-hover: 0 8px 24px rgba(84, 104, 224, .24);
  --text: #4d5780;
  --text-light: #8e97b8;
  --text-strong: #303b63;
  --success: #4cd97b;
  --warning: #ffb84d;
  --error: #ff6b81;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --transition: .25s var(--ease-bounce);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-sans); }

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #dfe6f5 100%);
  min-height: 100vh;
  padding: 20px;
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(84, 104, 224, 0.10);
  overflow: hidden;
}

/* ---------- header ---------- */
header {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  color: #fff;
  padding: 28px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
h1 { font-size: 2.1rem; margin-bottom: 8px; display: flex; align-items: center; gap: 14px; }
h1 svg { width: 2rem; height: 2rem; flex: none; }
.subtitle { font-size: 1.05rem; opacity: .92; font-weight: 300; }

/* ---------- 上下布局（主人指定：预览区放下方） ---------- */
.content { display: flex; flex-direction: column; }
.upload-section { padding: 34px 40px; }
.preview-section { padding: 34px 40px; background: #f9fafc; border-top: 1px solid var(--border); }

.section-title {
  font-size: 1.25rem; margin-bottom: 22px; color: var(--accent-deep);
  display: flex; align-items: center; gap: 10px;
}
.section-title svg { width: 1.35rem; height: 1.35rem; flex: none; }
.muted { color: var(--text-light); font-weight: 400; font-size: .85em; }

/* ---------- 拖放上传区 ---------- */
.upload-area {
  border: 3px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 42px 30px;
  text-align: center;
  background: #f8fafd;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 22px;
  outline: none;
}
.upload-area:hover, .upload-area:focus-visible, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.upload-icon svg { width: 56px; height: 56px; color: var(--accent); }
.upload-text { font-size: 1.1rem; margin: 14px 0 6px; color: var(--text-strong); }
.upload-subtext { color: var(--text-light); margin-bottom: 18px; font-size: .92rem; }

.file-input { display: none; }
.upload-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  padding: 11px 28px;
  border-radius: var(--r-md);
  font-weight: 600;
  cursor: pointer;
  font-size: .95rem;
  transition: all var(--transition);
  box-shadow: var(--shadow-soft);
}
.upload-area:hover .upload-btn { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.file-info {
  margin: 4px 0 18px;
  padding: 13px 16px;
  background: var(--accent-light);
  border-radius: var(--r-sm);
  border-left: 4px solid var(--accent-deep);
  font-size: .95rem;
  color: var(--text-strong);
  word-break: break-all;
}

/* 1GB 引导横幅（F12） */
.banner {
  margin: 4px 0 18px;
  padding: 13px 16px;
  background: #fff8e8;
  border-radius: var(--r-sm);
  border-left: 4px solid var(--warning);
  font-size: .92rem;
  color: #8a6a33;
  line-height: 1.6;
  word-break: break-all;
}

.format-hint { display: flex; gap: 10px; margin: 0 0 24px; flex-wrap: wrap; }
.format-tag {
  background: var(--accent-light);
  padding: 6px 13px;
  border-radius: var(--r-pill);
  font-size: .82rem;
  color: var(--accent-deep);
  font-weight: 500;
}

/* ---------- 设置区 ---------- */
.settings {
  background: #fff;
  padding: 22px 24px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.setting-label { font-weight: 600; color: var(--text); }

.mode-switch { display: flex; gap: 10px; }
.size-option {
  padding: 9px 18px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all .2s;
  font-size: .92rem;
  color: var(--text);
}
.size-option:hover { background: var(--accent-light); }
.size-option.active { background: var(--accent-deep); color: #fff; }
.size-option input { display: none; }

.custom-size { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .92rem; }
.custom-size-input {
  width: 110px;
  padding: 9px 12px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  text-align: center;
  font-size: .95rem;
  color: var(--text-strong);
  outline: none;
  transition: all var(--transition);
}
.custom-size-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }

.warn-text {
  padding: 10px 14px;
  background: #fff8e8;
  border-left: 3px solid var(--warning);
  border-radius: var(--r-sm);
  color: #8a6a33;
  font-size: .88rem;
  margin-bottom: 14px;
}

/* 设置提示文案（group-hint / sep-note 一直在用，此前漏定义——本轮补齐） */
.setting-hint { font-size: .82rem; color: var(--text-light); line-height: 1.6; margin: -4px 0 14px; }

/* 功能开关（N7 最小形态：流式 ZIP） */
.opt-check { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; color: var(--text); line-height: 1.55; margin: 2px 0 14px; cursor: pointer; }
.opt-check input { margin-top: 3px; flex: none; width: 15px; height: 15px; accent-color: var(--accent-deep); cursor: pointer; }

/* ---------- 动作按钮 ---------- */
.action-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; justify-content: center; align-items: center; gap: 10px;
  box-shadow: var(--shadow-soft);
}
.action-btn svg { width: 1.2rem; height: 1.2rem; }
.action-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.action-btn:active:not(:disabled) { transform: scale(.97); }
.action-btn:disabled { background: var(--border-strong); cursor: not-allowed; box-shadow: none; }
.action-btn--ghost {
  background: #fff; color: var(--accent-deep);
  border: 1.5px solid var(--border-strong);
  box-shadow: none;
  margin-top: 10px; padding: 11px; font-size: .95rem;
}
.action-btn--ghost:hover:not(:disabled) { border-color: var(--accent); }
.action-btn--ghost:disabled { color: var(--text-light); }

/* ---------- 预览区 ---------- */
.preview-area {
  background: #fff;
  border-radius: var(--r-md);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  height: 300px;
  overflow: auto;
  margin-bottom: 10px;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 60px 20px; color: var(--text-light); text-align: center;
}
.empty-state svg { width: 44px; height: 44px; stroke: var(--border-strong); }
.preview-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.preview-table th {
  background: var(--accent-light);
  padding: 10px 13px;
  text-align: left;
  font-weight: 600;
  color: var(--text-strong);
  border-bottom: 2px solid var(--border-strong);
  position: sticky; top: 0;
  white-space: nowrap;
}
.preview-table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-table tr:hover td { background: var(--accent-soft); }
.preview-note { font-size: .82rem; color: var(--text-light); margin-bottom: 18px; }

/* ---------- 进度 ---------- */
.progress-container { margin: 20px 0; }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .92rem; color: var(--text-strong); }
.progress-bar {
  height: 10px;
  background: var(--accent-light);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width .3s ease;
}

/* ---------- 错误（E1-E4） ---------- */
.error {
  margin: 18px 0;
  padding: 14px 16px;
  background: #fff1f3;
  border-left: 4px solid var(--error);
  border-radius: var(--r-sm);
  color: #8f3a47;
}
.error #error-title { font-weight: 700; margin-bottom: 4px; }
.mini-btn {
  margin-top: 10px;
  padding: 6px 14px;
  background: #fff;
  border: 1.5px solid var(--error);
  color: #8f3a47;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: .85rem;
  transition: all .2s;
}
.mini-btn:hover { background: #ffe3e8; }

/* ---------- 结果列表 ---------- */
.result-title { margin-top: 26px; }
.result-list { margin: 0 0 14px; max-height: 260px; overflow-y: auto; }
.result-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 15px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 9px;
  box-shadow: 0 2px 5px rgba(84, 104, 224, .06);
}
.result-name { font-weight: 600; color: var(--text-strong); word-break: break-all; font-size: .93rem; }
.result-meta { font-size: .82rem; color: var(--text-light); margin-top: 2px; }
.download-btn {
  flex: none;
  background: var(--accent-deep);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: .85rem;
  transition: all .2s;
  text-decoration: none;
}
.download-btn:hover { background: var(--accent); }
.download-all-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-soft);
}
.download-all-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.download-all-btn:disabled, .deliver-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- 交付层（M4：三路交付）---------- */
.deliver-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.deliver-row .download-all-btn { flex: 1 1 150px; width: auto; }
.deliver-btn {
  flex: 1 1 150px;
  padding: 12px;
  background: #fff;
  color: var(--accent-deep);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  font-weight: 600;
  cursor: pointer;
  font-size: .95rem;
  transition: all var(--transition);
}
.deliver-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.deliver-status { font-size: .85rem; margin-top: 12px; text-align: center; }
.pv-more { margin-top: 10px; }

/* ---------- footer / 工具类 ---------- */
footer {
  text-align: center;
  padding: 18px;
  color: var(--text-light);
  font-size: .88rem;
  border-top: 1px solid var(--border);
  background: #f9fafc;
}
.hidden { display: none !important; }

@media (max-width: 768px) {
  header { padding: 22px 24px; }
  .upload-section, .preview-section { padding: 24px; }
  .mode-switch { flex-wrap: wrap; }
}
