/* Skin Studio — editor styles
   Neutral graphite surfaces, one warm accent, 26px controls, hairline borders. */

:root {
  --bg-0: #0f0f11;        /* canvas */
  --bg-1: #17171a;        /* panels */
  --bg-2: #1e1e22;        /* inputs, raised */
  --bg-3: #26262b;        /* hover */
  --bg-4: #2f2f35;        /* pressed / selected */
  --line: #26262b;
  --line-2: #323238;
  --text: #ececef;
  --text-2: #a3a3ab;
  --text-3: #6e6e78;
  --accent: #8b28f7;       /* Delta purple (Delta's own "Purple" colour asset) */
  --accent-2: #9e47ff;
  --accent-ink: #ffffff;
  --accent-text: #b98cff;  /* lighter tint for accent text and icons on the dark UI */
  --accent-soft: rgba(139, 40, 247, .18);
  --ok: #5ccf8a;
  --warn: #f2c14e;
  --bad: #f2716b;
  --screen: #19c8ff;
  --r: 5px;
  --h: 26px;
  --font: "Inter", system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid; grid-template-rows: 44px 1fr 24px;
  background: var(--bg-0); color: var(--text);
  font: 12px/1.45 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 11px; }
.flex { flex: 1; }
b { font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- icons */
svg.i { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- controls */
button, select, input, output { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  height: var(--h); display: inline-flex; align-items: center; gap: 6px; padding: 0 10px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--text); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--bg-3); border-color: #3d3d44; }
.btn:active:not(:disabled) { background: var(--bg-4); }
.btn .i { width: 14px; height: 14px; color: var(--text-2); }
.btn.wide { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); border-color: transparent; color: var(--text); }
.btn.sm { height: 24px; padding: 0 7px; gap: 5px; font-size: 12px; }
.btn.sm .i { width: 13px; height: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary .i { color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger:hover:not(:disabled) { border-color: rgba(242, 113, 107, .5); color: var(--bad); }
.btn-danger:hover:not(:disabled) .i { color: var(--bad); }

.btn-icon {
  width: var(--h); height: var(--h); display: inline-grid; place-items: center; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--r); color: var(--text-2);
}
.btn-icon:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }
.btn-icon.sm { width: 22px; height: 22px; }
.btn-icon.sm .i { width: 13px; height: 13px; }
.btn-icon.danger:hover:not(:disabled) { color: var(--bad); }

