/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --border: #dde1ec;
  --text: #1a1d29;
  --text-soft: #545a72;
  --text-faint: #8288a0;
  --accent: #2f5fde;
  --accent-dark: #1f43ab;
  --accent-soft: #e8edfd;
  --success: #17875a;
  --success-soft: #e4f6ee;
  --error: #c0362c;
  --error-soft: #fceceb;
  --warn: #9a6400;
  --warn-soft: #fdf3dc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 24, 44, .04), 0 8px 24px -8px rgba(20, 24, 44, .10);
  --shadow-lg: 0 20px 60px -20px rgba(20, 24, 44, .35);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a;
    --surface: #191b26;
    --surface-2: #20222f;
    --border: #2c2f42;
    --text: #edeef5;
    --text-soft: #b0b4c9;
    --text-faint: #767b95;
    --accent: #6f8fff;
    --accent-dark: #a9bcff;
    --accent-soft: #212a4d;
    --success: #48c793;
    --success-soft: #12301f;
    --error: #ff7a70;
    --error-soft: #341715;
    --warn: #e2b13d;
    --warn-soft: #332608;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 60px -20px rgba(0, 0, 0, .7);
  }
}

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

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 20px; }
.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; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--text); color: var(--bg); z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }
.section { padding: 56px 0; }
.section-title { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2rem); margin-bottom: 10px; }
.section-lead { color: var(--text-soft); max-width: 62ch; margin-bottom: 32px; font-size: 1.02rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem; }
.brand .logo-mark {
  width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { font-size: .93rem; font-weight: 600; color: var(--text-soft); transition: color .15s var(--ease-out); }
.main-nav a:hover { color: var(--accent); }
.main-nav a.current { color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 40px 0 60px; color: var(--text-faint); font-size: .88rem; }
.site-footer .foot-grid { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer nav a:hover { color: var(--accent); }
.foot-note { max-width: 74ch; line-height: 1.7; }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding: 40px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 1.25rem + 2vw, 2.65rem); margin-bottom: 12px; }
.hero .subtitle { color: var(--text-soft); font-size: clamp(1rem, .95rem + .3vw, 1.15rem); max-width: 60ch; margin: 0 auto; }

.tool-wrap { padding: 28px 0 12px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; max-width: 720px; margin: 0 auto;
}
.mode-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2);
  border-radius: 999px; padding: 4px; margin-bottom: 18px;
}
.mode-toggle button {
  padding: 10px 12px; border-radius: 999px; font-weight: 700; font-size: .88rem;
  color: var(--text-soft); transition: all .18s var(--ease-out); text-align: center;
}
.mode-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 38px 20px;
  text-align: center; cursor: pointer; transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
  background: var(--surface);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { width: 46px; height: 46px; color: var(--accent); }
.dropzone .dz-title { font-weight: 700; font-size: 1.02rem; }
.dropzone .dz-sub { color: var(--text-faint); font-size: .87rem; }
.dropzone .btn { margin-top: 4px; }

.tool-card[data-state="idle"] .stage-file,
.tool-card[data-state="idle"] .stage-progress,
.tool-card[data-state="idle"] .stage-done,
.tool-card[data-state="idle"] .stage-error { display: none; }

.tool-card[data-state="file"] .stage-dropzone,
.tool-card[data-state="file"] .stage-progress,
.tool-card[data-state="file"] .stage-done,
.tool-card[data-state="file"] .stage-error { display: none; }

.tool-card[data-state="working"] .stage-dropzone,
.tool-card[data-state="working"] .stage-file,
.tool-card[data-state="working"] .stage-done,
.tool-card[data-state="working"] .stage-error { display: none; }

.tool-card[data-state="done"] .stage-dropzone,
.tool-card[data-state="done"] .stage-file,
.tool-card[data-state="done"] .stage-progress,
.tool-card[data-state="done"] .stage-error { display: none; }

.tool-card[data-state="error"] .stage-dropzone,
.tool-card[data-state="error"] .stage-file,
.tool-card[data-state="error"] .stage-progress,
.tool-card[data-state="error"] .stage-done { display: none; }

