:root {
  --bg: #1c1f26;
  --panel: #23262f;
  --panel-2: #2a2e38;
  --line: #353a46;
  --text: #e7e9ee;
  --muted: #98a0b0;
  --accent: #4c8dff;
  --accent-2: #34c17b;
  --danger: #e5544b;
  --sel: #4c8dff;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 13px;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

/* ---------- Toolbar ---------- */
/* Осмысленные группы-«пилюли» в порядке работы: добавить → разложить → лист → проект → экспорт → вид.
   .tb-row = display:contents: группы текут одним потоком и переносятся без «сирот» на любой ширине. */
#toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tb-row { display: contents; }
.tb-group {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, .028);
  border: 1px solid rgba(255, 255, 255, .055);
  border-radius: 10px;
}
/* в тулбаре элементы компактнее, чем в панелях */
#toolbar .btn { padding: 6px 10px; }
#toolbar .btn.icon { padding: 5px 8px; }
#toolbar .select, #toolbar .num { padding: 5px 7px; }
#toolbar .num { width: 52px; }
#toolbar input[type="color"] { width: 30px; height: 28px; }
.tb-group.zoom { gap: 4px; }
.tb-cap {
  font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: #78808f;
  margin: 0 4px 0 2px;
}
.tb-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tb-sep.small { height: 18px; }
.tb-spacer { flex: 1; }
.tb-label { color: var(--muted); font-size: 12px; }
.tb-check { cursor: pointer; white-space: nowrap; }
.tb-check input { vertical-align: -2px; margin-right: 4px; cursor: pointer; }
.proj-name {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 150px;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #333846; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3f7ff0; }
.btn.accent { background: var(--accent-2); border-color: var(--accent-2); color: #06281a; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 8px; font-size: 12px; flex: 1; }
.btn.icon { padding: 6px 9px; font-size: 15px; line-height: 1; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

.select, .num, input[type="color"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.select.full, .num.full { width: 100%; }
.num { width: 62px; }
input[type="color"] { width: 34px; height: 32px; padding: 2px; cursor: pointer; }

.zoom-label { min-width: 46px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Workspace ---------- */
#workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}
#workspace.hidden { display: none; }

/* Sidebar */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px;
}
.sb-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; line-height: 1.4; }

.cat {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--panel-2);
  font-weight: 600;
}
.cat-head .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.cat-drop {
  padding: 8px;
  min-height: 44px;
}
.cat-drop.drag-over { background: rgba(76,141,255,.12); outline: 2px dashed var(--accent); outline-offset: -6px; }
.dropzone-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 10px 4px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.thumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border-radius: 6px;
  margin-bottom: 5px;
  cursor: pointer;
  background: var(--panel-2);
}
.thumb:hover { background: #333846; }
.thumb.selected { outline: 2px solid var(--sel); }
.thumb.hidden-item { opacity: .45; }
.thumb.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.thumb.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.thumb img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
  flex: none;
}
.thumb .t-name {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumb .t-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}
.thumb .t-btn:hover { color: var(--text); background: rgba(255,255,255,.08); }

/* Viewport / board */
#viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background:
    repeating-conic-gradient(#20242c 0% 25%, #191c22 0% 50%) 50% / 28px 28px;
  cursor: default;
}
#viewport.panning { cursor: grabbing; }
/* зажатый пробел — «рука»: курсор grab поверх всего, включая фото и маркеры */
#viewport.space-pan, #viewport.space-pan .item, #viewport.space-pan .handle { cursor: grab; }
#viewport.space-pan.panning, #viewport.space-pan.panning .item, #viewport.space-pan.panning .handle { cursor: grabbing; }

#board {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  /* will-change ставится ТОЛЬКО во время жеста (класс .gesture): в покое доска
     перерисовывается резко под текущий зум/DPI, а не растягивается кэш-текстурой (мыло как в старой версии) */
}
#board.gesture { will-change: transform; }

.item {
  position: absolute;
  outline: 1px solid rgba(0,0,0,.04);
}
.item .clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.item img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  image-rendering: auto;
}
.item.selected { outline: none; }
.item .frame {
  position: absolute;
  inset: 0;
  border: calc(1.5px / var(--vs, 1)) solid var(--sel);
  pointer-events: none;
  display: none;
}
.item.selected .frame { display: block; }