select, input[type=text], input[type=number] {
  height: var(--h); width: 100%; min-width: 0; padding: 0 8px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text);
  transition: border-color .12s;
}
select { appearance: none; padding-right: 22px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%236e6e78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
select option { background: var(--bg-2); }
select:hover, input[type=text]:hover, input[type=number]:hover { border-color: #3d3d44; }
select:focus, input:focus { outline: none; border-color: var(--accent); }
input[type=number] { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

input[type=color].swatch, .swatch {
  width: var(--h); height: var(--h); flex: none; padding: 2px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 3px; }

/* range */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: var(--bg-4); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 3px; background: var(--bg-4); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 0 0 3px var(--bg-1); }
input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--text); border: 0; }
input[type=range]:hover::-webkit-slider-thumb { background: var(--accent-text); }
input[type=range]:focus { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { background: var(--accent); }

/* switch */
.switch { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch { position: relative; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 24px; height: 14px; flex: none; border-radius: 8px; background: var(--bg-4); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(10px); background: var(--accent-ink); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 1px; }
.switch:hover { color: var(--text); }

kbd { display: inline-block; min-width: 18px; padding: 1px 5px; text-align: center; font: 10.5px var(--mono); color: var(--text-2);
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 14px; padding: 0 10px 0 12px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
}
.tb-group { display: flex; align-items: center; gap: 2px; }
.tb-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; }
.tb-right { gap: 6px; }
.brand { gap: 9px; padding-right: 10px; border-right: 1px solid var(--line); height: 100%; }
.logo { width: 22px; height: 22px; color: var(--accent); display: block; }
.logo-link { display: block; border-radius: 6px; transition: transform .15s; }
.logo-link:hover { transform: scale(1.08); }
.doc { display: flex; flex-direction: column; line-height: 1.15; }
.doc-app { font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.doc-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-centre { display: flex; justify-content: center; gap: 10px; }

.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 7px; }
.seg:empty { display: none; }
.seg button {
  height: 24px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px;
  background: transparent; border: 0; border-radius: 5px; color: var(--text-2); font-weight: 500;
}
.seg button:hover:not(:disabled) { color: var(--text); background: var(--bg-2); }
.seg button.on { background: var(--bg-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button.on .i { color: var(--accent-text); }
.seg button .i { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- workspace */
.workspace { display: grid; grid-template-columns: 252px 1fr 304px; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--bg-1); }
.panel-left { border-right: 1px solid var(--line); }
.panel-right { border-left: 1px solid var(--line); }

.tabs { display: flex; gap: 2px; padding: 0 8px; height: 36px; align-items: stretch; border-bottom: 1px solid var(--line); flex: none; }
.tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px;
  background: none; border: 0; color: var(--text-3); font-weight: 500;
}
.tabs button .i { width: 14px; height: 14px; }
.tabs button:hover { color: var(--text-2); }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
  background: var(--bg-4); color: var(--text-2); }
.badge.warn { background: rgba(242, 193, 78, .16); color: var(--warn); }
.badge.bad { background: rgba(242, 113, 107, .18); color: var(--bad); }

.tab-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
.tab-body::-webkit-scrollbar { width: 8px; }
.tab-body::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 4px; border: 2px solid var(--bg-1); }

