/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #eef1f8;
  --border: #dfe4ee;
  --text: #12182b;
  --text-soft: #57617a;
  --text-faint: #8791a8;
  --accent: #2f5eea;
  --accent-hover: #2249c9;
  --accent-soft: #e8edff;
  --success: #12a35a;
  --success-soft: #e4f7ee;
  --danger: #d8402f;
  --danger-soft: #fdeceb;
  --ad: #a8b0c3;
  --ad-bg: #f0f2f8;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(18, 24, 43, 0.04), 0 8px 24px rgba(18, 24, 43, 0.06);
  --shadow-pop: 0 12px 40px rgba(18, 24, 43, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131d;
    --surface: #171b28;
    --surface-soft: #1d2233;
    --border: #2a3044;
    --text: #eef1fb;
    --text-soft: #a4acc4;
    --text-faint: #6c7591;
    --accent: #6d8dff;
    --accent-hover: #86a1ff;
    --accent-soft: #1c2440;
    --success: #35c987;
    --success-soft: #103a27;
    --danger: #ff6b5b;
    --danger-soft: #3a1c19;
    --ad: #4a516a;
    --ad-bg: #1a1f2e;
  }
}

/* =============================================================
   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(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  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: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
ul, ol { padding-left: 1.2em; }
::selection { background: var(--accent-soft); color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 880px; margin-inline: auto; padding-inline: 1.25rem; }
.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(--surface);
  z-index: 9999; border-radius: 8px; font-weight: 600; transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .15s var(--ease-out), background-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn--primary:active { transform: scale(0.98); }
.btn--lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn--ghost { background: transparent; color: var(--text-soft); text-decoration: underline; padding: .5rem .8rem; }
.btn--ghost:hover { color: var(--text); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem; max-width: 880px; margin-inline: auto;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0;
}
.header-nav a { color: var(--text-soft); font-size: .9rem; font-weight: 600; }

/* =============================================================
   5. Hero + tool section
   ============================================================= */
.hero { padding: .5rem 0 2rem; }
.hero__eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: .9rem;
}
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.6rem); max-width: 20ch; }
.hero__sub { color: var(--text-soft); font-size: 1.05rem; max-width: 52ch; margin-top: .7rem; }

/* -- tool card -- */
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 1.5rem; margin-top: 1.5rem;
}
.tool-card [data-ready], .tool-card [data-progress], .tool-card [data-done], .tool-card [data-error] { display: none; }
.tool-card[data-state="idle"] [data-zone] { display: block; }
.tool-card:not([data-state="idle"]) [data-zone] { display: none; }
.tool-card[data-state="ready"] [data-ready] { display: block; }
.tool-card[data-state="loading-engine"] [data-progress],
.tool-card[data-state="working"] [data-progress] { display: block; }
.tool-card[data-state="done"] [data-done] { display: flex; }
.tool-card[data-state="error"] [data-error] { display: block; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  text-align: center; border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 2.6rem 1.5rem; cursor: pointer; transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon { color: var(--accent); }
.dropzone__title { font-weight: 700; font-size: 1.05rem; }
.dropzone__sub { color: var(--text-soft); font-size: .9rem; }

.file-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.1rem; }
.file-list__item {
  display: flex; align-items: center; gap: .6rem; background: var(--surface-soft);
  border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem;
}
.file-list__icon { flex-shrink: 0; color: var(--text-faint); }
.file-list__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-list__size { color: var(--text-faint); font-size: .82rem; flex-shrink: 0; }

.format-picker__label { font-weight: 700; font-size: .9rem; margin-bottom: .6rem; color: var(--text-soft); }
.format-picker__options { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.2rem; }
.format-option {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .6rem 1.1rem;
  font-weight: 700; font-size: .92rem; color: var(--text-soft); transition: all .15s var(--ease-out);
}
.format-option:hover { border-color: var(--accent); color: var(--accent); }
.format-option.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.tool-card__progress { text-align: center; padding: 1.5rem 0; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; margin-bottom: .9rem; }
.progress-bar__fill { height: 100%; width: 6%; background: var(--accent); border-radius: 999px; transition: width .25s var(--ease-out); }
.progress-text { color: var(--text-soft); font-size: .92rem; }

