:root {
  color-scheme: dark;
  --bg: #16141e;
  --panel: #1b1924;
  --elevated: #211e2b;
  --border: #312d3e;
  --border-soft: #2a2735;
  --ink: #f2edf8;
  --muted: #aaa2bb;
  --quiet: #8e859f;
  --accent: #c7aafa;
  --accent-strong: #bb99f5;
  --accent-soft: #342847;
  --positive: #8bd5b3;
  font: 13px/1.45 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; height: 100dvh; background: var(--bg); color: var(--ink); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 65px 43px minmax(0, 1fr) 30px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; background: none; border: 1px solid transparent; color: var(--muted); border-radius: 7px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { color: var(--ink); background: #2a2636; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
button:disabled { opacity: .36; cursor: default; }
button svg, .search svg, .selection-card svg { width: 16px; height: 16px; flex: 0 0 auto; }
svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.symbols { display: none; }
.icon { width: 34px; height: 34px; padding: 0; flex: 0 0 auto; }
.icon.small { width: 27px; height: 27px; }
.icon.tiny { width: 23px; height: 23px; }
.icon.small svg, .icon.tiny svg { width: 14px; height: 14px; }
.icon.active, .tool.active { background: var(--accent-soft); color: var(--accent); }
.quiet, .secondary, .primary, .danger { min-height: 35px; padding: 0 12px; font-weight: 600; }
.secondary { border-color: #3c354a; background: #282332; color: #ded3ec; }
.secondary:hover:not(:disabled) { background: #373047; border-color: #554967; }
.primary { background: var(--accent-strong); color: #251837; border-color: var(--accent-strong); box-shadow: 0 1px 1px #0c081655; }
.primary:hover:not(:disabled) { background: #d4bafa; border-color: #d4bafa; color: #221636; }
.danger { border-color: #523746; color: #edabc3; background: #312434; }
.danger:hover:not(:disabled) { background: #4b2e44; color: #ffcbde; }
.text-button { gap: 4px; }
.text-button svg { width: 13px; height: 13px; }
.divider { width: 1px; height: 21px; background: var(--border); flex: 0 0 auto; margin: 0 4px; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 18px; background: #1a1823; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 220px; }
.brand img { filter: drop-shadow(0 3px 12px #a97aff32); }
.brand h1 { font-size: 17px; line-height: 1.18; font-weight: 650; letter-spacing: -.28px; }
.brand span { font-size: 9px; font-weight: 650; letter-spacing: 1.65px; color: #b7a8ce; }
.file-actions { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.header-right { display: flex; align-items: center; gap: 8px; }
.save-button { border-color: var(--border); background: #211e2b; margin: 0 3px; }
.export-split { display: flex; position: relative; }
.export-split > .primary:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.export-split > .dropdown { width: 32px; padding: 0; border-left-color: #9f7fd4; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.dropdown-menu { position: absolute; z-index: 8; top: calc(100% + 7px); right: 0; display: grid; background: #262232; border: 1px solid #443b55; border-radius: 9px; padding: 5px; min-width: 213px; box-shadow: 0 8px 25px #0a0713a0; }
.dropdown-menu button { padding: 8px 9px; justify-content: flex-start; }
.document-bar { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 0 17px; background: #17151f; border-bottom: 1px solid var(--border); }
.document-tabs { display: flex; align-self: stretch; min-width: 0; overflow-x: auto; scrollbar-width: thin; align-items: stretch; }
.document-tab { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; padding: 0 5px 0 8px; border-right: 1px solid #282532; border-top: 2px solid transparent; min-width: 125px; max-width: 238px; }
.document-tab.active { border-top-color: var(--accent-strong); border-right-color: var(--border); background: #242031; }
.document-tab .tab-select { gap: 7px; min-width: 0; justify-content: flex-start; padding: 5px; flex: 1; }
.document-tab .tab-label { text-overflow: ellipsis; overflow: hidden; }
.document-tab.active .tab-select { color: var(--ink); }
.document-tab svg { width: 14px; height: 14px; color: var(--accent); }
.document-tab .close-tab svg { color: var(--quiet); width: 12px; height: 12px; }
.tab-dot { border-radius: 10px; width: 6px; height: 6px; background: var(--accent); flex: 0 0 auto; }
.document-meta { color: var(--quiet); margin-left: auto; white-space: nowrap; font-size: 11px; }
.workspace { display: grid; grid-template-columns: 246px minmax(0, 1fr) 292px; min-height: 0; }
.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); }
.scene-panel { border-right: 1px solid var(--border); }
.inspector { border-left: 1px solid var(--border); }
.panel-tabs { display: flex; min-height: 46px; border-bottom: 1px solid var(--border); padding: 0 12px; gap: 4px; }
.panel-tabs button { flex: 1; padding: 0 7px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; gap: 6px; font-weight: 600; }
.panel-tabs button.active { color: var(--accent); border-bottom-color: var(--accent-strong); }
.panel-tabs svg { width: 15px; height: 15px; }
.panel-content { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 9px; }
.panel-heading h2 { font-size: 14px; font-weight: 650; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 13px 10px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; background: #17151f; color: var(--quiet); }
.search:focus-within { border-color: #8d71ba; }
.search input { width: 100%; border: 0; padding: 7px 0; background: none; outline: none; height: 32px; }
.search input:focus-visible { outline: none; }
.scene-summary { display: flex; justify-content: space-between; align-items: center; min-height: 27px; margin: 0 14px 2px; color: var(--quiet); font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.scene-summary .text-button { margin-left: auto; padding: 2px 4px; font-size: 10px; color: var(--muted); font-weight: 500; }
.tree { min-height: 0; overflow: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: #514661 transparent; }
.tree-row { display: flex; min-height: 32px; gap: 1px; align-items: center; border: 1px solid transparent; border-radius: 7px; color: var(--muted); }
.tree-row:hover { background: #24202f; }
.tree-row.selected { background: #332846; border-color: #473658; color: #eadbff; }
.tree-row.partial { border-left-color: var(--accent-strong); }
.tree-row.is-hidden { opacity: .48; }
.tree-row .expand, .tree-row .visibility { width: 21px; height: 23px; }
.tree-row .expand svg, .tree-row .visibility svg { width: 12px; height: 12px; }
.tree-row .visibility { margin-right: 3px; }
.tree-row .tree-main { justify-content: flex-start; flex: 1; min-width: 0; border: 0; padding: 4px 0; gap: 7px; color: inherit; height: 29px; background: transparent; }
.tree-row .tree-main:hover { background: transparent; }
.tree-row .tree-main svg { width: 14px; height: 14px; color: #ae95c9; }
.tree-label { flex: 1; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; text-align: left; }
.tree-size { color: var(--quiet); font-size: 10px; margin: 0 3px; }
.tree-row.child { margin-left: 24px; padding-left: 5px; border-left-color: var(--border); }
.list-note { padding: 10px 8px; color: var(--muted); font-size: 12px; }
.tree .more { padding: 4px 8px; margin: 4px; }
#asset-collections { margin: 0 13px 10px; width: auto; }
.asset-row { display: flex; align-items: center; border-bottom: 1px solid var(--border-soft); gap: 5px; padding: 7px 4px; }
.asset-row > div { flex: 1; min-width: 0; }
.asset-row strong, .asset-row small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.asset-row strong { font-size: 12px; font-weight: 600; }
.asset-row small { color: var(--quiet); font-size: 10px; }
.clipboard { display: flex; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid var(--border); padding: 12px 12px; min-height: 62px; }
.clipboard-icon { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 7px; background: #2c253b; color: var(--accent); }
.clipboard-icon svg { width: 16px; height: 16px; }
.clipboard > div:nth-child(2) { flex: 1; min-width: 0; }
.clipboard strong, .clipboard span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clipboard strong { font-weight: 600; font-size: 12px; }
.clipboard span { color: var(--quiet); font-size: 10px; }
.view-panel { display: grid; grid-template-rows: 46px minmax(0, 1fr); min-width: 0; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 0 12px; background: #1e1b27; border-bottom: 1px solid var(--border); min-width: 0; }
.tool-group { display: flex; align-items: center; gap: 2px; }
.tool { min-height: 31px; padding: 0 8px; font-size: 12px; font-weight: 600; gap: 6px; }
.tool svg { width: 15px; height: 15px; }
.view-switch { display: flex; margin-left: auto; border: 1px solid var(--border); background: #17151f; border-radius: 7px; padding: 2px; }
.view-switch button { padding: 4px 10px; min-width: 36px; line-height: 15px; font-size: 11px; }
.view-switch button.active { color: #e3d0ff; background: #332841; }
.viewport { min-height: 0; min-width: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 45% 48%, #241d31, #141320 80%); }
.viewport canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.viewport canvas[data-mode=section], .viewport canvas[data-mode=place] { cursor: crosshair; }
.viewport canvas[data-mode=pan] { cursor: grab; }
.viewport canvas[data-mode=pan]:active { cursor: grabbing; }
.viewport canvas[data-mode=move] { cursor: move; }
.viewport canvas.is-moving { cursor: grabbing; }
.view-pill, .viewport-help, .view-utilities { position: absolute; background: #1a1725ed; border: 1px solid #3c344c; border-radius: 7px; z-index: 1; }
.view-pill { left: 15px; top: 14px; display: flex; align-items: center; gap: 8px; padding: 5px 9px; color: #ded2f0; font-size: 11px; pointer-events: none; }
.live-dot, .status-dot { width: 6px; height: 6px; border-radius: 7px; background: var(--accent); }
.view-utilities { top: 14px; right: 14px; display: flex; gap: 2px; padding: 2px; }
.view-utilities .icon { width: 27px; height: 27px; }
.view-utilities .icon svg { width: 14px; height: 14px; }
.viewport-help { bottom: 14px; left: 14px; max-width: calc(100% - 28px); display: flex; align-items: center; gap: 8px; padding: 3px 7px 3px 9px; color: var(--muted); font-size: 11px; }
.viewport-help .text-button { border-left: 1px solid #3e374d; border-radius: 0; padding: 3px 4px 3px 9px; }
.axis-gizmo { width: 67px; height: 66px; position: absolute; right: 16px; bottom: 14px; pointer-events: none; }
.axis-gizmo span, .axis-gizmo i { position: absolute; display: grid; place-items: center; }
.axis-gizmo span { height: 18px; width: 18px; border-radius: 50%; font-weight: 700; font-size: 10px; }
.axis-y { left: 26px; top: 1px; color: #122c29; background: #86d7b9; }
.axis-x { right: 1px; bottom: 12px; color: #3b1c30; background: #e68fae; }
.axis-z { left: 3px; bottom: 4px; color: #242042; background: #a497ee; }
.axis-gizmo i { width: 5px; height: 5px; left: 32px; top: 34px; background: #b6abc9; border-radius: 50%; }
.axis-gizmo i::before, .axis-gizmo i::after, .axis-y::after { content: ''; position: absolute; height: 1px; width: 20px; background: #777084; }
.axis-y::after { top: 24px; width: 15px; transform: rotate(90deg); }
.axis-gizmo i::before { left: 4px; top: 3px; transform: rotate(21deg); transform-origin: left; }
.axis-gizmo i::after { right: 3px; top: 4px; transform: rotate(-39deg); transform-origin: right; }
.marquee { position: absolute; border: 1px solid var(--accent); background: #af85ee35; z-index: 2; pointer-events: none; }
.loading, .empty-view, .drag-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 11px; text-align: center; padding: 20px; }
.loading { background: #171521e8; z-index: 4; color: var(--muted); }
.spinner { height: 22px; width: 22px; border-radius: 50%; border: 2px solid #54416f; border-top-color: var(--accent); animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-view { pointer-events: none; }
.empty-view button { pointer-events: auto; margin: 0 3px; }
.empty-view p, .muted { color: var(--muted); }
.empty-mark { width: 51px; height: 51px; display: grid; place-items: center; border-radius: 13px; background: var(--accent-soft); color: var(--accent); }
.empty-mark svg, .drag-overlay svg { width: 26px; height: 26px; }
.drag-overlay { inset: 8px; z-index: 6; pointer-events: none; background: #2f2345e8; color: #ecdafe; border: 2px dashed var(--accent); border-radius: 10px; font-size: 18px; }
.inspector-body { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #544661 transparent; }
.inspector-section { padding: 17px 15px 18px; }
.inspector-section.special { border-bottom: 1px solid #473a56; background: #211b2d; }
.inspector-section h2 { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.inspector-section p { font-size: 12px; color: var(--muted); margin: 5px 0 12px; }
.inspector-section .subtle { font-size: 11px; color: var(--quiet); line-height: 1.5; margin: 9px 0 0; }
.inspector-section .match-reference { margin: 0 0 7px; font-size: 11px; overflow-wrap: anywhere; }
.match-options { display: grid; grid-template-columns: 1fr .78fr 1.18fr; gap: 5px; }
.match-options button { min-width: 0; min-height: 31px; padding: 2px 4px; font-size: 11px; white-space: normal; line-height: 1.2; }
.field-label, .section-label, .field-grid label { display: block; color: #cfc4df; font-size: 11px; font-weight: 600; }
.field-label { margin: 10px 0 5px; }
.section-label, fieldset h3, .inspector-section h3 { margin: 14px 0 7px; font-size: 12px; font-weight: 650; }
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; background: #16141e; border: 1px solid #3a3349; border-radius: 6px; color: var(--ink); padding: 6px 8px; min-height: 32px; }
input::placeholder, textarea::placeholder { color: var(--quiet); opacity: 1; }
.search input { padding: 7px 0; border: 0; background: transparent; }
input[type=color] { min-height: 33px; padding: 3px; cursor: pointer; }
input[type=checkbox] { margin: 0; accent-color: var(--accent-strong); flex: 0 0 auto; width: 14px; height: 14px; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
fieldset:disabled { opacity: .54; }
.check { display: flex; gap: 8px; align-items: center; color: #ccc2db; margin: 11px 0; font-size: 11px; }
.check + .check { margin-top: 8px; }
.palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.palette { min-width: 0; display: flex; align-items: flex-start; flex-direction: column; text-align: left; padding: 7px; gap: 4px; white-space: normal; border-color: #3b3249; background: #231e2c; }
.palette.active { border-color: #a384d4; box-shadow: inset 0 0 0 1px #9276c049; background: #342744; }
.palette strong { font-weight: 650; font-size: 11px; line-height: 1.15; color: var(--ink); }
.palette small { font-size: 9px; line-height: 1.23; color: var(--muted); }
.swatches { display: flex; width: 100%; height: 23px; border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.swatches span { flex: 1; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.split > button { font-size: 11px; padding: 0 6px; min-width: 0; }
.style-actions { margin-top: 14px; }
.full { width: 100%; margin-top: 7px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin: 8px 0; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-grid.material-grid { grid-template-columns: minmax(0, .7fr) minmax(0, 1.65fr); }
.field-grid input, .field-grid select { display: block; margin-top: 3px; }
.selection-card { display: flex; align-items: center; gap: 8px; background: #252031; border: 1px solid #3c334b; border-radius: 7px; padding: 8px; }
.selection-card svg { color: var(--accent); }
.selection-card strong, .selection-card span { display: block; }
.selection-card strong { font-size: 12px; overflow-wrap: anywhere; }
.selection-card span { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.status-bar { border-top: 1px solid var(--border); background: #191722; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; gap: 9px; font-size: 11px; color: var(--muted); min-width: 0; }
.status-bar > div { display: flex; align-items: center; gap: 13px; min-width: 0; }
#status { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status-dot { background: var(--positive); flex: 0 0 auto; }
.offline { border-left: 1px solid var(--border); padding-left: 12px; color: #9ed2be; white-space: nowrap; }
.toast { max-width: min(90vw, 520px); position: fixed; bottom: 43px; right: 16px; z-index: 9; border: 1px solid #5d4a78; background: #30233f; color: #f2e8ff; box-shadow: 0 8px 20px #0f0a18aa; border-radius: 8px; padding: 10px 14px; }
.toast.error { background: #432939; border-color: #89516c; }
dialog { padding: 0; border: 1px solid #544568; color: var(--ink); border-radius: 12px; background: #221d2d; box-shadow: 0 20px 70px #08060bd9; width: min(500px, calc(100% - 28px)); }
dialog::backdrop { background: #08060db5; }
dialog form { padding: 17px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 7px; }
.dialog-heading h2 { font-size: 17px; }
#dialog-content p { margin: 5px 0 11px; color: var(--muted); }
#dialog-content ul { padding-left: 20px; color: var(--muted); }
#dialog-content li + li { margin-top: 7px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 1140px) {
  .workspace { grid-template-columns: 205px minmax(0, 1fr) 256px; }
  .brand { flex-basis: 176px; }
  .tool { padding-inline: 5px; }
  .toolbar { gap: 3px; padding-inline: 6px; }
  .toolbar .divider { margin: 0 1px; }
}
@media (max-width: 975px) {
  .tool span { display: none; }
  .tool { width: 31px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 167px minmax(0, 1fr) 223px; }
  .app-header { padding-inline: 11px; gap: 6px; }
  .brand { flex-basis: auto; }
  .brand h1 { font-size: 15px; }
  .header-right { gap: 3px; }
  .tree-size, .document-meta { display: none; }
  .inspector-section { padding-inline: 10px; }
}
@media (max-width: 780px) {
  body { height: auto; min-height: 100dvh; grid-template-rows: 55px 38px 1fr auto; }
  .app-header { padding-inline: 8px; }
  .brand { gap: 5px; }
  .brand img { width: 30px; height: 30px; }
  .brand h1 { font-size: 13px; }
  .brand span { font-size: 7px; letter-spacing: .6px; }
  .file-actions { gap: 1px; }
  .file-actions .quiet { padding: 0 4px; min-width: 25px; }
  .app-header .divider, .file-actions .quiet span, .header-right .save-button span, .header-right .help { display: none; }
  .app-header .icon { width: 25px; }
  .header-right .primary { font-size: 10px; padding-inline: 5px; gap: 3px; }
  .header-right .primary svg { width: 13px; }
  .export-split > .dropdown { width: 22px; }
  .header-right .save-button { padding: 0 5px; margin: 0; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-rows: 55dvh minmax(315px, auto); }
  .view-panel { grid-column: 1 / -1; grid-row: 1; }
  .scene-panel, .inspector { grid-row: 2; max-height: 78dvh; border-top: 1px solid var(--border); }
  .toolbar { padding-inline: 8px; }
  .axis-gizmo { bottom: 53px; }
  .status-bar { min-height: 30px; }
  #preview-status, .offline { display: none; }
  .clipboard { padding: 7px; }
  .document-bar { padding-inline: 4px; }
  .scene-summary { margin-inline: 9px; gap: 3px; font-size: 9px; }
}
@media (max-width: 425px) {
  .brand { gap: 4px; }
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 12px; }
}
@media (max-width: 395px) {
  body { grid-template-rows: auto 38px 1fr auto; }
  .app-header { flex-wrap: wrap; gap: 0 6px; padding-block: 4px; }
  .brand { flex: 1 0 auto; min-height: 39px; }
  .file-actions { margin-right: 0; }
  .header-right { margin-left: auto; }
  .panel-tabs { padding-inline: 5px; gap: 2px; }
  .panel-tabs button { min-width: 0; padding-inline: 3px; gap: 4px; }
  .panel-tabs svg { width: 12px; height: 12px; }
  .inspector .panel-tabs svg { display: none; }
  .toolbar .divider { display: none; }
  .toolbar .icon, .toolbar .tool { width: 27px; }
  .view-switch button { min-width: 29px; padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
