/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e2e5ec;
  --text: #171b26;
  --text-muted: #5c6272;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0ff;
  --danger: #d5432c;
  --danger-soft: #fdecea;
  --success: #1a8f5e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 24, 38, 0.04), 0 8px 24px rgba(20, 24, 38, 0.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ad-border: #c7cee0;
  --ad-bg: #eef1f8;
  --ad-text: #7a8092;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10121a;
    --surface: #171a25;
    --surface-2: #1e2230;
    --border: #2a2f40;
    --text: #eef0f6;
    --text-muted: #a2a8ba;
    --accent: #5b8def;
    --accent-ink: #0d1220;
    --accent-soft: #1b2740;
    --danger: #ff7a63;
    --danger-soft: #3a1f1c;
    --success: #4bcf94;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --ad-border: #384056;
    --ad-bg: #1b2030;
    --ad-text: #8890a6;
  }
}

/* =============================================================
   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;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.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; text-decoration: none;
}
.skip-link:focus { top: 1rem; }
.container { max-width: 880px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}
.hide-noscript { display: none; }
.no-js .hide-noscript { display: block; }
.no-js .js-only { display: none; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 0;
}
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.header-note { font-size: .85rem; color: var(--text-muted); }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 1.5rem 0 .5rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); margin-bottom: .6rem; }
.hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; margin-inline: auto; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 1.5rem 0 1rem;
}
.format-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.format-tab {
  flex: 1; padding: .7rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; text-align: center; transition: background .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.format-tab.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 2rem 1rem; 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(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--accent); }
.dropzone strong { font-size: 1rem; }
.dropzone span { color: var(--text-muted); font-size: .9rem; }

.file-list { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.file-row {
  display: grid; grid-template-columns: 1.6rem 1fr auto auto; align-items: center; gap: .6rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .7rem; font-size: .92rem;
}
.file-row__idx { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.file-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__size { color: var(--text-muted); font-size: .85rem; white-space: nowrap; }
.file-row__actions { display: flex; gap: .25rem; }
.icon-btn {
  width: 1.8rem; height: 1.8rem; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); font-size: .9rem; line-height: 1;
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn--danger { color: var(--danger); }

.tool-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.count-note { font-size: .85rem; color: var(--text-muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem;
  background: var(--accent); color: var(--accent-ink); transition: transform .12s var(--ease-out), opacity .12s var(--ease-out);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--accent); text-decoration: underline; padding: .4rem; font-weight: 600; }

.progress-wrap { margin-top: 1.1rem; }
.progress-track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s var(--ease-out); }
.progress-label { font-size: .85rem; color: var(--text-muted); margin-top: .4rem; }

.result-box {
  margin-top: 1.1rem; padding: 1rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid var(--accent);
  display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center;
}

.error-box {
  margin-top: 1rem; padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger);
  font-size: .9rem;
}

.privacy-badge {
  display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--text-muted);
  justify-content: center; text-align: center; margin: 1rem auto 0; max-width: 60ch;
}
.privacy-badge svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--success); }
.limits-note { text-align: center; font-size: .82rem; color: var(--text-muted); margin-top: .4rem; }

/* =============================================================
   7. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 1px dashed var(--ad-border); background: var(--ad-bg); color: var(--ad-text);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  margin: 1.75rem auto;
}
.ad-slot--leaderboard { min-height: 90px; max-width: 728px; }
.ad-slot--incontent { min-height: 250px; max-width: 336px; }

/* =============================================================
   8. Sections
   ============================================================= */
.section { padding: 2.5rem 0; }
.section h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); margin-bottom: 1.25rem; text-align: center; }
.section-intro { text-align: center; color: var(--text-muted); max-width: 60ch; margin: -0.5rem auto 1.5rem; }

.steps { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; }
.step__num {
  width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; margin-bottom: .8rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.step p { color: var(--text-muted); font-size: .95rem; }

.seo-copy { color: var(--text); font-size: .98rem; max-width: 72ch; margin-inline: auto; }
.seo-copy p { margin-bottom: 1rem; }
.seo-copy p:last-child { margin-bottom: 0; }

.ideas-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.idea-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; display: flex; gap: .8rem; align-items: flex-start;
}
.idea-card svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; margin-top: .1rem; }
.idea-card h3 { font-size: .98rem; margin-bottom: .25rem; }
.idea-card p { font-size: .88rem; color: var(--text-muted); }

.faq-list { max-width: 72ch; margin-inline: auto; display: flex; flex-direction: column; gap: .6rem; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .3rem .2rem;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: .8rem 1rem; font-weight: 600; font-size: .97rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); font-weight: 400; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { padding: 0 1rem 1rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 1rem;
  color: var(--text-muted); font-size: .85rem;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; justify-content: space-between; }
.footer-links { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.footer-links a { text-decoration: underline; }
.footer-credits { margin-top: .8rem; font-size: .78rem; opacity: .8; }

/* =============================================================
   10. Download interstitial (popup ad) — fires AFTER download starts
   ============================================================= */
.ad-popup {
  border: none; border-radius: var(--radius); padding: 0; max-width: 380px; width: calc(100% - 2rem);
  box-shadow: var(--shadow); background: var(--surface); color: var(--text);
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;
}
.ad-popup::backdrop { background: rgba(10, 12, 20, .55); }
.ad-popup__inner { padding: 1.1rem; }
.ad-popup__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.ad-popup__head span { font-size: .8rem; color: var(--text-muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.ad-popup__close {
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); font-size: 1.1rem;
}
.ad-popup .ad-slot { margin: 0 0 1rem; min-height: 220px; }
.ad-popup__foot { text-align: center; }

/* =============================================================
   11. Corner toast
   ============================================================= */
.corner-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  width: 220px; background: var(--surface); border: 1px solid var(--ad-border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: .8rem; transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: transform .25s var(--ease-out), opacity .25s var(--ease-out);
}
.corner-toast.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.corner-toast__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.corner-toast__head span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ad-text); }
.corner-toast__close { width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); font-size: .85rem; }
.corner-toast .ad-slot { margin: 0; min-height: 100px; }

/* =============================================================
   12. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .ideas-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .hero { padding-top: 2rem; }
}

/* =============================================================
   13. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
