:root {
  --bg: #0e1116; --panel: #171b22; --line: #232a33; --ink: #e6edf3;
  --muted: #8b96a5; --accent: #4f9dff; --accent2: #2bd4a7; --danger: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
header {
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 16px;
}
h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.tag {
  font-size: 11px; color: var(--accent2); border: 1px solid var(--accent2);
  border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle;
}
#status { margin: 0; color: var(--muted); font-size: 13px; }
main { display: grid; grid-template-columns: 1fr 280px; gap: 18px; padding: 18px 22px; }
@media (max-width: 820px) { main { grid-template-columns: 1fr; } }

#stage {
  min-height: 60vh; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.dropzone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 48px;
  color: var(--muted); text-align: center; transition: border-color .15s, color .15s;
}
.dropzone.hot { border-color: var(--accent); color: var(--ink); }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }

#canvasWrap { position: relative; line-height: 0; }
#canvas { max-width: 100%; max-height: 78vh; cursor: crosshair; border-radius: 8px; display: block; }
#canvas.compare { cursor: ew-resize; }
#divider {
  position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none;
}
#divider::after {
  content: "‹ ›"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--accent); color: #03121f; font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 2px 6px; letter-spacing: 1px;
}

aside { display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

#masks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#masks li {
  display: flex; align-items: center; gap: 8px; background: #0f141b;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px;
}
#masks .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
#masks .grow { flex: 1; color: var(--muted); }
#masks button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; line-height: 1; }

button { font: inherit; border-radius: 9px; padding: 10px 14px; cursor: pointer; border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--accent); color: #03121f; border-color: var(--accent); font-weight: 650; }
.primary:not(:disabled):hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--ink); }
.ghost:hover { border-color: var(--accent); }
.busy { pointer-events: none; opacity: .6; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: #0f141b; border: 1px solid var(--line); color: var(--muted);
  transition: border-color .12s, color .12s, background .12s;
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip.sel { background: var(--accent); color: #03121f; border-color: var(--accent); font-weight: 600; }
#freeText {
  width: 100%; margin-bottom: 10px; padding: 9px 10px; border-radius: 8px;
  background: #0f141b; border: 1px solid var(--line); color: var(--ink); font: inherit;
}
#freeText:focus { outline: none; border-color: var(--accent); }
