/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #14171f;
  --text-muted: #5b6270;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eef3ff;
  --success: #16a34a;
  --success-bg: #ecfdf3;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --max-w: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-alt: #161922;
    --surface: #1a1d27;
    --border: #2a2e3a;
    --text: #f2f3f5;
    --text-muted: #9aa1b1;
    --brand: #5b8cff;
    --brand-dark: #7ba0ff;
    --brand-light: #1b2540;
    --success: #34d399;
    --success-bg: #0f2a1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; }

/* ===== Hero ===== */
.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(28px, 4vw, 44px); margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p.lead { font-size: 18px; color: var(--text-muted); max-width: 640px; margin: 0 auto 20px; }
.trust-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--success-bg); color: var(--success);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* ===== Tool grid ===== */
.category { margin: 40px 0; }
.category h2 { font-size: 20px; margin-bottom: 16px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tool-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; transition: box-shadow .15s, transform .15s;
}
.tool-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.tool-card .icon { font-size: 26px; margin-bottom: 10px; }
.tool-card h3 { font-size: 15px; margin: 0 0 4px; color: var(--text); }
.tool-card p { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ===== Tool page layout ===== */
.tool-page { padding: 32px 0 64px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }
.tool-header { text-align: center; margin-bottom: 28px; }
.tool-header h1 { font-size: clamp(24px, 3.4vw, 34px); margin: 0 0 10px; }
.tool-header p { color: var(--text-muted); max-width: 560px; margin: 0 auto; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-alt); padding: 48px 24px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--brand); background: var(--brand-light); }
.dropzone .dz-icon { font-size: 40px; margin-bottom: 12px; }
.dropzone strong { color: var(--brand); }
.dropzone input[type=file] { display: none; }
.dz-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* Panel / card */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }

/* File list */
.file-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-alt); }
.file-row .thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--border); flex-shrink: 0; }
.file-row .meta { flex: 1; min-width: 0; }
.file-row .meta .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .meta .size { font-size: 12px; color: var(--text-muted); }
.file-row .remove { color: var(--danger); cursor: pointer; font-size: 13px; background: none; border: none; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
select, input[type=number], input[type=text] {
  font-family: var(--font); font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); font-size: 13px; cursor: pointer; font-weight: 600; color: var(--text-muted);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-sm); border: none;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: .9; text-decoration: none; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn-block { width: 100%; margin-top: 18px; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Progress */
.progress-wrap { margin-top: 16px; display: none; }
.progress-wrap.active { display: block; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; width: 0%; background: var(--brand); transition: width .2s; }
.progress-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Result */
.result-panel { display: none; text-align: center; }
.result-panel.active { display: block; }
.result-stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0; flex-wrap: wrap; }
.result-stats div { text-align: center; }
.result-stats .num { font-size: 22px; font-weight: 800; }
.result-stats .lbl { font-size: 12px; color: var(--text-muted); }
.savings { color: var(--success); font-weight: 700; }

/* Info sections */
.info-block { margin-top: 48px; }
.info-block h2 { font-size: 20px; margin-bottom: 12px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.step { background: var(--bg-alt); border-radius: var(--radius); padding: 16px; }
.step .n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq p { color: var(--text-muted); margin: 10px 0 0; font-size: 14px; }

/* Ad slots */
.ad-slot { display: flex; align-items: center; justify-content: center; margin: 28px auto; overflow: hidden; }
.ad-slot .ad-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); text-align: center; }
.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--incontent { min-height: 250px; }

/* Affiliate box */
.affiliate-box { background: var(--brand-light); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 24px; }
.affiliate-box h3 { margin: 0 0 6px; font-size: 15px; }
.affiliate-box p { margin: 0 0 12px; font-size: 13px; color: var(--text-muted); }
.affiliate-box .disclosure { font-size: 11px; color: var(--text-muted); margin-top: 10px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 40px 0 24px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; }
.footer-grid h4 { font-size: 13px; margin: 0 0 10px; }
.footer-grid a { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.footer-bottom { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 32px; }

/* Privacy note */
.privacy-note { display: flex; align-items: flex-start; gap: 10px; background: var(--success-bg); color: var(--success); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; font-weight: 600; margin-top: 16px; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 36px 0 20px; }
}
