:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1424;
  --surface: #131d31;
  --surface-muted: #18243a;
  --text: #edf3ff;
  --muted: #a8b5ca;
  --line: #2a3953;
  --primary: #60a5fa;
  --primary-dark: #93c5fd;
  --danger: #fca5a5;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}
button, input, select { font: inherit; }
button, .drop-zone { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.header-inner, .container, .site-footer {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}
.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; text-decoration: none; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--primary);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.language-link, .icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
.language-link { padding: 7px 12px; text-decoration: none; font-weight: 700; }
.icon-button { width: 42px; cursor: pointer; }

.container { padding: 28px 0 72px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .9rem; }
.breadcrumb a { text-underline-offset: 3px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
  gap: 36px;
  align-items: end;
  padding: 58px 0 38px;
}
.eyebrow, .section-label { color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; max-width: 780px; font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: 1.03; letter-spacing: -.055em; }
.lead { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: clamp(1.02rem, 2vw, 1.2rem); }
.privacy-note {
  margin: 0;
  padding: 20px;
  display: flex;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: .92rem;
}
.privacy-note svg { flex: 0 0 auto; color: var(--primary); }
.privacy-note strong { display: block; color: var(--text); }

.tool-card, .content-section {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tool-card { overflow: hidden; }
.drop-zone {
  margin: 22px;
  min-height: 250px;
  padding: 42px 22px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border: 2px dashed #94a3b8;
  border-radius: 18px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.drop-zone:hover, .drop-zone.dragover, .drop-zone:focus-visible { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); outline: none; transform: translateY(-1px); }
.drop-zone h2 { margin: 15px 0 5px; font-size: 1.3rem; }
.drop-zone p { margin: 0; color: var(--muted); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; color: white; background: var(--primary); }

.workspace { padding: 0 22px 24px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0 16px; }
.workspace-header h2 { margin-bottom: 2px; }
.workspace-meta { margin: 0; color: var(--muted); }
.image-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.image-item {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}
.image-item.dragging { opacity: .45; }
.drag-handle { color: var(--muted); text-align: center; cursor: grab; font-size: 1.2rem; }
.thumbnail { width: 72px; height: 58px; object-fit: cover; border-radius: 9px; background: #e2e8f0; }
.image-info { min-width: 0; }
.image-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.image-meta { color: var(--muted); font-size: .84rem; }
.item-actions { display: flex; gap: 6px; }
.small-button {
  min-width: 40px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.small-button.remove { color: var(--danger); }

.settings {
  margin-top: 20px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
}
.field { display: grid; gap: 7px; }
.field label { font-size: .88rem; font-weight: 700; }
.field select, .field input {
  width: 100%;
  min-height: 43px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}
.field select:disabled { opacity: .55; cursor: not-allowed; }
.output-field { grid-column: span 2; }
.range-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; min-height: 43px; }
.range-row output { min-width: 42px; color: var(--muted); font-size: .86rem; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.button {
  min-height: 45px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
}
.button:disabled { opacity: .55; cursor: wait; }
.button-secondary { background: var(--surface); color: var(--text); }
.button-primary { border-color: var(--primary); background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); }
.status { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.status.error { color: var(--danger); }

.content-section { margin-top: 32px; padding: clamp(24px, 5vw, 48px); box-shadow: none; }
.content-section > h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -.035em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.step-number { color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .08em; }
.step h3 { margin: 12px 0 6px; }
.step p, .faq-item p { margin-bottom: 0; color: var(--muted); }
.faq-list { display: grid; gap: 10px; }
.faq-item { padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.faq-item summary { padding: 16px 0; font-weight: 750; cursor: pointer; }
.faq-item p { padding: 0 0 17px; }
.site-footer { padding: 30px 0 44px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 42px; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .header-inner, .container, .site-footer { width: min(100% - 22px, 1120px); }
  .container { padding-top: 20px; }
  .hero { padding: 38px 0 28px; }
  .tool-card { border-radius: 16px; }
  .drop-zone { margin: 12px; min-height: 220px; padding-inline: 16px; }
  .workspace { padding-inline: 12px; }
  .image-item { grid-template-columns: 26px 54px minmax(0, 1fr); }
  .thumbnail { width: 54px; height: 48px; }
  .item-actions { grid-column: 2 / -1; justify-content: flex-end; }
  .settings { grid-template-columns: 1fr; padding: 14px; }
  .output-field { grid-column: span 1; }
  .toolbar .button { flex: 1 1 45%; }
  .toolbar .button-primary { flex-basis: 100%; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
