:root {
  --bg: #F4EFE6;
  --paper: #FFFCF7;
  --ink: #141414;
  --muted: #6B6560;
  --line: #E4DDD2;
  --accent: #FF5A1F;
  --accent-deep: #E04510;
  --guide: #3B82F6;
  --dash: #C9C0B4;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20,20,20,.08);
  --font: "Archivo", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --shirt-scale: 1;
  --area-dx: 0px;
  --area-dy: 0px;
  --stage-ar: 0.89286;
  --pa-l: 0.245;
  --pa-t: 0.18;
  --pa-w: 0.51;
  --pa-h: 0.58;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font);
  height: 100%;
  overflow: hidden;
}
body { min-height: 100dvh; height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--accent-deep); }
img { max-width: 100%; display: block; }
button, input, select, textarea, summary { font: inherit; }

.wrap {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 10px 14px 12px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.topbar { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; flex: 0 0 auto; }
.pill { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); }
.prod-switch {
  display: inline-flex; background: #F1EBE1; border-radius: 999px; padding: 3px; gap: 2px;
  flex: 0 0 auto;
}
.prod-switch button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 10px; font: inherit; font-weight: 700;
  font-size: .78rem; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.prod-switch button[aria-pressed="true"] {
  background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.rotate-banner {
  display: none; align-items: center; gap: 10px; flex: 0 0 auto;
  background: #FFF4EE; border: 1px solid #F0C7B4; color: #7A3A1E;
  border-radius: 12px; padding: 8px 12px; font-size: .84rem;
}
@media (max-width: 820px) and (orientation: portrait) {
  .rotate-banner { display: flex; }
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(280px, .72fr);
  gap: 14px;
  align-items: stretch;
}

.stage-card, .panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  min-height: 0;
}
.stage-card {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel {
  padding: 6px 10px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.stage-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; flex: 0 0 auto; }
.stage-toolbar.sub { margin-bottom: 8px; justify-content: flex-start; gap: 10px; }
.fit-toggle { margin-left: auto; white-space: nowrap; }
.fit-extra { font-weight: inherit; }
@media (max-width: 900px) {
  .fit-extra { display: none; }
}

.tee-stage-wrap {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--stage-ar, 0.89286)));
  aspect-ratio: var(--stage-ar, 0.89286);
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
.stage-overlay-bar {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 8px);
  flex-wrap: nowrap;
}
.stage-overlay-bar > * { pointer-events: auto; }
.stage-overlay-bar .seg.frost {
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  padding: 2px;
}
.stage-overlay-bar .seg.frost button {
  padding: 5px 9px;
  font-size: .7rem;
  font-weight: 700;
  color: #2a2a2a;
}
.stage-overlay-bar .seg.frost button[aria-pressed="true"] {
  background: rgba(255,255,255,.95);
  color: var(--ink);
}
.stage-overlay-bar #area-reset.frost {
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: .7rem;
  padding: 5px 8px;
}
@media (max-width: 900px) and (orientation: landscape) {
  .stage-overlay-bar { bottom: 3px; gap: 4px; }
  .stage-overlay-bar .seg.frost { padding: 1px; }
  .stage-overlay-bar .seg.frost button { padding: 3px 6px; font-size: .6rem; }
}
.seg { display: inline-flex; background: #F1EBE1; border-radius: 999px; padding: 4px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px;
  padding: 8px 14px; font-weight: 650; cursor: pointer;
}
.seg.mini button { padding: 6px 11px; font-size: .78rem; font-weight: 700; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button .tag {
  display: inline-block; margin-left: 6px; font-size: .65rem; font-weight: 700;
  background: #FFF0E8; color: var(--accent-deep); border-radius: 999px; padding: 2px 6px; vertical-align: middle;
}
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatches span { font-size: .78rem; color: var(--muted); margin-right: 2px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }

.tee-fit {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  container-type: size;
  display: grid;
  place-items: center;
}
.tee-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #111;
  border-radius: 18px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.tee-shirt {
  position: absolute; inset: 0;
  transform: scale(var(--shirt-scale, 1));
  transform-origin: 50% 48%;
  transition: transform .22s ease;
  pointer-events: none;
}
.tee-base, .tee-tint {
  position: absolute;
  width: 168%; height: 168%;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  object-fit: contain; pointer-events: none; max-width: none;
}
.tee-tint { mix-blend-mode: multiply; opacity: 0; transition: opacity .2s ease; }
.tee-stage[data-color="black"] .tee-tint { background: #1a1a1a; opacity: .72; }
.tee-stage[data-color="cream"] .tee-tint { background: #F3E6CF; opacity: .55; }
.tee-stage[data-color="orange"] .tee-tint { background: #FF7A3D; opacity: .45; }
.tee-stage[data-color="heather"] .tee-tint { background: #9A9A9A; opacity: .55; }
.tee-stage[data-color="white"] .tee-tint { opacity: 0; }

.product-mock {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  max-width: none;
}
.tee-stage[data-product="tee"] .product-mock,
.tee-stage[data-product="magnet"] .product-mock,
.product-mock[hidden] { display: none !important; }
.tee-stage:not([data-product="tee"]) .tee-shirt { display: none; }
.tee-stage { background: #111; }
body:not([data-product="tee"]) .tee-only { display: none !important; }
body:not([data-product="tee"]):not([data-product="magnet"]):not([data-product="cup"]) .color-swatches { display: none !important; }
body:not([data-product="magnet"]) .magnet-only { display: none !important; }
.tee-stage:not([data-product="magnet"]) .magnet-body { display: none !important; }
.tee-stage[data-product="cup"] .product-mock,
.tee-stage:not([data-product="cup"]) .cup-body { display: none !important; }
.tee-stage:not([data-product="cup"]) .cup-print-shade { display: none !important; }

.print-area {
  position: absolute;
  left: calc(var(--pa-l, 0.245) * 100% + var(--area-dx, 0px));
  top: calc(var(--pa-t, 0.18) * 100% + var(--area-dy, 0px));
  width: calc(var(--pa-w, 0.51) * 100%);
  height: calc(var(--pa-h, 0.58) * 100%);
  border: 1.5px dashed var(--guide);
  border-radius: 3px;
  overflow: visible;
  background: rgba(59,130,246,.05);
  cursor: grab;
  z-index: 2;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.print-clip {
  position: absolute; inset: 0; overflow: hidden; border-radius: 2px;
}
.layer-stack { position: absolute; inset: 0; }
.print-area:active { cursor: grabbing; }
.tee-stage.relocating .print-area {
  cursor: move;
  box-shadow: 0 0 0 2px var(--accent), 0 8px 18px rgba(0,0,0,.25);
  border-style: solid;
  border-color: var(--accent);
}
.tee-stage.overlay-off .print-area {
  border-color: transparent;
  background: transparent;
}
.tee-stage.overlay-off .print-label,
.tee-stage.overlay-off .mm-readout { display: none !important; }
.tee-stage.overlay-off:not(.relocating) .print-area.empty::after { opacity: .85; }

.print-label {
  position: absolute; left: 50%; top: -1.55rem; transform: translateX(-50%);
  width: max-content; text-align: center; pointer-events: none;
  color: var(--guide); font-size: clamp(.55rem, 1.6vw, .7rem); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.print-label small { display: block; font-weight: 600; letter-spacing: 0; text-transform: none; opacity: .95; }
.print-area.empty::after {
  content: "Drop art here";
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,.82); font-size: clamp(.75rem, 2.4vw, .92rem);
  text-align: center; padding: 10px; pointer-events: none; z-index: 1;
}
.design-wrap {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translate(var(--dx, 0px), var(--dy, 0px));
  width: calc(var(--print-pct, 100) * 1%);
  max-width: 100%;
  pointer-events: none;
}
.design-wrap.has-art {
  pointer-events: auto;
  cursor: grab;
}
.design-wrap.has-art:active { cursor: grabbing; }
.design-fx { display: block; }
.design-shape { display: block; width: 100%; position: relative; overflow: hidden; }
.design-shape[data-shape="circle"],
.design-shape[data-shape="square"],
.design-shape[data-shape="diamond"],
.design-shape[data-shape="hexagon"] { aspect-ratio: 1 / 1; }
.design-shape[data-shape="oval"] { aspect-ratio: 3 / 4; }
.design-crop {
  display: block; width: 100%;
}
.design-shape:not([data-shape="none"]) .design-crop {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transform: translate(var(--crop-x, 0%), var(--crop-y, 0%)) scale(var(--crop-sc, 1));
  transform-origin: center center;
  will-change: transform;
}
.design-shape:not([data-shape="none"]) .design {
  width: 100%; height: 100%; object-fit: cover; max-width: none;
}
.crop-inside { margin-top: 10px; }
.crop-xy { display: flex; flex-direction: column; gap: 6px; }
.design-shape[data-shape="circle"] { clip-path: circle(closest-side at 50% 50%); }
.design-shape[data-shape="oval"] { clip-path: ellipse(50% 50% at 50% 50%); }
.design-shape[data-shape="square"] { clip-path: inset(0 round 8%); }
.design-shape[data-shape="diamond"] { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.design-shape[data-shape="hexagon"] { clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.design {
  width: 100%; height: auto; display: block;
  -webkit-user-drag: none; user-select: none;
}
.design-wrap.has-art:not([data-shape="none"]) .design,
.design-wrap.has-art[data-shape="none"] .design { /* keep */ }
.mm-readout {
  position: absolute; left: 50%; bottom: -1.45rem; transform: translateX(-50%);
  color: var(--guide); font-size: clamp(.58rem, 1.6vw, .72rem); font-weight: 700;
  white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  display: none; z-index: 3;
}
.mm-readout.show { display: block; }

.text-layer {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--ts, 1));
  transform-origin: center center;
  pointer-events: auto; cursor: grab;
  max-width: none; text-align: center; line-height: 1.05;
  user-select: none; -webkit-user-select: none;
  padding: 0;
}
.text-wrap-box {
  position: relative;
  width: var(--tw, auto);
  min-width: 8px;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}
.text-layer:active { cursor: grabbing; }
.text-layer.selected { outline: none; }
.text-layer.selected .text-wrap-box {
  outline: 1.5px dashed rgba(255,90,31,.95);
  outline-offset: 3px;
}
.tee-stage.overlay-off .text-layer.selected { outline: none; }
.tee-stage.overlay-off .text-layer .width-handle { display: none !important; }
.design-wrap.selected.has-art {
  outline: 1.5px dashed rgba(255,90,31,.95);
  outline-offset: 3px;
}
.tee-stage.overlay-off .design-wrap.selected { outline: none; }
.text-layer.is-locked, .design-wrap.is-locked { pointer-events: none !important; cursor: default; }
.text-layer canvas, .text-layer img {
  display: block; pointer-events: none; max-width: none;
}
.text-layer .width-handle {
  position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 28px; border-radius: 999px; background: var(--accent);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  cursor: ew-resize; pointer-events: auto; z-index: 4;
}

.hint { margin: 8px 2px 0; font-size: .74rem; color: var(--muted); text-align: center; line-height: 1.4; flex: 0 0 auto; min-height: calc(1.4em * 2); }
.under-stage { margin-top: 8px; display: grid; gap: 8px; flex: 0 0 auto; }
.under-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.panel h2 { margin: 0 0 8px; font-size: 1rem; letter-spacing: -0.02em; }
.panel p.note { margin: 0 0 12px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.panel p.note.tight { margin-bottom: 10px; font-size: .82rem; }

.acc { border-bottom: 1px solid var(--line); }
.acc:last-of-type { border-bottom: 0; }
.acc > summary {
  list-style: none; cursor: pointer;
  font-weight: 750; font-size: .95rem;
  padding: 11px 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  user-select: none;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
  margin-right: 4px;
}
.acc[open] > summary::after { transform: rotate(-135deg); }
.acc-body { padding: 0 4px 14px; }
.rollout {
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 0;
}
.rollout > summary {
  list-style: none; cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--muted);
  padding: 9px 12px; user-select: none;
}
.rollout > summary::-webkit-details-marker { display: none; }
.rollout-body { display: grid; gap: 10px; padding: 0 12px 12px; }

.drop {
  border: 2px dashed var(--dash); border-radius: 14px; background: #FBF7F0;
  padding: 16px 14px; text-align: center; cursor: pointer; transition: .15s ease;
  margin-bottom: 12px; display: block;
}
.drop:hover, .drop.dragover { border-color: var(--accent); background: #FFF4EE; }
.drop strong { display: block; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: .84rem; }
.drop input { display: none; }
.controls { display: grid; gap: 12px; margin: 4px 0 0; }
.control { display: grid; gap: 6px; }
.control-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.control-head label, .labelish { font-size: .8rem; color: var(--muted); }
.control-head .val { font-size: .8rem; font-weight: 700; color: var(--ink); }
.control-head .hintish { font-size: .72rem; color: var(--muted); }
.control input[type="range"] { width: 100%; accent-color: var(--accent); }
.centre-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pos-status { font-size: .75rem; color: var(--muted); min-height: 1.1em; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: .82rem; font-weight: 700; user-select: none;
}
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.toggle.tight { font-size: .78rem; gap: 6px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fx-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.fx-row input[type="color"] {
  width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer;
}
.mini-range { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 120px; }
.mini-range span { font-size: .75rem; font-weight: 700; min-width: 2.4em; }
.mini-range input { flex: 1; accent-color: var(--accent); }

.text-panel { margin-top: 0; }
.text-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.text-editor {
  display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #FBF7F0; margin-bottom: 10px;
}
.text-editor[hidden] { display: none !important; }
.field { display: grid; gap: 4px; }
.field > span { font-size: .75rem; color: var(--muted); }
.field input[type="text"], .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
}
.field input[type="color"] {
  width: 48px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; cursor: pointer;
}
.field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
  resize: vertical; min-height: 68px; line-height: 1.35;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 10px; font-size: .75rem; font-weight: 700; cursor: pointer;
}
.preset[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.preset[disabled], .preset.is-disabled {
  opacity: .4; cursor: not-allowed; pointer-events: none;
}
.font-preview {
  display: block; margin-top: 4px; font-size: 1.05rem; line-height: 1.2; color: var(--ink);
  padding: 4px 2px; min-height: 1.4em;
}

.layer-list { display: grid; gap: 6px; }
.layer-item {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff;
  font-size: .84rem; cursor: pointer;
}
.layer-item[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.layer-item.locked { background: #F7F4EE; }
.layer-item.locked .meta strong::after { content: " · locked"; color: var(--muted); font-weight: 650; font-size: .72rem; }
.layer-item .lock-btn { color: var(--muted); }
.layer-item .lock-btn[aria-pressed="true"] { color: var(--accent-deep); background: #FFF0E8; border-color: #F0C7B4; }
.layer-item .lock-btn svg { width: 14px; height: 14px; display: block; margin: 0 auto; }
.layer-item .grip {
  cursor: grab; color: var(--muted); letter-spacing: -1px; font-size: 1rem; text-align: center;
  user-select: none;
}
.layer-item .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.layer-item .meta strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-item .muted { color: var(--muted); font-size: .72rem; }
.layer-item .layer-btns { display: flex; gap: 4px; }
.layer-item .layer-btns button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  width: 28px; height: 28px; cursor: pointer; font-size: .85rem; line-height: 1; padding: 0;
}
.layer-item .layer-btns button:disabled { opacity: .35; cursor: default; }
.layer-item.dragging { opacity: .45; }

.tryon-preview, .tryon-result { margin: 8px 0; }
.tryon-preview img, .tryon-result img {
  width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #111;
  -webkit-touch-callout: default;
}
.tryon-status {
  min-height: 1.2em; margin: 8px 0; font-size: .82rem; color: var(--muted); line-height: 1.4;
}
.tryon-status.error { color: #9B1C1C; }
.tryon-status.ok { color: #1F6B3A; }
#tryon-btn { width: 100%; margin-top: 4px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 650;
  cursor: pointer; background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-deep); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid transparent; text-decoration: underline; text-underline-offset: 3px; padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { color: var(--ink); }
.btn.compact { padding: 7px 12px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.busy { opacity: .7; pointer-events: none; }

.footer-note { margin-top: 14px; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 999px;
  font-size: .85rem; transition: transform .2s ease; z-index: 20; max-width: calc(100% - 24px);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.back-note { font-size: .78rem; color: var(--muted); margin: 12px 4px 0; line-height: 1.4; }
.tiny-link { font-size: .84rem; white-space: nowrap; }

.size-bar {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.size-toggle {
  display: inline-flex; background: #F1EBE1; border-radius: 999px; padding: 3px; gap: 2px;
}
.size-toggle button {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font-weight: 700; cursor: pointer; font-size: .8rem;
}
.size-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.size-chip {
  min-width: 40px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-weight: 700; font-size: .8rem;
}
.size-chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.size-chip:hover { border-color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) and (orientation: portrait) {
  .layout { grid-template-rows: auto minmax(150px, 1fr); }
  .hint { display: none; }
  .tee-fit {
    flex: 0 0 auto;
    width: 100%;
    height: min(34dvh, 320px);
    min-height: 200px;
  }
  .size-bar { flex-wrap: nowrap; gap: 6px; margin-top: 6px; }
  .size-chips { flex-wrap: nowrap; gap: 4px; }
  .size-chip { min-width: 28px; padding: 5px 7px; }
  .under-stage { margin-top: 6px; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .hint { display: none; }
  .tee-fit { flex: 1 1 auto; min-height: 140px; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .layout { grid-template-columns: 1.15fr .85fr; grid-template-rows: minmax(0, 1fr); gap: 10px; }
  .wrap { padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 520px) {
  .size-chip { min-width: 34px; padding: 6px 8px; font-size: .74rem; }
  .size-bar { gap: 6px; }
  .wrap { padding-left: 8px; padding-right: 8px; padding-top: 8px; }
  .seg button { padding: 7px 10px; }
  .rotate-banner { font-size: .75rem; padding: 6px 8px; }
  .hint { font-size: .68rem; margin-top: 4px; }
  .stage-toolbar { margin-bottom: 6px; }
  .prod-switch button { padding: 5px 8px; font-size: .72rem; }
  .fit-toggle { font-size: .78rem; }
}

.job-progress { margin-top: 8px; width: 100%; min-width: 0; }
.job-progress-track {
  height: 6px; background: #E8E0D4; border-radius: 99px; overflow: hidden;
}
.job-progress-fill {
  height: 100%; width: 36%; border-radius: 99px; background: var(--accent);
  transform: translateX(-120%);
  animation: job-indet 1.15s ease-in-out infinite;
}
@keyframes job-indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.job-progress.is-error .job-progress-fill {
  animation: none; width: 100%; transform: none; background: #C4463A;
}
.job-progress.is-ok .job-progress-fill {
  animation: none; width: 100%; transform: none; background: #2F7A48;
}
.job-progress-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px; min-width: 0;
}
.job-progress-label {
  font-size: .82rem; color: var(--muted); line-height: 1.35; min-width: 0;
}
.job-progress.is-error .job-progress-label { color: #9B1C1C; font-weight: 650; }
.job-progress.is-ok .job-progress-label { color: #1F6B3A; }
.job-progress .job-retry { flex: 0 0 auto; }
@media (max-width: 900px) and (orientation: landscape) {
  .job-progress { margin-top: 4px; }
  .job-progress-track { height: 5px; }
  .job-progress-label { font-size: .72rem; }
}

.magnet-body {
  position: absolute;
  left: calc(var(--pa-l, 0.245) * 100% + var(--area-dx, 0px));
  top: calc(var(--pa-t, 0.18) * 100% + var(--area-dy, 0px));
  width: calc(var(--pa-w, 0.51) * 100%);
  height: calc(var(--pa-h, 0.58) * 100%);
  z-index: 1;
  pointer-events: none;
  background: #f7f7f7;
  box-shadow: 0 10px 22px rgba(0,0,0,.48), 0 1px 0 rgba(255,255,255,.28) inset, 0 -2px 6px rgba(0,0,0,.18) inset;
}
.tee-stage[data-color="white"] .magnet-body { background: #f7f7f7; }
.tee-stage[data-color="cream"] .magnet-body { background: #F3E6CF; }
.tee-stage[data-color="heather"] .magnet-body { background: #9A9A9A; }
.tee-stage[data-color="orange"] .magnet-body { background: #FF7A3D; }
.tee-stage[data-color="black"] .magnet-body { background: #1a1a1a; box-shadow: 0 10px 22px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.08) inset; }
.tee-stage[data-crop="circle"] .magnet-body,
.tee-stage[data-crop="circle"] .print-area,
.tee-stage[data-crop="circle"] .print-clip { border-radius: 50%; }
.tee-stage[data-crop="square"] .magnet-body,
.tee-stage[data-crop="square"] .print-area,
.tee-stage[data-crop="square"] .print-clip { border-radius: 7%; }
.tee-stage[data-crop="roundrect"] .magnet-body,
.tee-stage[data-crop="roundrect"] .print-area,
.tee-stage[data-crop="roundrect"] .print-clip { border-radius: 14% / 10%; }
.tee-stage[data-product="magnet"] .print-area { background: transparent; }
.nowrap-toggle { display: inline-flex; margin-top: 6px; font-size: .8rem; }
.magnet-only.size-bar { justify-content: center; }
#magnet-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
  width: 100%;
}
.magnet-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 7px 8px 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  box-shadow: none;
}
.magnet-chip:hover { border-color: var(--accent); }
.magnet-chip[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink);
  background: #fff;
  color: var(--ink);
}
.magnet-thumb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.magnet-thumb-shape {
  width: calc(var(--mw, 1) * 36px);
  height: calc(var(--mh, 1) * 36px);
  background: #EFE8DC;
  border: 1.5px solid #3a3a3a;
  box-sizing: border-box;
}
.magnet-thumb-shape.is-circle { border-radius: 50%; }
.magnet-thumb-shape.is-square { border-radius: 5px; }
.magnet-thumb-shape.is-roundrect { border-radius: 8px; }
.magnet-chip[aria-pressed="true"] .magnet-thumb-shape {
  background: var(--accent);
  border-color: var(--ink);
}
.magnet-chip-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.1;
  white-space: nowrap;
}

.tee-stage-wrap { container-type: size; }
@container (max-width: 280px) {
  .stage-overlay-bar { bottom: 4px; gap: 4px; }
  .stage-overlay-bar .seg.frost button { padding: 3px 6px; font-size: .6rem; }
}
@container (max-width: 200px) {
  .stage-overlay-bar .seg.frost { padding: 1px; }
  .stage-overlay-bar .seg.frost button { padding: 2px 5px; font-size: .55rem; }
}

@media (max-width: 430px) {
  .prod-switch { padding: 2px; gap: 0; }
  .prod-switch button { padding: 5px 5px; font-size: .64rem; }
}
@media (max-width: 430px) {
  #magnet-chips { gap: 5px; }
  .magnet-chip { padding: 5px 4px 4px; border-radius: 10px; }
  .magnet-thumb { width: 34px; height: 34px; }
  .magnet-thumb-shape { width: calc(var(--mw, 1) * 28px); height: calc(var(--mh, 1) * 28px); }
  .magnet-chip-label { font-size: .6rem; }
}
@media (max-width: 900px) and (orientation: landscape) {
  #magnet-chips { gap: 5px; }
  .magnet-chip { padding: 3px 5px 3px; border-radius: 9px; }
  .magnet-thumb { width: 30px; height: 30px; }
  .magnet-thumb-shape { width: calc(var(--mw, 1) * 24px); height: calc(var(--mh, 1) * 24px); }
  .magnet-chip-label { font-size: .58rem; }
}
@media (max-width: 900px) and (orientation: portrait) {
  .magnet-only.size-bar { flex-wrap: nowrap; justify-content: center; }
  #magnet-chips { flex-wrap: nowrap; }
}

.pill.test-badge { display: none !important; }

.cup-body {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.cup-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}
.tee-stage[data-product="cup"] .print-area {
  background: transparent;
  border-radius: 8% / 6%;
  overflow: visible;
}
.tee-stage[data-product="cup"] .print-clip {
  border-radius: 8% / 6%;
  overflow: hidden;
  filter: url(#cup-cylinder);
}
.tee-stage[data-product="cup"].overlay-off .print-area {
  background: transparent;
}
.tee-stage[data-product="cup"] .print-area.empty .cup-print-shade { display: none; }
.cup-print-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
  background:
    linear-gradient(to right,
      rgba(0,0,0,.34) 0%,
      rgba(0,0,0,.12) 18%,
      rgba(255,255,255,.10) 38%,
      rgba(255,255,255,.16) 48%,
      rgba(255,255,255,.04) 58%,
      rgba(0,0,0,.10) 78%,
      rgba(0,0,0,.36) 100%),
    linear-gradient(to bottom,
      rgba(0,0,0,.10) 0%,
      rgba(255,255,255,.06) 22%,
      rgba(0,0,0,0) 50%,
      rgba(0,0,0,.14) 100%);
  mix-blend-mode: overlay;
  opacity: .92;
}
.tee-stage[data-color="black"] .cup-print-shade {
  background:
    linear-gradient(to right,
      rgba(0,0,0,.55) 0%,
      rgba(255,255,255,.04) 28%,
      rgba(255,255,255,.18) 46%,
      rgba(255,255,255,.05) 62%,
      rgba(0,0,0,.50) 100%);
  mix-blend-mode: soft-light;
  opacity: 1;
}
.cup-filters { position: absolute; width: 0; height: 0; overflow: hidden; }
