/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --border: #e2e4ec;
  --text: #1a1d29;
  --text-soft: #565b6e;
  --text-faint: #8a8fa3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fd;
  --success: #16a34a;
  --success-soft: #eafbf1;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 1px 2px rgba(20,22,40,.04), 0 12px 32px -16px rgba(20,22,40,.18);
  --shadow-pop: 0 20px 60px -20px rgba(20,22,40,.35);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Manrope", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a24;
    --surface-2: #1e2230;
    --border: #2a2f3f;
    --text: #eef0f7;
    --text-soft: #b3b8cc;
    --text-faint: #7b8099;
    --accent: #7c74ff;
    --accent-hover: #8f88ff;
    --accent-soft: #23234a;
    --success-soft: #0f2a1c;
    --error-soft: #2c1518;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { 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, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.container { max-width: 1120px; margin-inline: auto; padding-inline: 1.25rem; }
.container-narrow { max-width: 760px; }
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }
.link-btn { color: var(--accent); font-weight: 600; padding: .3rem .1rem; }
.link-btn:hover { text-decoration: underline; }

/* =============================================================
   4. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 1rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px rgba(79,70,229,.55); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-download { width: 100%; }

/* =============================================================
   5. Header
   ============================================================= */
.site-header { padding-block: 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.header-nav { display: none; gap: 1.6rem; font-weight: 600; font-size: .95rem; color: var(--text-soft); }
.header-nav a:hover { color: var(--accent); }
@media (min-width: 720px) { .header-nav { display: flex; } }

/* =============================================================
   6. Hero + tool card
   ============================================================= */
.hero { padding-block: 2.4rem 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); max-width: 20ch; margin-inline: auto; }
.hero-sub { color: var(--text-soft); font-size: 1.05rem; max-width: 56ch; margin: .9rem auto 0; }

.tool-card {
  margin: 1.8rem auto 0; max-width: 640px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 1.4rem; text-align: left;
}
.tool-tabs { display: flex; gap: .4rem; background: var(--surface-2); padding: .35rem; border-radius: 999px; margin-bottom: 1.3rem; }
.tool-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem .5rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  color: var(--text-soft); transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.tool-tab:hover { color: var(--text); }
.tool-tab.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.tool-panel[hidden] { display: none; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center;
  padding: 2.2rem 1.2rem; border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; color: var(--text-soft); transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { color: var(--accent); }
.dz-text { color: var(--text); font-size: 1rem; }
.dz-text strong { font-weight: 700; }
.dz-hint { font-size: .82rem; color: var(--text-faint); }

.dz-file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem 1rem; margin-top: .9rem;
}
.dz-file-name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tool-options { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.1rem; }
.option-field { display: flex; flex-direction: column; gap: .35rem; }
.option-field label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.option-field select, .option-field input {
  padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-weight: 600;
}
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.option-note { font-size: .82rem; color: var(--text-faint); margin-top: -.3rem; }

.tool-progress { margin-top: 1.1rem; }
.progress-label { font-size: .88rem; color: var(--text-soft); margin-bottom: .5rem; font-weight: 600; }
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .25s var(--ease-out); }