/* blocks & collapsible sections */
.block { padding: 12px 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.block-head { display: flex; align-items: center; justify-content: space-between; min-height: 22px; font-weight: 600; color: var(--text); }
.block.bake { border-bottom: 0; }

.sec { border-bottom: 1px solid var(--line); }
.sec > summary {
  list-style: none; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  font-weight: 600; cursor: pointer; user-select: none;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary:hover { background: rgba(255, 255, 255, .02); }
.sec > summary .chev { width: 12px; height: 12px; color: var(--text-3); transition: transform .15s; }
.sec[open] > summary .chev { transform: rotate(90deg); }
.sec-body { padding: 2px 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.subpanel { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 7px; }

/* fields */
.field-label { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.field-label em { font-style: normal; color: var(--text-3); margin-left: 4px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline.between { justify-content: space-between; }
.inline select { flex: 1; }
.btn-row { display: flex; gap: 6px; }
.btn-row .btn { flex: 1; justify-content: center; }
.toolrow { display: flex; align-items: center; gap: 2px; }

.num { position: relative; display: block; }
.num > span { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 600; color: var(--text-3); pointer-events: none; }
.num input { padding-left: 19px; padding-right: 4px; }

.txt-field, .sel-field { display: flex; flex-direction: column; gap: 4px; }
.txt-field > span, .sel-field > span { font-size: 11px; color: var(--text-2); }

/* sliders made by ui.js: <div class="field"><label><span>name</span><span class="k">value</span></label><input range></div> */
.field { display: flex; flex-direction: column; gap: 1px; }
.field > label { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--text-2); }
.field .k { font: 10.5px var(--mono); color: var(--text-3); }
.field:hover .k { color: var(--text-2); }

.credit { margin: 0; font-size: 11px; line-height: 1.5; color: var(--text-3); }
.credit a { color: var(--accent-text); text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.hint { margin: 0; font-size: 11px; color: var(--text-3); line-height: 1.5; }
.hint b { color: var(--text-2); font-weight: 600; }
.meta { font-size: 11px; color: var(--text-2); line-height: 1.5; word-break: break-word; }
.placeholder { margin: 0; padding: 18px 16px; color: var(--text-3); font-size: 11.5px; line-height: 1.55; display: none; }
#selPanel.hidden ~ #stickerProps.hidden ~ #inspectEmpty { display: block; }
#packOpts.hidden ~ #styleEmpty { display: block; }
.empty-note { display: none; margin: 0; font-size: 11px; color: var(--text-3); }
.empty-note b { color: var(--text-2); }
#stickerList:empty + .empty-note { display: block; }

/* lists (elements, stickers) */
.list { display: flex; flex-direction: column; gap: 1px; }
.list > div {
  height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 0 10px;
  border-radius: var(--r); color: var(--text-2); cursor: pointer; position: relative;
}
.list > div:hover { background: var(--bg-2); color: var(--text); }
.list > div.sel { background: var(--accent-soft); color: var(--text); }
.list > div.sel::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--accent); }
.list .k { font: 10.5px var(--mono); color: var(--text-3); }
.add-row { display: flex; gap: 6px; margin-top: 2px; }
.add-row select { flex: 1; }

/* thumbnails & chips (some styled inline by ui.js) */
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs > div { transition: border-color .12s, transform .12s; background-color: var(--bg-2) !important; border-color: var(--line-2) !important; border-radius: 6px !important; }
.thumbs > div:hover { border-color: var(--accent) !important; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips > button {
  height: 24px; display: inline-flex; align-items: center; padding: 0 9px !important; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; color: var(--text-2); font-size: 11px; font-weight: 500;
}
.chips > button:hover { color: var(--text); border-color: #45454d; }
.chips > button .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.mat-colours label { display: flex; }
.mat-colours .hint { margin-left: 4px; }
.seg.full { display: flex; flex-wrap: wrap; width: 100%; }
.seg.full button { flex: 1 1 auto; justify-content: center; padding: 0 6px; font-size: 11px; height: 22px; }
.seg.full button[hidden], .seg.full[hidden] { display: none; }
.seg.full button.custom::after { content: ""; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: var(--accent-text); }
#btnFillPanel > div:not(.seg) { display: flex; flex-direction: column; gap: 6px; }
#btnFillPanel > #btnGlyphRow { flex-direction: row; align-items: center; }
#btnFillPanel > div[hidden] { display: none; }
.grad-bar { height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.grad-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.grad-presets > button { height: 22px !important; border: 1px solid rgba(255, 255, 255, .08); border-radius: 4px; }
.grad-presets > button:hover { outline: 1px solid var(--accent); outline-offset: 1px; }
.stops > .row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px !important; }
.stops input[type=color] { width: 22px !important; height: 22px !important; padding: 1px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 4px; }
.stops button { width: 22px; height: 22px; padding: 0 !important; background: transparent; border: 0; color: var(--text-3); border-radius: 4px; }
.stops button:hover:not(:disabled) { background: var(--bg-3); color: var(--bad); }
.stops .k { font: 10.5px var(--mono); color: var(--text-3); }

/* shortcuts */
.keys > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text-2); font-size: 11px; }

/* checks */
.checks { padding: 8px 0; }
.checks > div { position: relative; padding: 7px 14px 7px 32px; font-size: 11.5px; color: var(--text-2); border-bottom: 1px solid var(--line); line-height: 1.45; }
.checks > div::before { content: ""; position: absolute; left: 14px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.checks .ok::before { background: var(--ok); }
.checks .warn::before { background: var(--warn); }
.checks .bad::before { background: var(--bad); }
.checks .bad { color: var(--text); }

/* ---------------------------------------------------------------- stage */
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#stageWrap {
  position: relative; flex: 1; overflow: auto; display: grid; place-items: center; padding: 20px;
  background-color: var(--bg-0);
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .055) 1px, transparent 0);
  background-size: 18px 18px;
}
#cv { display: block; touch-action: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 50px rgba(0, 0, 0, .55); }
#empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
#stageWrap:has(#empty:not(.hidden)) #cv { visibility: hidden; }
.empty-card { max-width: 340px; text-align: center; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 44px; height: 44px; fill: none; stroke: var(--text-3); stroke-width: 1.2; stroke-linecap: round; margin-bottom: 4px; }
.empty-card h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.empty-card p { margin: 0 0 6px; color: var(--text-3); line-height: 1.55; }
#drop { position: absolute; inset: 10px; display: none; place-items: center; pointer-events: none;
  border: 1.5px dashed var(--accent); border-radius: 10px; background: rgba(139, 40, 247, .07); }
