:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #1a1f2b;
  --muted: #6b7280;
  --brand: #5b6cff;
  --brand-dark: #3f4ed1;
  --accent: #ff7a59;
  --border: #e6e8ef;
  --ok: #1faa6b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(30, 40, 80, 0.08);
  --badge-bg: #eef0ff;
  --badge-fg: #3f4ed1;
  --cta-bg: #f5f6ff;
  --cta-border: #5b6cff;
  --quote-bg: #f0f2ff;
  --quote-fg: #3a3f55;
  --pill-free-bg: #fff4e8;
  --pill-free-fg: #ff7a59;
  --pill-ok-bg: #eafaf1;
  --pill-ok-fg: #1faa6b;
  --nav-bg: rgba(255, 255, 255, 0.85);
  color-scheme: light dark;
}

[data-theme="dark"] {
  --bg: #0e1117;
  --surface: #161b26;
  --ink: #e8eaf0;
  --muted: #9aa3b2;
  --brand: #7c8aff;
  --brand-dark: #4a5ad6;
  --accent: #ff7a59;
  --border: #2a313f;
  --ok: #2ebb6f;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --badge-bg: #1c2233;
  --badge-fg: #9aa6ff;
  --cta-bg: #1a2030;
  --cta-border: #3a4a8c;
  --quote-bg: #1a2030;
  --quote-fg: #aeb6c8;
  --pill-free-bg: #2e2118;
  --pill-free-fg: #ff916e;
  --pill-ok-bg: #11281d;
  --pill-ok-fg: #34c987;
  --nav-bg: rgba(14, 17, 23, 0.8);
}

