:root {
  --bg: #fbfbfd;
  --bg-card: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-cyan: #17c3e6;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  --radius: 22px;
  --max-width: 1120px;
  /* themed surfaces */
  --bg-nav: rgba(251, 251, 253, 0.8);
  --bg-subtle: #f5f5f7;
  --bg-subtle-hover: #eaeaec;
  --dropzone-bg: #f1f8ff;
  --dropzone-border: rgba(0, 113, 227, 0.35);
  --preview-bg: #000000;
  --pro-card-bg: linear-gradient(180deg, #ffffff, #f4faff);
}

/* Dark theme — applied when the user's OS prefers dark (and they haven't
   forced light), or when they explicitly pick dark via the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0c;
    --bg-card: #1c1c1e;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --bg-nav: rgba(10, 10, 12, 0.8);
    --bg-subtle: #1c1c1e;
    --bg-subtle-hover: #2a2a2d;
    --dropzone-bg: rgba(0, 113, 227, 0.12);
    --dropzone-border: rgba(0, 113, 227, 0.5);
    --pro-card-bg: linear-gradient(180deg, #161b22, #0d1520);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-card: #1c1c1e;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --bg-nav: rgba(10, 10, 12, 0.8);
  --bg-subtle: #1c1c1e;
  --bg-subtle-hover: #2a2a2d;
  --dropzone-bg: rgba(0, 113, 227, 0.12);
  --dropzone-border: rgba(0, 113, 227, 0.5);
  --pro-card-bg: linear-gradient(180deg, #161b22, #0d1520);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.nav-logo {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
}
.nav-logo .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
}
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 13px; color: var(--text-secondary); }
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { background: var(--bg-subtle-hover); transform: translateY(-1px); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.lang-toggle {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.lang-toggle:hover { background: var(--bg-subtle-hover); transform: translateY(-1px); }

/* RTL: mirror the reveal-on-scroll slide and keep numbers/price LTR */
[dir="rtl"] .price .price,
[dir="rtl"] .price span { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .doc, [dir="rtl"] .hero, [dir="rtl"] .modes, [dir="rtl"] .pricing { text-align: right; }
[dir="rtl"] .doc ul, [dir="rtl"] .price-card ul { padding-right: 20px; padding-left: 0; }

/* Hero */
.hero {
  text-align: center;
  padding: 96px 0 56px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #1d1d1f, #3a3a3d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p.sub {
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  color: var(--text-secondary);
  margin: 0 auto 40px;
  max-width: 640px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(.2,.8,.2,1), transform 0.7s cubic-bezier(.2,.8,.2,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* Dropzone */
.dropzone {
  max-width: 720px;
  margin: 0 auto;
  border: 1.5px dashed var(--dropzone-border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--dropzone-bg);
  transform: scale(1.01);
}
.dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 24px;
  cursor: pointer;
}
.dropzone-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.dropzone-title { font-size: 17px; font-weight: 600; }
.dropzone-hint { font-size: 13px; color: var(--text-secondary); }
.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.warning-banner {
  max-width: 720px;
  margin: 14px auto 0;
  font-size: 12.5px;
  color: #9a6700;
  background: #fff8e6;
  border: 1px solid #ffe6a8;
  border-radius: 12px;
  padding: 10px 14px;
  display: none;
}
.warning-banner.show { display: block; }

/* File queue */
.file-queue {
  max-width: 720px;
  margin: 20px auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
}
.file-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-row .size { color: var(--text-secondary); flex-shrink: 0; }
.file-row .remove {
  border: none; background: none; color: var(--text-secondary);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px;
}
.file-row .remove:hover { color: #e04b4b; }
.file-row .status { font-size: 12px; flex-shrink: 0; min-width: 90px; text-align: right; }
.file-row.status-done .status { color: #1a9e5c; }
.file-row.status-error .status { color: #e04b4b; }
.file-row.status-working .status { color: var(--accent); }
.file-row a.download-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  flex-shrink: 0;
}

/* Preview / region selector */
.preview-section {
  max-width: 780px;
  margin: 40px auto 0;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.preview-section h3 { margin: 0 0 4px; font-size: 16px; }
.preview-section .hint { margin: 0 0 16px; font-size: 13px; color: var(--text-secondary); }
.preview-stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  user-select: none;
}
.preview-stage video {
  width: 100%;
  display: block;
  max-height: 420px;
}
.region-box {
  position: absolute;
  border: 2px solid var(--accent-cyan);
  background: rgba(23, 195, 230, 0.18);
  cursor: move;
  touch-action: none;
}
.region-box .handle {
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  bottom: -8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: nwse-resize;
  touch-action: none;
}
.preset-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.chip:hover { background: var(--bg-subtle-hover); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Mode cards */
.modes {
  max-width: var(--max-width);
  margin: 72px auto 0;
  padding: 0 24px;
}
.modes h2 { text-align: center; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.02em; margin-bottom: 8px; }
.modes .sub { text-align: center; color: var(--text-secondary); margin: 0 0 40px; }
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.mode-card {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mode-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.mode-card h4 { margin: 0 0 6px; font-size: 15px; }
.mode-card p { margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.mode-card .badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
}
.mode-card.disabled { opacity: 0.55; cursor: not-allowed; }
.mode-group {
  grid-column: 1 / -1;
  margin: 8px 0 -4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.mode-card .tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--dropzone-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

.process-bar {
  max-width: 780px;
  margin: 28px auto 0;
  display: flex;
  justify-content: center;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 34px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 6px 20px rgba(0,113,227,0.25);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(0,113,227,0.32); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Progress */
.progress-section {
  max-width: 780px;
  margin: 24px auto 0;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle-hover);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent));
  transition: width 0.25s ease;
}
.progress-label {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Pricing */
.pricing {
  max-width: var(--max-width);
  margin: 96px auto 0;
  padding: 0 24px;
}
.pricing h2 { text-align: center; font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.02em; margin-bottom: 40px; }
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.price-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.price-card.pro { border-color: rgba(0,113,227,0.3); background: var(--pro-card-bg); }
.price-card h3 { margin: 0 0 6px; font-size: 20px; }
.price-card .price { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 12px 0; }
.price-card .price span { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.price-card ul { padding-left: 18px; margin: 16px 0; color: var(--text-secondary); font-size: 13.5px; }
.price-card li { margin-bottom: 6px; }
.pro-status {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff4e5;
  color: #b06a00;
}
.pro-status.live { background: #e6f9ee; color: #1a9e5c; }

/* Footer */
.footer {
  margin-top: 96px;
  padding: 40px 24px 60px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
}
.footer a { color: var(--text-secondary); text-decoration: none; }
.footer a:hover { color: var(--text); }
.footer-links { margin-top: 10px; }
.footer-links a { margin: 0 8px; }

/* Content / legal pages (About, Contact, Privacy) */
.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 24px 24px;
}
.doc .back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}
.doc .back:hover { text-decoration: underline; }
.doc h1 {
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.doc h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 36px 0 10px;
}
.doc p, .doc li { color: var(--text-secondary); font-size: 16px; line-height: 1.65; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent); }
.doc .meta { font-size: 14px; color: var(--text-secondary); }
.doc strong { color: var(--text); }
.doc table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 18px;
  font-size: 15px;
  overflow: hidden;
  border-radius: 12px;
}
.doc th, .doc td {
  border: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  color: var(--text-secondary);
}
.doc th { background: var(--bg-subtle); color: var(--text); font-weight: 600; }
.doc .table-scroll { overflow-x: auto; }

.related-guides {
  margin-top: 48px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.related-guides h2 { margin-top: 0; font-size: 17px; }
.related-guides ul { margin: 0; padding-left: 20px; }
.related-guides a { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1d1d1f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (max-width: 480px) {
  .hero { padding: 64px 0 40px; }
  .dropzone-label { padding: 40px 18px; }
  .preview-section { padding: 18px; }
  .price-card { padding: 22px; }
}
