/* fonts are self-hosted so no third party sees our visitors (SIL OFL, see assets/fonts) */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("../assets/fonts/space-grotesk-latin.woff2") format("woff2");
}

:root {
  --bg: #0b0d17;
  --bg-2: #11142a;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef0ff;
  --muted: #9aa0c3;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --grad: linear-gradient(120deg, var(--violet), var(--cyan));
  --radius: 20px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
    --bg: #f5f4ff;
    --bg-2: #ebe9ff;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-2: rgba(255, 255, 255, 0.9);
    --line: rgba(40, 30, 120, 0.12);
    --text: #15132b;
    --muted: #5f5b85;
    --ok: #0f9d6b;
    --warn: #b7791f;
    --shadow: 0 20px 50px -24px rgba(60, 40, 160, 0.35);
  }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4ff;
    --bg-2: #ebe9ff;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-2: rgba(255, 255, 255, 0.9);
    --line: rgba(40, 30, 120, 0.12);
    --text: #15132b;
    --muted: #5f5b85;
    --ok: #0f9d6b;
    --warn: #b7791f;
    --shadow: 0 20px 50px -24px rgba(60, 40, 160, 0.35);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
a { color: inherit; }
kbd {
  font: 12px var(--font); padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--glass-2);
}

/* animated background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; opacity: 0.25;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; animation: drift 18s ease-in-out infinite alternate; }
.b1 { width: 520px; height: 520px; background: var(--violet); top: -180px; left: -120px; }
.b2 { width: 460px; height: 460px; background: var(--cyan); top: -120px; right: -140px; animation-delay: -6s; }
.b3 { width: 380px; height: 380px; background: var(--pink); bottom: -200px; left: 35%; opacity: 0.25; animation-delay: -12s; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }

/* nav */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: 18px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 21px var(--font-display); }
.nav-right { display: flex; gap: 8px; }
.chip {
  font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--line); color: var(--muted); text-decoration: none;
}
.chip-link:hover { color: var(--text); border-color: var(--violet); }
.chip-link { cursor: pointer; font-family: inherit; }
.steps li b { font-weight: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 8px 20px 40px; }

/* landing */
.landing { display: grid; gap: 36px; }
.hero { text-align: center; display: grid; gap: 14px; justify-items: center; padding-top: 24px; }
.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--cyan);
  padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, var(--cyan) 12%, transparent);
}
.hero h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1.05; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { max-width: 620px; color: var(--muted); font-size: 17px; margin: 0; }

.drop {
  position: relative; display: grid; justify-items: center; gap: 10px; text-align: center; cursor: pointer;
  max-width: 760px; width: 100%; margin: 0 auto; padding: 56px 20px;
  border-radius: 28px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}
