:root {
  --left: 248px;
  --right: 344px;
  --tl: 307px;
  --bg: #121212;
  --panel: #1a1a1a;
  --panel2: #212121;
  --line: #2c2c2c;
  --text: #d4d4d4;
  --dim: #838383;
  --accent: #4cc9f0;
  --key: #ffd166;
  --danger: #ff6b81;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 12px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow: hidden; user-select: none; -webkit-user-select: none; }
input, select, button { font: inherit; color: inherit; }
input[type=text] { user-select: text; -webkit-user-select: text; }

#app { display: flex; flex-direction: column; height: 100vh; }
#dock-root { flex: 1 1 auto; display: flex; min-height: 0; min-width: 0; }
.dock-split-node { display: flex; min-width: 0; min-height: 0; }
.dock-split-node.dock-row { flex-direction: row; }
.dock-split-node.dock-col { flex-direction: column; }
.dock-split-node > .split-v { width: 4px; flex: none; }
.dock-split-node > .split-h { height: 4px; flex: none; }
.dock-preview.swap { background: #ffd16622; border-color: var(--key); }
.dock-panel { display: flex; flex-direction: column; min-width: 60px; min-height: 60px; flex: 1 1 0; position: relative; background: var(--panel); }
.dock-head { display: flex; align-items: center; gap: 4px; height: 16px; flex: none; padding: 0 4px; background: #161616; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; cursor: grab; user-select: none; }
.dock-head:hover { color: var(--text); }
.dock-grip { font-size: 11px; line-height: 1; opacity: .7; }
.dock-btn { background: none; border: 0; color: inherit; padding: 0 4px; cursor: pointer; font-size: 12px; line-height: 14px; }
.dock-btn:hover { color: var(--accent); }
.dock-panel > :not(.dock-head) { flex: 1 1 auto; min-height: 0; min-width: 0; }
.dock-split { flex: none; }
.dock-preview { position: fixed; z-index: 95; background: #4cc9f033; border: 2px solid var(--accent); border-radius: 4px; pointer-events: none; }
body.dock-dragging, body.dock-dragging * { cursor: grabbing !important; }
.dock-menu button:disabled { opacity: .4; cursor: default; }
#topbar { flex: none; height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
#left { background: var(--panel); overflow-y: auto; }
#viewport { position: relative; overflow: hidden; background: #000; min-width: 0; min-height: 0; }
#view-canvas { position: absolute; inset: 0; display: block; touch-action: none; }
#inspector { background: var(--panel); display: flex; min-height: 0; overflow: hidden; }
#timeline { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.split-v { background: var(--line); cursor: col-resize; touch-action: none; }
.split-h { background: var(--line); cursor: row-resize; touch-action: none; }
.split-v:hover, .split-h:hover { background: var(--accent); }

.brand { font-weight: 700; letter-spacing: .3px; color: var(--accent); margin-right: 8px; white-space: nowrap; }
.doc-title { color: var(--dim); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-stats { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.grow { flex: 1 1 auto; min-width: 0; }
.sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; flex: none; }
.mini { color: var(--dim); font-size: 11px; white-space: nowrap; }

.tb { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; cursor: pointer; white-space: nowrap; }
.tb:hover:not(:disabled) { border-color: #4f4f4f; background: #2a2a2a; }
.tb:disabled { opacity: .4; cursor: default; }
.tb.wide { width: 100%; margin-top: 6px; }
.tb.danger:hover { border-color: var(--danger); color: var(--danger); }
.tb.toggle.on { background: #1d3a4b; border-color: var(--accent); color: #dff6ff; }
.flip-preview { width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 4px; }
.tb.dice:not(.on) { filter: grayscale(1); opacity: .6; }
.tb.autokey.on { background: #4b1d27; border-color: var(--danger); color: #ffd9df; }
.tb.play { min-width: 34px; text-align: center; }

.menu { position: relative; }
.menu-pop { display: none; position: absolute; top: calc(100% + 3px); left: 0; z-index: 40; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; min-width: 200px; padding: 4px; box-shadow: 0 8px 26px #0009; }
.menu-pop.open { display: block; }
.menu-pop button { display: block; width: 100%; background: none; border: 0; text-align: left; padding: 5px 8px; border-radius: 3px; cursor: pointer; }
.menu-pop button:hover { background: #343434; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

.view-bar { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.view-bar > * { pointer-events: auto; }
.view-bar .grow { pointer-events: none; }
.view-bar .tb, .view-bar select, .view-bar .seg button { background: #1a1a1ae6; }
.view-pop { display: none; position: absolute; top: 30px; right: 0; width: 220px; padding: 6px 8px; background: #1a1a1af2; border: 1px solid var(--line); border-radius: 5px; z-index: 20; }
.view-pop.open { display: block; }
.view-pop .lbl { flex: 1; }
.view-pop .num { width: 70px; flex: none; }
.view-pop .fields { flex: none; }
.view-pop .fields .num { width: 52px; }
.view-pop .fields .swatch { width: 52px; flex: none; }

select { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; max-width: 100%; }

.seg { display: inline-flex; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.seg button { background: var(--panel2); border: 0; border-right: 1px solid var(--line); padding: 3px 8px; cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #343434; }
.seg button.on { background: #1d3a4b; color: #dff6ff; }
.seg.small button { padding: 2px 6px; font-size: 11px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.tab { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 7px 0; cursor: pointer; color: var(--dim); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.panel-pad { padding: 8px; }
.subhead { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin: 8px 0 5px; }
.help { color: var(--dim); font-size: 11px; line-height: 1.4; margin: 5px 0; }
.help.steps { padding-left: 16px; }
.help.steps li { margin-bottom: 4px; }

.add-group { margin-bottom: 8px; }
.add-head { display: flex; align-items: center; gap: 5px; width: 100%; background: none; border: 0; padding: 3px 0; margin-bottom: 3px; cursor: pointer; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; text-align: left; }
.add-head:hover { color: var(--text); }
.add-caret { width: 10px; }
.add-count { margin-left: auto; opacity: .55; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.add-btn { display: flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; cursor: pointer; text-align: left; min-width: 0; }
.add-btn { font-size: 12px; line-height: 1.15; }
.add-btn span:last-child { min-width: 0; overflow-wrap: anywhere; }
.add-btn:hover { border-color: var(--accent); }
.ico { display: grid; place-items: center; color: var(--accent); width: 18px; flex: none; }

.tex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 5px; margin-top: 6px; }
.tex-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 2px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.tex-item.on { border-color: var(--accent); }
.tex-item span { display: block; width: 100%; font-size: 10px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.tex-editor { border-top: 1px solid var(--line); }
.tex-preview-wrap { flex: none; line-height: 0; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.tex-meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; align-items: stretch; }
.tex-meta .text { flex: none; }
.tex-actions { display: flex; flex-wrap: wrap; gap: 3px; }
.tex-actions .tb { padding: 3px 6px; }
.layer-card { background: #151515; border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; margin: 6px 0; }
.layer-card select { flex: 1; min-width: 0; }
.layer-card .lbl { flex: 1 1 80px; width: auto; }
.layer-card .fields { flex: 0 1 110px; }

.sec { border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; gap: 5px; padding: 6px 8px; font-weight: 600; cursor: pointer; }
.sec-head:hover { background: #202020; }
.sec-tag { font-size: 10px; font-weight: 500; color: #ffcc66; border: 1px solid #ffcc6655; border-radius: 3px; padding: 0 4px; }
.caret { color: var(--dim); width: 10px; }
.sec-body { padding: 0 8px 8px; }

.row { display: flex; align-items: center; gap: 4px; min-height: 24px; }
.row.tight { gap: 4px; align-items: stretch; }
.lbl { width: 84px; flex: none; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fields { display: flex; gap: 3px; flex: 1; min-width: 0; align-items: center; }
.num { flex: 1 1 0; min-width: 0; width: 100%; background: #131313; border: 1px solid var(--line); border-radius: 3px; padding: 2px 4px; font-variant-numeric: tabular-nums; cursor: ew-resize; text-align: right; height: 21px; }
.num:focus { cursor: text; border-color: var(--accent); outline: none; }
.num.scrub { border-color: var(--accent); }
.num.animated { color: #ffe2a6; background: #241f12; }
.text { flex: 1; min-width: 0; background: #131313; border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; height: 22px; }
.text:focus { border-color: var(--accent); outline: none; }

.key, .key-spacer { width: 16px; height: 16px; flex: none; }
.key { background: none; border: 0; padding: 0; cursor: pointer; position: relative; }
.key::before { content: ''; position: absolute; left: 4px; top: 4px; width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid #666666; background: transparent; }
.key:hover::before { border-color: var(--key); }
.key[data-state=anim]::before { border-color: var(--key); }
.key[data-state=key]::before { border-color: var(--key); background: var(--key); }

.swatch { width: 44px; height: 21px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: none; cursor: pointer; flex: none; }
.swatch::-webkit-color-swatch-wrapper { padding: 1px; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 2px; }
.check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.check input { margin: 0; }

.mesh-types { display: flex; flex-wrap: wrap; gap: 3px 8px; margin-bottom: 6px; }
.mesh-group { display: flex; flex-wrap: wrap; gap: 2px; }
.mesh-type { display: grid; place-items: center; width: 28px; background: var(--panel2); border: 1px solid var(--line); border-radius: 3px; padding: 3px 0; cursor: pointer; color: var(--dim); font-size: 13px; }
.mesh-type svg { display: block; }
.mesh-type:hover { border-color: #4f4f4f; }
.mesh-type.on { background: #1d3a4b; border-color: var(--accent); color: #dff6ff; }
.profile-block { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.profile { display: block; border: 1px solid var(--line); border-radius: 3px; cursor: crosshair; touch-action: none; max-width: 100%; }
.grad { display: block; cursor: pointer; touch-action: none; max-width: 100%; }
.grad-wrap { margin: 4px 0 2px; }
.slot-row { margin: 3px 0; }
.slot { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; background: #131313; border: 1px solid var(--line); border-radius: 4px; padding: 3px; cursor: pointer; text-align: left; }
.slot:hover { border-color: var(--accent); }
.slot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { border-radius: 2px; flex: none; }

.popover { position: fixed; z-index: 50; background: var(--panel2); border: 1px solid #444444; border-radius: 6px; padding: 6px; box-shadow: 0 10px 30px #000b; max-height: 60vh; overflow-y: auto; width: 300px; }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pick { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pick:hover { border-color: var(--accent); }
.pick.on { border-color: var(--key); }
.pick span { display: block; width: 100%; font-size: 10px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pick-none { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--dim); background: #131313; }
.pick-none.white { background: #fff; }

.stats { display: flex; flex-direction: column; gap: 3px; }
.stat { display: flex; justify-content: space-between; gap: 8px; color: var(--dim); }
.stat b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }

.tl-toolbar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); flex: none; min-width: 0; overflow: hidden; }
.time-label { font-variant-numeric: tabular-nums; color: var(--text); background: #131313; border: 1px solid var(--line); border-radius: 3px; padding: 2px 7px; margin: 0 4px; white-space: pre; min-width: 96px; text-align: center; }
.tl-canvas-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#tl-canvas { position: absolute; inset: 0; display: block; outline: none; touch-action: none; }
.rename { position: absolute; height: 20px; background: #131313; border: 1px solid var(--accent); border-radius: 3px; padding: 0 3px; z-index: 5; outline: none; }

#toasts { position: fixed; bottom: calc(var(--tl) + 14px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 5px; z-index: 60; pointer-events: none; align-items: center; }
.toast { background: #242424; border: 1px solid #444444; border-radius: 5px; padding: 6px 12px; box-shadow: 0 6px 20px #0008; max-width: 70vw; }
.toast.error { border-color: var(--danger); color: #ffd9df; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #333333; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

#status { flex: none; height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 11px; overflow: hidden; white-space: nowrap; min-width: 0; }
.st-name { color: var(--accent); flex: none; }
.st-hints { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; min-width: 0; }
.st-hints kbd { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; line-height: 15px; }
.st-what { color: var(--dim); margin-right: 8px; }
.st-help { flex: none; background: none; border: 0; color: var(--dim); cursor: pointer; padding: 0 4px; font-size: 11px; }
.st-help:hover { color: var(--text); }

.help-page { position: fixed; inset: 0; z-index: 80; background: #070707cc; display: flex; align-items: center; justify-content: center; padding: 24px; }
.help-body { background: var(--panel); border: 1px solid #444444; border-radius: 8px; max-width: 1040px; width: 100%; max-height: 100%; overflow-y: auto; padding: 14px 18px 18px; box-shadow: 0 16px 50px #000a; user-select: text; -webkit-user-select: text; }
.help-head { display: flex; align-items: center; }
.help-head h2 { margin: 0; font-size: 15px; }
.help-cols { columns: 3 290px; column-gap: 26px; margin-top: 8px; }
.help-sec { break-inside: avoid; margin-bottom: 14px; }
.help-sec h3 { margin: 0 0 4px; font-size: 12px; color: var(--accent); }
.help-sec dl { margin: 0; display: grid; grid-template-columns: minmax(90px, 44%) 1fr; gap: 3px 10px; }
.help-sec dt { color: var(--text); }
.help-sec dd { margin: 0; color: var(--dim); }

.key-pop { position: absolute; z-index: 30; width: 196px; background: var(--panel2); border: 1px solid #444444; border-radius: 6px; padding: 6px 8px; box-shadow: 0 8px 26px #0009; }
.key-pop .lbl { flex: 0 0 76px; width: 76px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num.short { flex: none; width: 56px; }

.swatches { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-width: 0; }
.chip { width: 16px; height: 16px; padding: 0; border: 1px solid #0008; border-radius: 3px; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.chip:hover { box-shadow: 0 0 0 1px var(--accent); }
.chip.add { background: none; color: var(--dim); line-height: 13px; font-size: 13px; text-align: center; }
.chip.add:hover { color: var(--text); }
input.chip.add-color { width: 22px; background: none; border: 0; box-shadow: none; }
.strip-row { min-height: 20px; }
.swatch-menu { display: flex; align-items: center; gap: 6px; }
.help.warn { color: #ffb86b; }
.swatch-new { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.array-map { display: block; border: 1px solid var(--line); border-radius: 3px; margin-bottom: 4px; }
.mod-btn { flex: none; width: 18px; height: 18px; padding: 0; background: none; border: 0; color: #808080; cursor: pointer; font-size: 17px; line-height: 16px; }
.mod-btn:hover { color: var(--text); }
.mod-btn.on { color: var(--accent); }
.motion-pop { width: 224px; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; }
.motion-pop .lbl { flex: 0 0 70px; width: 70px; color: var(--dim); }
.motion-pop select { flex: 1 1 0; min-width: 0; }
.motion-title { font-weight: 600; margin-bottom: 2px; }
.motion-preview { display: block; border: 1px solid var(--line); border-radius: 3px; margin: 2px 0; }
.tb.sync { flex: none; padding: 1px 5px; }

.insp-rail { flex: none; width: 28px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; border-right: 1px solid var(--line); background: #151515; overflow-y: auto; scrollbar-width: none; }
.insp-rail::-webkit-scrollbar { display: none; }
.rail-btn { flex: none; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; border-radius: 4px; color: #949494; cursor: pointer; }
.rail-btn:hover { background: #2a2a2a; color: var(--text); }
.rail-btn.closed { color: #606060; }
.rail-btn.on { background: #1d3a4b; color: #dff6ff; }
.insp-body { flex: 1 1 auto; min-width: 0; position: relative; overflow-y: auto; overflow-x: hidden; }
.insp-tail { height: 60vh; }

.docs-frame { display: flex; background: var(--panel); border: 1px solid #444444; border-radius: 8px; width: 100%; max-width: 1180px; height: 100%; overflow: hidden; box-shadow: 0 16px 50px #000a; }
.docs-nav { flex: none; width: 220px; padding: 10px 8px; border-right: 1px solid var(--line); background: #151515; overflow-y: auto; }
.docs-nav button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 4px; cursor: pointer; }
.docs-nav button:hover { background: #2a2a2a; }
.docs-doc { padding: 5px 8px; font-weight: 600; margin-top: 2px; }
.docs-doc.on { color: var(--accent); }
.docs-toc { padding: 3px 8px 3px 14px; color: var(--dim); font-size: 11px; }
.docs-toc.lv3 { padding-left: 26px; }
.docs-main { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.docs-close { position: absolute; top: 10px; right: 18px; z-index: 2; }
.md { flex: 1 1 auto; min-width: 0; padding: 18px 32px 40px; overflow-y: auto; font-size: 13px; line-height: 1.55; user-select: text; -webkit-user-select: text; outline: none; position: relative; }
.md > :first-child { margin-top: 0; padding-right: 110px; }
.md h1 { font-size: 22px; margin: 22px 0 10px; color: #f2f2f2; }
.md h2 { font-size: 16px; margin: 24px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); color: #f2f2f2; }
.md h3 { font-size: 14px; margin: 18px 0 6px; color: #f2f2f2; }
.md h4, .md h5, .md h6 { font-size: 13px; margin: 14px 0 4px; color: var(--text); }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 3px 0; }
.md a { color: var(--accent); }
.md code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #121212; border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; }
.md pre { background: #121212; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; }
.md blockquote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid #444444; color: var(--dim); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md img { max-width: 100%; }
.md-table { overflow-x: auto; margin: 10px 0; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--panel2); }
.docs-error { color: var(--danger); }
.md::after { content: ''; display: block; height: 60vh; }
.mod-spacer { flex: none; width: 18px; }
.effector-targets { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; }
.motion-only { display: flex; gap: 8px; flex-wrap: wrap; }
.motion-only .check { display: inline-flex; align-items: center; gap: 2px; }
.bake-badge { display: none; position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 3px 10px; background: #1a1a1ae6; border: 1px solid #4f4f4f; border-radius: 4px; color: var(--text); font-size: 11px; white-space: nowrap; pointer-events: none; }
.bake-badge.on { display: block; }

.fold { margin-top: 3px; }
.fold-head { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid #222222; color: var(--dim); padding: 3px 0 1px; font-size: 11px; cursor: pointer; }
.fold-head:hover { color: var(--text); }
.fold-head.active { color: var(--accent); }
.fold-body { padding-top: 2px; }
.layer-head { align-items: center; gap: 3px; flex-wrap: wrap; }
.layer-head select { flex: 1 1 60px; }
.layer-head .tb { padding: 2px 5px; }
.layer-grip { cursor: grab; color: var(--dim); padding: 0 2px; touch-action: none; }
.layer-thumb { flex: none; border: 1px solid var(--line); border-radius: 2px; }
.layer-thumb.off { outline: 1px dashed #606060; outline-offset: -1px; }
.layer-card.hidden-layer { border-style: dashed; opacity: .85; }
.layer-card.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.layer-card.drop-after { box-shadow: 0 2px 0 var(--accent); }
.curve-ed { display: block; border: 1px solid var(--line); border-radius: 3px; cursor: crosshair; touch-action: none; margin: 2px 0; }
.tex-tool { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }
.tex-tool .lbl { flex: 1 1 80px; width: auto; }
.tex-tool .fields { flex: 0 1 110px; }
.mini.warn { color: #ffb86b; }

#timeline { position: relative; }
#workspace-switch { margin-left: 14px; }
.shadowed > .lbl, .shadowed .fields, .shadowed > select, .subhead.shadowed > span { opacity: .45; }
.subhead.row { margin: 8px 0 5px; }
.shadow-link { padding: 1px 5px; margin-left: 4px; }
.scene-list { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; }
.scene-obj { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel2); cursor: pointer; }
.scene-obj.on { border-color: var(--accent); }
.scene-obj.open .scene-name > span:first-child { color: #ffd166; }
.scene-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.scene-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-apply { display: flex; align-items: center; gap: 4px; }
.layer-head { flex-wrap: nowrap; }
.layer-head .tb { padding: 3px 5px; }
.tex-library .row.tight { flex-wrap: wrap; }
.tex-library select { flex: 1 1 100%; }
.tex-workspace { position: absolute; inset: 0; z-index: 35; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tw-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--line); flex: none; overflow: hidden; white-space: nowrap; }
.tw-body { flex: 1 1 auto; min-height: 0; display: flex; }
.tw-col { min-height: 0; overflow-y: auto; }
.tw-lib { flex: 0 0 210px; padding: 6px; border-right: 1px solid var(--line); }
.tw-view { flex: 0 0 auto; width: 370px; padding: 6px 15px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.tw-canvas { display: block; background: #131313; border: 1px solid var(--line); border-radius: 3px; touch-action: none; }
.tw-edit { flex: 1 1 auto; min-width: 0; }
.tw-tools { flex: 0 0 290px; border-left: 1px solid var(--line); }
.tw-tools .tex-tool:first-child { border-top: 0; margin-top: 0; }
.tex-controls { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.tex-controls .text { flex: 1 1 auto; min-width: 0; }
.tex-controls .lbl { flex: 0 0 80px; }
.tex-controls select, .tex-controls .choice { flex: 1 1 auto; }
.gen-pick { width: 440px; max-height: 70vh; }
.gen-grid { grid-template-columns: repeat(6, 1fr); }
.gen-grid .pick span { white-space: normal; line-height: 1.2; height: 2.4em; }
.gen-btn { flex: 1 1 auto; min-width: 0; text-align: left; white-space: normal; line-height: 1.2; font-size: 11px; }
.tw-edit .tex-editor.big { display: block; border-top: 0; }
.tw-edit .tex-editor.big .tex-meta { flex-direction: row; align-items: center; flex-wrap: wrap; }
.tw-edit .tex-editor.big .tex-meta .text { flex: 0 1 180px; }
.tw-edit .layer-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px; align-items: start; }
.tw-edit .layer-card { margin: 4px 0; }
.tw-brush { flex-wrap: wrap; gap: 6px; }
.tw-pair { display: inline-flex; align-items: center; gap: 3px; }
.tw-pair .num { width: 54px; flex: none; }
.tw-narrow { flex: 0 0 48px; display: flex; }
#tw-dissolve { flex: 1 1 auto; min-width: 60px; }
.chip-user { padding: 1px 6px; font-size: 11px; }
.chip-user.on { border-color: var(--accent); }
.tw-lib .row.tight { flex-wrap: wrap; }
.tw-lib select { flex: 1 1 100%; }
.mod-card { background: #151515; border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; margin: 4px 0; }
.mod-card.sel { border-color: #ffd166; }
.mod-card.base { border-left: 3px solid #8a7dff; }
.mod-place { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 3px; }
.mod-head { align-items: center; gap: 3px; cursor: pointer; }
.mod-head .tb { padding: 1px 5px; }
.uv-lbl { width: 30px; flex: none; font-family: ui-monospace, Menlo, monospace; }
#uv-u, #uv-v { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
#attach-verts { flex: 1 1 auto; min-width: 0; }
.seg.choice { flex: 1 1 auto; min-width: 0; display: flex; }
.seg.choice button { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 2px 5px; }
.layer-dragging [data-layer-drop] { outline: 1px dashed #4cc9f088; outline-offset: 1px; }
[data-layer-drop].layer-drop-over { outline: 2px solid var(--accent); outline-offset: 1px; background: #1d3a4b; }
.layer-pick { width: 260px; display: flex; flex-direction: column; gap: 1px; }
.layer-pick .lp-row { display: flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.layer-pick .lp-row:hover { background: #343434; }
.layer-pick .lp-row.off { opacity: .45; cursor: default; }
.layer-pick .lp-row.off:hover { background: none; }
.layer-pick .lp-row input { margin: 0; }
.layer-pick .lp-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.layer-pick .lp-foot { display: flex; gap: 4px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 5px; }
.layer-set { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.layer-set.warn { color: #ffb86b; border-color: #ffb86b66; }
.tl-toolbar .seg.choice { flex: none; }
.tl-toolbar > * { flex-shrink: 0; }
.tl-toolbar > .grow { flex-shrink: 1; }
.tl-toolbar select { max-width: 84px; }
.tl-toolbar .seg.choice button { flex: none; }
.layer-pick .lp-fold { flex: none; width: 14px; padding: 0; background: none; border: 0; color: var(--dim); cursor: pointer; text-align: center; }
.tb.icon { width: 26px; padding: 3px 0; text-align: center; }

/* Catalog: folder tree, preview grid, dialogs */
.sec-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); margin: 2px 0 4px; }
.sec-title.cat-sec { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.tb.primary { background: #1d3a4b; border-color: #2f6b86; color: #dff6ff; }
.tb.primary:hover:not(:disabled) { background: #24485c; border-color: var(--accent); }
input[type=search] { user-select: text; -webkit-user-select: text; }
.cat { display: flex; flex-direction: column; gap: 5px; }
.cat p.mini { white-space: normal; margin: 4px 0; }
.cat-head { display: flex; align-items: center; gap: 4px; }
.cat-root { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-search { flex: none; width: 100%; }
.cat-tools { flex-wrap: wrap; }
.cat-tree { border: 1px solid var(--line); border-radius: 4px; padding: 2px 0; max-height: 220px; overflow-y: auto; background: #151515; }
.cat-dir { display: flex; align-items: center; gap: 3px; padding: 2px 6px 2px 4px; cursor: pointer; white-space: nowrap; }
.cat-dir:hover { background: #262626; }
.cat-dir.on { background: #1d3a4b; color: #dff6ff; }
.cat-dir.drop, .cat-dir.on.drop { background: #2c4a2c; outline: 1px dashed #8fe08f; }
.cat-caret { width: 10px; flex: none; color: var(--dim); text-align: center; }
.cat-dname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cat-count { color: var(--dim); font-size: 10px; }
.cat-group { font-size: 10px; color: var(--dim); margin: 6px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 5px; }
.cat-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 2px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; align-items: stretch; }
.cat-item:hover { border-color: #4f4f4f; }
.cat-item.on { border-color: var(--accent); }
.cat-item span { display: block; font-size: 10px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.cat-item .cat-path { color: var(--dim); font-size: 9px; }
.cat-thumb-box { aspect-ratio: 1; border-radius: 3px; overflow: hidden; background: repeating-conic-gradient(#1e1e1e 0 25%, #272727 0 50%) 0 0 / 16px 16px; }
.cat-thumb-box.none::after { content: '·'; display: flex; height: 100%; align-items: center; justify-content: center; color: var(--dim); }
.cat-thumb { width: 100%; height: 100%; display: block; object-fit: cover; }
.cat-thumb-box.none .cat-thumb { display: none; }
.cat-empty { text-align: center; }
.ctx-menu { position: fixed; top: 0; left: 0; z-index: 90; }
.menu-pop button.danger { color: var(--danger); }
.dlg-back { position: fixed; inset: 0; z-index: 85; background: #07070799; display: flex; align-items: center; justify-content: center; }
.dlg { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; min-width: 320px; max-width: 460px; box-shadow: 0 12px 40px #000a; display: flex; flex-direction: column; gap: 8px; }
.dlg h3 { margin: 0 0 2px; font-size: 13px; }
.dlg p { margin: 0; color: var(--dim); }
.dlg-field { display: flex; flex-direction: column; gap: 3px; }
.dlg-field > span:first-child { color: var(--dim); }
.dlg-field .text { flex: none; height: 26px; }
.dlg-err { color: var(--danger); min-height: 0; }
.dlg-err:empty { display: none; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.menu-head { padding: 3px 8px 4px; font-size: 10px; color: var(--dim); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.dlg { max-height: 90vh; overflow-y: auto; }
.dlg p.warn { color: #ffb86b; }
.dlg-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dlg-sec { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.dlg-sec:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.dlg-row { display: flex; align-items: center; gap: 6px; }
.dlg-row .lbl { color: var(--dim); }
.dlg-field .mini { white-space: normal; }
.cat-example { white-space: normal; word-break: break-all; color: var(--accent); }
.cat-ex-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg { max-width: 520px; }
.path-pt .fields input { min-width: 0; }
.path-pt.sel { background: #1d2a36; border-radius: 3px; }
.path-pt .tb.icon { flex: none; }