.file-info {
  display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.file-info .file-icon { width: 38px; height: 38px; flex-shrink: 0; color: var(--accent); }
.file-info .file-meta { min-width: 0; flex: 1; }
.file-info .file-name { font-weight: 700; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info .file-sub { color: var(--text-faint); font-size: .82rem; margin-top: 2px; }
.file-info .file-remove { color: var(--text-faint); padding: 6px; border-radius: 8px; }
.file-info .file-remove:hover { background: var(--border); color: var(--text); }
.stage-file .btn-primary { width: 100%; margin-top: 14px; }

.progress-wrap { padding: 8px 0 4px; }
.progress-status { font-size: .92rem; font-weight: 600; margin-bottom: 12px; text-align: center; color: var(--text-soft); }
.progress-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 6%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: 999px; transition: width .3s var(--ease-out); }
.progress-note { text-align: center; font-size: .82rem; color: var(--text-faint); margin-top: 12px; }

.stage-done { text-align: center; }
.done-icon { width: 52px; height: 52px; margin: 0 auto 12px; color: var(--success); }
.done-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.done-sub { color: var(--text-faint); font-size: .87rem; margin-bottom: 18px; }
.btn-download { width: 100%; font-size: 1.02rem; padding: 16px; }
.reset-link { display: inline-block; margin-top: 16px; font-size: .87rem; color: var(--text-faint); font-weight: 600; }
.reset-link:hover { color: var(--accent); }
.warn-box { margin-top: 14px; text-align: left; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .82rem; }

.stage-error { text-align: center; }
.error-icon { width: 46px; height: 46px; margin: 0 auto 10px; color: var(--error); }
.error-title { font-weight: 700; margin-bottom: 4px; }
.error-msg { color: var(--text-soft); font-size: .9rem; margin-bottom: 16px; }

.privacy-badge {
  max-width: 720px; margin: 16px auto 0; display: flex; align-items: flex-start; gap: 10px;
  font-size: .84rem; color: var(--text-faint); padding: 0 6px;
}
.privacy-badge svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--success); }
.limits-row { max-width: 720px; margin: 6px auto 0; font-size: .8rem; color: var(--text-faint); padding: 0 6px; }

/* =============================================================
   6. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; font-weight: 700; font-size: .93rem;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background .15s var(--ease-out);
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================================
   7. Ad slots
   ============================================================= */
.ad-slot {
  max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-faint);
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin-top: 32px; }
.ad-slot--incontent { min-height: 250px; margin: 8px auto; max-width: 728px; }
.ad-corner {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 260px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 14px; display: flex; gap: 10px; align-items: flex-start;
  transform: translateY(120%); opacity: 0; transition: transform .4s var(--ease-out), opacity .4s var(--ease-out);
}
.ad-corner.is-visible { transform: translateY(0); opacity: 1; }
.ad-corner .ad-corner-box {
  flex: 1; min-height: 60px; display: grid; place-items: center; border: 1px dashed var(--border);
  border-radius: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--text-faint);
}
.ad-corner .ad-corner-close { color: var(--text-faint); padding: 4px; border-radius: 6px; flex-shrink: 0; }
.ad-corner .ad-corner-close:hover { background: var(--surface-2); color: var(--text); }

/* =============================================================
   8. Steps / uses / FAQ
   ============================================================= */
.steps-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
.step-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: relative;
}
.step-num {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; margin-bottom: 14px;
}
.step-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step-card p { color: var(--text-soft); font-size: .92rem; }

.uses-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.use-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; gap: 14px; }
.use-card svg { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.use-card h3 { font-size: 1rem; margin-bottom: 4px; }
.use-card p { color: var(--text-soft); font-size: .89rem; }

.seo-copy { max-width: 74ch; color: var(--text-soft); line-height: 1.75; }
.seo-copy h2 { color: var(--text); font-size: 1.2rem; margin: 22px 0 8px; }
.seo-copy p { margin-bottom: 12px; }

.faq-list { max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 6px 0; }
.faq-item summary {
  cursor: pointer; font-weight: 700; padding: 14px 4px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chevron { transition: transform .2s var(--ease-out); flex-shrink: 0; width: 18px; height: 18px; color: var(--text-faint); }
.faq-item[open] summary .chevron { transform: rotate(180deg); }
.faq-item p { padding: 0 4px 16px; color: var(--text-soft); font-size: .93rem; line-height: 1.65; }

.cross-link-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
}
.cross-link-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.cross-link-card p { color: var(--text-soft); font-size: .9rem; }

/* =============================================================
   9. Popup dialog (download interstitial)
   ============================================================= */
dialog.ad-popup {
  border: none; border-radius: var(--radius); padding: 0; max-width: 420px; width: calc(100% - 40px);
  box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text);
}
dialog.ad-popup::backdrop { background: rgba(10, 12, 20, .55); backdrop-filter: blur(2px); }
.ad-popup-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ad-popup-head span { font-size: .78rem; font-weight: 700; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; }
.ad-popup-close { padding: 6px; border-radius: 8px; color: var(--text-faint); }
.ad-popup-close:hover { background: var(--surface-2); color: var(--text); }
.ad-popup-body { padding: 20px 16px 24px; }
.ad-popup-slot {
  min-height: 250px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--text-faint); font-weight: 700; font-size: .8rem;
  letter-spacing: .08em; text-transform: uppercase;
  background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px);
}
.ad-popup-foot { padding: 0 16px 18px; text-align: center; }

/* =============================================================
   10. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
  .uses-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .section { padding: 72px 0; }
}
@media (min-width: 960px) {
  .container { max-width: 1080px; }
}

/* =============================================================
   11. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-corner { transition: none; }
}
