:root {
  --bg: #0b0d10;
  --fg: #e8eaed;
  --dim: #9aa3ad;
  --acc: #7aa2ff;
  --card: #14171c;
  --line: #232830;
  --bad: #ff7a7a;
  --ok: #6ede8a;
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f7f8fa; --fg:#14171c; --dim:#5b6570; --card:#fff; --line:#e3e7ec; --bad:#c22; --ok:#1a8f3c; }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
}
h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.engine { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.engine label { color: var(--dim); font-size: 13px; }
.note { color: var(--dim); font-size: 12px; }
.note.bad { color: var(--bad); }

select, button, input[type=file] { font: inherit; color: inherit; }
select {
  background: var(--card); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; padding: 6px 10px; font-size: 13px;
}

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; }
.tabs button {
  background: none; border: 1px solid transparent; border-bottom: none;
  color: var(--dim); padding: 8px 16px; border-radius: 10px 10px 0 0; cursor: pointer;
}
.tabs button.on { background: var(--card); border-color: var(--line); color: var(--fg); }

/* Two columns, both capped, and the pair centred — on a wide monitor an
   uncapped result column grows to 900 px and pushes itself off the screen. */
main {
  display: grid; grid-template-columns: minmax(300px, 380px) minmax(320px, 580px);
  gap: 24px; padding: 0 24px 24px; align-items: start; justify-content: center;
}
@media (max-width: 860px) { main { grid-template-columns: minmax(0, 1fr); } }

.controls, .result { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.controls { border-top-left-radius: 0; }
/* Five feature sliders make the left column taller than the viewport; keep the
   thing the user is actually looking at on screen while they scroll. */
.result { position: sticky; top: 16px; }
@media (max-width: 860px) { .result { position: static; } }

/* ---- upload tiles ---- */
.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* A single tile does not need to be square — the sliders below it are what
   matters, and a 1:1 preview pushes them off the screen. */
.drops.one { grid-template-columns: 1fr; }
.drops.one .drop { aspect-ratio: 16 / 10; }
.drop {
  position: relative; aspect-ratio: 1; border: 1.5px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center; cursor: pointer; overflow: hidden; background: var(--bg);
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--acc); }
.drop.busy { opacity: .55; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.drop.filled img { display: block; }
.drop.filled p { display: none; }
.drop p { color: var(--dim); font-size: 12px; margin: 0; padding: 0 10px; text-align: center; }
.drop .tag {
  position: absolute; top: 8px; left: 8px; z-index: 1; font-size: 11px; font-weight: 600;
  background: rgba(0,0,0,.6); color: #fff; padding: 2px 7px; border-radius: 6px;
}

/* ---- sliders ---- */
.slider { margin-top: 18px; }
.row { display: flex; justify-content: space-between; align-items: baseline; }
.row label { font-size: 13px; }
.row output { color: var(--acc); font-size: 13px; font-variant-numeric: tabular-nums; }
.ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 4px; background: var(--line); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px;
  background: var(--acc); border-radius: 50%; border: none;
}
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--acc); border-radius: 50%; border: none; }
input[type=range]:disabled { opacity: .4; cursor: default; }

#features .feature { margin-top: 10px; }

button.ghost {
  margin-top: 16px; background: none; border: 1px solid var(--line); color: var(--dim);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { color: var(--fg); border-color: var(--acc); }

/* ---- result ---- */
.stage {
  position: relative; aspect-ratio: 1; max-height: calc(100vh - 220px);
  border-radius: 12px; overflow: hidden;
  background: var(--bg); display: grid; place-items: center;
}
#out { width: 100%; height: 100%; object-fit: contain; display: none; }
#out.on { display: block; }
.hint { color: var(--dim); font-size: 14px; }
.statusbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; color: var(--dim); font-size: 12px; min-height: 18px;
}
.statusbar span { font-variant-numeric: tabular-nums; }
.statusbar .bad { color: var(--bad); }
.statusbar a { color: var(--acc); }
