:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #0891b2;
  --accent-soft: #ecfeff;
  --preview-bg: transparent;
  --r: 16px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { width: min(1100px, 92vw); margin: 0 auto; flex: 1; }
a { color: inherit; }

.top { width: min(1100px, 92vw); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--ink) 50%, #a5f3fc 50%); }
.tag { color: var(--muted); font-size: 0.9rem; }

.hero { text-align: center; padding: 28px 0 8px; }
h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 14px; }
h1 span { color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); max-width: 620px; margin: 0 auto 28px; font-size: 1.08rem; line-height: 1.55; }

.drop {
  border: 2px dashed #cbd5e1; border-radius: 24px; background: var(--card);
  padding: 56px 20px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
  outline: none;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { transform: scale(1.01); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop .icon { width: 60px; height: 60px; border-radius: 18px; background: var(--ink); color: #fff; display: grid; place-items: center; margin-bottom: 6px; }
.drop strong { font-size: 1.2rem; }
.drop span { color: var(--muted); }

.model { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 16px auto 0; color: var(--muted); font-size: 0.88rem; max-width: 640px; }
.track { width: 120px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; flex: none; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.track.done .fill { background: #10b981; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 36px 0 14px; }
.bgs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.right { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--c, #fff); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checker-sw, .checker { background-color: #fff; background-image: conic-gradient(#e5e7eb 25%, transparent 0 50%, #e5e7eb 0 75%, transparent 0); background-size: 16px 16px; }
.custom { background: conic-gradient(#f43f5e, #f59e0b, #10b981, #06b6d4, #8b5cf6, #f43f5e); }
.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.btn { font: inherit; font-weight: 600; font-size: 0.92rem; border-radius: 10px; padding: 9px 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: #94a3b8; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); flex: 1; }
.btn.primary:hover { background: #1e293b; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; }

.samples { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 0.9rem; flex-wrap: wrap; }
.sample { padding: 0; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; width: 56px; height: 56px; background: none; transition: transform .12s, border-color .12s; }
.sample:hover, .sample:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; }

.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 64px 0 24px; }
.why div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.why h3 { margin: 0 0 6px; font-size: 1.02rem; }
.why p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 0.95rem; }

.faq { max-width: 760px; margin: 40px auto 60px; }
.faq h2 { letter-spacing: -0.02em; }
details { border-bottom: 1px solid var(--line); padding: 14px 2px; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); line-height: 1.55; margin: 10px 0 2px; }

footer { width: min(1100px, 92vw); margin: 0 auto; padding: 24px 0 32px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
  .tag { display: none; }
  .drop { padding: 40px 16px; }
  .model { flex-direction: column; gap: 6px; }
}

.nav { display: flex; gap: 18px; font-size: 0.92rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"], .nav a:hover { color: var(--ink); font-weight: 600; }
@media (max-width: 600px) { .nav { gap: 12px; font-size: 0.85rem; } }
.prose { max-width: 720px; margin: 24px auto 60px; line-height: 1.65; }
.prose h1 { font-size: 2rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.prose h2 { font-size: 1.15rem; margin-top: 28px; }
.prose p { color: #334155; }
.prose .muted { color: var(--muted); font-size: 0.9rem; }
.contact-email { font-size: 1.3rem; font-weight: 600; }
footer a { color: var(--muted); }
@media (max-width: 900px) { .top { flex-wrap: wrap; gap: 10px; } .nav { flex-wrap: wrap; gap: 8px 14px; } }
.prose { max-width: 720px; margin: 24px auto 60px; line-height: 1.65; }
.prose h1 { font-size: 2rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.prose h2 { font-size: 1.15rem; margin-top: 28px; }
.prose p { color: #334155; }
.prose .muted { color: var(--muted); font-size: 0.9rem; }
.contact-email { font-size: 1.3rem; font-weight: 600; }
footer a { color: var(--muted); }

/* ---------- workspace: big preview + strip ---------- */
.name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state { color: var(--muted); font-size: 0.84rem; }
.s-meta .state.err { color: #dc2626; }
.workspace { margin: 36px 0 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; animation: pop .25s ease-out; scroll-margin-top: 12px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.stage { position: relative; height: min(70vh, 720px); min-height: 200px; transition: height .2s; display: grid; place-items: center; background: #f1f5f9; padding: 16px; }
.fit { position: relative; max-width: 100%; max-height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.fit .checker { position: absolute; inset: 0; }
body.solid-bg .fit .checker { background: var(--preview-bg); }
.fit canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.working .fit canvas.orig, .stage.queued .fit canvas.orig { opacity: .45; filter: grayscale(.5); }
.stage.done .fit { cursor: ew-resize; }
.handle { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 0; z-index: 3; display: none; outline: none; }
.stage.done .handle { display: block; }
.handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.25); }
.handle span { position: absolute; top: 50%; left: -18px; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.3); display: grid; place-items: center; }
.handle span::after { content: "\2039\00a0\203A"; font-weight: 700; color: var(--ink); font-size: 18px; line-height: 1; }
.handle:focus-visible span { box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(15,23,42,.3); }
.lbl { position: absolute; top: 10px; z-index: 2; font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(15,23,42,.65); color: #fff; display: none; pointer-events: none; }
.stage.done .lbl { display: block; }
.l-before { left: 10px; } .l-after { right: 10px; }
.s-spin { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); border-top-color: var(--accent); animation: spin .8s linear infinite; display: none; z-index: 4; }
.stage.working .s-spin, .stage.queued .s-spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.s-bar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.s-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.s-actions { display: flex; gap: 8px; }
.s-actions .btn.primary { flex: none; padding: 10px 20px; }
.s-strip { display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px; border-top: 1px solid var(--line); background: #fafbfc; }
.workspace:not(.multi) .thumb:not(.add) { display: none; }
.workspace:not(.multi) .s-strip .right { display: none; }
.strip { display: flex; gap: 8px; overflow-x: auto; flex: 1; padding: 3px; scrollbar-width: thin; }
.thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; border: 2px solid var(--line); padding: 0; cursor: pointer; overflow: hidden; display: grid; place-items: center; background-color: #fff; background-image: conic-gradient(#eef0f3 25%, transparent 0 50%, #eef0f3 0 75%, transparent 0); background-size: 10px 10px; }
.thumb canvas { max-width: 100%; max-height: 100%; display: block; }
.thumb.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.thumb.queued canvas, .thumb.working canvas { opacity: .5; }
.t-spin { position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: none; }
.thumb.queued .t-spin, .thumb.working .t-spin { display: block; }
.thumb.error { border-color: #fca5a5; }
.thumb.error::after { content: "!"; position: absolute; inset: auto 4px 4px auto; width: 16px; height: 16px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.thumb.add { background: #fff; border-style: dashed; font-size: 26px; color: var(--muted); font-weight: 300; }
.thumb.add:hover { border-color: var(--accent); color: var(--accent); }
.workspace:not(.multi) .s-strip { padding: 10px 18px; }
.workspace:not(.multi) .thumb.add { width: auto; height: auto; padding: 8px 14px; font-size: 0.9rem; font-weight: 600; border-radius: 10px; display: inline-flex; white-space: nowrap; }
.workspace:not(.multi) .thumb.add::after { content: "\00a0 Add more images"; }
@media (max-width: 600px) {
  .stage { padding: 8px; }
  .s-bar { padding: 12px; gap: 12px; }
  .s-actions { width: 100%; }
  .s-actions .btn.primary { flex: 1; }
  .s-strip { flex-wrap: wrap; }
  .strip { flex-basis: 100%; }
  .s-strip .right { width: 100%; }
  .s-strip .right .btn { flex: 1; }
  .stage { height: auto; }
}

/* editing tools */
.s-tools { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); background: #fafbfc; font-size: 0.88rem; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-weight: 600; border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }
.rng { display: inline-flex; align-items: center; gap: 8px; }
.rng input { width: 120px; accent-color: var(--accent); }
.rng output { min-width: 2.2em; font-variant-numeric: tabular-nums; color: var(--ink); }
.ed-btns { display: flex; gap: 6px; margin-left: auto; }
.ed-btns .btn { padding: 6px 12px; }
.stage:not([data-mode="erase"]):not([data-mode="restore"]) ~ .s-tools .brush-only { display: none; }
.stage[data-mode="erase"] .handle, .stage[data-mode="restore"] .handle, .stage[data-mode="erase"] .lbl, .stage[data-mode="restore"] .lbl { display: none !important; }
.stage[data-mode="erase"] .fit, .stage[data-mode="restore"] .fit { cursor: none; }
.stage[data-mode="restore"] .fit canvas.out { z-index: 1; }
.brush-cursor { position: absolute; z-index: 5; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.6); transform: translate(-50%, -50%); pointer-events: none; }
.stage[data-mode="restore"] .brush-cursor { border-color: #10b981; }
.stage[data-mode="erase"] .brush-cursor { border-color: #f43f5e; }
@media (max-width: 600px) { .s-tools { gap: 10px; padding: 10px 12px; } .rng input { width: 90px; } .ed-btns { margin-left: 0; } }
/* tool cards (homepage index + cross-links) */
.more-tools { margin: 56px 0 8px; }
.more-tools h2 { letter-spacing: -0.02em; font-size: 1.3rem; margin: 0 0 14px; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tool-cards a { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; transition: border-color .15s, transform .15s; }
.tool-cards a:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-cards strong { font-size: 1rem; }
.tool-cards span { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.tool-cards a.here { border-color: var(--accent); background: var(--accent-soft); }
.alt-link { color: var(--muted); font-size: 0.92rem; margin: 14px 0 0; }
