/* ============================================================
   Convertly — design system
   System fonts, no external requests, light + dark themes.
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f1f7;
  --text: #171a23;
  --muted: #5b6472;
  --border: #e3e6ee;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef0ff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --err: #b91c1c;
  --err-soft: #fee2e2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 26, 35, .05), 0 8px 24px rgba(23, 26, 35, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1017;
    --surface: #171a24;
    --surface-2: #1f2330;
    --text: #e8eaf1;
    --muted: #98a1b3;
    --border: #2a2f3e;
    --accent: #818cf8;
    --accent-strong: #a5b4fc;
    --accent-soft: #232742;
    --ok: #4ade80;
    --ok-soft: #173425;
    --warn: #fbbf24;
    --warn-soft: #38290a;
    --err: #f87171;
    --err-soft: #3a1616;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

.container { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1040px; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.muted { color: var(--muted); font-size: .92em; }
.err { color: var(--err); }

/* ---------------- header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

.lang-switch {
  margin-left: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.lang-switch:hover { color: var(--accent-strong); border-color: var(--accent); text-decoration: none; }

/* ---------------- hero / breadcrumbs ---------------- */

.breadcrumbs { margin: 22px 0 4px; font-size: .86rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-strong); }

.tool-hero { padding: 14px 0 4px; }
.tool-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.tool-hero .subtitle { margin: 0 0 6px; color: var(--muted); font-size: 1.02rem; max-width: 62ch; }

/* ---------------- tool shell ---------------- */

.tool-shell {
  margin: 20px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 46px 20px;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, transform .15s;
  user-select: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.is-drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  transform: scale(1.008);
}
.dz-icon { width: 44px; height: 44px; color: var(--accent); }
.dz-title { margin: 6px 0 0; font-size: 1.16rem; font-weight: 700; }
.dz-sub { margin: 0; color: var(--muted); font-size: .93rem; }
.dz-sub .link { color: var(--accent-strong); text-decoration: underline; }
.dz-formats { margin: 6px 0 0; font-size: .8rem; letter-spacing: .02em; color: var(--muted); font-family: var(--mono); }

/* ---------------- controls ---------------- */

.controls {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 16px 0 4px;
}
.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--muted);
}
.controls .grow { flex: 1; }

input[type="range"] { width: 190px; accent-color: var(--accent); }

select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

/* ---------------- queue ---------------- */

.counter {
  margin: 12px 0 4px;
  font-size: .9rem;
  color: var(--muted);
  font-family: var(--mono);
}

.queue { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.q-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.q-item[data-status="working"] { border-left: 3px solid var(--accent); }
.q-item[data-status="error"] { border-left: 3px solid var(--err); }
.q-item[data-status="done"] { border-left: 3px solid var(--ok); }

.q-thumb {
  width: 46px; height: 46px;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, var(--border) 25%, transparent 25%, transparent 75%, var(--border) 75%),
    linear-gradient(45deg, var(--border) 25%, transparent 25%, transparent 75%, var(--border) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  flex: none;
}

.q-body { min-width: 0; flex: 1; }
.q-name {
  font-weight: 600;
  font-size: .93rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.q-meta .arrow { color: var(--accent); }
.q-note { font-size: .78rem; color: var(--warn); margin-top: 2px; }

.q-side { display: flex; align-items: center; gap: 10px; flex: none; }

/* row status is set on <li> via data-status */
.q-item[data-status="working"] .q-side::after {
  content: "";
  width: 16px; height: 16px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- badges & buttons ---------------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  font-family: var(--mono);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 18px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--accent-strong); border-color: var(--border); }
.btn-ghost:not(:disabled):hover { background: var(--surface-2); }
.btn-small { padding: 5px 12px; font-size: .84rem; }

.icon-btn {
  font: inherit;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: .9rem;
}
.icon-btn:hover { background: var(--surface); color: var(--err); }

.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.status { min-height: 1.4em; margin: 8px 0 0; font-size: .84rem; color: var(--muted); }

.privacy-line {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: .84rem;
  color: var(--muted);
  text-align: center;
}

.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-size: .9rem; margin: 12px 0 0; }
.notice-err { background: var(--err-soft); color: var(--err); }

/* ---------------- notices / content ---------------- */

.prose { margin: 34px 0; }
.prose h2 { font-size: 1.28rem; margin: 1.4em 0 .5em; letter-spacing: -.01em; }
.prose h3 { font-size: 1.06rem; margin: 1.2em 0 .4em; }
.prose p { margin: .7em 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 52px;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  border-radius: 50%;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute; left: 17px; top: 36px; bottom: 2px;
  width: 1px; background: var(--border);
}

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  margin: 8px 0;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 13px 0;
  list-style: none;
  position: relative;
  padding-right: 30px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  position: absolute; right: 4px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 700;
}
details[open] summary::after { content: "–"; }
details .faq-a { padding: 0 0 14px; color: var(--text); }

/* ---------------- homepage ---------------- */

.home-hero { text-align: center; padding: 64px 0 28px; }
.home-hero h1 {
  font-size: clamp(2rem, 5.5vw, 2.9rem);
  margin: 0 0 12px;
  letter-spacing: -.02em;
  line-height: 1.12;
}
.home-hero .accent { color: var(--accent-strong); }
.home-hero p { color: var(--muted); font-size: 1.08rem; max-width: 56ch; margin: 0 auto; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 30px 0 10px;
}
.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.tool-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.tool-card .tc-icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 10px; }
.tool-card h2 { margin: 0 0 6px; font-size: 1.06rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 26px 0;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.feature h3 { margin: 0 0 6px; font-size: .98rem; }
.feature p { margin: 0; color: var(--muted); font-size: .88rem; }
.feature .f-icon { width: 26px; height: 26px; color: var(--accent); margin-bottom: 8px; }

/* ---------------- ads ---------------- */

.ad-slot {
  margin: 22px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-slot:empty { display: none; }

/* ---------------- footer ---------------- */

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer .inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px 20px;
}
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--muted); font-size: .9rem; }
.site-footer nav a:hover { color: var(--text); }
.site-footer .copy { margin-left: auto; color: var(--muted); font-size: .84rem; }

/* ---------------- responsive ---------------- */

@media (max-width: 620px) {
  .controls { gap: 14px; }
  input[type="range"] { width: 150px; }
  .q-side .btn { display: none; }   /* thumb download still available via Download-all */
  .q-item { gap: 10px; }
  .site-footer .copy { margin-left: 0; }
}
