/* ── Theme ────────────────────────────────────────────────────────── */
:root {
  --primary:    #818cf8;
  --secondary:  #6366f1;
  --grad:       linear-gradient(135deg, #818cf8, #6366f1);
  --bg:         #0f0f14;
  --bg-card:    #1e1e28;
  --bg-surface: #18181f;
  --text:       #e8e8f0;
  --text-muted: #a0a0b8;
  --text-faint: #636380;
  --border:        rgba(255,255,255,.07);
  --border-medium: rgba(255,255,255,.12);
  --radius:    14px;
  --radius-sm:  8px;
  --font: system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.7; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; font-family: inherit; }

/* ── Header ───────────────────────────────────────────────────────── */
.site-header { background: rgba(15,15,20,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1140px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo-icon { width: 32px; height: 32px; flex-shrink: 0; }
.logo-text { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.main-nav { display: flex; align-items: center; gap: 4px; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500; color: var(--text-muted); transition: color .15s, background .15s; }
.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(255,255,255,.06); }
@media (max-width: 540px) { .main-nav { display: none; } }

/* ── Layout ───────────────────────────────────────────────────────── */
.main-wrap { max-width: 760px; margin: 0 auto; padding: 28px 20px 80px; }
.ad-slot { background: var(--bg-surface); border: 1px dashed var(--border-medium); border-radius: var(--radius-sm); min-height: 90px; display: flex; align-items: center; justify-content: center; margin: 18px 0; color: var(--text-faint); font-size: .78rem; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.tool-hero { text-align: center; padding: 20px 0 28px; }
.tool-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 20px; background: rgba(129,140,248,.12); color: var(--primary); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.tool-title { font-size: clamp(1.8rem,4vw,2.6rem); font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.gradient-title { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tool-subtitle { font-size: 1rem; color: var(--text-muted); max-width: 580px; margin: 0 auto; }

/* ── Error banner ─────────────────────────────────────────────────── */
.error-banner { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.25); border-radius: var(--radius-sm); padding: 12px 16px; font-size: .88rem; color: #f87171; margin-bottom: 16px; }

/* ── Upload zone ──────────────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border-medium); border-radius: var(--radius); padding: 52px 24px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--bg-surface); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: rgba(129,140,248,.04); }
.upload-icon { width: 64px; height: 64px; margin: 0 auto 20px; background: rgba(129,140,248,.12); border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.upload-icon svg { width: 30px; height: 30px; stroke: var(--primary); }
.upload-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.upload-sub { font-size: .88rem; color: var(--text-faint); margin-bottom: 24px; line-height: 1.5; }
.btn-upload { display: inline-block; padding: 12px 32px; background: var(--grad); color: #fff; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 700; cursor: pointer; transition: opacity .15s; }
.btn-upload:hover { opacity: .87; }
.upload-note { font-size: .76rem; color: var(--text-faint); margin-top: 14px; }

/* ── Files stage ──────────────────────────────────────────────────── */
.files-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.files-summary { font-size: .82rem; color: var(--text-muted); }
.files-summary strong { color: var(--text); }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.btn-add-more { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: rgba(129,140,248,.1); border: 1px solid rgba(129,140,248,.25); border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600; color: var(--primary); transition: background .15s, border-color .15s; }
.btn-add-more:hover { background: rgba(129,140,248,.18); border-color: rgba(129,140,248,.45); }
.btn-add-more svg { width: 14px; height: 14px; stroke: var(--primary); fill: none; }
.btn-clear-all { padding: 7px 12px; background: none; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); font-size: .78rem; color: var(--text-faint); transition: color .15s, border-color .15s; }
.btn-clear-all:hover { color: #f87171; border-color: rgba(248,113,113,.35); }

/* ── File list ────────────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color .15s, background .15s, opacity .15s;
  user-select: none;
}
.file-item.is-dragging { opacity: .4; }
.file-item.drop-target { border-color: var(--primary); background: rgba(129,140,248,.06); }

.drag-handle {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  cursor: grab;
  padding: 4px 3px;
  flex-shrink: 0;
  opacity: .4;
  transition: opacity .15s;
}
.drag-handle:hover { opacity: .9; }
.drag-handle:active { cursor: grabbing; }
.drag-dot-row { display: flex; gap: 2.5px; }
.drag-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }
@media (max-width: 540px) { .drag-handle { display: none; } }

.file-order {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(129,140,248,.15);
  color: var(--primary);
  font-size: .68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.file-icon {
  width: 36px; height: 36px;
  background: rgba(129,140,248,.1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-icon svg { width: 18px; height: 18px; stroke: var(--primary); fill: none; }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: .74rem; color: var(--text-faint); margin-top: 1px; }

.reorder-btns { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.btn-reorder {
  width: 26px; height: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-faint);
  font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
  padding: 0;
}
.btn-reorder:hover:not(:disabled) { color: var(--text); border-color: var(--border-medium); background: rgba(255,255,255,.06); }
.btn-reorder:disabled { opacity: .25; cursor: not-allowed; }
.btn-reorder svg { width: 10px; height: 10px; stroke: currentColor; }

.btn-remove {
  width: 30px; height: 30px;
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-faint);
  font-size: 1.15rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-remove:hover { color: #f87171; border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.08); }

/* ── Merge button ─────────────────────────────────────────────────── */
.btn-merge {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px;
  background: var(--grad);
  color: #fff; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 700;
  border: none;
  transition: opacity .15s;
  margin-bottom: 8px;
}
.btn-merge:hover:not(:disabled) { opacity: .87; }
.btn-merge:disabled { opacity: .4; cursor: not-allowed; }
.btn-merge svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.merge-hint { text-align: center; font-size: .78rem; color: var(--text-faint); margin-top: 4px; }

/* ── Progress ─────────────────────────────────────────────────────── */
.progress-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; text-align: center; }
.progress-title { font-size: .95rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.progress-file { font-size: .8rem; color: var(--text-faint); margin-bottom: 16px; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-bar-bg { background: rgba(255,255,255,.06); border-radius: 6px; height: 8px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; background: var(--grad); border-radius: 6px; transition: width .25s ease; }
.progress-text { font-size: .78rem; color: var(--text-faint); }

/* ── Done / result ────────────────────────────────────────────────── */
.result-card { background: var(--bg-card); border: 1px solid rgba(129,140,248,.3); border-radius: var(--radius); padding: 24px; margin-bottom: 14px; }
.result-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; background: rgba(129,140,248,.12); color: var(--primary); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 16px; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 420px) { .result-stats { grid-template-columns: 1fr 1fr; } }
.stat-block { background: var(--bg-surface); border-radius: var(--radius-sm); padding: 14px 10px; text-align: center; }
.stat-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 5px; }
.stat-value { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.stat-unit  { font-size: .75rem; color: var(--text-faint); margin-top: 2px; }

.btn-download { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 14px; background: var(--grad); color: #fff; border-radius: var(--radius-sm); font-size: .96rem; font-weight: 700; border: none; transition: opacity .15s; margin-bottom: 8px; }
.btn-download:hover { opacity: .87; }
.btn-download svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.btn-secondary-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-secondary { flex: 1; min-width: 140px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; background: none; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); color: var(--text-muted); font-size: .84rem; font-weight: 600; transition: border-color .15s, color .15s; }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-secondary svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

/* ── SEO sections ─────────────────────────────────────────────────── */
.page-section { max-width: 100%; }
.section-head { text-align: center; margin-bottom: 28px; }
.section-title { font-size: clamp(1.2rem,2.5vw,1.5rem); font-weight: 700; color: #fff; margin-bottom: 8px; }
.section-desc  { font-size: .92rem; color: var(--text-muted); max-width: 560px; margin: 0 auto; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 42px 0; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 13px; }
.feature-card  { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature-icon  { font-size: 1.5rem; margin-bottom: 9px; }
.feature-title { font-size: .92rem; font-weight: 700; color: #fff; margin-bottom: 5px; }
.feature-desc  { font-size: .82rem; color: var(--text-muted); line-height: 1.6; }

.steps-grid { display: flex; flex-direction: column; gap: 12px; }
.step-card   { display: flex; align-items: flex-start; gap: 15px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.step-number { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800; flex-shrink: 0; }
.step-title  { font-size: .92rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.step-desc   { font-size: .82rem; color: var(--text-muted); }

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-q { width: 100%; padding: 14px 17px; background: none; color: var(--text); font-size: .9rem; font-weight: 600; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: background .15s; }
.faq-q:hover { background: rgba(255,255,255,.03); }
.faq-icon { font-size: 1.1rem; color: var(--primary); flex-shrink: 0; transition: transform .2s; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-a p { padding: 0 17px 14px; font-size: .87rem; color: var(--text-muted); line-height: 1.7; }
.faq-item.open .faq-a  { max-height: 500px; }
.faq-item.open .faq-icon { transform: rotate(45deg); }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 12px; }
.related-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.related-card:hover { border-color: var(--primary); text-decoration: none; }
.related-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.related-icon svg { width: 17px; height: 17px; color: #fff; }
.related-name { font-size: .88rem; font-weight: 700; color: var(--text); }
.related-desc { font-size: .77rem; color: var(--text-muted); flex: 1; }
.related-link { font-size: .77rem; color: var(--primary); font-weight: 600; }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a1a28; border: 1px solid rgba(129,140,248,.35); color: var(--text); padding: 10px 20px; border-radius: 8px; font-size: .88rem; font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 44px 20px 28px; }
.footer-inner { max-width: 1140px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3,1fr); gap: 32px; margin-bottom: 36px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-brand-text { font-size: .82rem; color: var(--text-faint); margin-top: 10px; }
.footer-heading { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: .85rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-faint); flex-wrap: wrap; gap: 8px; }
