:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --light: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #ea580c;
  --warn-bg: #fff7ed;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 16px; text-decoration: none; color: inherit; }
.brand-icon { width: 32px; height: 32px; border-radius: 8px; }
.brand-dot { display: none; }
.topbar-nav { display: flex; gap: 16px; }
.topbar-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.topbar-nav a:hover { color: var(--text); }

/* ── Main layout ── */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 100px;
}

/* ── Hero ── */

.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 800; margin-bottom: 6px; }
.hero p { color: var(--muted); font-size: 15px; margin-bottom: 20px; }

/* ── Search ── */

.search-wrap { position: relative; max-width: 560px; margin: 0 auto; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search-bar:focus-within {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.search-icon { color: var(--light); font-size: 18px; }
.search-bar input {
  width: 100%; border: 0; outline: none; font-size: 15px;
  background: transparent; color: var(--text);
}
.search-bar input::placeholder { color: var(--light); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
  z-index: 20;
}
.hidden { display: none !important; }
.dropdown-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.group-title {
  font-size: 11px;
  color: var(--light);
  font-weight: 700;
  padding: 12px 14px 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .1s;
}
.result-row:hover, .result-row.active { background: var(--primary-soft); }
.result-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.result-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--primary-soft); display: grid; place-items: center; font-size: 16px;
  flex-shrink: 0;
}
.result-text { min-width: 0; }
.result-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.result-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font-size: 10px; color: var(--primary); background: var(--primary-soft);
  border: 1px solid var(--primary-border); padding: 2px 7px; border-radius: 999px; font-weight: 700;
}
.open-btn {
  border: 1px solid var(--line); background: var(--panel);
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--muted); transition: all .15s;
}
.open-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }

/* ── Chips ── */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center; }
.chip {
  border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--primary-border); color: var(--primary); background: var(--primary-soft); }

/* ── Popular tools ── */

.popular { margin-bottom: 24px; }
.popular h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tool-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: all .15s;
}
.tool-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tool-card .result-icon { margin-bottom: 8px; }
.tool-card h3 { font-size: 14px; margin-bottom: 4px; }
.tool-card p { color: var(--muted); font-size: 12px; line-height: 1.4; }
.tool-card-link {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600;
  color: var(--primary); text-decoration: none; transition: opacity .15s;
}
.tool-card-link:hover { opacity: .7; }

/* ── Workspace ── */

.workspace { display: grid; gap: 16px; }

.workspace-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.workspace-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.workspace-header h2 { font-size: 18px; font-weight: 700; }
.tool-badge {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--line-soft); padding: 4px 12px; border-radius: 999px;
}
.tool-badge.active { color: var(--primary); background: var(--primary-soft); }

/* ── Stepper ── */

.stepper { display: flex; gap: 4px; margin-bottom: 20px; }
.step {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 6px; background: var(--line-soft); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--light); transition: all .2s;
}
.step.active { background: var(--primary-soft); color: var(--primary); }
.step.done { background: var(--success-bg); color: var(--success); }
.step-num {
  width: 22px; height: 22px; border-radius: 999px;
  background: currentColor; color: white;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  opacity: .2;
}
.step.active .step-num, .step.done .step-num { opacity: 1; }

/* ── Upload zone ── */

.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px 16px;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--line-soft); transition: all .2s;
  min-height: 140px;
}
.upload-zone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.upload-icon { font-size: 28px; opacity: .6; }
.upload-btn {
  background: var(--primary); color: white; border: 0;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.upload-btn:hover { background: var(--primary-hover); }
.upload-hint { font-size: 13px; color: var(--light); }

/* ── Files section ── */

.files-section { margin-top: 16px; }
.files-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.files-header h3 { font-size: 14px; font-weight: 700; }
.file-count { font-size: 12px; color: var(--muted); font-weight: 600; }
#filesList { list-style: none; display: grid; gap: 6px; }
#filesList li {
  display: flex; align-items: center; gap: 8px;
  background: var(--line-soft); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; color: var(--text);
}
#filesList li::before { content: '📄'; font-size: 14px; }

/* ── Config section ── */