.tool-result {
  display: flex; align-items: center; gap: 1rem; margin-top: 1.1rem;
  background: var(--success-soft); border-radius: var(--radius); padding: 1rem 1.1rem;
  flex-wrap: wrap;
}
.result-icon {
  width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.result-info { display: flex; flex-direction: column; flex: 1 1 160px; min-width: 0; }
.result-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-info span { font-size: .85rem; color: var(--text-soft); }
.tool-result .btn-download { flex: 1 1 100%; }
@media (min-width: 480px) { .tool-result .btn-download { flex: 0 0 auto; width: auto; } }

.reset-link { display: block; text-align: center; margin-top: .8rem; }

.tool-error { margin-top: 1.1rem; background: var(--error-soft); color: var(--error); border-radius: var(--radius); padding: 1rem 1.1rem; }
.tool-error p { margin-bottom: .5rem; font-weight: 600; }

.privacy-badge { margin-top: 1.3rem; font-size: .88rem; color: var(--text-soft); }

/* =============================================================
   7. Ad slots (placeholders)
   ============================================================= */
.ad-slot {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; font-size: .8rem; letter-spacing: .08em;
}
.ad-label { font-weight: 800; }
.ad-leaderboard { max-width: 1120px; margin: 2rem auto; margin-inline: 1.25rem; }
@media (min-width: 1170px) { .ad-leaderboard { margin-inline: auto; } }
.ad-in-content { max-width: 760px; margin: 2.2rem auto; margin-inline: 1.25rem; min-height: 250px; }
@media (min-width: 810px) { .ad-in-content { margin-inline: auto; } }

.ad-dialog {
  border: none; border-radius: var(--radius-lg); padding: 1.4rem; max-width: 420px; width: calc(100% - 2.5rem);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.ad-dialog::backdrop { background: rgba(15,17,25,.55); }
.ad-dialog-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.4rem; line-height: 1; color: var(--text-faint); padding: .3rem; }
.ad-dialog-close:hover { color: var(--text); }
.ad-dialog-slot { min-height: 200px; margin-bottom: 1rem; }
.ad-dialog .btn-secondary { width: 100%; }

.ad-toast {
  position: fixed; bottom: 1.1rem; right: 1.1rem; z-index: 500;
  width: 230px; padding: .9rem; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-pop);
}
.ad-toast[hidden] { display: none; }
.ad-toast .ad-slot { min-height: 70px; margin-top: .5rem; }
.ad-toast-close { position: absolute; top: .35rem; right: .5rem; font-size: 1.1rem; color: var(--text-faint); padding: .2rem; }
.ad-toast-close:hover { color: var(--text); }

/* =============================================================
   8. Content sections
   ============================================================= */
.section { padding-block: 3rem; }
.section h2 { font-size: clamp(1.5rem, 3vw, 2rem); text-align: center; margin-bottom: 2rem; }
.section-seo h2 { text-align: left; margin-bottom: 1.1rem; }
.section-seo p { color: var(--text-soft); margin-bottom: 1rem; }
.section-seo p:last-child { margin-bottom: 0; }

.steps-grid { list-style: none; display: grid; gap: 1.2rem; counter-reset: step; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.steps-grid li {
  counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; position: relative;
}
.steps-grid li::before {
  content: counter(step); display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; margin-bottom: .9rem;
}
.steps-grid h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.steps-grid p { color: var(--text-soft); font-size: .93rem; }

.usos-grid { display: grid; gap: 1rem; }
@media (min-width: 540px) { .usos-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .usos-grid { grid-template-columns: repeat(3, 1fr); } }
.usos-grid article {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem;
}
.usos-grid .u-emoji { font-size: 1.6rem; margin-bottom: .6rem; display: block; }
.usos-grid h3 { font-size: 1rem; margin-bottom: .35rem; }
.usos-grid p { color: var(--text-soft); font-size: .9rem; }

.faq-list { display: flex; flex-direction: column; gap: .7rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-item summary {
  cursor: pointer; padding: 1.05rem 1.2rem; font-weight: 700; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); flex: none; transition: transform .2s var(--ease-out); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 1.2rem 1.1rem; color: var(--text-soft); font-size: .93rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; margin-top: 1rem; }
.footer-row { display: flex; flex-direction: column; gap: 1rem; font-size: .85rem; color: var(--text-faint); }
@media (min-width: 720px) { .footer-row { flex-direction: row; align-items: center; justify-content: space-between; } }
.footer-credits { margin-top: .3rem; font-size: .78rem; }
.footer-nav { display: flex; gap: 1.2rem; font-weight: 600; }
.footer-nav a:hover { color: var(--accent); }

/* =============================================================
   10. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .tool-card { padding: 1.8rem; }
}

/* =============================================================
   11. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}
