/* dkCutout — author: direk james */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --text: #e9ecf2;
  --muted: #9aa3b2;
  --accent: #7cf0b4;
  --accent-ink: #062615;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1b2b25 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 24px; flex-wrap: wrap;
}
.brand { font-family: "Space Grotesk", sans-serif; font-size: 20px; }
.brand b { color: var(--accent); }
.logo { display: inline-block; transform: rotate(-90deg); }
.badge {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 16px; }

.hero { text-align: center; }
.hero h1 {
  font-family: "Space Grotesk", sans-serif; font-size: clamp(30px, 6vw, 52px);
  line-height: 1.05; margin: 24px 0 12px;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto 28px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 48px 20px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; transition: border-color .15s, transform .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); transform: translateY(-2px); }
.drop-icon {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 22px; margin-bottom: 6px;
}
.drop span, .drop small { color: var(--muted); }

.options { margin-top: 16px; color: var(--muted); font-size: 14px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
select {
  margin-left: 8px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit;
}

.hidden { display: none !important; }

.status { margin: 12px 0 16px; }
.status-text { color: var(--muted); margin-bottom: 8px; font-size: 14px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.fill.indeterminate { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.compare {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); user-select: none; touch-action: none;
  margin: 0 auto; /* width/height set by JS to match the photo's shape */
}
.compare.painting { cursor: none; }
.layer { position: absolute; inset: 0; }
.layer img, .layer canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
}
.ghost-img { opacity: 0; transition: opacity .15s; }
.compare.painting .ghost-img { opacity: .3; }
.compare.painting .before,
.compare.painting .handle,
.compare.painting .tag,
.compare.painting #upView { display: none; }
.brush-cursor {
  position: absolute; border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px #000; pointer-events: none; transform: translate(-50%, -50%);
}
.brush-cursor.erase { border-color: #ff6b6b; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button {
  border: 0; border-radius: 0; background: transparent; color: var(--muted);
  padding: 8px 12px; font-size: 14px;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.brush-tools { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.brush-tools input { width: 110px; vertical-align: middle; accent-color: var(--accent); }
button.small { padding: 7px 12px; font-size: 13px; }

.tune {
  margin-top: 14px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; font-size: 14px;
}
.tune .slider { display: flex; flex-direction: column; gap: 6px; }
.tune .slider span { display: flex; justify-content: space-between; }
.tune input[type=range] { width: 100%; accent-color: var(--accent); }
.tune .check { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.tune input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { color: var(--muted); margin: 10px 0 0; }
.checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d9d9d9 25%, transparent 25%),
    linear-gradient(-45deg, #d9d9d9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9d9d9 75%),
    linear-gradient(-45deg, transparent 75%, #d9d9d9 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.before {
  position: absolute; inset: 0; background: #000;
  clip-path: inset(0 50% 0 0);
}
.handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: var(--accent); transform: translateX(-1px); cursor: ew-resize;
}
.handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.tag {
  position: absolute; top: 10px; font-size: 12px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.6); color: #fff; pointer-events: none;
}
.tag-l { left: 10px; } .tag-r { right: 10px; }

.actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 16px; flex-wrap: wrap;
}
.meta { color: var(--muted); font-size: 14px; }
.btns { display: flex; gap: 10px; }
button {
  font: 600 15px Inter, sans-serif; border-radius: 10px; padding: 11px 18px;
  cursor: pointer; border: 1px solid var(--line);
}
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--text); }
.ghost:hover { border-color: var(--muted); }

.top-right { display: flex; align-items: center; gap: 10px; }

dialog#help {
  width: min(560px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
}
dialog#help::backdrop { background: rgba(0, 0, 0, .6); }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-head h2 { font-family: "Space Grotesk", sans-serif; margin: 0; font-size: 22px; }
dialog#help h3 { color: var(--accent); font-size: 15px; margin: 18px 0 6px; }
dialog#help p, dialog#help li { color: var(--text); font-size: 14px; margin: 6px 0; }
dialog#help ul { padding-left: 18px; margin: 6px 0; }
dialog#help i { color: var(--muted); }
kbd {
  font: 12px Inter, sans-serif; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--bg);
}
.help-note { margin-top: 16px !important; color: var(--muted) !important; }

footer {
  text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px;
}
footer a { color: var(--muted); }

@media (max-width: 520px) {
  .btns { width: 100%; }
  .btns button { flex: 1; }
}

/* ---------- upscale panel ---------- */
.upscale {
  margin-top: 14px; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(180deg, #1b1f28, var(--panel));
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.up-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.upscale h2 { font-family: "Space Grotesk", sans-serif; font-size: 20px; margin: 0; }
.up-sub { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.up-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 16px 0 4px; color: var(--muted); font-size: 14px;
}
.up-size { font-family: "Space Grotesk", sans-serif; color: var(--text); font-size: 15px; }
.up-size b { color: var(--accent); }
.up-progress { margin-top: 14px; }
.up-btns { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
button:disabled { opacity: .5; cursor: not-allowed; }
.upscale .hint:empty { display: none; }
@media (max-width: 520px) { .up-btns button { flex: 1; } }
.working .toolbar, .working .tune, .working .compare.painting { pointer-events: none; opacity: .5; }
