:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #efece4;
  --surface-3: #e6e2d8;
  --ink: #17160f;
  --ink-2: #3b3930;
  --muted: #6f6b60;
  --line: #e2ded3;
  --accent: #ff5a1f;
  --accent-2: #ff7a45;
  --accent-ink: #ffffff;
  --accent-soft: #ffe9df;
  --ok: #178a4c;
  --ok-soft: #dcf3e5;
  --warn: #a2620b;
  --warn-soft: #fbefd8;
  --danger: #c7331d;
  --shadow-1: 0 1px 2px rgba(23, 22, 15, .06), 0 2px 8px rgba(23, 22, 15, .05);
  --shadow-2: 0 10px 40px rgba(23, 22, 15, .12), 0 2px 8px rgba(23, 22, 15, .06);
  --radius: 22px;
  --radius-sm: 14px;
  --checker-a: #f3f1ec;
  --checker-b: #e8e5de;
  --stage-glow: radial-gradient(1200px 600px at 50% 18%, #fffdf8 0%, #f1ede4 55%, #ebe6db 100%);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0c;
    --surface: #181815;
    --surface-2: #22211d;
    --surface-3: #2c2b26;
    --ink: #f4f2ea;
    --ink-2: #d7d3c7;
    --muted: #a29e92;
    --line: #2d2c27;
    --accent-soft: #3a1f13;
    --ok-soft: #12301f;
    --warn-soft: #33260f;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
    --checker-a: #25241f;
    --checker-b: #1d1c18;
    --stage-glow: radial-gradient(1200px 600px at 50% 18%, #262520 0%, #191915 60%, #121210 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0c; --surface: #181815; --surface-2: #22211d; --surface-3: #2c2b26;
  --ink: #f4f2ea; --ink-2: #d7d3c7; --muted: #a29e92; --line: #2d2c27;
  --accent-soft: #3a1f13; --ok-soft: #12301f; --warn-soft: #33260f;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 18px 50px rgba(0, 0, 0, .55);
  --checker-a: #25241f; --checker-b: #1d1c18;
  --stage-glow: radial-gradient(1200px 600px at 50% 18%, #262520 0%, #191915 60%, #121210 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.logo {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; font-family: var(--font-display);
  font-weight: 800; font-size: 22px; letter-spacing: -.02em;
}
.logo-mark { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-weight: 550; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.engine-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--muted);
  padding: 6px 11px; border-radius: 999px; background: var(--surface-2);
}
.engine-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.engine-pill.on .dot { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
.engine-pill.off .dot { background: #f59e0b; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px;
}
.mobile-nav { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 18px;
  font-weight: 600; font-size: 14.5px; line-height: 1;
  background: var(--surface-2); color: var(--ink);
  transition: transform .12s ease, background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-2); }
.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-accent:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-lg { padding: 15px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink);
  transition: background .15s, transform .12s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- create layout ---------- */
.create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-areas: "stage panel";
  gap: 20px;
  padding: 20px max(20px, env(safe-area-inset-right)) 28px max(20px, env(safe-area-inset-left));
  max-width: 1440px; margin: 0 auto;
}
.stage-col { grid-area: stage; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel { grid-area: panel; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
/* Desktop: the panel stays in view beside the stage and scrolls on its own, and the product
   card's price-and-Order bar is pinned to its bottom - ordering never needs a page scroll. */
@media (min-width: 1000px) {
  .panel {
    position: sticky; top: calc(var(--header-h) + 20px); align-self: start;
    max-height: calc(100dvh - var(--header-h) - 40px); overflow-y: auto;
    scrollbar-width: thin; padding-bottom: 2px;
  }
  .panel > .card:last-child { margin-top: auto; }
}

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-1); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.card-pad { padding: 18px; }
.card h3 {
  margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}

/* ---------- stage ---------- */
.stage {
  position: relative; overflow: hidden;
  border-radius: 28px; background: var(--stage-glow);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  aspect-ratio: 1 / 1; max-height: calc(100dvh - var(--header-h) - 60px);
  width: 100%;
  container-type: size;
  user-select: none; -webkit-user-select: none;
}
.stage-bar {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 5;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.stage-bar > * { pointer-events: auto; }
.stage-title {
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 7px 14px; border-radius: 999px; max-width: 55%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 0;
}
.stage-title:focus { outline: 2px solid var(--accent); }
.stage-actions { margin-left: auto; display: flex; gap: 6px; }
.stage-actions .icon-btn {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.mockup {
  position: absolute; left: 50%; top: calc(50% + 4px); transform: translate(-50%, -50%);
  width: min(92cqw, calc(100cqh - 130px)); aspect-ratio: 1 / 1;
}
.mini { container-type: size; }
.mini .mockup { top: 50%; width: 92cqmin; }
.mockup svg.garment { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.print-area { position: absolute; touch-action: none; }
.print-area.empty::after, .print-area.editing::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px;
  border: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent);
  pointer-events: none;
}
.print-area.on-dark.empty::after, .print-area.on-dark.editing::after { border-color: rgba(255, 255, 255, .35); }
.print-area .design {
  position: absolute; left: 50%; top: 50%;
  object-fit: contain; cursor: grab;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .04));
  transition: opacity .35s ease;
  -webkit-user-drag: none;
}
.print-area .design.dragging { cursor: grabbing; }
.print-area .design.loading { opacity: 0; }
.print-area.clip { overflow: hidden; }
.empty-hint {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: color-mix(in srgb, var(--ink) 45%, transparent); font-size: 13px; font-weight: 550;
  padding: 10px; pointer-events: none;
}
.on-dark .empty-hint { color: rgba(255, 255, 255, .55); }