.handle {
  position: absolute;
  width: calc(11px / var(--vs, 1));
  height: calc(11px / var(--vs, 1));
  background: #fff;
  border: calc(1.5px / var(--vs, 1)) solid var(--sel);
  border-radius: 2px;
  display: none;
  z-index: 5;
}
/* обычный режим: только углы (пропорциональный масштаб);
   края — только в режиме обрезки ✂, как в Figma */
.item.selected.solo .handle:not(.edge) { display: block; }

/* Текстовый блок на листе */
.item .tx {
  position: absolute;
  inset: 0;
  white-space: pre;
  line-height: 1.3;
  font-family: "Segoe UI", Arial, sans-serif;
  pointer-events: none;
  overflow: visible;
}
.item.text-item { outline: none; }

/* Режим обрезки: показываем все маркеры и подсвечиваем рамку оранжевым */
.item.crop-mode .handle { display: block; background: #ffb020; border-color: #ff8a00; }
.item.crop-mode .handle.edge { display: block; }
.item.crop-mode .frame { display: block; border-color: #ffb020; }

/* Режим «двигать кадр» (двойной клик): пунктирная рамка, курсор перемещения */
.item.pan-mode { cursor: move; }
.item.pan-mode .frame { display: block; border-style: dashed; }

/* «Магниты» моей раскладки: полупрозрачные ячейки видны только во время перетаскивания */
.slot-ghosts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}
.slot-ghost {
  position: absolute;
  border: calc(2px / var(--vs, 1)) dashed rgba(124, 58, 237, 0.55);
  background: rgba(124, 58, 237, 0.07);
  border-radius: calc(6px / var(--vs, 1));
  transition: background 0.12s, border-color 0.12s;
}
.slot-ghost.hot {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.95);
  border-style: solid;
}
.slot-ghost .sg-name {
  position: absolute;
  top: calc(4px / var(--vs, 1));
  left: calc(6px / var(--vs, 1));
  font-size: calc(12px / var(--vs, 1));
  line-height: 1.4;
  color: rgba(93, 34, 196, 0.95);
  background: rgba(255, 255, 255, 0.78);
  padding: 0 calc(5px / var(--vs, 1));
  border-radius: calc(3px / var(--vs, 1));
  white-space: nowrap;
}

