/* ═══════════════════════════════════════════════════════════
   墨图工坊 · Design System
   Dark-first · System fonts · No external dependencies
   ═══════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────── */
:root {
  --bg:          #0f1117;
  --surface:     #181c27;
  --surface-2:   #1e2332;
  --surface-3:   #242840;
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.13);
  --text:        #e8eaf2;
  --muted:       #7a8099;
  --muted-2:     #4a5168;
  --accent:      #4f7cff;
  --accent-glow: rgba(79,124,255,0.18);
  --green:       #3ecf8e;
  --amber:       #f5a623;
  --red:         #ef4444;
  --radius:      12px;
  --radius-sm:   8px;
  --font:        'PingFang SC','Microsoft YaHei',system-ui,sans-serif;
  --t:           180ms cubic-bezier(.4,0,.2,1);
}

/* Light mode overrides */
body.light {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e4e8f2;
  --border:    rgba(0,0,0,0.08);
  --border-2:  rgba(0,0,0,0.15);
  --text:      #1a1d2e;
  --muted:     #6b7280;
  --muted-2:   #9ca3af;
}

/* ─── Reset ───────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ─── Layout helpers ──────────────────────────────────────── */
.page-wrap { display: flex; flex-direction: column; min-height: 100vh; }
.page-wrap > main { flex: 1; }

/* ─── Header ──────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; gap: 16px;
}
body.light .site-header { background: rgba(244,246,251,0.92); }

.logo {
  font-size: 16px; font-weight: 700; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.logo-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #7c5cfc);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

/* Header search */
.header-search {
  flex: 1; max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 34px;
  transition: border-color var(--t);
}
.header-search:focus-within { border-color: var(--accent); }
.header-search svg { color: var(--muted); flex-shrink: 0; }
.header-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; flex: 1;
}
.header-search input::placeholder { color: var(--muted); }