.config-section { margin-top: 16px; }
.config-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 14px;
}
.config-label {
  display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.config-label select {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; background: var(--panel);
  color: var(--text); cursor: pointer; transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.config-label select:focus { border-color: var(--primary-border); outline: none; }

.convert-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: white; border: 0;
  padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background .15s; box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.convert-btn:hover { background: var(--primary-hover); }
.convert-btn:active { transform: scale(.99); }
.convert-btn-icon { font-size: 16px; }
.config-hint { text-align: center; margin-top: 8px; color: var(--light); font-size: 12px; }

/* ── Queue card ── */

.queue-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.queue-header h3 { font-size: 16px; font-weight: 700; }
.bulk-btn {
  background: var(--line-soft); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.bulk-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }

#queueList { list-style: none; display: grid; gap: 10px; }
.queue-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; display: grid; gap: 6px;
  transition: border-color .2s, background .2s;
}
.queue-item:has(.status.done) { border-color: #bbf7d0; background: #f0fdf4; }
.queue-item:has(.status.failed) { border-color: #fecaca; background: #fef2f2; }
.queue-item:has(.status.uploading) { border-color: #c7d2fe; background: #eef2ff; }
.queue-item:has(.status.processing) { border-color: #fed7aa; background: #fff7ed; }
.queue-item-head { display: flex; justify-content: space-between; align-items: center; }
.queue-title { font-size: 13px; font-weight: 700; }
.phase-label { font-size: 12px; color: var(--light); }
.progress-track { width: 100%; height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width .3s ease;
}
.status { font-size: 12px; font-weight: 700; }
.status.done { color: var(--success); }
.status.processing { color: var(--warn); }
.status.uploading { color: #4f46e5; }
.status.queued { color: var(--light); }
.status.failed { color: var(--error); }

.download-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: white; background: var(--primary); text-decoration: none; font-weight: 700;
  padding: 10px 16px; border-radius: var(--radius-sm); margin-top: 4px;
  transition: background .15s; box-shadow: 0 2px 6px rgba(37,99,235,.2);
}
.download-link:hover { background: var(--primary-hover); }
.download-link::before { content: '⬇'; font-size: 14px; }

.retry-btn {
  border: 1px solid #fecaca; background: var(--error-bg);
  color: var(--error); border-radius: 8px; padding: 5px 12px;
  font-size: 12px; font-weight: 700; width: fit-content; cursor: pointer;
  transition: all .15s;
}
.retry-btn:hover { background: #fee2e2; }

.done-info {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  padding: 4px 0; border-top: 1px solid var(--line-soft);
}

/* ── Mobile sticky CTA ── */

.mobile-sticky-cta {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 40; border: 0; border-radius: var(--radius-sm);
  padding: 14px 20px; font-size: 15px; font-weight: 800;
  background: var(--primary); color: white;
  box-shadow: 0 8px 24px rgba(37,99,235,.35);
  cursor: pointer; transition: all .15s;
}
.mobile-sticky-cta:hover { background: var(--primary-hover); }

/* ── How it works ── */

.how-it-works { margin-top: 40px; margin-bottom: 16px; }
.how-it-works h2 { font-size: 18px; font-weight: 700; margin-bottom: 14px; text-align: center; }
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px; text-align: center;
}
.step-card-icon { font-size: 24px; margin-bottom: 10px; }
.step-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.step-card p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }

/* ── Footer ── */

.site-footer {
  max-width: 720px; margin: 0 auto; padding: 24px 16px 40px;
  text-align: center; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 6px 0; }
.footer-link {
  display: inline-block; margin-bottom: 10px;
  color: var(--primary); text-decoration: none; font-weight: 600; font-size: 14px;
}
.footer-link:hover { text-decoration: underline; }
.footer-copy a { color: var(--primary); text-decoration: none; }
.footer-copy a:hover { text-decoration: underline; }

/* ── Responsive ── */

@media (max-width: 640px) {
  main { padding: 16px 12px 120px; }
  .hero h1 { font-size: 1.4rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tool-card { padding: 12px; }
  .tool-card h3 { font-size: 13px; }
  .tool-card p { font-size: 11px; }
  .config-row { grid-template-columns: 1fr; }
  .workspace-card { padding: 16px; }
  .stepper { gap: 3px; }
  .step { font-size: 12px; padding: 7px 4px; }
  .steps-row { grid-template-columns: 1fr; gap: 8px; }
  .step-card { padding: 16px 14px; }
}