.drop::before {
  /* gradient ring */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.55; transition: opacity 0.2s;
}
.drop:hover, .drop.drag { transform: translateY(-2px); }
.drop:hover::before, .drop.drag::before { opacity: 1; }
.drop-art {
  width: 92px; height: 92px; display: grid; place-items: center; border-radius: 26px; color: #fff;
  background: var(--grad); box-shadow: 0 12px 40px -10px var(--violet);
}
.drop-art svg { animation: spin 14s linear infinite; }
.drop.drag .drop-art svg { animation-duration: 2s; }
.drop-title { font: 700 22px var(--font-display); margin-top: 6px; }
.drop-sub { color: var(--muted); font-size: 14px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  padding: 22px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.feature h3 { font-size: 17px; margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.f-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff;
  background: var(--grad);
}

/* busy */
.busy { display: grid; justify-items: center; gap: 18px; padding: 120px 0; color: var(--muted); }
.orbit { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--line); position: relative; animation: spin 1s linear infinite; }
.orbit span {
  position: absolute; top: -7px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 16px var(--cyan);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* result */
.result { display: grid; gap: 18px; }
.steps { list-style: none; display: flex; justify-content: center; gap: 8px; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--glass); border: 1px solid var(--line); color: var(--muted);
}
.steps li em { font-style: normal; font-weight: 400; opacity: 0.8; }
.steps li span {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  background: var(--glass-2); border: 1px solid var(--line);
}
.steps li.done { color: var(--text); }
.steps li.done span { background: var(--grad); color: #fff; border-color: transparent; }

.status {
  text-align: center; font-weight: 600; padding: 10px 16px; border-radius: 14px; justify-self: center;
  background: var(--glass); border: 1px solid var(--line);
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }

.grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.side { display: grid; gap: 14px; }
.panel {
  padding: 14px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); display: grid; gap: 12px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.hint { font-size: 12.5px; color: var(--muted); }

/* compare slider */
.compare {
  position: relative; width: min(100%, calc(68vh * var(--ar, 1.5))); margin: 0 auto; border-radius: 14px; overflow: hidden;
  user-select: none; touch-action: none; cursor: ew-resize;
  /* classic checkerboard so transparent areas are obvious */
  background: repeating-conic-gradient(#cfd3dc 0% 25%, #ffffff 0% 50%) 50% / 18px 18px;
}
.compare canvas { display: block; width: 100%; height: auto; }
.compare .after { position: absolute; inset: 0; height: 100%; clip-path: inset(0 0 0 50%); }
.compare.zoom { width: 100%; aspect-ratio: 1; cursor: grab; }
.compare.zoom.panning { cursor: grabbing; }
.zoom-tools { display: flex; align-items: center; gap: 8px; }
.zoom-tools .seg button { padding: 4px 11px; font-size: 15px; }
.compare.zoom canvas { height: 100%; image-rendering: pixelated; }
.compare.zoom.smooth canvas { image-rendering: auto; }
.divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 18px rgba(139, 92, 246, 0.8); pointer-events: none;
}
.divider span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #3b2a8a; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.tag {
  position: absolute; top: 10px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(10, 10, 25, 0.65); color: #fff; pointer-events: none; backdrop-filter: blur(6px);
}
.tag-l { left: 10px; }
.tag-r { right: 10px; }
.spot {
  position: absolute; border: 2px solid var(--cyan); border-radius: 6px; cursor: move; touch-action: none;
  min-width: 18px; min-height: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.12), 0 0 14px var(--cyan);
}

/* batch */
.batch { display: grid; gap: 16px; }
.batch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.batch-head h2 { font-size: 22px; }
.batch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost-btn {
  display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px;
  background: var(--glass); border: 1px solid var(--line); color: var(--text);
}
.ghost-btn:hover { border-color: var(--violet); }
.small-cta { display: inline-flex; font-size: 15px; padding: 10px 16px; }
.small-cta.ready { box-shadow: 0 0 0 3px var(--ok); }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card {
  position: relative; display: grid; gap: 8px; padding: 10px; border-radius: 16px; cursor: pointer; text-align: left;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--violet); }
.card .thumb {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; display: block;
  background: repeating-conic-gradient(#8882 0% 25%, transparent 0% 50%) 50% / 14px 14px;
}
.card .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { justify-self: start; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--glass-2); color: var(--muted); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: #ef4444; }
.badge.work::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.8s linear infinite; vertical-align: -1px; }
.card .x {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 10, 25, 0.65); color: #fff; border: 0; font-size: 13px; opacity: 0; transition: opacity 0.15s;
}
.card:hover .x, .card:focus-within .x { opacity: 1; }
.back {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--text); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color 0.15s, transform 0.15s;
}
.back .ic, .save-back .ic {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 15px; font-weight: 700;
}
.back .ic { background: var(--glass-2); border: 1px solid var(--line); }
.back:hover { border-color: var(--violet); }
.back:hover .ic { transform: translateX(-2px); transition: transform 0.15s; }
.back:disabled { opacity: 0.5; cursor: not-allowed; }

