:root {
  color-scheme: dark;
  --bg: #0a0b0f;
  --bg-raised: #12141b;
  --bg-input: #191c25;
  --line: #262a36;
  --line-soft: #1c1f29;
  --text: #e7e9ef;
  --text-dim: #9aa1b1;
  --text-faint: #6b7280;
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --ok: #3ecf8e;
  --warn: #f5a524;
  --err: #f2555a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(60rem 30rem at 78% -12%, rgba(124, 140, 255, 0.12), transparent 65%),
    radial-gradient(45rem 25rem at 6% -8%, rgba(62, 207, 142, 0.07), transparent 60%);
  background-repeat: no-repeat;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* --------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 11, 15, 0.82);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand .mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent), #4f5bd5);
  color: #fff;
  font-size: 19px;
  box-shadow: 0 8px 20px -10px var(--accent);
}

.brand h1 { font-size: 16px; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--text-faint); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.status[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.16); }
.status[data-state="busy"] .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.16); }
.status[data-state="down"] .dot { background: var(--err); box-shadow: 0 0 0 3px rgba(242, 85, 90, 0.16); }

/* --------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #0b0c11;
  background: var(--text);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}

.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: #373d4d; }

.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger.ghost:hover:not(:disabled) { color: var(--err); border-color: rgba(242, 85, 90, 0.4); }

/* --------------------------------------------------------------- settings */

.settings {
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-raised);
  padding: 20px 24px 16px;
}

.settings-grid {
  display: grid;
  gap: 18px 26px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  max-width: 1240px;
  margin: 0 auto;
}

.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-dim);
  font-weight: 500;
}

.field-label output {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
}

.field small { color: var(--text-faint); font-size: 11.5px; line-height: 1.45; }

.field input[type="text"] {
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 11px;
  font: inherit;
  font-size: 13px;
}

.field input[type="text"]:focus { outline: none; border-color: var(--accent); }

input[type="range"] {
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 6px 0;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-raised);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
  cursor: pointer;
}

.field.checkbox { flex-direction: row; align-items: flex-start; gap: 10px; }
.field.checkbox input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.field.checkbox strong { display: block; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.field.checkbox small { display: block; margin-top: 3px; }

.settings-actions {
  max-width: 1240px;
  margin: 16px auto 0;
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------- layout */

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 24px 80px;
}

/* --------------------------------------------------------------- dropzone */

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.016), transparent);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.dropzone:hover, .dropzone:focus-visible {
  border-color: #3b4356;
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.004);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--accent);
  font-size: 18px;
}

.dropzone-title { margin: 0; font-size: 16px; font-weight: 500; }
.dropzone-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--text-faint); }

/* --------------------------------------------------------------- queue */

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 12px;
}

.counts { font-size: 13px; color: var(--text-dim); }
.counts b { color: var(--text); font-weight: 600; }
.queue-actions { display: flex; gap: 8px; }

.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.job {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  animation: rise 0.22s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.job.is-error { border-color: rgba(242, 85, 90, 0.35); }
.job.is-done { border-color: rgba(62, 207, 142, 0.22); }

.thumb {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.job-main { min-width: 0; }

.job-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.job-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: 11.5px; color: var(--text-faint); flex: none; font-variant-numeric: tabular-nums; }

.job-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.badge {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--line);
  flex: none;
}

.badge.uploading, .badge.queued { color: #8fa2ff; border-color: rgba(124, 140, 255, 0.3); }
.badge.running { color: var(--warn); border-color: rgba(245, 165, 36, 0.3); }
.badge.done { color: var(--ok); border-color: rgba(62, 207, 142, 0.3); }
.badge.error, .badge.canceled { color: var(--err); border-color: rgba(242, 85, 90, 0.3); }

.job-error { color: var(--err); overflow-wrap: anywhere; }

.bar {
  margin-top: 9px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #5ad1a5);
  transition: width 0.25s ease;
}

.bar.indeterminate .bar-fill {
  width: 35% !important;
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}

.job-actions { display: flex; gap: 6px; align-items: center; flex: none; }

/* --------------------------------------------------------------- compare */

.compare {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-raised);
  color: var(--text);
  padding: 0;
  width: min(1100px, 94vw);
  max-width: 94vw;
  box-shadow: 0 40px 80px -30px #000;
}

.compare::backdrop { background: rgba(4, 5, 8, 0.78); backdrop-filter: blur(3px); }

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.compare-head strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-tools { display: flex; align-items: center; gap: 12px; flex: none; }

.compare-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.compare-toggle input { accent-color: var(--accent); }

.compare-body { padding: 14px; }

.compare-slider {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #05060a;
  user-select: none;
  touch-action: none;
  max-height: 74vh;
  display: grid;
}

/* Both layers occupy the same grid cell with identical sizing, so the wipe is a
   clip on the top layer. Sizing them differently (one centred by object-fit, one
   left-aligned in a wrapper) would misalign the seam on portrait images. */