/* Dark-mode button + toast AA fixes (white-text buttons meet WCAG AA) */
[data-theme="dark"] .btn-primary { background: var(--brand-dark); }
[data-theme="dark"] .btn-primary:hover { background: #3f56c8; }
[data-theme="dark"] .toast { background: #1c2436; border: 1px solid var(--border); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: var(--nav-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.logo span { color: var(--brand); }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.brand span { color: var(--brand); }
.lang-switch { font-weight: 700; color: var(--ink); padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.lang-switch:hover { border-color: var(--brand); color: var(--brand); }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14px; }
.nav-links a:hover { color: var(--ink); }
.btn { display: inline-block; border: none; cursor: pointer; font-weight: 600; border-radius: 10px; padding: 10px 18px; font-size: 14px; transition: .15s; text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--brand); background: rgba(91,108,255,0.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Higher-specificity overrides: nav-links a (color: muted) wins over .btn-primary,
   so force white text inside .nav-links. */
.nav-links a.btn-primary { color: #fff; }
.nav-links a.btn-primary:hover { color: #fff; }
.nav-links a.auth-btn { color: var(--brand); }
.nav-links a.auth-btn:hover { color: #fff; }

/* hero */
.hero { padding: 70px 0 40px; text-align: center; }
.hero h1 { font-size: 44px; line-height: 1.1; margin: 0 0 14px; letter-spacing: -1px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.hero .badge { display: inline-block; background: var(--badge-bg); color: var(--badge-fg); font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }

/* workbench */
.workbench { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin: 10px 0 60px; }
.section-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 40px 20px; text-align: center; color: var(--muted); transition: .15s; cursor: pointer; }
.dropzone.drag { border-color: var(--brand); background: #f3f4ff; color: var(--brand-dark); }
.options { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.opt { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer; }
.opt input { accent-color: var(--brand); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* before/after comparison */
.compare-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.compare-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.compare-segments { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.compare-segments .segment { border: none; background: transparent; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--muted); border-radius: 8px; cursor: pointer; }
.compare-segments .segment.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.compare-segments .segment:hover:not(.active) { color: var(--ink); }

.compare { position: relative; width: 100%; max-width: 800px; margin: 0 auto 22px; aspect-ratio: 4/3; border-radius: 14px; overflow: hidden; background: #0c0e14; box-shadow: 0 8px 30px rgba(20,25,45,.18); user-select: none; }
.compare-pane { position: absolute; inset: 0; }
.compare-pane.before { z-index: 1; }
.compare-pane.after { z-index: 2; width: 50%; overflow: hidden; }
.compare-pane img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }
.compare-pane.after img { width: 200%; } /* keep the visible 50% at full container width */
.compare-pane .label { position: absolute; top: 14px; font-size: 13px; font-weight: 800; color: #fff; background: rgba(0,0,0,.55); padding: 6px 12px; border-radius: 8px; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,.15); text-transform: uppercase; letter-spacing: .5px; }
.compare-pane.before .label { left: 14px; }
.compare-pane.after .label { right: 14px; }

.compare .divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 0 16px rgba(0,0,0,.25); z-index: 3; pointer-events: none; }
.compare .handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.compare .handle svg { margin-left: 2px; }

.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; z-index: 4; }

/* split (side-by-side) mode */
.compare.split { display: flex; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.compare.split .compare-pane { position: relative; flex: 1 1 50%; aspect-ratio: 4/3; overflow: hidden; }
.compare.split .compare-pane.after { width: auto; }
.compare.split .compare-pane img { position: absolute; width: 200%; height: 100%; object-fit: contain; }
.compare.split .compare-pane.before img { left: 0; }
.compare.split .compare-pane.after img { left: -100%; }
.compare.split .divider, .compare.split input[type=range] { display: none; }

/* result / misc */
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.plan-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.plan-pill.free { background: var(--pill-free-bg); color: var(--pill-free-fg); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1a1f2b; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .2s; z-index: 50; }

/* ── Site footer ──────────────────────────────────────────────────────── */
.site-footer { text-align: center; padding: 40px 20px 30px; border-top: 1px solid var(--border); margin-top: 60px; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 14px; }
.footer-links a { color: var(--muted); font-size: 14px; text-decoration: none; }
.footer-links a:hover { color: var(--brand); }
.footer-meta { color: var(--muted); font-size: 12px; margin: 0; }

/* ── Legal pages (privacy / terms) ────────────────────────────────────── */
.legal { max-width: 720px; padding: 40px 20px 80px; }
.legal h1 { font-size: 28px; margin-bottom: 6px; }
.legal h2 { font-size: 18px; margin-top: 32px; margin-bottom: 10px; }
.legal p, .legal li { font-size: 15px; line-height: 1.7; color: var(--muted); }
.legal ul { padding-left: 20px; }
.legal a { color: var(--brand); }
.toast.show { opacity: 1; }
.spinner { width: 16px; height: 16px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; display: inline-block; vertical-align: -3px; margin-right: 6px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* pricing */
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0 60px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; }
.plan.featured { border-color: var(--brand); box-shadow: var(--shadow); }
.plan h3 { margin: 0 0 6px; }
.plan .price { font-size: 30px; font-weight: 800; margin: 8px 0; }
.plan ul { list-style: none; padding: 0; margin: 14px 0; color: var(--muted); font-size: 14px; }
.plan li { padding: 4px 0; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0 50px; }

@media (max-width: 760px) {
  .hero h1 { font-size: 32px; }
  .pricing { grid-template-columns: 1fr; }
  .nav-links a:not(.btn):not(.lang-switch) { display: none; }
}

/* features */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0 50px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-ic { font-size: 28px; margin-bottom: 8px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* faq */
.faq { display: grid; gap: 14px; margin: 16px 0 50px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.faq-item h3 { margin: 0 0 6px; font-size: 16px; }
.faq-item p { margin: 0; color: var(--muted); font-size: 14px; }

@media (max-width: 760px) {
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
}

/* ── blog ─────────────────────────────────────────────────────────────── */
.blog-hero { text-align: center; padding: 56px 20px 24px; }
.blog-hero h1 { font-size: 40px; margin: 0 0 10px; letter-spacing: -.5px; }
.post-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 18px 0 50px; }
.post-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; color: var(--ink); transition: .15s; box-shadow: var(--shadow); }
.post-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.post-card h3 { margin: 8px 0 8px; font-size: 17px; line-height: 1.35; }
.post-card p { margin: 0; color: var(--muted); font-size: 14px; }
.post-meta { color: var(--brand); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.post-more { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 700; color: var(--brand); }

/* article */
.article { max-width: 720px; padding: 40px 20px 60px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.article h1 { font-size: 34px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.5px; }
.article h2 { font-size: 22px; margin: 34px 0 10px; }
.article h3 { font-size: 18px; margin: 22px 0 8px; }
.article p { margin: 12px 0; }
.article ul, .article ol { margin: 12px 0; padding-left: 22px; }
.article li { margin: 6px 0; }
.article blockquote { margin: 22px 0; padding: 14px 18px; border-left: 4px solid var(--brand); background: var(--quote-bg); border-radius: 0 10px 10px 0; color: var(--quote-fg); font-style: italic; }
.article-rule { border: none; border-top: 1px solid var(--border); margin: 34px 0 18px; }
.cta-box { margin: 28px 0; padding: 22px 24px; border: 1px solid var(--cta-border); border-radius: var(--radius); background: var(--cta-bg); text-align: center; }
.cta-box h3 { margin: 0 0 6px; }
.cta-box p { margin: 0 0 14px; color: var(--muted); }

.footer { display: flex; justify-content: center; gap: 14px; }

@media (max-width: 760px) {
  .post-list { grid-template-columns: 1fr; }
  .blog-hero h1 { font-size: 30px; }
  .article h1 { font-size: 26px; }
  .nav-links { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .nav-links a:not(.btn):not(.lang-switch) { display: none; }
}

/* ── theme toggle (top-right, beside language switch) ─────────────── */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 9px;
  background: transparent; color: var(--ink);
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ic-sun { display: none; }
[data-theme="dark"] .icon-btn .ic-moon { display: none; }
[data-theme="dark"] .icon-btn .ic-sun { display: block; }

/* ── Auth (login/logout) ─────────────────────────────────────────────── */
.auth-btn {
  font-size: 0.85em;
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--brand);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.auth-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.auth-user {
  font-size: 0.82em;
  color: var(--muted);
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 480px) {
  .workbench { padding: 18px 14px; }
  .hero { padding: 48px 0 28px; }
  .dropzone { padding: 28px 14px; }
  .options { gap: 8px; }
  .opt { padding: 8px 10px; font-size: 13px; }
  .compare-toolbar { flex-wrap: wrap; gap: 8px; }
  .icon-btn { width: 34px; height: 34px; }
}