/* the "Save changes" pill: gradient, check badge, a light sweep and a soft breathing glow */
.save-back {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 22px 6px 6px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; text-align: left;
  background: linear-gradient(120deg, #7c3aed, #6366f1 45%, #06b6d4);
  box-shadow: 0 12px 30px -12px rgba(124, 58, 237, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  animation: appear 0.35s cubic-bezier(.2, .9, .3, 1.3), breathe 3s ease-in-out 0.4s infinite;
  transition: transform 0.15s, filter 0.15s;
}
.save-back .ic { background: #fff; color: #6d28d9; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.save-back .txt { display: grid; line-height: 1.15; }
.save-back b { font: 700 15px var(--font-display); }
.save-back small { font-size: 11.5px; opacity: 0.85; }
.save-back::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg); animation: shine 3.6s ease-in-out 0.8s infinite;
}
.save-back:hover { transform: translateY(-1px); filter: brightness(1.08); }
.save-back:active { transform: translateY(0) scale(0.98); }
.save-back:disabled { opacity: 0.6; cursor: not-allowed; animation: none; }
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes breathe {
  0%, 100% { box-shadow: 0 12px 30px -12px rgba(124, 58, 237, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
  50% { box-shadow: 0 14px 38px -8px rgba(124, 58, 237, 0.95), 0 0 26px -6px rgba(34, 211, 238, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
}
@keyframes appear { from { opacity: 0; transform: translateY(-6px) scale(0.96); } }
@media (prefers-reduced-motion: reduce) {
  .save-back, .save-back::after { animation: none; }
}

/* video screen */
.vview { display: grid; gap: 16px; }
.vhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.vhead h2 { font-size: 20px; word-break: break-all; }
.vstage {
  position: relative; width: min(100%, calc(66vh * var(--ar, 1.7778))); margin: 0 auto; border-radius: 14px; overflow: hidden;
  background: #000; user-select: none; touch-action: none;
}
.vstage video { display: block; width: 100%; height: auto; }
.vstage .after { position: absolute; inset: 0; height: 100%; clip-path: inset(0 0 0 50%); }
.vstage.compared { cursor: ew-resize; }
.vstage.brush { cursor: none; }
.vlayer { position: absolute; inset: 0; width: 100%; height: 100%; }
.vlayer.paint { opacity: 0.5; pointer-events: none; }
.vspot {
  position: absolute; border: 2px solid var(--cyan); border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 14px var(--cyan); animation: blink 1.6s ease-in-out infinite;
}
.vstage.compared .vspot, .vstage.brush .vspot { display: none; }
@keyframes blink { 50% { opacity: 0.35; } }
.vcontrols { display: flex; align-items: center; gap: 10px; }
.vcontrols input { flex: 1; accent-color: var(--violet); }
.vplay {
  width: 40px; height: 40px; border-radius: 50%; border: 0; color: #fff; font-size: 14px; flex: none;
  background: var(--grad); box-shadow: 0 6px 18px -6px var(--violet);
}

/* FAQ pop-up */
.faq-dialog { width: min(760px, calc(100vw - 32px)); max-height: 86vh; overflow: auto; }
.faq-dialog .seo { margin: 0; padding: 4px 2px 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* SEO content: how-to + FAQ + tool links */
.seo {
  display: grid; gap: 14px; max-width: 860px; width: 100%; margin: 8px auto 0; padding: 26px;
  border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.seo h2 { font-size: 22px; }
.howto { list-style: none; counter-reset: step; display: grid; gap: 10px; margin: 0 0 8px; padding: 0; }
.howto li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 2px 12px; align-items: start; }
.howto li::before {
  content: counter(step); grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 700 15px var(--font-display); color: #fff; background: var(--grad);
}
.howto b { font-family: var(--font-display); }
.howto span { color: var(--muted); font-size: 14.5px; }
.faq { display: grid; gap: 8px; }
.faq details { border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); padding: 12px 14px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 6px; }
.faq p { margin: 0; color: var(--muted); font-size: 14.5px; }
.tools-nav { margin: 0 0 10px; font-size: 13px; line-height: 2; }
.tools-nav a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.tools-nav a:hover { color: var(--cyan); }
.tools-nav [aria-current] { color: var(--cyan); font-weight: 600; }
.focus-glow { animation: focusGlow 1.4s ease-in-out 3; }
@keyframes focusGlow { 50% { box-shadow: 0 0 0 3px var(--cyan), 0 0 30px -4px var(--cyan); } }

/* magic sparkles behind the home page */
#magic { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.8s; }
#magic.on { opacity: 1; }
.editor-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
/* edited image: a soft gradient frame and a frosted "✦ Edited" label on the photo */
.card.edited { border-color: transparent; }
.card.edited::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card.edited .thumb { box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35); }
.edited-tag {
  position: absolute; top: 17px; left: 17px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 8px; border-radius: 999px; pointer-events: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: #fff;
  background: rgba(14, 12, 34, 0.55); border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.edited-tag i {
  font-style: normal; font-size: 12px;
  background: linear-gradient(120deg, #c4b5fd, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.9), var(--shadow); transform: scale(1.03); }
  100% { box-shadow: 0 0 0 18px rgba(139, 92, 246, 0), var(--shadow); transform: scale(1); }
}
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100vw - 32px));
  text-align: center; padding: 10px 18px; border-radius: 999px; font-weight: 600; color: var(--ok);
  background: var(--glass-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -6px); opacity: 0; } }
.confirm-actions.three { grid-template-columns: 1fr 1fr 1.4fr; }

/* background */
.bg-remove { width: 100%; }
.bg-options { display: grid; gap: 8px; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch {
  height: 44px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: #fff; overflow: hidden; position: relative; transition: transform 0.15s, box-shadow 0.15s;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.active { box-shadow: 0 0 0 2px var(--cyan); }
.sw-clear { background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 14px 14px; }
.sw-white { background: #fff; }
.sw-blur { background: linear-gradient(135deg, #8b5cf6aa, #22d3eeaa); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.sw-color { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); }
.sw-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.touch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.touch .tool.on.touch-keep { border-color: #22c55e; box-shadow: 0 0 0 1px #22c55e inset; }
.touch .tool.on.touch-cut { border-color: #ef4444; box-shadow: 0 0 0 1px #ef4444 inset; }

/* save */
.save-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.select {
  width: 100%; padding: 9px 10px; border-radius: 10px; font: inherit; font-size: 13px; color: var(--text);
  background: var(--glass-2); border: 1px solid var(--line); cursor: pointer;
}
.select option { color: #15132b; }
.seg.wide { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg.wide.two { grid-template-columns: 1fr 1fr; }
.model-hint { margin: -4px 0 0; text-align: center; }
.save-row { display: flex; gap: 8px; }
.name-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.name-box {
  display: flex; align-items: center; border-radius: 10px; overflow: hidden;
  background: var(--glass-2); border: 1px solid var(--line);
}
.name-box:focus-within { border-color: var(--violet); }
.name-box input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px;
}
.name-box b { padding: 0 10px; color: var(--muted); font-weight: 600; }
.save-row .cta { flex: 1; }
.copy { white-space: nowrap; }

/* toolbar, zoom viewport, brush & crop */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 14px;
  background: var(--glass-2); border: 1px solid var(--line);
}
.tool {
  padding: 7px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  background: var(--glass-2); border: 1px solid var(--line); transition: border-color 0.15s;
}
.tool:hover:not(:disabled) { border-color: var(--violet); }
.tool.on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.tool:disabled { opacity: 0.45; cursor: not-allowed; }
.primary-tool { background: var(--grad); color: #fff; border: 0; }
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.seg button { padding: 7px 10px; font-size: 13px; font-weight: 600; background: var(--glass-2); border: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--grad); color: #fff; }
.size { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.size input { width: 110px; accent-color: var(--violet); }
.center { text-align: center; margin: 0; }

.viewport { border-radius: 14px; overflow: hidden; }
.viewport.zoomed { overflow: auto; max-height: 70vh; }
.viewport.zoomed .compare { margin: 0; border-radius: 0; }
.viewport.zoomed .compare canvas { image-rendering: auto; }

.paint { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; pointer-events: none; }
.brush-cursor {
  position: absolute; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none; transform: translate(-50%, -50%);
}
.compare.brush, .compare.mask { cursor: none; }
.compare.mask .divider, .compare.mask .tag, .compare.mask .spot { display: none; }
.compare.brush .divider, .compare.brush .tag, .compare.brush .spot,
.compare.crop .divider, .compare.crop .tag, .compare.crop .spot { display: none; }
.crop-box {
  position: absolute; border: 2px solid #fff; cursor: move; touch-action: none;
  box-shadow: 0 0 0 9999px rgba(5, 6, 15, 0.55);
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 33.333% 33.333%; background-position: -1px -1px;
}
.crop-box span {
  position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.crop-box [data-h="nw"] { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-box [data-h="ne"] { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-box [data-h="sw"] { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-box [data-h="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }

/* upscale options */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button { font: inherit; color: inherit; cursor: pointer; }
.option {
  display: grid; gap: 2px; padding: 14px 10px; border-radius: 14px; text-align: center;
  background: var(--glass-2); border: 1px solid var(--line); transition: border-color 0.15s, transform 0.15s;
}
.option b { font: 700 18px var(--font-display); }
.option small { color: var(--muted); font-size: 12px; }
.option:hover:not(:disabled) { border-color: var(--violet); transform: translateY(-1px); }
.option.active { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.option:disabled { opacity: 0.45; cursor: not-allowed; }

.progress { display: grid; gap: 6px; text-align: center; }
.bar { height: 8px; border-radius: 999px; background: var(--glass-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.25s; }

.cta {
  display: grid; gap: 2px; padding: 16px; border: 0; border-radius: 16px; color: #fff;
  font: 700 18px var(--font-display); background: var(--grad); box-shadow: 0 14px 40px -12px var(--violet);
  transition: transform 0.15s, filter 0.15s;
}
.cta small { font: 500 12px var(--font); opacity: 0.85; }
.cta:hover { transform: translateY(-1px); filter: brightness(1.08); }
.ghost {
  padding: 12px; border-radius: 14px; background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--violet); }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* notices, fair use, privacy */
.notice { text-align: center; color: var(--muted); font-size: 13.5px; margin: -18px 0 0; }
.linklike {
  background: none; border: 0; padding: 0; color: var(--cyan); text-decoration: underline; text-underline-offset: 3px;
  font-size: inherit;
}
.chip { font-family: inherit; }
.blocked {
  display: flex; gap: 14px; align-items: flex-start; max-width: 760px; width: 100%; margin: -12px auto 0; padding: 16px 18px;
  border-radius: 18px; background: color-mix(in srgb, #ef4444 12%, var(--glass)); border: 1px solid color-mix(in srgb, #ef4444 45%, transparent);
}
.blocked h3 { font-size: 17px; margin-bottom: 4px; }
.blocked p { margin: 0 0 6px; }
.blocked-ico { font-size: 26px; line-height: 1; }
.info {
  width: min(560px, calc(100vw - 32px)); padding: 26px 24px 20px; border-radius: 22px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.info::backdrop { background: rgba(5, 6, 15, 0.6); backdrop-filter: blur(4px); }
.info h2 { font-size: 20px; margin-bottom: 12px; }
.info .close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass-2);
}
.facts { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 8px; }
.facts .ok-li, .facts .no-li { list-style: none; margin-left: -18px; }
.ok-li { color: var(--ok); font-weight: 600; }
.no-li { color: var(--muted); }

/* upscale confirm */
.confirm { text-align: center; }
.confirm-ico {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center;
  font-size: 26px; color: #fff; background: var(--grad); box-shadow: 0 10px 30px -10px var(--violet);
}
.big-size { font: 700 26px var(--font-display); margin: 0 0 14px; }
.big-size small { display: block; font: 500 13px var(--font); color: var(--muted); }
.facts.compact { text-align: left; list-style: none; padding: 0; gap: 10px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 6px; }
.confirm-actions .cta { font-size: 16px; padding: 13px; }

/* upscale loader */
.up-overlay { position: absolute; inset: 0; pointer-events: none; }
.up-overlay::before {
  /* light sweep across the image while the AI works */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
  background-size: 250% 100%; animation: sweep 2.4s ease-in-out infinite;
}
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.tile-cursor {
  position: absolute; border: 2px solid var(--cyan); border-radius: 4px; transition: all 0.25s;
  box-shadow: 0 0 18px var(--cyan), inset 0 0 18px rgba(34, 211, 238, 0.35); opacity: 0;
}
.up-card {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); pointer-events: auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 18px;
  width: max-content; max-width: calc(100% - 20px);
  background: rgba(12, 12, 30, 0.72); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.ring { position: relative; width: 48px; height: 48px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: rgba(255, 255, 255, 0.15); }
.ring .arc { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset 0.3s; }
.ring.loading svg { animation: spin 1.1s linear infinite; }
.ring.loading .arc { stroke-dashoffset: 85; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; }
.up-text { display: grid; line-height: 1.3; min-width: 0; }
.up-text b { font-size: 14px; }
.up-text span { font-size: 12.5px; opacity: 0.75; }
.small-btn { padding: 7px 12px; font-size: 13px; color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.compare.working { cursor: progress; }
.compare.working .spot, .compare.working .divider { display: none; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 20px 30px; }
.foot p { margin: 0; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .nav { flex-wrap: wrap; }
  .nav-right { flex-wrap: wrap; justify-content: flex-end; }
}