.compare-slider img {
  display: block;
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  max-height: 74vh;
  object-fit: contain;
}

#compare-before { clip-path: inset(0 50% 0 0); }

.handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.7);
  cursor: ew-resize;
}

/* Widens the grab area without widening the visible line. */
.handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -14px;
  right: -14px;
}

.handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.compare-body.side-by-side .compare-slider { grid-template-columns: 1fr 1fr; gap: 8px; }
.compare-body.side-by-side #compare-before { grid-area: 1 / 1; clip-path: none; }
.compare-body.side-by-side #compare-after { grid-area: 1 / 2; }
.compare-body.side-by-side .handle { display: none; }

.compare-foot { margin: 0; padding: 0 16px 14px; font-size: 11.5px; color: var(--text-faint); }
.compare-body.side-by-side ~ .compare-foot { visibility: hidden; }

/* --------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, 90vw);
}

.toast {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-raised);
  padding: 10px 13px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: rise 0.18s ease both;
}

.toast.error { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }

@media (max-width: 680px) {
  .job { grid-template-columns: 48px minmax(0, 1fr); }
  .thumb { width: 48px; height: 48px; }
  .job-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .topbar { padding: 14px 16px; }
  main { padding: 20px 16px 60px; }
}

/* ========================================================= site chrome */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 11, 15, 0.88);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.site-header .brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-header .brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.site-header .brand-text small { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  font-size: 13.5px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover { color: var(--text); }

.btn-nav { padding: 7px 14px; font-size: 13px; flex: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5a6be0);
  color: #fff;
  border: none;
}

.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #8f9cff, #6a7ae8); }

/* ------------------------------------------------------------- hero */

.hero {
  padding: 48px 24px 32px;
  border-bottom: 1px solid var(--line-soft);
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.hero-lead {
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-actions .btn { text-decoration: none; display: inline-flex; align-items: center; }

.hero-stats {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.hero-stats strong { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------ content sections */

.content-section {
  padding: 56px 24px;
}

.content-section.alt {
  background: rgba(255, 255, 255, 0.018);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.section-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.section-inner.narrow { max-width: 760px; }

.section-head { margin-bottom: 28px; max-width: 720px; }
.section-head.centered { text-align: center; margin-left: auto; margin-right: auto; }

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.65;
}

.feature-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.feature-grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.feature-card {
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.feature-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.feature-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
  counter-reset: step;
}

.steps li {
  padding: 22px 22px 22px 68px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raised);
  position: relative;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 140, 255, 0.25);
}

.steps h3 { font-size: 16px; margin-bottom: 8px; }
.steps p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }

.faq-list { display: flex; flex-direction: column; gap: 14px; }

.faq-list article {
  padding: 20px 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.faq-list h3 { font-size: 15px; margin-bottom: 8px; }
.faq-list p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-dim); }
.faq-list a { color: var(--accent); }

/* ------------------------------------------------------------- tool panel */

.tool-panel {
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--bg-raised);
  padding: 18px;
  box-shadow: var(--shadow);
}

.tool-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-panel .settings {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--bg);
}

.tool-panel .settings-grid { max-width: none; margin: 0; }
.tool-panel .settings-actions { max-width: none; margin-top: 12px; }

.tool-panel .dropzone { margin-bottom: 0; }
.tool-panel .queue-head { margin-top: 22px; }

/* ------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 40px 24px;
  background: rgba(0, 0, 0, 0.22);
}

.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.footer-brand strong { font-size: 15px; }
.footer-brand p { margin: 8px 0 0; font-size: 13px; color: var(--text-dim); max-width: 36ch; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
}

.footer-nav a {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
}

.footer-nav a:hover { color: var(--text); }

.footer-copy {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------------------------------------------------------- legal pages */

.legal-page { padding: 48px 24px 80px; }

.legal-inner {
  max-width: 720px;
  margin: 0 auto;
}

.legal-inner h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: -0.02em;
}

.legal-updated {
  margin: 8px 0 28px;
  font-size: 13px;
  color: var(--text-faint);
}

.legal-inner h2 {
  font-size: 18px;
  margin: 32px 0 10px;
}

.legal-inner h3 {
  font-size: 15px;
  margin: 18px 0 8px;
  color: var(--text-dim);
}

.legal-inner p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-dim);
}

.legal-inner a { color: var(--accent); }
.legal-back { margin-top: 36px !important; }
.legal-back a { text-decoration: none; font-weight: 500; }

@media (max-width: 900px) {
  .hero h1 { max-width: none; }
  .site-nav { display: none; }
}

@media (max-width: 680px) {
  .site-header-inner { padding: 12px 16px; }
  .hero { padding: 32px 16px 24px; }
  .content-section { padding: 40px 16px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn-nav { display: none; }
}