#drop span { padding: 6px 12px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* view bar under the canvas */
.viewbar {
  flex: none; height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 10px;
  background: var(--bg-1); border-top: 1px solid var(--line);
}
.vb-group { display: flex; align-items: center; gap: 4px; }
.chip {
  height: 26px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: var(--r);
  color: var(--text-3); cursor: pointer; user-select: none; border: 1px solid transparent;
}
.chip { position: relative; }   /* contains its hidden checkbox (otherwise it can widen the page) */
.chip input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { color: var(--text-2); background: var(--bg-2); }
.chip:has(input:checked) { color: var(--text); background: var(--bg-2); border-color: var(--line-2); }
.chip:has(input:checked) .i { color: var(--accent-text); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); }
.chip-select select { height: 22px; width: auto; padding: 0 20px 0 4px; border: 0; background-color: transparent; color: inherit; background-position: right 4px center; }
.mini { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px; color: var(--text-3); }
.mini select { width: 48px; height: 22px; padding: 0 16px 0 6px; background-position: right 5px center; }
.mini input[type=range] { width: 96px; }
.mini output { width: 38px; font: 10.5px var(--mono); color: var(--text-2); text-align: right; }

/* ---------------------------------------------------------------- dialog */
.dlg { padding: 0; width: min(720px, calc(100vw - 40px)); color: var(--text); background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.dlg::backdrop { background: rgba(6, 6, 8, .62); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlg-in .14s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.dlg-body { display: grid; grid-template-columns: 1fr 230px; gap: 18px; padding: 18px; }
.dlg-main { display: flex; flex-direction: column; gap: 8px; }
.dlg-main .txt-field input { height: 30px; font-size: 13px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts.three { grid-template-columns: repeat(3, 1fr); }
.opt { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 7px; transition: border-color .12s, background .12s; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:hover { border-color: #45454d; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt-title { font-weight: 600; }
.opt-sub { font-size: 11px; color: var(--text-3); }
.opt:has(input:checked) .opt-sub { color: var(--text-2); }
.dlg-preview { margin: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-0); border: 1px solid var(--line); border-radius: 8px; }
.pv-row { display: flex; gap: 8px; align-items: flex-start; justify-content: center; flex: 1; }
.pv-row img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .07); background: #000; }
#newPrevP { height: 220px; }
#newPrevL { width: 100%; max-width: 100px; align-self: center; }
.dlg-preview figcaption { font-size: 11px; color: var(--text-3); text-align: center; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.empty-card .btn-row { width: 100%; max-width: 280px; }

/* ---------------------------------------------------------------- status bar */
.statusbar {
  display: flex; align-items: center; gap: 18px; padding: 0 12px;
  background: var(--bg-1); border-top: 1px solid var(--line); color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden;
}
.statusbar #msg { margin-left: auto; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }

/* narrower windows: slimmer panels, icon-only buttons */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: 228px 1fr 280px; }
  .seg button { padding: 0 8px; }
  .tb-group .btn-ghost { padding: 0 7px; }
}
@media (max-width: 1100px) {
  .seg button, .btn-ghost { font-size: 0; gap: 0; }
  .doc-name { max-width: 120px; }
}

/* ================================================================ phone layout
   Canvas fills the screen, panels open as sheets from a bottom tab bar. */
.mobile-nav, .sheet-close, .sheet-scrim { display: none; }

@media (max-width: 820px) {
  body { grid-template-rows: auto 1fr auto; }
  input[type=text], input[type=number], select { font-size: 16px; }   /* stops iOS zooming in on focus */
  button, .chip, .opt { touch-action: manipulation; }

  /* top bar: icons only, the two switchers on their own row */
  .topbar { grid-template-columns: auto 1fr auto; gap: 6px; padding: 6px 8px; row-gap: 6px;
    padding-top: max(6px, env(safe-area-inset-top)); }
  .brand { border-right: 0; padding-right: 0; gap: 7px; }
  .doc-app { display: none; }
  .doc-name { max-width: 110px; font-size: 12.5px; }
  .tb-group .btn-ghost { font-size: 0; gap: 0; padding: 0 8px; }
  .tb-group .btn-ghost .i { width: 17px; height: 17px; }
  #bFolder, #bSaveJson, .tb-sep { display: none; }
  .tb-right .btn-primary { font-size: 0; gap: 0; width: 38px; padding: 0; justify-content: center; }
  .tb-right .btn-primary .i { width: 17px; height: 17px; }
  .tb-centre { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; gap: 6px; }
  .seg button { font-size: 12px; padding: 0 9px; height: 30px; }
  .tb-centre .seg button:not(.on) { font-size: 0; gap: 0; padding: 0 9px; }   /* icons only, label on the active one */
  .seg button .i { width: 15px; height: 15px; }

  /* canvas */
  .workspace { grid-template-columns: 1fr; }
  #stageWrap { padding: 10px; }
  .viewbar { height: 44px; gap: 6px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
  .viewbar::-webkit-scrollbar { display: none; }
  .vb-group { flex: none; }
  .chip { height: 32px; padding: 0 9px; font-size: 12px; }
  .mini input[type=range] { width: 80px; }

  /* panels become bottom sheets */
  .panel { position: fixed; left: 0; right: 0; z-index: 40;
    bottom: calc(56px + env(safe-area-inset-bottom)); max-height: 62vh; min-height: 40vh;
    border: 0; border-top: 1px solid var(--line-2); border-radius: 14px 14px 0 0;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .55);
    transform: translateY(calc(100% + 80px)); transition: transform .22s ease; }
  .panel.open { transform: none; }
  .panel::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--bg-4); }
  .panel .tabs { padding-top: 10px; height: 46px; }
  .sheet-close { display: inline-grid; margin-left: auto; align-self: center; order: 9; }
  .sheet-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .35);
    opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sheet-scrim.on { opacity: 1; pointer-events: auto; }

  /* bottom tab bar */
  .mobile-nav { display: flex; z-index: 45; height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--bg-1); border-top: 1px solid var(--line); }
  .mobile-nav button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; background: none; border: 0; color: var(--text-3); font-size: 10.5px; font-weight: 500; }
  .mobile-nav button .i { width: 20px; height: 20px; }
  .mobile-nav button.on { color: var(--text); }
  .mobile-nav button.on .i { color: var(--accent-text); }
  .mobile-nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

  /* messages as short-lived pop-ups above the tab bar */
  .statusbar { position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 50;
    border: 1px solid var(--line-2); border-radius: 10px; background: rgba(23, 23, 26, .94); padding: 8px 12px;
    pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
  .statusbar.show { opacity: 1; transform: none; }
  .statusbar #pos, .statusbar #selInfo { display: none; }
  .statusbar #msg { margin: 0; white-space: normal; }

  /* new-skin dialog stacks */
  .dlg { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); overflow: auto; }
  .dlg-body { grid-template-columns: 1fr; gap: 12px; padding: 14px; }
  .dlg-preview { order: -1; }
  .pv-row { justify-content: center; }
  #newPrevP { height: 150px; }
  #newPrevL { max-width: 150px; }
  .opts, .opts.three { grid-template-columns: 1fr; }
  .empty-card { padding: 0 20px; }
}
#symText { flex: 1; min-width: 0; }
.dlg.dlg-sm { width: min(420px, calc(100vw - 32px)); }
.resume-body { display: flex; gap: 16px; align-items: center; padding: 18px; }
.resume-body img { width: 72px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); background: #000; }
.resume-body p { margin: 0; }
.resume-label { font-size: 11px; color: var(--text-3); }
.resume-name { font-size: 15px; font-weight: 600; margin: 2px 0 4px !important; overflow-wrap: anywhere; }