.tool-card__done { flex-direction: column; align-items: center; text-align: center; gap: .9rem; padding: 1rem 0; }
.done-icon {
  width: 52px; height: 52px; border-radius: 50%; background: var(--success-soft); color: var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800;
}
.done-text { font-weight: 700; font-size: 1.05rem; }
.done-meta { color: var(--text-soft); font-size: .88rem; }

.tool-card__error { text-align: center; padding: 1rem 0; }
.error-text { color: var(--danger); font-weight: 600; margin-bottom: .9rem; }

.privacy-badge {
  display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--text-soft);
  margin-top: 1rem; justify-content: center; text-align: center;
}
.limits-note { font-size: .8rem; color: var(--text-faint); text-align: center; margin-top: .35rem; }

/* =============================================================
   6. Ad slots
   ============================================================= */
.ad-slot {
  border: 1px dashed var(--ad); background: var(--ad-bg); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; color: var(--ad);
  font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
}
.ad-slot--leaderboard { min-height: 90px; margin-block: 1.75rem; }
.ad-slot--incontent { min-height: 250px; margin-block: 2rem; }
.ad-slot--dialog { min-height: 200px; width: 100%; margin-block: 1rem; }
.ad-slot--corner { min-height: 60px; width: 100%; margin-top: .6rem; }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding: 2.25rem 0; }
.section h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: 1.1rem; }
.section > p.section__intro { color: var(--text-soft); margin-bottom: 1.4rem; max-width: 62ch; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.step {
  display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.1rem;
}
.step__num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.step__title { font-weight: 700; margin-bottom: .2rem; }
.step__text { color: var(--text-soft); font-size: .92rem; }

.seo-copy { color: var(--text-soft); }
.seo-copy p { margin-bottom: 1rem; }
.seo-copy h3 { font-size: 1.05rem; color: var(--text); margin-block: 1.3rem .5rem; }

.ideas-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.idea-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem;
}
.idea-card__title { font-weight: 700; margin-bottom: .35rem; font-size: .98rem; }
.idea-card__text { color: var(--text-soft); font-size: .9rem; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .2rem 1.1rem; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: 1rem 0; font-weight: 700; font-size: .96rem;
  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); flex-shrink: 0; transition: transform .2s var(--ease-out); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { color: var(--text-soft); font-size: .92rem; padding-bottom: 1rem; }

/* =============================================================
   8. Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--border); padding: 2rem 0 2.5rem; margin-top: 1rem;
}
.footer-cols { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; margin-bottom: 1.5rem; }
.footer-col h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: .7rem; }
.footer-col a, .footer-col p { display: block; color: var(--text-soft); font-size: .9rem; margin-bottom: .4rem; }
.footer-bottom { color: var(--text-faint); font-size: .82rem; border-top: 1px solid var(--border); padding-top: 1.2rem; }
.footer-bottom p { margin-bottom: .3rem; }

/* =============================================================
   9. Ad dialog (download interstitial)
   ============================================================= */
.ad-dialog {
  border: none; border-radius: var(--radius-lg); padding: 1.5rem; max-width: 380px; width: calc(100% - 2rem);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.ad-dialog::backdrop { background: rgba(10, 13, 24, 0.55); }
.ad-dialog__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .3rem; }
.ad-dialog__title { font-weight: 700; font-size: 1rem; }
.ad-dialog__close {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-soft); flex-shrink: 0;
}
.ad-dialog__close:hover { background: var(--surface-soft); }

/* =============================================================
   10. Corner toast
   ============================================================= */
.corner-toast {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 900; width: min(260px, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); padding: .9rem;
  animation: toastIn .35s var(--ease-out);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.corner-toast[hidden] { display: none; }
.corner-toast__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.corner-toast__title { font-size: .82rem; font-weight: 700; color: var(--text-soft); }
.corner-toast__close {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 1rem; flex-shrink: 0;
}
.corner-toast__close:hover { background: var(--surface-soft); }

@media (prefers-reduced-motion: reduce) {
  .corner-toast { animation: none; }
}

/* =============================================================
   11. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .format-picker__options { gap: .7rem; }
}
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .ideas-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .hero h1 { max-width: 24ch; }
}
