/* BOB STUDIO */
body.studio { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.st-top { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--bg2); flex: none; }
.st-top .brand-mark { width: 34px; height: 34px; }
.st-top .brand-name { font-size: 18px; }
.st-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.st-actions label.btn-ghost { cursor: pointer; }
.st-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; }

/* сегменты-переключатели */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { flex: 1; height: 32px; padding: 0 10px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.seg.sm button { height: 30px; font-size: 12.5px; }

/* библиотека */
.st-lib { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-right: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.st-lib input[type=search] { height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); outline: 0; }
.st-lib input[type=search]:focus { border-color: var(--a1); }
.lib-hint { margin: 0; font-size: 12px; color: var(--dim); }
.lib-hint.pick { color: var(--a2); font-weight: 600; }
.lib-grid { flex: 1 1 0; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 8px; align-content: start; padding-right: 2px; }
.lib-it { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); text-align: left; transition: border-color .15s, transform .15s; }
.lib-it:hover { border-color: var(--a1); transform: translateY(-2px); }
.lib-it .im { display: block; width: 100%; height: 0; padding-top: 100%; background: var(--tile); position: relative; flex: none; }
.lib-it img { position: absolute; left: 7%; top: 7%; width: 86%; height: 86%; object-fit: contain; }
.lib-it .id { position: absolute; left: 6px; top: 6px; font: 700 10.5px Inter; color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 2px 6px; border-radius: 6px; }
.lib-it b { font-size: 12px; font-weight: 600; padding: 6px 8px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-more { grid-column: 1 / -1; text-align: center; color: var(--dim); font-size: 12px; padding: 8px; }

/* сцена */
.st-view { position: relative; min-width: 0; background: #0a0c11; overflow: hidden; }
.st-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.st-view canvas.over { cursor: move; }
.frame-guide { position: absolute; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.38); border: 1px dashed rgba(255,255,255,.35); }
.st-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.st-tools .seg { background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); }
.chip-btn.sm { height: 38px; font-size: 13px; }
.st-help { position: absolute; left: 12px; right: 12px; bottom: 10px; font-size: 11.5px; color: rgba(255,255,255,.62); text-shadow: 0 1px 2px #000; pointer-events: none; }
.st-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: rgba(255,255,255,.75); pointer-events: none; max-width: 420px; text-shadow: 0 1px 3px #000; }
.st-empty b { display: block; font: 700 22px Unbounded, Inter; color: #fff; margin-bottom: 8px; }
.st-load { position: absolute; right: 12px; top: 12px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(10px); font-size: 13px; }
.st-load i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--a2); animation: spin .8s linear infinite; }
.sel-box { position: absolute; pointer-events: none; border: 1.5px solid var(--a2); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }

/* свойства */
.st-props { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-left: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.props { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.pbox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pbox h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pbox h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim); }
.ptitle { font-weight: 700; font-size: 16px; line-height: 1.25; }
.psub { font-size: 12px; color: var(--muted); margin-top: -6px; }
.prow { display: grid; grid-template-columns: 92px minmax(0, 1fr) 54px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.prow input[type=range] { width: 100%; accent-color: var(--a1); }
.prow input[type=number] { width: 54px; height: 28px; padding: 0 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); text-align: right; font-size: 12px; }
.prow select, .pfull select, .pfull input[type=text] { width: 100%; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); padding: 0 8px; }
.pfull { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.pbtns button, .chip { height: 32px; padding: 0 11px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; transition: border-color .15s, background .15s; }
.pbtns button:hover, .chip:hover { border-color: var(--line2); }
.pbtns button.on, .chip.on { border-color: var(--a1); background: color-mix(in srgb, var(--a1) 22%, var(--panel2)); }
.pbtns button.bad { color: var(--bad); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--a) 0 58%, var(--b) 58% 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.colors { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.colors input[type=color] { width: 44px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); padding: 2px; }
.straps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.straps button { aspect-ratio: 2 / 1; border-radius: 8px; background: #2a3045 center/contain no-repeat; border: 1px solid var(--line); }
.straps button.on { border-color: var(--a2); box-shadow: 0 0 0 1px var(--a2); }
.straps button.none { background: var(--panel2); font-size: 11px; color: var(--muted); }
.plate-prev { width: 100%; border-radius: 6px; display: block; }
details.joint { border-top: 1px solid var(--line); padding-top: 8px; }
details.joint summary { cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.joint summary::after { content: '▾'; color: var(--dim); }
details.joint[open] summary::after { content: '▴'; }
details.joint .prow { margin-top: 6px; }
.attached { display: flex; flex-direction: column; gap: 6px; }
.attached div { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 6px 8px; border-radius: 9px; background: var(--bg2); }
.attached button { color: var(--a2); font-size: 12px; font-weight: 600; }
.pnote { font-size: 12px; color: var(--dim); margin: 0; }

/* рендер */
.render-dlg[open] { width: min(720px, calc(100vw - 24px)); }
.render-dlg .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.render-dlg label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.render-dlg select { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); padding: 0 10px; }
.render-prev { margin-top: 14px; min-height: 220px; border-radius: 14px; display: grid; place-items: center; color: var(--dim); background: repeating-conic-gradient(#2a2f3d 0 25%, #222632 0 50%) 0 0/24px 24px; overflow: hidden; }
.render-prev img { max-width: 100%; max-height: 52vh; display: block; }
.render-dlg .btn, .render-dlg .btn-ghost { justify-content: center; height: 44px; text-decoration: none; }

@media (max-width: 1100px) { .st-main { grid-template-columns: 240px minmax(0, 1fr) 290px; } }
@media (max-width: 820px) {
  body.studio { height: auto; overflow: auto; }
  .st-main { grid-template-columns: 1fr; }
  .st-view { height: 62vh; order: -1; }
  .st-lib { border-right: 0; }
  .lib-grid { flex: none; height: 46vh; }
  .props { flex: none; overflow: visible; }
  .st-actions .btn-ghost { padding: 0 10px; }
}