/* Header right actions */
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-btn {
  height: 32px; padding: 0 12px;
  border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: none;
  color: var(--muted); transition: all var(--t);
}
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn.icon-btn-sm {
  width: 32px; padding: 0;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

/* Tool-page header breadcrumb */
.tool-header-bar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 12px;
}
body.light .tool-header-bar { background: rgba(244,246,251,0.95); }
.back-btn {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px;
  padding: 4px 8px; border-radius: 6px;
  cursor: pointer; background: none; border: none;
  transition: all var(--t); flex-shrink: 0;
}
.back-btn:hover { color: var(--text); background: var(--surface); }
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  overflow: hidden;
}
.breadcrumb-sep { color: var(--muted-2); flex-shrink: 0; }
.breadcrumb-cur { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Lang switcher — hover dropdown */
.lang-switcher {
  position: relative; flex-shrink: 0;
}
.lang-cur-btn {
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  transition: all var(--t); white-space: nowrap;
}
.lang-cur-btn:hover, .lang-switcher:hover .lang-cur-btn {
  background: var(--surface); color: var(--text); border-color: var(--border-2);
}
.lang-arrow { font-size: 9px; color: var(--muted-2); }
.lang-drop {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  overflow: hidden; min-width: 96px; z-index: 300;
  flex-direction: column;
}
.lang-switcher:hover .lang-drop { display: flex; }
.lang-opt {
  width: 100%; padding: 8px 14px; text-align: left;
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; transition: all var(--t);
}
.lang-opt:hover { background: var(--surface-3); color: var(--text); }
.lang-opt.active { color: var(--accent); font-weight: 600; }

/* ─── Hero Section (home) ─────────────────────────────────── */
.hero {
  max-width: 900px; margin: 0 auto;
  padding: 72px 24px 48px;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-glow);
  border: 1px solid rgba(79,124,255,0.3);
  border-radius: 100px; padding: 4px 12px 4px 8px;
  font-size: 12px; color: var(--accent); margin-bottom: 20px;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.hero h1 {
  font-size: clamp(28px,5vw,44px);
  font-weight: 800; letter-spacing: -1px;
  line-height: 1.15; margin-bottom: 16px;
  background: linear-gradient(135deg,#fff 0%,#a0aec0 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.light .hero h1 {
  background: linear-gradient(135deg,#1a1d2e 0%,#4f7cff 100%);
  -webkit-background-clip: text; background-clip: text;
}
.hero-sub {
  font-size: 15px; color: var(--muted);
  max-width: 480px; margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-search {
  max-width: 480px; margin: 0 auto 32px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  display: flex; align-items: center;
  padding: 0 16px; height: 48px; gap: 10px;
  transition: border-color var(--t), box-shadow var(--t);
}
.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.hero-search svg { color: var(--muted); flex-shrink: 0; }
.hero-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 14px; flex: 1;
}
.hero-search input::placeholder { color: var(--muted); }
.hero-stats {
  display: flex; justify-content: center; gap: 32px;
}
.stat { text-align: center; }
.stat-num { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Search results dropdown */
.search-results {
  max-width: 480px; margin: 0 auto;
  display: grid; gap: 8px; margin-top: 8px;
}
.search-empty { padding: 14px 16px; color: var(--muted); font-size: 13px; }
.search-result-card {
  display: flex; justify-content: space-between; gap: 12px;
  align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color var(--t);
}
.search-result-card:hover { border-color: var(--border-2); }
.search-result-card strong { display: block; margin-bottom: 3px; font-size: 13px; }
.search-result-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.search-result-card span {
  display: inline-flex; margin-top: 6px;
  padding: 3px 8px; border-radius: 100px;
  background: var(--accent-glow); color: var(--accent); font-size: 11px;
}
.search-result-card > strong { color: var(--accent); font-size: 12px; flex-shrink: 0; }

/* ─── Quick Upload Banner ─────────────────────────────────── */
.section-wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px 64px; }
.quick-upload {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 32px; text-align: center;
  cursor: pointer; margin-bottom: 40px;
  transition: border-color var(--t);
  position: relative;
}
.quick-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.quick-upload:hover { border-color: var(--accent); }
.quick-upload-icon { font-size: 32px; margin-bottom: 10px; }
.quick-upload-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.quick-upload-sub { font-size: 13px; color: var(--muted); }
.quick-upload-formats {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 14px; flex-wrap: wrap;
}

/* ─── Category Tabs ───────────────────────────────────────── */
.category-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.cat-tab {
  height: 32px; padding: 0 14px;
  border-radius: 100px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  transition: all var(--t);
}
.cat-tab:hover { border-color: var(--border-2); color: var(--text); }
.cat-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Category Section ────────────────────────────────────── */
.cat-section { margin-bottom: 48px; }
.cat-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.cat-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.cat-icon.blue  { background: rgba(79,124,255,0.15); }
.cat-icon.red   { background: rgba(239,68,68,0.15); }
.cat-icon.green { background: rgba(62,207,142,0.15); }
.cat-icon.amber { background: rgba(245,166,35,0.15); }
.cat-name { font-size: 15px; font-weight: 600; }
.cat-count {
  margin-left: auto; font-size: 12px; color: var(--muted);
  background: var(--surface-2); padding: 2px 8px; border-radius: 100px;
}

/* ─── Tool Grid & Cards ───────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 12px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: all var(--t);
  display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0; transition: opacity var(--t);
}
.tool-card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.tool-card:hover::before { opacity: 1; }
.tool-card-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; position: relative;
}
.tool-card-icon.blue  { background: rgba(79,124,255,0.15); }
.tool-card-icon.red   { background: rgba(239,68,68,0.15); }
.tool-card-icon.green { background: rgba(62,207,142,0.15); }
.tool-card-icon.amber { background: rgba(245,166,35,0.15); }
.tool-card-name { font-size: 14px; font-weight: 600; }
.tool-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.tool-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.tag.hot  { background: rgba(245,166,35,0.1); color: var(--amber); border-color: rgba(245,166,35,0.25); }
.tag.new  { background: rgba(62,207,142,0.1); color: var(--green); border-color: rgba(62,207,142,0.25); }
.tag.local{ background: rgba(79,124,255,0.1); color: var(--accent); border-color: rgba(79,124,255,0.2); }

/* ─── Tool Page Layout ────────────────────────────────────── */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  max-width: 1100px; margin: 0 auto;
  padding: 24px 24px 80px;
}
@media(max-width:768px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-sidebar { order: -1; }
}

/* Tool header */
.tool-page-header { margin-bottom: 20px; }
.tool-page-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.tool-page-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0;
}
.tool-page-icon.blue  { background: rgba(79,124,255,0.15); }
.tool-page-icon.red   { background: rgba(239,68,68,0.15); }
.tool-page-icon.green { background: rgba(62,207,142,0.15); }
.tool-page-icon.amber { background: rgba(245,166,35,0.15); }
.tool-page-icon.purple{ background: rgba(124,92,252,0.15); }
.tool-page-h1 { font-size: 20px; font-weight: 700; }
.tool-page-desc { font-size: 13px; color: var(--muted); }
.tool-page-meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.meta-tag {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 8px; border-radius: 100px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.meta-tag.green { background: rgba(62,207,142,0.1); color: var(--green); border-color: rgba(62,207,142,0.2); }
.meta-tag.blue  { background: rgba(79,124,255,0.1); color: var(--accent); border-color: rgba(79,124,255,0.2); }

/* ─── Upload Zone ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  position: relative;
  background: var(--surface);
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,124,255,0.04);
}
.upload-zone.drag-over { box-shadow: 0 0 0 4px var(--accent-glow); }
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.upload-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  height: 36px; padding: 0 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; pointer-events: none;
  transition: opacity var(--t);
}
.upload-limits {
  display: flex; justify-content: center; gap: 12px;
  margin-top: 14px; flex-wrap: wrap;
}
.limit-item { font-size: 11px; color: var(--muted-2); }

/* ─── File Queue ──────────────────────────────────────────── */
.queue-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; margin-top: 24px;
}
.queue-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.queue-clear-btn {
  font-size: 12px; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 0;
}
.queue-clear-btn:hover { opacity: 0.8; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color var(--t);
}
.file-item.done      { border-color: rgba(62,207,142,0.25); }
.file-item.error     { border-color: rgba(239,68,68,0.25); }
.file-item.processing{ border-color: rgba(79,124,255,0.3); }

.file-thumb {
  width: 44px; height: 44px; border-radius: 6px;
  object-fit: cover; background: var(--surface-2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.file-meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.file-meta .saved { color: var(--green); }
.file-status { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }

/* Status chips */
.status-chip {
  font-size: 11px; padding: 2px 8px;
  border-radius: 100px; font-weight: 500; white-space: nowrap;
}
.status-chip.waiting    { background: var(--surface-2); color: var(--muted); }
.status-chip.processing { background: rgba(79,124,255,0.15); color: var(--accent); }
.status-chip.done       { background: rgba(62,207,142,0.12); color: var(--green); }
.status-chip.error      { background: rgba(239,68,68,0.12); color: var(--red); }

/* Progress bar */
.progress-bar {
  height: 3px; background: var(--surface-3);
  border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 99px; transition: width 0.3s ease;
}
.progress-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.4s infinite ease-in-out;
}
@keyframes indeterminate {
  0%   { transform: translateX(-250%); }
  100% { transform: translateX(500%); }
}

/* Error inline */
.error-msg {
  font-size: 11px; color: var(--red); margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.retry-btn {
  font-size: 11px; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 0;
  text-decoration: underline;
}

/* File action buttons */
.file-action-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: none; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all var(--t); flex-shrink: 0;
}
.file-action-btn:hover { background: var(--surface-2); color: var(--text); }
.file-action-btn.download {
  border-color: rgba(62,207,142,0.3);
  color: var(--green); background: rgba(62,207,142,0.08);
}
.file-action-btn.download:hover { background: rgba(62,207,142,0.18); }

/* ─── Result Summary Bar ──────────────────────────────────── */
.result-bar {
  background: rgba(62,207,142,0.07);
  border: 1px solid rgba(62,207,142,0.22);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px;
}
.result-bar-icon { font-size: 20px; flex-shrink: 0; }
.result-bar-text { flex: 1; font-size: 13px; }
.result-bar-text strong { color: var(--green); }
.download-all-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--green); color: #0f1117;
  border: none; border-radius: var(--radius-sm);
  height: 34px; padding: 0 14px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: opacity var(--t);
}
.download-all-btn:hover { opacity: 0.88; }

