:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #1d1d27;
  --muted: #6b6b7b;
  --line: #e4e2dc;
  --accent: #6d5efc;
  --accent-ink: #fff;
  --danger: #c62f4b;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; }
.brand { font-weight: 700; font-size: 18px; display: flex; gap: 10px; align-items: center; letter-spacing: -0.01em; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); box-shadow: inset 0 0 0 5px var(--accent), inset 0 0 0 11px #fff; }
.link { color: var(--muted); text-decoration: none; font-size: 14px; }
.link:hover { color: var(--ink); }

.steps { display: flex; gap: 6px; justify-content: center; padding: 4px 16px 20px; flex-wrap: wrap; }
.step { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 999px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.step span { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.step.active { background: var(--ink); color: #fff; }
.step.done span { background: var(--accent); border-color: var(--accent); color: #fff; }
.step:disabled { opacity: 0.45; cursor: default; }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px 40px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px; }
.panel[data-panel="1"] { max-width: 680px; margin: 0 auto; text-align: center; }
h1 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 22px 0 10px; }
.lead { color: var(--muted); margin: 0 auto 24px; max-width: 520px; line-height: 1.5; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.45; }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 44px 20px; cursor: pointer; transition: .15s; background: #fbfaf8; }
.drop:hover, .drop.over { border-color: var(--accent); background: #f3f1ff; }
.drop-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--muted); }
.drop-inner strong { color: var(--ink); }
.drop-icon { font-size: 26px; width: 52px; height: 52px; border-radius: 50%; background: #ece9ff; color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.samples { margin: 18px 0 6px; display: flex; gap: 8px; justify-content: center; align-items: center; color: var(--muted); font-size: 14px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.tips { list-style: none; padding: 0; margin: 20px 0 0; color: var(--muted); font-size: 13px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

.split { display: grid; grid-template-columns: 360px 1fr; gap: 32px; }
.split.wide { grid-template-columns: 330px 1fr; }
@media (max-width: 820px) { .split, .split.wide { grid-template-columns: 1fr; } .stage { order: -1; } }

.field { margin: 0 0 18px; }
.field > label, .row > label { font-size: 14px; font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.field small { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.mini { font-size: 13px; font-weight: 400 !important; color: var(--muted); display: flex; gap: 4px; align-items: center; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500 !important; }
.switch input { display: none; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: #d8d6d0; position: relative; transition: .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 18px; }

.seg { display: flex; background: #f0eee9; border-radius: 10px; padding: 3px; gap: 3px; margin-top: 6px; }
.seg button { flex: 1; border: 0; background: none; font: inherit; font-size: 13px; padding: 8px 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 600; }
.ico { width: 16px; height: 16px; border: 2px solid currentColor; display: block; }
.ico.sq { border-radius: 4px; } .ico.ci { border-radius: 50%; }
.ico.si { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }

.swatches { justify-content: flex-start; gap: 14px; margin-top: 8px; }
.swatches label { font-weight: 400; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
input[type=color] { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; padding: 0; background: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }

details summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 6px 0; }
details[open] summary { margin-bottom: 8px; }
.howto { padding-left: 18px; margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

.original { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.original img { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; }

.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.btn { border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; padding: 11px 18px; border-radius: 10px; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--line); }

.stage { position: relative; min-width: 0; }
.preview2d { position: relative; aspect-ratio: 1; background: #f3f2ee; border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.preview2d img { max-width: 78%; max-height: 78%; image-rendering: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,.12)); }
.dims { text-align: center; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.viewer { position: relative; height: 560px; border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 35%, #ffffff, #e9e7e1); }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
@media (max-width: 820px) { .viewer { height: 380px; } }
.error { color: var(--danger); background: #fdecef; border-radius: 10px; padding: 10px 14px; font-size: 14px; }

.spinner { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(246,245,242,.55); }
.spinner::after { content: ""; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #d9d6ff; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.specs dt { color: var(--muted); } .specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.downloads { display: grid; gap: 8px; }
.dl { text-align: left; font: inherit; width: 100%; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: var(--ink); font-size: 14px; background: #fff; cursor: pointer; }
.dl:hover { border-color: var(--accent); }
.dl small { color: var(--muted); font-size: 12px; display: block; }
.dl b { font-weight: 600; }
.dl .fmt { font-size: 11px; font-weight: 700; background: #f0eee9; border-radius: 6px; padding: 3px 7px; }
.dl.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.dl.primary small { color: #e3e0ff; } .dl.primary .fmt { background: rgba(255,255,255,.2); }

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

.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sw { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px 4px 4px; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); }
.sw i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.sw.cap { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.sw.cap::after { content: "keycap"; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.sw.unused { opacity: .45; }
.dl .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); vertical-align: -1px; }

/* ---------------------------------------------------------------- accounts */
.top-right { display: flex; align-items: center; gap: 18px; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.menu summary::-webkit-details-marker { display: none; }
.menu .email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 999px; background: #eceae4; color: var(--muted); }
.badge.pro { background: var(--accent); color: #fff; }
.menu-items { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 200px; box-shadow: 0 10px 30px rgba(0,0,0,.08); z-index: 10; }
.menu-items button { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu-items button:hover { background: #f3f2ee; }
.menu-note { margin: 4px 10px 6px; font-size: 12px; color: var(--muted); }

.gate { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #f3f1ff; border: 1px solid #dcd7ff; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.dl.locked .fmt::before { content: "🔒 "; }
.dl.busy { opacity: .6; pointer-events: none; }

.modal { border: 0; border-radius: 18px; padding: 28px; width: min(400px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.25); color: var(--ink); }
.modal::backdrop { background: rgba(20,20,30,.35); }
.modal h2 { margin-top: 0; }
.modal-x { position: absolute; top: 10px; right: 12px; }
.modal-x button { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.stack { display: grid; gap: 10px; }
.modal input[type=email] { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { font-size: 13px; background: #eef8f0; color: #1f6b35; border-radius: 10px; padding: 10px 12px; margin: 14px 0 0; }
.msg.bad { background: #fdecef; color: var(--danger); }
.price { display: flex; align-items: baseline; gap: 4px; margin: 18px 0 2px; }
.price b { font-size: 36px; letter-spacing: -0.02em; }
.price span { color: var(--muted); }
.save { color: #1f6b35; font-size: 13px; font-weight: 600; min-height: 18px; margin: 0 0 8px; }
.features { padding-left: 18px; margin: 0 0 18px; font-size: 14px; line-height: 1.8; }
.fine { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--danger); }

.notice { font-size: 13px; line-height: 1.45; background: #fff7e6; border: 1px solid #f3dfb0; color: #6b4e12; border-radius: 10px; padding: 10px 12px; margin: 16px 0 0; }

.slots { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; }
.slots .slot { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.slots .warn { flex-basis: 100%; color: #8a5a00; background: #fff7e6; border-radius: 8px; padding: 6px 8px; }
#basePicks { margin-top: 6px; }
.slots .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
