:root {
  --bg: #0b0c10;
  --text: #f3f5f9;
  --muted: rgba(243, 245, 249, .62);
  --line: rgba(255, 255, 255, .17);
  --surface: rgba(255, 255, 255, .08);
  --surface-2: rgba(255, 255, 255, .06);
  --accent: #9db8ff;
  --accent-ink: #0a1022;
  --radius: 18px;
  --glass-tint: rgba(22, 26, 38, .42);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- glass morphism ---------- */
.glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .04) 60%), var(--glass-tint);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .3);
  color: var(--text);
}

/* ---------- full-screen 3D ---------- */
.stage { position: fixed; inset: 0; }
.stage canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; touch-action: none; }
.stage canvas:active { cursor: grabbing; }
.status {
  position: fixed; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 24px; color: #cfd5e2; pointer-events: none; transition: opacity .3s; z-index: 1;
}
.status.hide { opacity: 0; }
.status.err { color: #ffb4b4; pointer-events: auto; }
.scrim {
  position: fixed; left: 0; right: 0; top: 0; height: 110px; pointer-events: none; z-index: 2;
  background: linear-gradient(to bottom, rgba(5, 6, 10, .55), transparent);
}

/* ---------- top: plain text tabs ---------- */
.topnav {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5; height: 56px; box-sizing: border-box; padding: 0 28px;   /* one fixed height: every page and the studio start 56 px down, so the gap under the tabs is the same everywhere */
  display: flex; justify-content: center; align-items: center; pointer-events: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55);
}
.brand {                                     /* site name, far left of the Home row */
  position: absolute; left: 28px; top: 50%; transform: translateY(-50%); pointer-events: auto;
  background: none; border: 0; padding: 6px 0; cursor: pointer; color: #fff;
  font-size: 20px; font-weight: 700; letter-spacing: .01em; line-height: 1; white-space: nowrap;
}
.brand b { color: #fff; font-weight: 700; }
.brand { text-shadow: 0 2px 4px rgba(0, 0, 0, .6), 0 4px 18px rgba(0, 0, 0, .55); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.links { display: flex; gap: 30px; pointer-events: auto; }
.links button {
  background: none; border: 0; padding: 6px 0; cursor: pointer; font-size: 14px; font-weight: 500;
  color: rgba(255, 255, 255, .68); border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.links button:hover { color: #fff; }
.links button[aria-current="true"] { color: #fff; border-bottom-color: #fff; }
.links button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ---------- right: circle buttons ---------- */
.rail {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 5;   /* vertically centred on the screen */
  display: flex; flex-direction: column; gap: 12px;
}
.circle {
  position: relative; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; padding: 0;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 60%), var(--glass-tint);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .32);
  transition: transform .15s, background .2s, color .2s;
}
.circle:hover { transform: scale(1.08); }
.circle:active { transform: scale(.96); }
.circle.on, .circle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, .55), rgba(190, 210, 255, .35));
  color: #0a1022; border-color: rgba(255, 255, 255, .6);
}
.circle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.circle::after {
  content: attr(data-tip); position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(6px, -50%);
  padding: 5px 10px; border-radius: 8px; white-space: nowrap; font-size: 12px; color: #fff; pointer-events: none;
  background: rgba(14, 16, 24, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .15s, transform .15s;
}
.circle:hover::after, .circle:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

/* ---------- left middle: Work dock ---------- */
:root { --dock-left: 20px; --dock-w: 176px; --panel-gap: 14px; }
.dock {
  position: fixed; right: var(--dock-left); bottom: 20px; z-index: 6; width: var(--dock-w);
  display: flex; flex-direction: column; align-items: flex-end; pointer-events: none;
}
.dock > * { pointer-events: auto; }
.panels { position: static; width: 0; height: 0; pointer-events: none; }
.fab {
  position: relative; height: 56px; min-width: 56px; padding: 0 20px; border-radius: 28px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600;
  transition: transform .15s, padding .25s, gap .25s;
}
.fab:hover { transform: translateY(-2px); }
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fab .ic { transition: transform .3s, opacity .2s; }
.fab .i-x { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.6); }
.dock.open .fab { padding: 0; width: 56px; border-radius: 50%; gap: 0; }
.dock.open .fab .fab-label { display: none; }
.dock.open .fab .i-grid { opacity: 0; transform: rotate(90deg) scale(.6); }
.dock.open .fab .i-x { opacity: 1; transform: none; }