/* Вкладки и Примерочная */
#tabsBar { display: flex; gap: 6px; padding: 4px 10px 0; background: #1b1d21; border-bottom: 1px solid #2a2d33; }
#tabsBar .tab { background: transparent; color: #9aa0aa; border: 0; padding: 7px 16px; cursor: pointer; border-radius: 8px 8px 0 0; font-size: 13px; }
#tabsBar .tab.active { background: #24262c; color: #fff; }
#tryonView, #genView { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px; overflow: auto; background: #202227; }
#tryonView.hidden, #genView.hidden { display: none; }
#tryonView { gap: 0; padding: 0; overflow: hidden; }
.gen-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.gen-seed { width: 110px; }
textarea.tr-prompt { resize: vertical; font-family: inherit; }
.tr-left { flex: 1; max-width: 640px; }
.tryon-panel {
  width: 330px;
  min-width: 330px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #1b1d22;
  border-right: 1px solid #30343b;
  padding: 14px;
  box-sizing: border-box;
}
.tr-title { color: #d5d9e0; font-size: 14px; margin-bottom: 10px; }
.tr-slots { display: flex; gap: 12px; margin-bottom: 10px; }
.tryon-panel .tr-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tr-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tr-slot { width: 150px; height: 200px; border: 2px dashed #4a4f59; border-radius: 10px; display: flex; align-items: center; justify-content: center; text-align: center; color: #8b919c; cursor: pointer; font-size: 13px; overflow: hidden; background: #26282e; }
.tryon-panel .tr-slot { width: auto; height: 128px; min-width: 0; border-radius: 8px; font-size: 12px; }
.tr-slot:hover { border-color: #7c3aed; color: #cbd0da; }
.tr-slot.filled { border-style: solid; border-color: #7c3aed; }
.tr-slot img { width: 100%; height: 100%; object-fit: cover; }
.tr-prompt { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #3a3e46; background: #26282e; color: #e8eaee; }
.tr-status { margin-top: 8px; color: #9aa0aa; font-size: 13px; min-height: 18px; }
.tr-result { margin-top: 10px; }
.tr-result img { max-width: 100%; max-height: 52vh; border-radius: 10px; border: 1px solid #3a3e46; }
.tr-history { width: 300px; flex: none; }
.tryon-history { width: auto; flex: 1; min-height: 0; margin-top: 16px; display: flex; flex-direction: column; }
.tryon-history #histList { overflow-y: auto; min-height: 0; padding-right: 2px; }
.tryon-stage {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px;
  box-sizing: border-box;
  background: #2b2f36;
}
.tryon-sheet {
  width: min(760px, 100%);
  min-height: calc(100vh - 150px);
  background: #f3f2ee;
  box-shadow: 0 14px 42px rgba(0,0,0,.42);
  border: 1px solid rgba(0,0,0,.08);
  padding: 28px;
  box-sizing: border-box;
  display: flex;
}
.tr-result-sheet {
  margin: 0;
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tr-result-sheet img {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.tryon-empty {
  color: #9a9a9a;
  font-size: 14px;
  text-align: center;
}
.hist-item { display: flex; align-items: center; gap: 8px; background: #26282e; border: 1px solid #33363e; border-radius: 8px; padding: 6px; margin-bottom: 8px; }
.hist-item[draggable="true"] { cursor: grab; }
.hist-item[draggable="true"]:active { cursor: grabbing; }
.hist-item img { width: 56px; height: 74px; object-fit: cover; border-radius: 6px; cursor: grab; flex: none; }
.hist-item .hi-meta { flex: 1; color: #aab0ba; font-size: 11.5px; line-height: 1.35; }
.hist-item .hi-acts { display: flex; flex-direction: column; gap: 4px; flex: none; }

/* слот примерочной — подсветка при перетаскивании с полки */
.tr-slot.drag-over { border-color: #7c3aed; background: #2e2740; }

/* Полка результатов — выезжающая панель справа, поверх обеих вкладок */
#resultTray {
  position: fixed; top: 0; right: 0; height: 100vh; width: 300px;
  background: #1c1e23; border-left: 1px solid #33363e; box-shadow: -6px 0 20px rgba(0,0,0,0.4);
  transform: translateX(100%); transition: transform 0.18s ease; z-index: 2000;
  display: flex; flex-direction: column; padding: 12px; box-sizing: border-box;
}
#resultTray.open { transform: translateX(0); }
#resultTray .tray-head { display: flex; align-items: center; justify-content: space-between; color: #e6e9ee; font-size: 14px; margin-bottom: 6px; }
#resultTray .tray-hint { color: #8b919c; font-size: 11.5px; margin-bottom: 10px; }
#trayList { overflow-y: auto; flex: 1; }

/* Курсор сотрудника в режиме наблюдения (координаты листа, компенсируем зум через --vs) */
.live-cursor {
  position: absolute;
  z-index: 60;
  pointer-events: none;
  transition: left 0.18s linear, top 0.18s linear;
}
.live-cursor .lc-dot {
  width: calc(12px / var(--vs, 1));
  height: calc(12px / var(--vs, 1));
  border-radius: 50%;
  background: #ff5722;
  border: calc(2px / var(--vs, 1)) solid #fff;
  box-shadow: 0 0 calc(6px / var(--vs, 1)) rgba(0, 0, 0, 0.45);
}
.live-cursor .lc-name {
  margin-top: calc(4px / var(--vs, 1));
  background: #ff5722;
  color: #fff;
  font-size: calc(12px / var(--vs, 1));
  padding: calc(2px / var(--vs, 1)) calc(6px / var(--vs, 1));
  border-radius: calc(4px / var(--vs, 1));
  white-space: nowrap;
  width: max-content;
}

/* Баннер режима наблюдения */
.live-banner {
  position: fixed;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: #7c3aed;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 13px;
}
.live-banner button {
  background: #fff;
  color: #7c3aed;
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}

.handle.nw { left: calc(-6px / var(--vs, 1)); top: calc(-6px / var(--vs, 1)); cursor: nwse-resize; }
.handle.ne { right: calc(-6px / var(--vs, 1)); top: calc(-6px / var(--vs, 1)); cursor: nesw-resize; }
.handle.sw { left: calc(-6px / var(--vs, 1)); bottom: calc(-6px / var(--vs, 1)); cursor: nesw-resize; }
.handle.se { right: calc(-6px / var(--vs, 1)); bottom: calc(-6px / var(--vs, 1)); cursor: nwse-resize; }
.handle.n { top: calc(-6px / var(--vs, 1)); left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.s { bottom: calc(-6px / var(--vs, 1)); left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.w { left: calc(-6px / var(--vs, 1)); top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.e { right: calc(-6px / var(--vs, 1)); top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.guide {
  position: absolute;
  background: #ff3b6b;
  display: none;
  z-index: 9999;
  pointer-events: none;
}
.guide.vertical { top: 0; width: calc(1px / var(--vs, 1)); height: 100%; }
.guide.horizontal { left: 0; height: calc(1px / var(--vs, 1)); width: 100%; }

.empty-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.empty-hint .eh-icon { font-size: 44px; margin-bottom: 10px; }
.empty-hint .eh-title { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-hint .eh-text { font-size: 13px; line-height: 1.5; }
.empty-hint.hidden { display: none; }

/* Inspector */
#inspector {
  width: 250px;
  min-width: 250px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 12px;
}
.insp-empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.insp-body.hidden, .insp-empty.hidden { display: none; }
.insp-name { font-weight: 600; margin-bottom: 2px; word-break: break-all; }
.insp-res { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { color: var(--muted); font-size: 12px; }
.field-row { display: flex; gap: 8px; }
.field.small { flex: 1; }
.insp-tip { color: var(--muted); font-size: 11px; margin: -4px 0 12px; line-height: 1.4; display: none; }
.insp-tip.show { display: block; }
.insp-actions { display: flex; gap: 6px; margin-bottom: 8px; }

#photoProps.hidden, #textProps.hidden { display: none; }
.hidden0 { display: none; }
.web-modal-sec {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0 2px;
  text-transform: none;
}
#ispZoom { width: 100%; cursor: pointer; }
.insp-hint { color: var(--muted); font-weight: 400; font-size: 11px; }
.ratio-row { display: flex; gap: 4px; flex-wrap: wrap; }
.ratio-row .btn { flex: 1; padding: 5px 4px; font-size: 12px; }
.txtarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  resize: vertical;
  font-family: inherit;
}
#txColor { width: 100%; height: 32px; }

/* Statusbar */
#statusbar {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.build-tag {
  margin-left: auto;
  padding-left: 12px;
  color: var(--muted);
  font-size: 11px;
  opacity: .8;
  white-space: nowrap;
}

/* Общий drop-overlay при перетаскивании файлов в окно */
#viewport.drag-over::after {
  content: "Отпустите, чтобы добавить фото";
  position: absolute;
  inset: 16px;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
  background: rgba(76,141,255,.08);
  z-index: 10000;
  pointer-events: none;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3f4c; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- Панель-план «Макро» --- */
.macro-plan {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(10, 12, 16, .62);
  display: flex; align-items: center; justify-content: center;
}
.macro-plan.hidden { display: none; }
.macro-plan .mp-box {
  width: min(560px, 94vw); max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 18px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.mp-title { color: #e6e9ee; font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.mp-sub { color: #8b919c; font-size: 12px; line-height: 1.4; margin-bottom: 12px; }
.mp-note {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.mp-count-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; color: #b9bfc9; font-size: 13px; }
.mp-cnt {
  min-width: 32px; height: 30px; padding: 0 8px;
  background: var(--panel-2); color: #cfd4dd; border: 1px solid var(--line);
  border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mp-cnt:hover { border-color: var(--accent); }
.mp-cnt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mp-slot-hint { color: #8b919c; font-size: 11.5px; margin-left: 4px; flex-basis: 100%; }
.mp-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mp-row { display: flex; align-items: center; gap: 8px; }
.mp-idx {
  flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 50%;
  color: #8b919c; font-size: 12px;
}
.mp-desc {
  flex: 1 1 auto; min-width: 0;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 9px; font-size: 13px;
}
.mp-zoom {
  flex: 0 0 130px;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 6px; font-size: 12.5px;
}
.mp-actions { display: flex; align-items: center; gap: 8px; }
.mp-spacer { flex: 1 1 auto; }

/* 2-й реф — щит-лист вещей */
.mp-items-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; margin-bottom: 12px; padding: 8px;
  background: rgba(255, 255, 255, .03); border: 1.5px dashed var(--line); border-radius: 8px;
  color: #8b919c; cursor: pointer; position: relative; overflow: hidden; text-align: center;
  transition: border-color .12s, background .12s;
}
.mp-items-drop:hover { border-color: var(--accent); background: rgba(76, 141, 255, .08); }
.mp-items-drop.drag { border-color: var(--accent); background: rgba(76, 141, 255, .14); }
.mp-items-drop.has-image { border-style: solid; min-height: 92px; padding: 0; }
.mp-items-drop img { width: 100%; height: 92px; object-fit: contain; background: #1a1d24; border-radius: 6px; }
.mp-items-cap { font-size: 13px; color: #cfd4dd; }
.mp-items-sub { font-size: 11px; color: #8b919c; }
.mp-items-x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: 13px;
}
.mp-items-x:hover { background: rgba(0, 0, 0, .8); }

/* Живой предпросмотр промта */
.mp-preview-wrap { margin-bottom: 14px; }
.mp-preview-head { color: #8b919c; font-size: 11.5px; margin-bottom: 4px; }
.mp-preview {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: #1a1d24; color: #b9bfc9; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 11.5px; line-height: 1.45; font-family: ui-monospace, Consolas, monospace;
  max-height: 160px;
}

/* --- «Перенос кожи головы» --- */
.skintx { position: fixed; inset: 0; z-index: 10001; background: rgba(10,12,16,.62); display: flex; align-items: center; justify-content: center; }
.skintx.hidden { display: none; }
.stx-box { width: min(900px, 96vw); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.stx-head { display: flex; align-items: center; justify-content: space-between; color: #e6e9ee; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.stx-sub { color: #8b919c; font-size: 12px; line-height: 1.4; margin-bottom: 12px; }
.stx-main { display: flex; gap: 14px; align-items: flex-start; }
.stx-canvas-wrap { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; background: #14161c; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 300px; }
.stx-canvas-wrap canvas { max-width: 100%; height: auto; border-radius: 6px; cursor: grab; }
.stx-canvas-wrap canvas:active { cursor: grabbing; }
.stx-side { flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; }
.stx-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px; background: rgba(255,255,255,.03); border: 1.5px dashed var(--line); border-radius: 8px; color: #cfd4dd; font-size: 12px; cursor: pointer; position: relative; overflow: hidden; text-align: center; }
.stx-drop:hover { border-color: var(--accent); }
.stx-drop.drag { border-color: var(--accent); background: rgba(76,141,255,.14); }
.stx-drop.has-image { border-style: solid; padding: 0; min-height: 70px; }
.stx-drop img { width: 100%; height: 70px; object-fit: contain; background: #1a1d24; border-radius: 6px; }
.stx-sub2 { font-size: 10.5px; color: #8b919c; }
.stx-badge { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 6px; }
.stx-ctl { display: flex; flex-direction: column; gap: 2px; color: #b9bfc9; font-size: 11.5px; }
.stx-ctl input[type=range] { width: 100%; }
.stx-ctl2 { color: #cfd4dd; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stx-actions { margin-top: 6px; }
.stx-box.stx-compact { width: min(440px, 94vw); }
.stx-compact .stx-drop { min-height: 64px; margin-bottom: 10px; }
.stx-compact .stx-drop.has-image { min-height: 100px; }
.stx-compact .stx-drop img { height: 100px; }
.stx-sheetinfo { color: #cfd4dd; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
/* плавающий бар сверки переноса кожи (холст остаётся виден для сравнения) */
.stx-review { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10002;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.55); }
.stx-review.hidden { display: none; }
.stx-review-lbl { color: #e6e9ee; font-size: 13px; font-weight: 600; }
