/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEF0F8;
  --ink: #15171F;
  --ink-soft: #5B5E70;
  --line: #E1E3EE;
  --accent: #4F46E5;
  --accent-ink: #FBFAFF;
  --ok: #15803D;
  --warn: #B45309;
  --danger: #B91C1C;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 1px 2px rgba(21,23,31,.04), 0 10px 30px -14px rgba(21,23,31,.16);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13141B;
    --surface: #1A1B24;
    --surface-2: #22232E;
    --ink: #F1F1F5;
    --ink-soft: #A2A3B3;
    --line: #2D2E3B;
    --accent: #7C74F0;
    --accent-ink: #14121F;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.is-hidden { display: none !important; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 700; color: var(--ink-soft);
}

/* =============================================================
   4. Header
   ============================================================= */
.site-header { padding: 16px 0; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; }
.logo-mark { color: var(--accent); }
.header-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.header-nav a {
  padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: .86rem; color: var(--ink-soft);
}
.header-nav a:hover, .header-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 34px 0 22px; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 4.2vw, 2.5rem); max-width: 22ch; margin: 0 auto; }
.hero-sub { margin: 12px auto 0; max-width: 58ch; color: var(--ink-soft); font-size: 1rem; }
.hero-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card { padding: 6px 0 30px; }
.tool-shell {
  max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-card);
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 38px 20px; border: 2px dashed var(--line); border-radius: var(--radius-m);
  text-align: center; cursor: pointer; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--surface-2); }
.dropzone-icon { font-size: 2.2rem; color: var(--accent); }
.dropzone-title { font-weight: 700; }
.dropzone-sub { font-size: .84rem; color: var(--ink-soft); }

.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2);
}
.file-row-icon { font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
.file-row-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-row-meta { font-size: .78rem; color: var(--ink-soft); flex-shrink: 0; }
.file-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.file-row-btn {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--ink-soft); font-size: .9rem;
}
.file-row-btn:hover { background: var(--surface); color: var(--ink); }
.file-row-btn.danger:hover { color: var(--danger); }

.add-more-row { margin-top: 10px; }
.add-more-btn {
  font-size: .84rem; font-weight: 700; color: var(--accent); padding: 8px 4px;
}

.tool-options { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.field-label { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.text-input, .select-input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: .95rem;
}
.text-input:focus, .select-input:focus { border-color: var(--accent); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: var(--radius-m); }
.seg-btn { padding: 8px 14px; border-radius: var(--radius-s); font-size: .84rem; font-weight: 700; color: var(--ink-soft); }
.seg-btn.is-active { background: var(--ink); color: var(--bg); }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-chip {
  display: flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1.5px solid var(--line);
  border-radius: 999px; font-size: .84rem; font-weight: 600; cursor: pointer;
}
.radio-chip input { accent-color: var(--accent); }
.radio-chip.is-active { border-color: var(--accent); background: var(--surface-2); }

.warning-banner {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-s); font-size: .85rem; line-height: 1.5;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-weight: 600;
}
.warning-banner .link-btn { color: var(--warn); text-decoration: underline; }

.progress-wrap { margin-top: 16px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s var(--ease-out); }
.progress-label { margin-top: 8px; font-size: .82rem; color: var(--ink-soft); text-align: center; }

.result-box {
  margin-top: 18px; padding: 18px; border-radius: var(--radius-m); background: var(--surface-2);
  border: 1px solid var(--line); text-align: center;
}
.result-stats { display: flex; justify-content: center; gap: 22px; margin-bottom: 14px; flex-wrap: wrap; }
.result-stat b { display: block; font-size: 1.3rem; }
.result-stat span { font-size: .78rem; color: var(--ink-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-secondary:hover { border-color: var(--accent); }
.link-btn { font-size: .86rem; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.actions-row { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.actions-row .btn-primary { flex: 1; min-width: 200px; }

.privacy-badge { margin-top: 16px; font-size: .82rem; color: var(--ink-soft); text-align: center; }

input[type="file"] { display: none; }

/* =============================================================
   7. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  margin: 30px auto; min-height: 90px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius-m); color: var(--ink-soft);
}
.ad-slot-leaderboard { max-width: 728px; }
.ad-slot-incontent { max-width: 728px; min-height: 250px; }
.ad-label {
  font-family: var(--mono); font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

.ad-dialog {
  border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px;
  width: min(92vw, 420px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card);
}
.ad-dialog::backdrop { background: rgba(10,10,16,.55); }
.ad-dialog-close { position: absolute; top: 12px; right: 14px; font-size: 1.3rem; line-height: 1; color: var(--ink-soft); }
.ad-dialog-body { min-height: 200px; display: flex; align-items: center; justify-content: center; margin: 14px 0; border: 1.5px dashed var(--line); border-radius: var(--radius-s); }
.ad-dialog-btn { width: 100%; }

.ad-corner {
  position: fixed; right: 16px; bottom: 16px; z-index: 500;
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-card); max-width: 260px; min-height: 56px;
}
.ad-corner-close { font-size: 1.05rem; color: var(--ink-soft); }

/* =============================================================
   8. Sections
   ============================================================= */
.section { padding: 44px 0; }
.section h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); margin-bottom: 20px; }

.steps-grid { display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.steps-grid > div { counter-increment: step; padding: 20px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.steps-grid > div::before {
  content: counter(step); display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: .88rem; margin-bottom: 12px;
}
.steps-grid h3 { font-size: 1rem; margin-bottom: 6px; }
.steps-grid p { color: var(--ink-soft); font-size: .92rem; }

.seo-copy { max-width: 74ch; }
.seo-copy p { margin-top: 14px; color: var(--ink-soft); }
.seo-copy p:first-of-type { margin-top: 0; }

.tools-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }
.tool-tile {
  padding: 18px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line);
  display: block; transition: border-color .15s var(--ease-out), transform .15s var(--ease-out);
}
.tool-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-tile-icon { font-size: 1.6rem; color: var(--accent); margin-bottom: 8px; }
.tool-tile h3 { font-size: .98rem; margin-bottom: 4px; }
.tool-tile p { font-size: .84rem; color: var(--ink-soft); }

.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 74ch; }
.faq-list details { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; background: var(--surface); }
.faq-list summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list p { margin-top: 10px; color: var(--ink-soft); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0 40px; }
.footer-row { display: flex; flex-direction: column; gap: 10px; font-size: .84rem; color: var(--ink-soft); }
@media (min-width: 720px) { .footer-row { flex-direction: row; justify-content: space-between; align-items: center; } }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-nav a:hover { color: var(--ink); }

/* =============================================================
   10. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