.tabs {
  position: absolute; right: 0; bottom: calc(100% + 12px); width: var(--dock-w);
  display: flex; flex-direction: column; gap: 2px; padding: 0 6px; border-radius: 20px;
  max-height: 0; opacity: 0; visibility: hidden; border-width: 0; overflow: hidden;
  transform: translateY(10px) scale(.96); transform-origin: bottom right;
  transition: max-height .3s, opacity .25s, transform .3s, visibility .3s, padding .3s;
}
.dock.open .tabs { max-height: 360px; opacity: 1; visibility: visible; padding: 6px; border-width: 1px; transform: none; }
.tabs button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent;
  cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; text-align: left; color: rgba(255, 255, 255, .8);
  transition: background .15s, color .15s;
}
.tabs button .ic { width: 18px; height: 18px; }
.tabs button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .9); color: #0c1222; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.dock-panel {
  position: fixed; right: calc(var(--dock-left) + var(--dock-w) + var(--panel-gap)); top: 50%;
  width: min(440px, calc(100vw - var(--dock-left) - var(--dock-w) - var(--panel-gap) - 16px));
  max-height: calc(100vh - 40px); border-radius: var(--radius); display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translate(14px, -50%) scale(.98); transform-origin: right center;
  transition: opacity .22s, transform .25s, visibility .25s;
}
.dock-panel.open { opacity: 1; visibility: visible; transform: translate(0, -50%); pointer-events: auto; }.pn-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 18px; }
.pn-head h2 { margin: 0; font-size: 16px; }
.pn-body { padding: 8px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.x {
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff;
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.x .ic { width: 16px; height: 16px; }
.x:hover { background: rgba(255, 255, 255, .22); }
.pn-body::-webkit-scrollbar { width: 8px; }
.pn-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 4px; }

/* ---------- top pages (Design / Processing / About) ---------- */
.page {
  position: fixed; left: 50%; top: 50%; z-index: 7; width: min(460px, calc(100vw - 32px));
  padding: 28px; border-radius: 22px; transform: translate(-50%, -46%) scale(.98);
  opacity: 0; visibility: hidden; transition: opacity .12s, transform .14s, visibility .14s;
}
.page.open { opacity: 1; visibility: visible; transform: translate(-50%, -50%); }
.page h2 { margin: 0 0 6px; font-size: 22px; }
.page p { margin: 8px 0 0; }
.page .x { position: absolute; right: 14px; top: 14px; }
.about-link { display: flex; justify-content: center; margin-top: 20px !important; }
.about-link .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; text-decoration: none; }
.about-soon { text-align: center; margin: 18px 0 0 !important; }
.about-soon mark { display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, rgba(255,196,64,.35), rgba(255,120,64,.35)); border: 1px solid rgba(255,196,64,.7); box-shadow: 0 0 16px rgba(255,170,60,.35); }
.credit { font-size: 11px; opacity: .45; margin-top: 18px !important; }
/* Product page: wide, scrolls inside */
.page.product { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow: auto; }
.pr-sub { color: var(--muted); }
.pr-body { display: grid; gap: 16px; margin-top: 14px; }
.pr-body h3 { margin: 0 0 8px; font-size: 16px; }
.pr-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0 !important; }
.pr-today, .pr-pay, .pr-wait, .pr-notice { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.pr-notice { border-color: rgba(157, 184, 255, .6); background: rgba(157, 184, 255, .12); }
.pr-wait { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pr-usage { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pr-usage li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.pr-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
@media (max-width: 560px) { .pr-cards { grid-template-columns: 1fr; } }
.pr-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); min-width: 0; }
.pr-card.cur { border-color: var(--accent); }
.pr-card h3 { margin: 0; font-size: 18px; }
.st-panelbody [data-slot="rib"] .color-row, .st-panelbody [data-slot="rib"] .card-head + .color-row + .note { display: none; }   /* the ribbing designer already sets the colours */
.pr-card { position: relative; }
.pr-pop { position: absolute; top: 14px; right: 14px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, rgba(255,196,64,.45), rgba(255,120,64,.45)); border: 1px solid rgba(255,196,64,.7); }
.pr-best { margin: 0; font-size: 13px; color: var(--muted); }
.pr-mo { margin-top: -6px; color: var(--muted); }
.pr-price { font-size: 26px; font-weight: 700; }
.pr-price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.pr-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; flex: 1; align-content: start; }
.pr-early { font-size: 12.5px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 200, 120, .14); border: 1px solid rgba(255, 200, 120, .4); }
/* compact, so the whole Product page fits on one screen without scrolling */
.page.product { padding: 18px 24px 16px; max-height: calc(100vh - 80px); }
.page.product h2 { font-size: 20px; }
.page.product .pr-sub { margin-top: 2px; }
.pr-body { gap: 10px; margin-top: 8px; }
.pr-body h3 { margin-bottom: 6px; }
.pr-today { padding: 10px 12px; }
.pr-usage li { padding: 5px 10px; }
.pr-cards { gap: 10px; }
.pr-card { padding: 12px 16px; gap: 5px; }
.pr-card h3 { font-size: 17px; }
.pr-price { font-size: 23px; }
.pr-mo { margin-top: -3px; }
.pr-card ul { gap: 1px; font-size: 13.5px; }
.pr-card .btn { min-height: 38px; }
.pr-note { margin: 3px 0 0 !important; }
.pr-pay ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.pr-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-row input { flex: 1 1 200px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.studio .quota { font-size: 12px; opacity: .8; padding: 0 8px; white-space: nowrap; }
.studio.lite .st-tools .tb:not([data-t="move"]):not([data-t="hand"]) { display: none; }
.soon {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid var(--line);
}

/* ---------- panel contents ---------- */
.group { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.group h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.group h3 .ic { width: 18px; height: 18px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
select {
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .08);
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
select option { color: #111; background: #fff; }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch span { display: flex; flex-direction: column; gap: 2px; }
.switch small { color: var(--muted); font-size: 12px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { flex: none; width: 44px; height: 26px; border-radius: 13px; background: rgba(255, 255, 255, .18); position: relative; transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.range { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.range span { display: flex; justify-content: space-between; color: var(--muted); }
.range b { color: #fff; font-variant-numeric: tabular-nums; }
.range input { width: 100%; accent-color: var(--accent); }

.card { display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: flex-start; min-height: 0; }
.meta { color: var(--muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flat { position: relative; width: 100%; background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.flat img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.flat img[hidden], .ed-stage img.bg[hidden] { display: none; }

/* ---------- front/back design editor ---------- */
.ed-stage {
  --edH: min(50vh, 520px);
  position: relative; align-self: center; height: var(--edH); width: calc(var(--edH) * 768 / 1163); max-width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  container-type: size; touch-action: none; user-select: none; outline: none;
}
.ed-stage:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.ed-stage img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.ed-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.ed-stage .outline { fill: none; stroke: #6b7280; stroke-width: 1.5; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.els { position: absolute; inset: 0; z-index: 2; }
.el { position: absolute; cursor: move; line-height: 0; }
.el img { width: 100%; height: auto; display: block; pointer-events: none; }
.el .txt { display: block; white-space: pre; line-height: 1.1; padding: 0 .05em; }
.el.sel { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.el .h { display: none; position: absolute; width: 11px; height: 11px; background: #fff; border: 1.5px solid #3a5bd9; border-radius: 2px; }
.el.sel .h { display: block; }
.h-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.h-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.h-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.h-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.h-rot { left: calc(50% - 6px); top: -26px; border-radius: 50% !important; cursor: grab; }
.h-rot::after { content: ""; position: absolute; left: 4px; top: 10px; width: 1.5px; height: 12px; background: #3a5bd9; }
.drop-zones { position: absolute; inset: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; }
.drop-zones > div {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  background: rgba(20, 24, 33, .55); color: #fff; font-size: 13px; border: 2px dashed rgba(255, 255, 255, .35); margin: 6px; border-radius: 8px;
  transition: background .12s;
}
.drop-zones > div span { font-size: 11px; opacity: .75; }
.drop-zones > div.on { background: rgba(58, 91, 217, .8); border-color: #fff; }
.el-tools { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.el-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.el-row [hidden] { display: none; }
.el-kind { font-size: 12px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-row input[type="text"] {
  flex: 1; min-width: 120px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.el-row select { padding: 5px 6px; font-size: 12px; }
.el-row input[type="color"] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.el-row .spacer { flex: 1; }
.mini {
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 12px; cursor: pointer;
}
.mini:hover { border-color: var(--accent); }
.mini[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.mini.danger:hover { border-color: #ff6b70; color: #ff6b70; }
.flat svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flat .outline { fill: none; stroke: #6b7280; stroke-width: 2; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; }
.flat .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #a3a9b5; font-size: 12px; pointer-events: none; }
.flat.has-img .empty { display: none; }
.flat.drag { outline: 2px dashed var(--accent); outline-offset: -4px; }
.flat-rib .fold { position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dotted #8b93a3; pointer-events: none; }
.flat-rib .empty { font-size: 11px; }
.dims { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: -4px; }
.mode-pane .dims { margin-top: -6px; }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.actions .btn { width: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .1); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 10px; font: inherit; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .16); }
.btn.primary { background: rgba(255, 255, 255, .92); color: #0c1222; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { margin: 0; color: var(--muted); font-size: 12px; }

/* segmented modes */
.modes {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.modes button { background: transparent; border: 0; border-radius: 9px; padding: 7px 6px; font-size: 13px; cursor: pointer; color: var(--text); }
.modes button:hover { background: rgba(255, 255, 255, .1); }
.modes button[aria-checked="true"] { background: rgba(255, 255, 255, .9); color: #0c1222; font-weight: 600; }
.modes button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-pane { display: flex; flex-direction: column; gap: 10px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-row input[type="color"] { width: 44px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.color-row input[type="text"] {
  width: 92px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 13px/1 ui-monospace, Consolas, monospace;
}
.swatches { display: flex; gap: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: var(--c); cursor: pointer; padding: 0; }
.swatches button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-subpane] { display: flex; flex-direction: column; }

/* ---------- export overlay + toast ---------- */
.export-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(6, 7, 10, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.export-box { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 280px; padding: 24px 28px; border-radius: 20px; }
.export-box .bar { width: 240px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.export-box .bar i { display: block; height: 100%; width: 0; background: #fff; transition: width .1s; }
.export-box span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.export-box button { background: transparent; border: 1px solid rgba(255, 255, 255, .3); border-radius: 9px; padding: 5px 14px; cursor: pointer; }
.export-box button:hover { background: rgba(255, 255, 255, .12); }
.toast {
  position: fixed; left: 50%; top: 70px; z-index: 30; padding: 9px 16px; border-radius: 999px; font-size: 13px;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .topnav { padding: 0 14px; }
  .links { gap: 20px; }
  .brand { display: none; }                  /* no room beside the 4 tabs on a phone */
  .rail { right: 10px; gap: 12px; }
  .circle { width: 40px; height: 40px; }
  .circle::after { display: none; }
  .dock { right: 14px; bottom: 20px; }
  .dock-panel { left: 12px; right: 12px; width: auto; top: auto; bottom: 90px; max-height: calc(100vh - 150px);
    transform: translateY(14px) scale(.98); transform-origin: bottom right; }
  .dock-panel.open { transform: none; }
  .dock.has-panel .tabs { max-height: 0; opacity: 0; visibility: hidden; padding: 0 6px; border-width: 0; pointer-events: none; }   /* menu would cover the open panel; the X button closes both */
  .ed-stage { --edH: min(40vh, 420px); }
}@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}



.out { width: 100%; resize: vertical; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font: 12px/1.4 ui-monospace, Consolas, monospace; }

/* ---------- Front / Back design panels: everything centred, tidy spacing ---------- */
.card[data-editor] { align-items: stretch; gap: 14px; text-align: center; }
.card[data-editor] .card-head { justify-content: center; }
.card[data-editor] .meta { text-align: center; }
.card[data-editor] .editor-host { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.card[data-editor] .ed-stage { margin: 4px auto 0; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.card[data-editor] .actions {
  width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.card[data-editor] .actions .btn {
  width: 100%; padding: 10px 4px; font-size: 13px; white-space: nowrap; text-align: center; justify-content: center;
}
.card[data-editor] .el-tools { width: 100%; align-items: center; text-align: center; }
.card[data-editor] .el-row { justify-content: center; }
.card[data-editor] .note { text-align: center; max-width: 36em; margin: 0 auto; }
/* ---------- right middle: garment switch (Jersey / T-shirt) ---------- */
.garment-switch {
  position: fixed; left: 20px; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 22px;
}
.garment-switch button {
  width: 58px; padding: 8px 0 6px; border: 0; border-radius: 17px; background: transparent; color: rgba(255, 255, 255, .8);
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; transition: background .15s, color .15s;
}
.garment-switch button span { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }
.garment-switch button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.garment-switch button[aria-checked="true"] { background: rgba(255, 255, 255, .92); color: #0c1222; }
.garment-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.studio-open .garment-switch { display: none; }
@media (max-width: 720px) { .garment-switch { left: 10px; } .garment-switch button { width: 48px; } }

.group[hidden] { display: none; }

/* ---------- Processing tab ---------- */
.page.processing { width: min(1320px, calc(100vw - 32px)); height: calc(100vh - 100px); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.pc-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; padding-right: 40px; }
.pc-head h2 { margin: 0; }
.pc-sub { margin: 2px 0 0 !important; color: var(--muted); font-size: 13px; max-width: 560px; }
.pc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pc-actions .btn { min-height: 40px; padding: 0 14px; width: auto; }
.pc-actions select, .pc-form select, .pc-form input:not([type=checkbox]):not([type=color]):not([type=file]), .pc-table input { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.pc-actions select { min-height: 40px; }
.pc-check { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.pc-prog { margin: 0 !important; padding: 8px 12px; border-radius: 10px; background: rgba(157, 184, 255, .14); border: 1px solid rgba(157, 184, 255, .5); font-size: 13px; }
.pc-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; flex: 1; min-height: 0; }
.pc-roster, .pc-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pc-side { overflow: auto; padding-right: 4px; }
.pc-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pc-tools .btn { min-height: 38px; padding: 0 12px; width: auto; }
.pc-count { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.pc-tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); flex: 1; min-height: 0; }
.pc-table { width: 100%; border-collapse: collapse; }
.pc-table th { position: sticky; top: 0; background: rgba(22, 26, 38, .92); text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 6px; z-index: 1; }
.pc-table td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.pc-table tr.sel td { background: rgba(157, 184, 255, .12); }
.pc-table td.n { color: var(--muted); width: 28px; font-size: 12px; }
.pc-table input { width: 100%; min-width: 80px; }
.pc-table input.num { min-width: 52px; width: 58px; text-align: center; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button { min-height: 32px; min-width: 38px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.pc-table td.bad .chips button { border-color: #ff7b7b; }
.pc-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pc-previews figure { margin: 0; display: grid; gap: 4px; justify-items: center; min-width: 0; }
.pc-previews figcaption { font-size: 12px; color: var(--muted); }
.pc-previews canvas { max-width: 100%; height: auto; border-radius: 10px; touch-action: none; cursor: move;
  background: repeating-conic-gradient(rgba(255,255,255,.10) 0 25%, rgba(255,255,255,.04) 0 50%) 0 0 / 14px 14px; }
.pc-hint { margin: 0 !important; color: var(--muted); font-size: 12.5px; }
.pc-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-tabs button { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.pc-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .92); color: #0c1222; border-color: transparent; font-weight: 600; }
.pc-panel { display: grid; gap: 10px; align-content: start; }
.pc-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.pc-form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.pc-form label.chk { display: flex; gap: 8px; align-items: center; color: var(--text); }
.pc-form .wide { grid-column: 1 / -1; }
.pc-form input[type=color] { width: 100%; height: 36px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.pc-lab { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.pc-btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.pc-btnrow .btn { min-height: 36px; padding: 0 12px; width: auto; }
.pc-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pc-layers li { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 4px; background: var(--surface-2); }
.pc-layers li.on { border-color: var(--accent); background: rgba(157, 184, 255, .12); }
.pc-layers .nm { flex: 1; text-align: left; background: none; border: 0; min-height: 34px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; padding: 0 6px; }
.pc-layers .nm small { color: var(--muted); font-size: 11px; }
.pc-layers .eye, .ib { min-width: 34px; min-height: 34px; background: none; border: 0; cursor: pointer; border-radius: 8px; }
.pc-dblock { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.pc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pc-cust { margin: 0; padding-left: 18px; }
@media (max-width: 900px) {
  .page.processing { overflow: auto; display: block; }
  .pc-grid { display: block; }
  .pc-roster { margin-bottom: 14px; } .pc-tablewrap { max-height: 360px; }
  .pc-two { grid-template-columns: 1fr; }
}

/* Processing: tidier arrangement (overrides the first pass above) */
.pc-head { align-items: center; }
.pc-actions { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; }
.pc-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pc-group + .pc-group { padding-left: 18px; border-left: 1px solid var(--line); }
.pc-grid { grid-template-columns: minmax(480px, 1.1fr) minmax(340px, 1fr); }
.pc-table th, .pc-table td { padding-left: 4px; padding-right: 4px; }
.pc-table th:nth-child(1), .pc-table td.n { width: 24px; }
.pc-table th:nth-child(3), .pc-table th:nth-child(4) { width: 58px; text-align: center; }
.pc-table input { min-width: 70px; }
.pc-table input.num { min-width: 48px; width: 52px; padding: 0 4px; }
.pc-table td.sz { width: 176px; }
.pc-table .chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pc-table .chips button { min-width: 0; padding: 0; }
.pc-table th:nth-child(7), .pc-table td:last-child { width: 30px; text-align: center; }
.pc-previews figure { gap: 6px; }
.pc-previews canvas { box-shadow: 0 6px 22px rgba(0, 0, 0, .35); }
@media (max-width: 900px) {
  .pc-group + .pc-group { padding-left: 0; border-left: 0; }
  .pc-grid { display: flex; flex-direction: column; gap: 14px; }
  .pc-side { order: -1; overflow: visible; }
  .pc-roster { margin-bottom: 14px; }
}

/* Processing: full window (below the top tabs) */
.page.processing, .page.processing.open { left: 14px; top: 66px; width: calc(100vw - 28px); height: calc(100vh - 80px); max-height: none; transform: none; border-radius: 16px;   /* same inset as the Design Studio: 10 px under the tabs, 14 px at the sides and bottom */ padding: 16px max(20px, 2.2vw) 14px; }
.page.processing .x { top: 12px; right: max(16px, 1.6vw); }
.pc-head { padding-right: 52px; }
.pc-grid { grid-template-columns: minmax(520px, 1.15fr) minmax(380px, 1fr); gap: 18px; }
@media (max-width: 900px) { .page.processing, .page.processing.open { top: 52px; height: calc(100vh - 52px); } }

/* Processing: "Others" cell = text or a picture per player */
.pc-table td.oth { display: flex; gap: 6px; align-items: center; min-width: 190px; }
.pc-table td.oth input[data-f] { flex: 1; min-width: 80px; }
.pc-table .imgbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px dashed var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; }
.pc-table .imgbtn:hover { border-color: var(--accent); }
.pc-table .thumb { flex: none; display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 2px 2px 4px; background: var(--surface); }
.pc-table .thumb img { height: 28px; width: auto; max-width: 48px; object-fit: contain; border-radius: 4px; }

/* Processing: per-player layers */
.pc-table td.oth { min-width: 200px; }
.pc-table .imgbtn.add { border-style: solid; font-weight: 600; }
.pc-table .pick-add { display: inline-flex; gap: 4px; align-items: center; }
.pc-table .cnt { background: none; border: 0; padding: 0 4px; margin-left: 6px; color: var(--accent); cursor: pointer; font-size: 12px; text-decoration: underline; white-space: nowrap; }
.pc-layers li.other { opacity: .5; }

/* Processing: layer settings arranged in rows with dividers; remove button on each layer card */
.pc-stack { display: grid; grid-template-columns: 1fr; gap: 10px; }
.pc-row { display: grid; grid-template-columns: var(--c, 1fr 1fr); gap: 8px 10px; align-items: end; min-width: 0; }
.pc-row label { min-width: 0; }
.pc-row select, .pc-row input:not([type=checkbox]):not([type=color]):not([type=file]) { width: 100%; }
.pc-sec { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.pc-sec > h4 { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.pc-checks { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.pc-checks label.chk { display: inline-flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; }
.pc-hint { display: block; }
.pc-layers .del { margin-left: 4px; color: #ff9d9d; font-size: 18px; line-height: 1; }
.pc-layers .del:hover { background: rgba(255, 120, 120, .18); }
.pc-btnrow .btn.danger { border-color: rgba(255, 120, 120, .6); color: #ffb4b4; }

/* Processing: locked layers */
.pc-layers li.locked { border-color: rgba(255, 210, 74, .75); background: rgba(255, 210, 74, .10); }
.pc-layers li.locked.on { background: rgba(255, 210, 74, .18); }
.pc-layers li.empty { border: 1px dashed var(--line); padding: 10px; color: var(--muted); font-size: 12.5px; justify-content: center; }
.pc-layers .lock { color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.pc-layers .lock.on { color: #ffd24a; }
.pc-layers li.own .nm small { color: var(--accent); }
.pc-lockset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.pc-lockset:disabled { opacity: .45; }
.lockrow { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.lockrow.on { border-color: rgba(255, 210, 74, .75); background: rgba(255, 210, 74, .10); }
.lockrow svg { color: #ffd24a; flex: none; }
.lockrow span { color: var(--muted); font-size: 12px; }

/* Processing: right half = fixed preview (left) + properties (right) */
.pc-grid { grid-template-columns: minmax(440px, 1fr) minmax(600px, 1.35fr); }
.pc-side { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(320px, 1.2fr); gap: 16px; overflow: hidden; padding-right: 0; min-height: 0; }
.pc-pvcol { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; align-self: stretch; }
.pc-pvcol .pc-previews { gap: 8px; flex: none; }
.pc-pvcol .pc-hint { flex: none; }
.pc-propcol { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; padding-right: 4px; }
@media (max-width: 1180px) {
  .pc-grid { grid-template-columns: minmax(380px, 1fr) minmax(520px, 1.3fr); }
}
@media (max-width: 900px) {
  .pc-side { display: flex; flex-direction: column; overflow: visible; order: -1; }
  .pc-pvcol { overflow: visible; }
  .pc-propcol { overflow: visible; }
}

/* Processing: front and back side by side; T-shirt sleeves (left, right) in a second row; caption (size in inches) under each pattern */
.pc-pvcol .pc-previews { grid-template-columns: 1fr 1fr; gap: 6px 8px; justify-items: center; align-items: start; }
.pc-previews figure[hidden] { display: none; }
.pc-garment { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 0; }
.pc-garment > summary { cursor: pointer; list-style: none; padding: 9px 14px; font-size: 13px; display: flex; align-items: center; gap: 8px; user-select: none; }
.pc-garment > summary::-webkit-details-marker { display: none; }
.pc-garment > summary::after { content: '\25BE'; margin-left: auto; color: var(--muted); transition: transform .15s; }
.pc-garment[open] > summary::after { transform: rotate(180deg); }
.pc-garment > summary b { color: var(--accent); }
.pc-garment .chips { display: flex; gap: 8px; padding: 0 14px 12px; }
.pc-garment .chips button { min-height: 36px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.pc-garment .chips button[aria-pressed="true"] { background: rgba(157, 184, 255, .28); border-color: var(--accent); }
/* Add layer column: only as wide as its button, centred */
.pc-table th:nth-child(6) { text-align: center; width: 1%; white-space: nowrap; }
.pc-table td.oth { display: table-cell; min-width: 0; width: 1%; white-space: nowrap; text-align: center; }
.pc-table td.oth .pick-add { vertical-align: middle; }
.pc-previews figure { gap: 4px; }
.pc-previews figcaption { font-size: 12px; color: var(--text); opacity: .85; text-align: center; }

/* Processing: preview | draggable line | properties */
.pc-side { grid-template-columns: var(--pv-w, 320px) 14px minmax(300px, 1fr); gap: 0; }
.pc-pvcol { align-items: center; padding-right: 2px; }
.pc-previews { width: 100%; }
.pc-split { cursor: col-resize; display: flex; justify-content: center; align-items: stretch; touch-action: none; outline: none; }
.pc-split i { width: 2px; border-radius: 2px; background: var(--line); transition: background .12s, width .12s; }
.pc-split:hover i, .pc-split.on i, .pc-split:focus-visible i { width: 4px; background: var(--accent); }
.pc-propcol { padding-left: 4px; }
@media (max-width: 900px) { .pc-split { display: none; } .pc-side { display: flex; } }

/* payment: QR next to the steps */
.pr-payrow { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.pr-qr { width: 200px; height: auto; border-radius: 12px; background: #fff; padding: 6px; flex: none; }
.pr-payrow ol { flex: 1; min-width: 240px; margin: 0; }

.pr-receipt { display: grid; gap: 6px; margin: 12px 0 8px; font-size: 13.5px; } .pr-receipt small { color: var(--muted); }

/* legal links (About, sign-in window) */
.legal-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; }
.legal-links a { color: var(--muted); text-decoration: underline; }
.auth-legal { font-size: 11.5px; color: var(--muted); } .auth-legal a { color: var(--muted); text-decoration: underline; }

/* phones: all top tabs fit */
@media (max-width: 720px) { .links { gap: 15px; } .links button { font-size: 13px; } }

/* screenshot deterrent (js/shield.js): black cover, nothing printed, no long-press menu on pictures */
#shield { position: fixed; inset: 0; z-index: 2147483000; background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .45s ease, backdrop-filter .45s ease, -webkit-backdrop-filter .45s ease, visibility 0s linear .45s; }   /* fades out slowly */
#shield.on { opacity: 1; visibility: visible; pointer-events: auto; -webkit-backdrop-filter: blur(48px); backdrop-filter: blur(48px);
  transition: opacity .12s ease-out, backdrop-filter .12s ease-out, -webkit-backdrop-filter .12s ease-out, visibility 0s; }   /* fades in quickly, so a capture is never taken before it is blurred */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { #shield { background: #000; } }   /* no blur support: fall back to black */
@media print { html, body { display: none !important; } }
body { -webkit-touch-callout: none; }
canvas, img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* Settings > Recent backup */
#backupBody .note { margin: 0 0 8px; }
.bk-work { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.bk-th { margin: 0; width: 72px; display: grid; gap: 3px; justify-items: center; }
.bk-th img, .bk-th i { width: 72px; height: 96px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #d9dbe1; display: block; }
.bk-th figcaption { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }

/* Processing: patterns saved online (future) */
.pc-online { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.pc-online small { color: var(--muted); }

/* Sign in: small button under the Work button, and the Google sign-up window */
.signin-btn { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; max-width: 176px; padding: 7px 14px; border-radius: 999px; cursor: pointer; font: 600 12.5px/1 inherit; color: #fff;
  background: rgba(20, 24, 36, .5); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(8px); }
.signin-btn:hover { background: rgba(255, 255, 255, .16); }
.signin-btn .ic { width: 16px; height: 16px; }
.signin-btn img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.signin-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(6, 8, 14, .55); backdrop-filter: blur(3px); padding: 16px; }
.auth-card { position: relative; width: min(400px, 100%); padding: 26px 24px 20px; border-radius: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-card h3 { margin: 4px 0 0; font-size: 19px; }
.auth-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.auth-card .auth-btn { min-height: 44px; display: flex; justify-content: center; margin-top: 4px; }
.auth-card .auth-note:empty { display: none; }
.auth-card .auth-note { color: #ffcf7a; }
.auth-card .x { position: absolute; right: 12px; top: 12px; }
.auth-later { min-height: 38px; padding: 0 18px; }

/* Welcome pack banner (Product + Processing) */
.wp-banner { border: 1px solid var(--accent); border-radius: 12px; background: rgba(157, 184, 255, .10); padding: 10px 14px; margin: 8px 0; font-size: 13px; }
.wp-banner[hidden] { display: none; }
.wp-banner .wp-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.wp-banner .wp-cd { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
.wp-banner ul { margin: 6px 0 4px; padding-left: 20px; }
.wp-banner p { margin: 4px 0 0 !important; color: var(--muted); font-size: 12px; }

/* Processing: centre line toggle */
.pc-snap { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text); align-self: flex-start; }
.pc-snap small { color: var(--muted); }

/* Processing: players list | draggable line | right half */
.pc-grid { grid-template-columns: var(--ro-w, minmax(440px, 1fr)) 14px minmax(560px, 1.35fr); gap: 0; }
.pc-roster { padding-right: 4px; }
@media (max-width: 1180px) { .pc-grid { grid-template-columns: var(--ro-w, minmax(380px, 1fr)) 14px minmax(520px, 1.3fr); } }
@media (max-width: 900px) { .pc-grid { display: flex; flex-direction: column; gap: 14px; } #pcSplitMain { display: none; } }

/* Processing: choose which size patterns are shown */
.pc-hidelist { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.pc-hidelist label.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); }

/* Processing: tabs and layer toolbar spread evenly; selected / hovered tab highlighted */
.pc-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pc-tabs button { width: 100%; min-height: 42px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
.pc-tabs button:hover { background: rgba(157, 184, 255, .16); border-color: rgba(157, 184, 255, .6); }
.pc-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pc-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; box-shadow: 0 0 0 3px rgba(157, 184, 255, .30), 0 6px 18px rgba(157, 184, 255, .25); }
.pc-toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.pc-toolbar .btn { width: 100%; padding: 0 8px; justify-content: center; }
@media (max-width: 520px) { .pc-tabs { grid-template-columns: 1fr; } }

/* Processing: four tabs, grouped hem settings, ribbing preview */
.pc-tabs { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.pc-sec.first { border-top: 0; padding-top: 0; }
.pc-ribprev { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line);
  background: repeating-conic-gradient(rgba(255,255,255,.10) 0 25%, rgba(255,255,255,.04) 0 50%) 0 0 / 14px 14px; }

/* Design Studio: ribbing designer (top switch: Ribbings) */
.rbe { display: grid; gap: 14px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rbe h3 { margin: 0; font-size: 17px; }
.rbe .note { margin: 0; }
.rbe-sec { display: grid; gap: 10px; }
.rbe-sec > h4 { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.rbe-tpls { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.rbe-tpl { display: grid; gap: 4px; padding: 10px; text-align: left; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; color: var(--text); }
.rbe-tpl:hover { border-color: var(--accent); background: rgba(157, 184, 255, .12); }
.rbe-tpl small { color: var(--muted); font-size: 11.5px; }
.rbe-thumb { width: 100%; height: auto; max-height: 64px; border-radius: 6px; border: 1px solid var(--line); object-fit: fill; }
.rbe-w { display: grid; gap: 4px; max-width: 220px; font-size: 12.5px; color: var(--muted); }
.rbe-w input, .rbe-h input { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; min-width: 0; width: 100%; }
.rbe-bands { display: grid; gap: 6px; }
.rbe-band { display: grid; grid-template-columns: 22px 44px minmax(90px, 1fr) 34px 34px 34px; gap: 8px; align-items: end; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rbe-n { align-self: center; color: var(--muted); font-size: 12px; text-align: center; }
.rbe-band input[type=color] { width: 44px; height: 36px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.rbe-h { display: grid; gap: 3px; font-size: 11.5px; color: var(--muted); }
.rbe-band .ib { min-width: 34px; min-height: 34px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--text); }
.rbe-band .ib:disabled { opacity: .3; cursor: default; }
.rbe-band .ib.del { color: #ff9d9d; font-size: 18px; }
.rbe-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rbe-pv { overflow: auto; border-radius: 8px; }
.rbe-prev { display: block; max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); }
.rbe-info { color: var(--muted); font-size: 12.5px; }

/* Tools page: one card per tool */
.page.tools { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow: auto; }
.tl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; align-items: stretch; }
.tl-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); min-width: 0; }
.tl-card h3 { margin: 0; font-size: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tl-card p { margin: 0 !important; color: var(--muted); }
.tl-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: rgba(120, 220, 160, .18); border: 1px solid rgba(120, 220, 160, .55); color: #bff5d4; }
.tl-prompt { width: 100%; resize: vertical; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 12.5px/1.45 system-ui, sans-serif; min-height: 140px; }
.tl-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.tl-card .btn, .tl-btns .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; text-decoration: none; width: auto; }
.tl-card > a.btn { align-self: flex-start; margin-top: auto; }
.about-link.fb { margin-top: 10px !important; }
.about-info { text-align: center; margin: 14px 0 0 !important; font-size: 14px; line-height: 1.7; color: var(--text); }
.about-info b { color: #fff; }

/* top right: what is left of the plan for the page you are on */
.nav-status { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); pointer-events: auto; white-space: nowrap;
  font-size: 12.5px; color: rgba(255, 255, 255, .85); padding: 6px 12px; border-radius: 999px; background: rgba(20, 24, 36, .45); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); }
.nav-status b { color: #fff; font-variant-numeric: tabular-nums; }
.nav-status[hidden] { display: none; }
body.studio-open .nav-status { right: 168px; }
@media (max-width: 1150px) { .nav-status { display: none; } }
/* top tabs: six now, so they scroll sideways on narrow screens instead of overflowing */
.topnav .links { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.topnav .links::-webkit-scrollbar { display: none; }
.topnav .links button { white-space: nowrap; flex: none; }

/* Design Studio on phones / tablets (js/mobile-studio.js) */
.studio .ms { display: flex; flex-direction: column; gap: 12px; padding: 64px max(14px, env(safe-area-inset-right)) 28px max(14px, env(safe-area-inset-left)); max-width: 560px; margin: 0 auto; min-height: 100%; }
.studio { overflow-y: auto; }
.ms-top { display: flex; justify-content: center; }
.ms-top .seg { width: 100%; max-width: 360px; display: grid; grid-template-columns: 1fr 1fr; }
.ms-top .seg button { min-height: 46px; font-size: 15px; }
.ms-pv { position: relative; height: clamp(200px, 32vh, 300px); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.ms-pv .mp-canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.ms-turn { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ms-turn button, .ms-chips button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.ms-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ms-chips button { width: 100%; }
.ms-chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.ms-card { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); }
.ms-card h3 { margin: 0; font-size: 17px; }
.ms-sub, .ms-info { margin: 0; color: var(--muted); font-size: 13px; }
.ms-big { display: flex; align-items: center; justify-content: center; min-height: 56px; font-size: 16px; width: 100%; }
.ms-ribrow { display: flex; align-items: center; gap: 14px; }
.ms-ribrow input[type=color] { width: 64px; height: 48px; padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.ms-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-actions .btn { min-height: 52px; width: 100%; }
.ms-note { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.ms-crop { position: fixed; inset: 0; z-index: 30; background: rgba(8, 10, 16, .88); display: grid; place-items: center; padding: 16px; overflow: auto; }
.ms-crop-box { display: grid; gap: 10px; justify-items: center; width: 100%; max-width: 480px; }
.ms-crop-box canvas { border-radius: 10px; touch-action: none; cursor: grab; max-width: 100%; }
.ms-zoom { display: flex; gap: 10px; align-items: center; width: 100%; max-width: 420px; }
.ms-zoom input { flex: 1; accent-color: var(--accent); }
.ms-crop-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.ms-crop-btns .btn { min-height: 50px; width: 100%; }
/* Processing on a phone: a small card instead of the full page */
.page.processing.pc-only, .page.processing.pc-only.open { left: 50%; top: 50%; width: min(460px, calc(100vw - 32px)); height: auto; border-radius: 22px; padding: 28px; display: block; border: 1px solid rgba(255, 255, 255, .22); overflow: visible; transform: translate(-50%, -46%) scale(.98); }
.page.processing.pc-only.open { transform: translate(-50%, -50%); }

/* Render card: the Resolution / Length / Frame rate / Turns selects must stay inside the card on narrow phones */
.group { min-width: 0; }
.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields label { min-width: 0; }
.fields select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
/* ---- colour picker (js/colorpicker.js): replaces the browser's popup on every <input type="color"> ---- */
.dkcp { position: fixed; z-index: 2147482000; width: 252px; padding: 10px; background: #2b2b2b; border: 1px solid #111; border-radius: 10px; box-shadow: 0 14px 44px rgba(0, 0, 0, .65); color: #e8e8e8; font: 12px/1.3 system-ui, "Segoe UI", Roboto, sans-serif; user-select: none; -webkit-user-select: none; }
.dkcp[hidden] { display: none; }
.dkcp.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 16px 16px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); max-height: 80vh; overflow: auto; }
.dkcp .cp-svw { position: relative; }
.dkcp canvas.cp-sv { display: block; width: 100%; height: 150px; border-radius: 6px; cursor: crosshair; touch-action: none; }
.dkcp.sheet canvas.cp-sv { height: 170px; }
.dkcp .cp-mark { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.dkcp .cp-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dkcp .cp-prev { flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: flex; border: 1px solid rgba(255, 255, 255, .45); }
.dkcp .cp-prev i { flex: 1; }
.dkcp input.cp-hue { flex: 1; min-width: 0; height: 14px; margin: 0; border-radius: 7px; -webkit-appearance: none; appearance: none; outline: none; cursor: pointer; touch-action: none; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.dkcp input.cp-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #777; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.dkcp input.cp-hue::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #777; }
.dkcp .cp-eyes[hidden] { display: none; }
.dkcp .cp-eye { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 8px; border-radius: 7px; border: 1px solid #111; background: #3a3a3a; color: #eee; font: inherit; cursor: pointer; }
.dkcp .cp-eye[hidden] { display: none; }
.dkcp .cp-eye:hover { background: #4a4a4a; }
.dkcp .cp-rgb { display: grid; grid-template-columns: repeat(3, 1fr) 1.5fr; gap: 6px; margin-top: 10px; }
.dkcp .cp-rgb label { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.dkcp .cp-rgb input { width: 100%; min-width: 0; box-sizing: border-box; padding: 6px 4px; text-align: center; background: #1f1f1f; color: #fff; border: 1px solid #111; border-radius: 5px; font: inherit; }
.dkcp .cp-rgb span { color: #9a9a9a; font-size: 11px; }
.dkcp .cp-swh { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 6px; color: #9a9a9a; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.dkcp .cp-del { padding: 2px 8px; border-radius: 6px; border: 1px solid #111; background: #3a3a3a; color: #eee; cursor: pointer; font-size: 12px; }
.dkcp .cp-del.on { background: #b3261e; border-color: #b3261e; }
.dkcp .cp-sws { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-height: 118px; overflow: auto; padding: 2px; }
.dkcp.sheet .cp-sws { max-height: 150px; }
.dkcp .cp-sw { aspect-ratio: 1; min-width: 0; border-radius: 6px; padding: 0; cursor: pointer; background: var(--c); border: 1px solid rgba(255, 255, 255, .35); }
.dkcp .cp-sw.on { outline: 2px solid #4da3ff; outline-offset: 1px; }
.dkcp .cp-sw.del { animation: cpwob .5s ease-in-out infinite alternate; border-color: #ff6b6b; }
@keyframes cpwob { to { transform: rotate(4deg); } }
.dkcp .cp-none { grid-column: 1 / -1; color: #8a8a8a; }
/* the Eyedropper tool's preview next to the pointer */
.eye-chip { position: fixed; z-index: 2147482500; display: flex; align-items: center; gap: 7px; padding: 4px 9px 4px 4px; background: rgba(20, 20, 20, .92); border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; color: #fff; font: 600 12px/1 system-ui, sans-serif; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.eye-chip[hidden] { display: none; }
.eye-chip i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
/* ---- Project menu (js/project.js): Open project / Save project in the Design Studio and in Processing ---- */
.prj-btn { white-space: nowrap; }
.prj-menu { position: fixed; z-index: 2147482000; min-width: 262px; max-width: calc(100vw - 16px); padding: 6px; display: flex; flex-direction: column; gap: 2px; background: #2b2b2b; border: 1px solid #111; border-radius: 10px; box-shadow: 0 14px 44px rgba(0, 0, 0, .65); }
.prj-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; color: #eee; cursor: pointer; font: inherit; }
.prj-item:hover, .prj-item:focus-visible { background: #3d3d3d; outline: none; }
.prj-item b { font-weight: 600; font-size: 13px; }
.prj-item small { color: #9a9a9a; font-size: 11px; line-height: 1.3; }