:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2a2433;
  --muted: #6d6578;
  --line: #e6dfd6;
  --accent: #7a3e9d;
  --accent-ink: #ffffff;
  --warn-bg: #fff4dc;
  --warn-ink: #6e4a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1922;
    --surface: #272330;
    --ink: #f1edf5;
    --muted: #aaa3b5;
    --line: #3b3546;
    --accent: #b98ad6;
    --accent-ink: #1c1922;
    --warn-bg: #43361a;
    --warn-ink: #f6dfa8;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-rounded, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--accent); font-size: 20px; font-weight: 700; text-decoration: none; }
.account { color: var(--muted); font-size: 14px; display: flex; gap: 12px; align-items: center; }
.banner {
  padding: 10px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  text-align: center;
}
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px; }
.start { max-width: 620px; margin: 40px auto; text-align: center; }
h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 24px 0 8px; }
.lead { color: var(--muted); font-size: 18px; margin: 0 0 28px; }
.drop {
  display: block;
  padding: 48px 20px;
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: 16px;
  cursor: pointer;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop strong { display: block; color: var(--accent); font-size: 20px; }
.drop span { color: var(--muted); font-size: 14px; }
.samples { color: var(--muted); }
.fineprint, .footer, .note { color: var(--muted); font-size: 13px; }
.footer { text-align: center; padding: 24px 16px; }
button { font: inherit; cursor: pointer; }
.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}
.primary {
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
.primary:disabled { opacity: .55; cursor: wait; }
.busy span { max-width: 300px; padding: 16px; text-align: center; }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.stage { position: relative; }
.stage img {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f5f5;
}
.busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  font-weight: 600;
}
.panel { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 0; font-weight: 650; }
.threads { margin: 0; padding: 0; list-style: none; }
.threads li { display: flex; gap: 10px; align-items: center; padding: 3px 0; font-size: 14px; }
.swatch { width: 18px; height: 18px; flex: none; border: 1px solid var(--line); border-radius: 50%; }
fieldset { margin: 0; padding: 0; border: 0; }
fieldset label { display: block; margin-bottom: 10px; font-size: 14px; }
fieldset input[type=range] { display: block; width: 100%; accent-color: var(--accent); }
.check { display: flex !important; gap: 8px; align-items: center; }
.warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 14px;
}
dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin-top: 0; font-size: 20px; }
.close { float: right; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; }
@media (max-width: 760px) {
  .work { grid-template-columns: minmax(0, 1fr); }
}