/* ─── Sidebar ─────────────────────────────────────────────── */
.tool-sidebar { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card.tips {
  background: rgba(79,124,255,0.06);
  border-color: rgba(79,124,255,0.15);
}
.card-title {
  font-size: 13px; font-weight: 600;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.card.tips .card-title { color: var(--accent); }

/* Settings controls */
.setting-row { margin-bottom: 14px; }
.setting-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.setting-value { color: var(--text); font-weight: 600; }
input[type="range"] {
  width: 100%; height: 4px; appearance: none;
  background: var(--surface-3); border-radius: 99px;
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent);
  cursor: pointer; border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.quality-presets { display: flex; gap: 6px; margin-top: 10px; }
.preset-btn {
  flex: 1; height: 28px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); cursor: pointer; transition: all var(--t);
}
.preset-btn:hover { border-color: var(--border-2); color: var(--text); }
.preset-btn.active { background: rgba(79,124,255,0.15); color: var(--accent); border-color: rgba(79,124,255,0.3); }

.toggle-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.toggle-label { font-size: 12px; color: var(--muted); }
.toggle {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--surface-3); position: relative;
  cursor: pointer; border: none; transition: background var(--t); flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform var(--t);
}
.toggle.on::after { transform: translateX(16px); }
.card-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Settings field (for non-compress tools) */
.field-row { margin-bottom: 12px; }
.field-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: block; }
.field-input {
  width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  padding: 7px 10px; outline: none; transition: border-color var(--t);
}
.field-input:focus { border-color: var(--accent); }
.field-color { padding: 3px 4px; height: 34px; cursor: pointer; }
.field-select {
  width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  padding: 7px 10px; outline: none; cursor: pointer;
  appearance: none; transition: border-color var(--t);
}
.field-select:focus { border-color: var(--accent); }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