.drawing {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; pointer-events: none;
}
.drawing::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .55) 45%, transparent 70%),
              color-mix(in srgb, var(--accent) 10%, transparent);
  background-size: 250% 100%, auto;
  animation: sheen 1.6s linear infinite;
}
.on-dark .drawing::before {
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .16) 45%, transparent 70%),
              rgba(255, 255, 255, .06);
  background-size: 250% 100%, auto;
}
@keyframes sheen { from { background-position: 150% 0, 0 0; } to { background-position: -100% 0, 0 0; } }

.status-float {
  position: absolute; left: 50%; top: 66px; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 28px);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px 10px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-2);
  animation: rise .3s cubic-bezier(.2, .9, .3, 1.2);
}
.status-float.warn { background: var(--warn-soft); color: var(--warn); box-shadow: var(--shadow-1); }
.status-float .btn { padding: 6px 11px; font-size: 12.5px; background: rgba(255, 255, 255, .15); color: inherit; }
.status-float svg { width: 18px; height: 18px; flex: none; }
/* A note, not a status: small enough to sit above the shirt's collar, off the print. */
.status-float.compact { gap: 7px; padding: 5px 5px 5px 10px; font-size: 12.5px; white-space: nowrap; }
.status-float.compact svg { width: 15px; height: 15px; }
.status-float.compact .btn { padding: 4px 10px; font-size: 12px; }
.status-float.out { animation: floatOut .25s ease forwards; }
.update-bar {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px;
  background: var(--ink); color: var(--bg); border-radius: 999px; box-shadow: var(--shadow-2);
  font-size: 13px; font-weight: 550; white-space: nowrap;
}
.update-bar .btn { padding: 5px 12px; font-size: 12.5px; background: var(--bg); color: var(--ink); }
@keyframes floatOut { to { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite; opacity: .9;
}
@keyframes spin { to { transform: rotate(360deg); } }

.size-control {
  position: absolute; right: 14px; bottom: 16px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 6px 8px 6px 12px; border-radius: 999px; box-shadow: var(--shadow-1);
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.size-control input { width: 110px; accent-color: var(--ink); }
.size-control .icon-btn { width: 30px; height: 30px; background: transparent; }
.size-control .icon-btn svg { width: 16px; height: 16px; }

/* ---------- strips (options + history) ---------- */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.thumb {
  position: relative; flex: none; width: 84px; height: 84px; border-radius: 16px;
  border: 2px solid transparent; padding: 0; overflow: hidden;
  background: conic-gradient(var(--checker-a) 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0) 0 0 / 14px 14px;
  transition: transform .15s, border-color .15s;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.thumb:hover { transform: translateY(-2px); }
.thumb[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.thumb .tag {
  position: absolute; left: 5px; bottom: 5px; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px; background: var(--surface); color: var(--ink-2);
  box-shadow: var(--shadow-1);
}
.thumb.pending { display: grid; place-items: center; color: var(--muted); }
.thumb.pending::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .5) 45%, transparent 70%);
  background-size: 250% 100%; animation: sheen 1.4s linear infinite;
}
.options-float {
  position: absolute; left: 14px; bottom: 16px; z-index: 5;
  display: flex; align-items: center; gap: 6px; max-width: calc(100% - 250px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 6px; border-radius: 18px; box-shadow: var(--shadow-1);
  animation: fade .3s ease;
}
.options-float .label { padding: 0 6px 0 8px; white-space: nowrap; }
.versions-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.versions-strip::-webkit-scrollbar { display: none; }
.versions-strip .thumb { flex: none; }
.ref-thumb { opacity: .75; border-style: dashed; }
.options-float .thumb { width: 58px; height: 58px; border-radius: 12px; }
.options-float .thumb img { padding: 4px; }

/* ---------- composer ---------- */
.hero { padding: 6px 4px 2px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.035em;
  font-size: clamp(30px, 3.2vw, 42px); line-height: 1.02; margin: 0 0 10px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.composer { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 999px;
}
.mode-switch button {
  border: 0; background: transparent; border-radius: 999px; padding: 8px 10px;
  font-weight: 600; font-size: 13.5px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.mode-switch button svg { width: 16px; height: 16px; }
.mode-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.prompt-box {
  position: relative; background: var(--surface-2); border-radius: 18px;
  border: 1.5px solid transparent; transition: border-color .15s, background .15s;
}
.prompt-box:focus-within { border-color: var(--ink); background: var(--surface); }
.prompt-box textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  padding: 14px 56px 14px 16px; font-size: 16px; line-height: 1.45;
  min-height: 84px; max-height: 200px; display: block;
}
.prompt-box textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.send {
  position: absolute; right: 9px; bottom: 9px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .12s, opacity .15s, background .15s;
}
.send:hover { background: var(--accent-2); }
.send:active { transform: scale(.92); }
.send[disabled] { opacity: .35; box-shadow: none; pointer-events: none; }
.send svg { width: 20px; height: 20px; }
.attach {
  position: absolute; right: 56px; bottom: 9px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.attach:hover { background: var(--surface-3); color: var(--ink); }
.attach svg { width: 20px; height: 20px; }
.prompt-box textarea { padding-right: 100px; }
.composer.dropping .prompt-box { border-color: var(--accent); background: var(--accent-soft); }
.ref-chip {
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 6px;
  background: var(--surface-2); border-radius: 16px; animation: rise-in .25s ease;
}
@keyframes rise-in { from { opacity: 0; transform: translateY(4px); } }
.ref-chip img { width: 52px; height: 52px; object-fit: cover; border-radius: 11px; flex: none; background: var(--surface); }
.ref-chip.uploading img { opacity: .5; }
.ref-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.ref-text span { color: var(--muted); font-size: 12.5px; }
.ref-chip .icon-btn { width: 34px; height: 34px; background: transparent; }
.ref-chip .spinner { margin-right: 10px; color: var(--muted); }
.ref-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); text-decoration: none; font-weight: 600; }
.ref-mini img { width: 24px; height: 24px; object-fit: cover; border-radius: 6px; }
.text-field { display: none; }
.text-field.open { display: block; }
.text-field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  padding: 11px 14px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; outline: 0;
}
.text-field input:focus { border-color: var(--ink); }
.text-field small { display: block; color: var(--muted); font-size: 12px; margin: 6px 4px 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .12s;
}
.chip:hover { border-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip svg { width: 15px; height: 15px; }
.chip .sw { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.chips-scroll { display: flex; gap: 7px; overflow-x: auto; padding: 1px 1px 4px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.styles-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.quota { font-size: 12.5px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.examples { display: flex; gap: 7px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
.examples::-webkit-scrollbar { display: none; }
.examples .label { flex: none; margin-right: 2px; }
.examples .example { flex: none; white-space: nowrap; }
.example {
  border: 0; text-align: left; background: var(--surface); border-radius: 14px;
  padding: 10px 13px; font-size: 13.5px; color: var(--ink-2); box-shadow: var(--shadow-1);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  transition: transform .12s, box-shadow .15s;
}
.example:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.composer-extra { display: flex; flex-direction: column; gap: 12px; }

/* ---------- product ---------- */
.product-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.product-tab {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 6px 4px; display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  transition: border-color .15s, background .15s;
}
.product-tab svg { width: 20px; height: 20px; flex: none; }
.product-tab[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); color: var(--ink); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
  transition: transform .12s;
  position: relative;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--ink);
}
.sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.size {
  min-width: 46px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 13px; font-weight: 650;
}
.size[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.buy-bar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  margin: 4px -18px -18px; padding: 12px 18px;
  background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.buy-bar .price { font-size: 22px; line-height: 1.1; }
.buy-bar .order-btn { margin-left: auto; white-space: nowrap; }
.price { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.price small { font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--muted); display: block; letter-spacing: 0; }
.stepper { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 999px; }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 50%; font-size: 18px; font-weight: 600; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
.product-meta { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.hint { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.hint svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

/* ---------- pages ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px max(20px, env(safe-area-inset-left)) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; font-size: clamp(28px, 4vw, 40px); margin: 0; line-height: 1; }
.page-head p { margin: 8px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.design-card {
  text-decoration: none; background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-1); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  transition: transform .15s, box-shadow .2s; display: flex; flex-direction: column;
}
.design-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.design-card .mini { aspect-ratio: 1 / 1; background: var(--stage-glow); position: relative; }
.design-card .meta { padding: 12px 14px 14px; }
.design-card .meta b { display: block; font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design-card .meta span { color: var(--muted); font-size: 12.5px; }
.new-card {
  border: 2px dashed var(--line); border-radius: var(--radius); display: grid; place-items: center;
  min-height: 260px; text-decoration: none; color: var(--muted); font-weight: 650; gap: 10px;
  transition: border-color .15s, color .15s, background .15s;
}
.new-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.new-card div { display: grid; place-items: center; gap: 10px; }
.new-card svg { width: 30px; height: 30px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2);
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.float-badge { position: absolute; top: 10px; left: 10px; }
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px;
  background: var(--accent-soft); color: var(--ink); margin-bottom: 18px; flex-wrap: wrap;
}
.banner p { margin: 0; flex: 1; min-width: 200px; font-size: 14px; }
.empty-page { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-page h2 { color: var(--ink); font-family: var(--font-display); letter-spacing: -.02em; margin: 0 0 8px; }

.order-card { display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; padding: 16px; align-items: center; }
.order-card + .order-card { margin-top: 12px; }
.order-card .mini { width: 120px; height: 120px; border-radius: 16px; background: var(--stage-glow); display: grid; place-items: center; position: relative; }
.order-card h4 { margin: 0 0 4px; font-size: 16px; }
.order-card .sub { color: var(--muted); font-size: 13px; }
.timeline { display: flex; align-items: center; gap: 0; margin-top: 12px; max-width: 460px; }
.timeline .step { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.timeline .bar { height: 5px; border-radius: 99px; background: var(--surface-3); margin-right: 4px; }
.timeline .step.done .bar { background: var(--ok); }
.timeline .step.done { color: var(--ink-2); }
.timeline .step.now .bar { background: linear-gradient(90deg, var(--ok), var(--accent)); }
.order-total { text-align: right; }
.order-total b { font-family: var(--font-display); font-size: 20px; display: block; }

/* ---------- modal / sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(12, 12, 10, .45);
  display: grid; place-items: center; padding: 20px;
  animation: fade .2s ease;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(460px, 100%); max-height: min(760px, calc(100dvh - 40px)); overflow: auto;
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-2);
  padding: 22px; position: relative;
  animation: pop .28s cubic-bezier(.2, .9, .3, 1.15);
}
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal .close { position: absolute; top: 14px; right: 14px; }
.modal h2 { font-family: var(--font-display); letter-spacing: -.02em; font-size: 26px; margin: 4px 0 6px; }
.modal p.lead { color: var(--muted); margin: 0 0 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 12px 14px; font-size: 16px; outline: 0; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--ink); }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 550; min-height: 20px; margin: 2px 0 10px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; padding: 9px; border-radius: 999px; font-weight: 650; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.checkout { display: grid; grid-template-columns: 250px 1fr; gap: 22px; }
.checkout .mini { aspect-ratio: 1 / 1; border-radius: 20px; background: var(--stage-glow); display: grid; place-items: center; position: relative; }
.lines { margin: 14px 0; display: grid; gap: 6px; font-size: 14px; }
.lines div { display: flex; justify-content: space-between; }
.lines .total { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-weight: 800; font-size: 16px; }
.lines .eta { color: var(--muted, #666); font-size: 13px; justify-content: flex-end; }
.order-total .btn { margin-top: 6px; }
.test-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; }
.test-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.success { text-align: center; padding: 10px 0 4px; }
.success .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 4px auto 14px; }
.success .tick svg { width: 32px; height: 32px; }
.menu {
  position: absolute; z-index: 70; min-width: 220px; background: var(--surface);
  border-radius: 18px; box-shadow: var(--shadow-2); padding: 8px;
  border: 1px solid var(--line); animation: pop .2s ease;
}
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; }
.menu .who span { color: var(--muted); font-size: 13px; }
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent;
  padding: 10px; border-radius: 12px; text-align: left; font-weight: 550; text-decoration: none; font-size: 14px;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu svg { width: 17px; height: 17px; }

/* ---------- toast ---------- */
.toasts {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(440px, calc(100% - 32px));
  pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 16px;
  box-shadow: var(--shadow-2); font-size: 14px; font-weight: 550;
  animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2); pointer-events: auto;
  display: flex; gap: 10px; align-items: center;
}
.toast.error { background: var(--danger); color: #fff; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast-text { flex: 1; }
.toast-action {
  border: 0; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 13px;
  background: rgba(255, 255, 255, .2); color: inherit; white-space: nowrap;
}
.toast-action:hover { background: rgba(255, 255, 255, .32); }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- the bot check (Turnstile), past a limit meant for bots ---------- */
.bot-check {
  position: fixed; z-index: 95; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); width: min(360px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-2); padding: 14px 16px; font-size: 14px;
  animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2);
}
.bot-check p { margin: 4px 0 0; color: var(--muted); }
.bot-check-widget:not(:empty) { margin-top: 10px; }

/* ---------- phones ---------- */
@media (max-width: 999px) {
  :root { --header-h: 56px; }
  .nav { display: none; }
  .engine-pill .label-long { display: none; }
  .create {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "panel";
    padding: 12px 16px calc(210px + env(safe-area-inset-bottom));
    gap: 12px;
  }
  .stage { border-radius: 24px; max-height: none; }
  .mockup { width: min(96cqw, calc(100cqh - 110px)); top: calc(50% + 2px); }
  .engine-pill .engine-text { display: none; }
  .engine-pill { padding: 10px; }
  .size-control { padding: 4px 4px 4px 10px; right: 10px; bottom: 10px; }
  .size-control .size-label { display: none; }
  .options-float { left: 10px; bottom: 10px; padding: 4px; gap: 4px; border-radius: 14px; max-width: calc(100% - 150px); }
  .options-float .label { display: none; }
  .options-float .thumb { width: 44px; height: 44px; border-radius: 10px; border-width: 2px; }
  .status-float { top: 60px; font-size: 12.5px; }
  .stage-title { font-size: 15px; max-width: 60%; }
  .mockup { width: 94%; height: 94%; }
  .size-control input { width: 72px; }
  .hero { order: -2; }
  .hero h1 { font-size: 30px; }
  .composer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    border-radius: 24px 24px 0 0; margin: 0;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .14);
    border: 0; border-top: 1px solid var(--line);
    gap: 9px;
  }
  .composer .styles-grid { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .composer .styles-grid::-webkit-scrollbar { display: none; }
  .composer .styles-label { display: none; }
  .prompt-box textarea { min-height: 50px; padding: 13px 96px 13px 14px; }
  .composer .collapse-mobile { display: none; }
  .composer.expanded .collapse-mobile { display: flex; }
  .mobile-nav {
    display: flex; gap: 2px;
  }
  .order-card { grid-template-columns: 84px 1fr; }
  .order-card .mini { width: 84px; height: 84px; }
  .order-total { grid-column: 1 / -1; text-align: left; display: flex; justify-content: space-between; align-items: center; }
  .checkout { grid-template-columns: 1fr; }
  .checkout .mini { max-width: 220px; margin: 0 auto; width: 100%; }
  .scrim { padding: 0; place-items: end center; }
  .modal, .modal.wide {
    width: 100%; border-radius: 26px 26px 0 0; max-height: 92dvh;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    animation: sheetUp .32s cubic-bezier(.2, .9, .3, 1);
  }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
  .toasts { bottom: calc(190px + env(safe-area-inset-bottom)); }
  .page { padding-top: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .new-card { min-height: 180px; }
}
@media (max-width: 380px) {
  .fields-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.fine-print { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; text-align: center; }
.fine-print a, .quota a { color: inherit; }
.narrow-form { max-width: 420px; }
.alt-card { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; margin: 14px 0; }
.alt-card p { margin: 6px 0 0; font-size: 16px; }

/* ---------- a refusal, kept in view under the prompt ---------- */
.refusal-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--danger, #c0392b) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger, #c0392b) 30%, transparent);
  font-size: 13.5px; line-height: 1.45;
}
.refusal-card svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--danger, #c0392b); }
.refusal-card p { margin: 0 0 4px; }
.refusal-card .muted { color: var(--muted); }
.refusal-card a { font-weight: 600; }