/* Process button */
.process-btn {
  width: 100%; height: 42px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity var(--t);
}
.process-btn:hover { opacity: 0.88; }
.process-btn:disabled { opacity: 0.38; cursor: not-allowed; }

/* Related tools */
.related-tool {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer;
  transition: background var(--t); text-decoration: none;
}
.related-tool:hover { background: var(--surface-2); }
.related-icon {
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.related-icon.blue  { background: rgba(79,124,255,0.15); }
.related-icon.red   { background: rgba(239,68,68,0.15); }
.related-icon.green { background: rgba(62,207,142,0.15); }
.related-icon.amber { background: rgba(245,166,35,0.15); }
.related-name { font-size: 12px; font-weight: 500; }
.related-desc { font-size: 11px; color: var(--muted); }

/* ─── Tools Catalog Page ──────────────────────────────────── */
.catalog-hero {
  max-width: 1100px; margin: 0 auto;
  padding: 48px 24px 32px;
}
.catalog-hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.catalog-hero p { color: var(--muted); font-size: 14px; max-width: 60ch; }
.catalog-search-row {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-top: 20px;
}
.catalog-search {
  flex: 1; min-width: 200px; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 38px;
  transition: border-color var(--t);
}
.catalog-search:focus-within { border-color: var(--accent); }
.catalog-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; flex: 1;
}
.catalog-search input::placeholder { color: var(--muted); }
.catalog-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  height: 32px; padding: 0 12px; border-radius: 100px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  transition: all var(--t);
}
.filter-btn:hover { border-color: var(--border-2); color: var(--text); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.catalog-body { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }
.catalog-section { margin-bottom: 48px; }
.catalog-section.hidden { display: none; }
.catalog-section-head { margin-bottom: 16px; }
.catalog-section-head h2 { font-size: 16px; font-weight: 600; }
.catalog-section-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tool-card.hidden { display: none; }

/* ─── Legal / Contact page ────────────────────────────────── */
.legal-wrap { max-width: 720px; margin: 0 auto; padding: 48px 24px 80px; }
.legal-wrap h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.legal-wrap .sub { color: var(--muted); font-size: 14px; margin-bottom: 32px; line-height: 1.7; }
.legal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.legal-card ul { padding-left: 20px; }
.legal-card li { color: var(--muted); line-height: 1.9; font-size: 14px; }

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  color: var(--muted); font-size: 13px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.footer-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity var(--t);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-2); }

/* ─── Responsive ──────────────────────────────────────────── */
@media(max-width:640px) {
  .hero { padding: 48px 16px 32px; }
  .section-wrap { padding: 0 16px 48px; }
  .hero-stats { gap: 20px; }
  .tool-grid { grid-template-columns: repeat(2,1fr); }
  .header-search { display: none; }
  .hero h1 { font-size: 26px; }
  .site-header { padding: 0 16px; }
  .tool-header-bar { padding: 0 16px; }
  .tool-layout { padding: 16px 16px 60px; }
  .quick-upload { padding: 24px 16px; }
}

/* ─── Before/After Comparison Modal ──────────────────────── */
.compare-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.compare-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
}
.compare-dialog {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.compare-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.compare-close {
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: var(--surface-2); cursor: pointer;
  color: var(--muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.compare-close:hover { color: var(--text); }
.compare-body {
  flex: 1; overflow: hidden; min-height: 0;
  padding: 16px;
}
.compare-wrap {
  position: relative; overflow: hidden;
  width: 100%; height: 100%; min-height: 300px; max-height: 65vh;
  border-radius: var(--radius-sm);
  cursor: ew-resize; user-select: none; touch-action: none;
  background: var(--surface-2);
}
.compare-after-layer,
.compare-before-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.compare-after-layer img,
.compare-before-layer img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  pointer-events: none; draggable: false;
}
.compare-before-layer {
  clip-path: inset(0 50% 0 0);
}
.compare-label {
  position: absolute; bottom: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; pointer-events: none;
  white-space: nowrap;
}
.compare-label-left  { left:  8px; }
.compare-label-right { right: 8px; }
.compare-handle {
  position: absolute; top: 0; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: ew-resize; z-index: 10;
  pointer-events: all;
}
.compare-handle-line {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: rgba(255,255,255,.9);
  pointer-events: none;
}
.compare-handle-knob {
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; color: #333;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  pointer-events: none; z-index: 1;
}
.compare-btn { font-size: 14px; }
@media(max-width:640px) {
  .compare-dialog { width: calc(100vw - 16px); }
  .compare-wrap { max-height: 50vh; min-height: 200px; }
}
