:root {
  --bg: #070a0f;
  --panel: #0d1118;
  --panel-2: #111720;
  --line: #232c38;
  --line-soft: rgba(130, 154, 184, .14);
  --text: #edf3f8;
  --muted: #8593a5;
  --muted-2: #596779;
  --cyan: #54d6ff;
  --cyan-soft: rgba(84, 214, 255, .12);
  --green: #65e6b4;
  --orange: #f1aa62;
  --violet: #a89cff;
  --red: #ff7188;
  --radius: 14px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  background:
    radial-gradient(circle at 15% -15%, rgba(52, 115, 155, .18), transparent 34%),
    radial-gradient(circle at 92% 10%, rgba(53, 80, 135, .12), transparent 28%),
    var(--bg);
}
button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1780px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 24px 24px; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: .04em; font-weight: 720; }
.brand p { margin: 3px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .13em; text-transform: uppercase; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(84,214,255,.35); border-radius: 9px; display: grid; place-content: center; gap: 3px; background: linear-gradient(135deg, rgba(84,214,255,.13), transparent); box-shadow: inset 0 0 18px rgba(84,214,255,.04); }
.brand-mark span { display: block; height: 2px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 10px rgba(84,214,255,.55); }
.brand-mark span:nth-child(1) { width: 15px; }
.brand-mark span:nth-child(2) { width: 21px; }
.brand-mark span:nth-child(3) { width: 11px; }
.server-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; color: var(--muted); font-size: 11px; background: rgba(10,14,20,.72); }
.server-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 10px currentColor; }
.server-pill.online i { background: var(--green); }
.server-pill.offline i { background: var(--red); }
.theme-toggle { height: 31px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(10,14,20,.72); cursor: pointer; }
.theme-toggle span { width: 14px; color: var(--cyan); font-size: 14px; line-height: 1; }
.theme-toggle b { font-size: 10px; font-weight: 600; }

.upload-bar { margin-top: 18px; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px dashed rgba(84,214,255,.26); border-radius: var(--radius); background: linear-gradient(90deg, rgba(84,214,255,.07), rgba(84,214,255,.015) 52%, rgba(9,13,19,.7)); transition: .18s ease; }
.upload-bar.dragging { border-color: var(--cyan); background: rgba(84,214,255,.13); transform: translateY(-1px); }
.upload-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.upload-icon { width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 22px; color: var(--cyan); border: 1px solid rgba(84,214,255,.22); background: rgba(84,214,255,.08); }
.upload-copy strong, .upload-copy span { display: block; }
.upload-copy strong { font-size: 13px; font-weight: 680; }
.upload-copy span { margin-top: 5px; font-size: 11px; color: var(--muted); }
.upload-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; flex: none; }
.limit { color: var(--muted-2); font-size: 10px; margin-right: 5px; }
.button { border-radius: 9px; border: 1px solid var(--line); height: 36px; padding: 0 14px; cursor: pointer; font-size: 12px; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-ghost { background: #121821; color: #b8c4d0; }
.button-primary { color: #031016; border-color: var(--cyan); background: var(--cyan); font-weight: 720; box-shadow: 0 0 20px rgba(84,214,255,.15); }
.button-reserved { height: 32px; padding: 0 11px; color: #8c9aaa; border-color: rgba(130,154,184,.18); background: rgba(15,21,29,.74); font-size: 10px; }

.map-summary { min-height: 116px; padding: 18px 4px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.map-profile { display: flex; align-items: center; min-width: 0; gap: 16px; }
.map-cover { width: 124px; height: 78px; flex: none; overflow: hidden; position: relative; border: 1px solid rgba(84,214,255,.2); border-radius: 11px; background: #0b1119; box-shadow: inset 0 0 24px rgba(84,214,255,.04), 0 10px 26px rgba(0,0,0,.2); }
.map-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-cover img[hidden], .map-cover-fallback[hidden] { display: none; }
.map-cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(84,214,255,.74); background: linear-gradient(135deg, rgba(84,214,255,.12), transparent 55%), repeating-linear-gradient(135deg, transparent 0 11px, rgba(84,214,255,.025) 11px 12px); }
.map-cover-fallback span { font-size: 12px; font-weight: 760; letter-spacing: .22em; transform: translateX(.11em); }
.map-identity { min-width: 0; }
.eyebrow { color: var(--cyan); font-size: 9px; font-weight: 760; letter-spacing: .18em; text-transform: uppercase; }
.map-identity h2 { margin: 6px 0 5px; overflow: hidden; color: #f1f6fa; font-size: 21px; line-height: 1.2; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.map-identity p { margin: 0; color: var(--muted); font-size: 11px; }
.map-identity .map-description { color: #aab8c6; }
.map-identity .map-technical { margin-top: 5px; color: var(--muted-2); font-size: 9px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(94px, 1fr)); gap: 1px; border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; background: var(--line-soft); }
.stats div { min-width: 105px; padding: 10px 16px; background: rgba(13,17,24,.92); }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 17px; font-weight: 680; font-variant-numeric: tabular-nums; }
.stats span { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .05em; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 354px; min-height: 690px; height: calc(100vh - 292px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(8,11,16,.86); box-shadow: 0 30px 80px rgba(0,0,0,.22); }
.viewer-panel { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 49px minmax(0,1fr) 58px; }
.viewer-toolbar { display: flex; align-items: center; gap: 10px; overflow-x: auto; padding: 7px 11px; border-bottom: 1px solid var(--line); background: rgba(14,18,25,.95); scrollbar-width: none; }
.viewer-toolbar::-webkit-scrollbar { display: none; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #090d13; }
.segmented button { min-width: 72px; height: 29px; padding: 0 9px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; white-space: nowrap; }
.segmented button.active { color: var(--text); background: #1b2430; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.select-wrap, .switch-wrap { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.select-wrap select { height: 30px; max-width: 172px; color: #cbd5df; border: 1px solid var(--line); border-radius: 7px; padding: 0 25px 0 9px; background: #0a0f15; }
#scene-kind-select { max-width: 145px; }
.switch-wrap { cursor: pointer; }
.switch-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 28px; height: 16px; border-radius: 99px; background: #28313d; position: relative; transition: .15s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: #8290a0; transition: .15s; }
.switch-wrap input:checked + .switch { background: rgba(84,214,255,.27); }
.switch-wrap input:checked + .switch::after { left: 15px; background: var(--cyan); }
.tool-button, .icon-button { border: 1px solid var(--line); background: #10161e; color: var(--muted); cursor: pointer; }
.tool-button { height: 30px; padding: 0 10px; border-radius: 7px; font-size: 10px; }
.region-select-button.active { color: var(--cyan); border-color: rgba(84,214,255,.55); background: var(--cyan-soft); box-shadow: inset 0 0 0 1px rgba(84,214,255,.08); }
.toolbar-spacer { min-width: 4px; flex: 1; }
.search-box { height: 31px; width: min(235px, 23vw); display: flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #090d13; color: var(--muted-2); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: #dfe7ee; background: transparent; font-size: 10px; }
.search-box input::placeholder { color: #536071; }

.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background-color: #070a0f; background-image: linear-gradient(rgba(87,107,130,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(87,107,130,.045) 1px, transparent 1px); background-size: 24px 24px; }
#map-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map-canvas.dragging { cursor: grabbing; }
#map-canvas.region-selecting { cursor: crosshair; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); pointer-events: none; }
.canvas-empty[hidden] { display: none; }
.canvas-empty strong { color: #b9c5d0; font-size: 13px; }
.canvas-empty span { font-size: 10px; }
.empty-orbit { width: 70px; height: 70px; position: relative; margin-bottom: 8px; border: 1px solid rgba(84,214,255,.18); border-radius: 50%; animation: orbit 12s linear infinite; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(84,214,255,.12); transform: rotate(45deg); }
.empty-orbit::after { inset: 24px; background: var(--cyan); border: 0; box-shadow: 0 0 16px var(--cyan); }
.empty-orbit i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.empty-orbit i:nth-child(1) { top: 5px; left: 32px; }.empty-orbit i:nth-child(2) { bottom: 12px; left: 8px; }.empty-orbit i:nth-child(3) { right: 7px; bottom: 15px; }
@keyframes orbit { to { transform: rotate(360deg); } }
.zoom-readout, .canvas-hint { position: absolute; bottom: 10px; color: #637184; font-size: 9px; pointer-events: none; }
.zoom-readout { left: 11px; padding: 5px 7px; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(6,9,13,.76); font-variant-numeric: tabular-nums; }
.canvas-hint { right: 12px; }
.selection-bar { display: flex; align-items: center; gap: 10px; padding: 8px 13px; border-top: 1px solid var(--line); background: rgba(14,18,25,.96); }
.selection-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #3a4654; box-shadow: 0 0 10px currentColor; }
.selection-bar div { min-width: 0; flex: 1; }
.selection-bar strong, .selection-bar p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection-bar strong { display: block; font-size: 11px; }
.selection-bar p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.selection-bar button { border: 0; color: var(--muted); background: none; font-size: 10px; cursor: pointer; }

.tree-panel { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 64px 36px 39px minmax(0,1fr) auto 37px; border-left: 1px solid var(--line); background: #0c1016; }
.tree-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px 8px; }
.tree-head h3 { margin: 5px 0 0; font-size: 14px; }
.icon-button { width: 28px; height: 28px; border-radius: 7px; }
.panel-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px 8px; border-top: 1px solid var(--line-soft); }
.panel-tab { border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.panel-tab.active { color: var(--text); background: #19222d; box-shadow: inset 0 -1px var(--cyan); }
.tree-filter-row { display: flex; gap: 5px; padding: 5px 11px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.tree-filter { border: 0; border-radius: 6px; padding: 0 9px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.tree-filter.active { color: var(--cyan); background: var(--cyan-soft); }
.tree-scroll { min-height: 0; overflow: auto; padding: 8px 8px 24px; scrollbar-color: #283443 transparent; scrollbar-width: thin; }
.tree-scroll details { margin: 2px 0; }
.tree-scroll summary { list-style: none; }
.tree-scroll summary::-webkit-details-marker { display: none; }
.tree-component { border: 1px solid transparent; border-radius: 9px; overflow: hidden; }
.tree-component[open] { border-color: var(--line-soft); background: rgba(255,255,255,.012); }
.component-summary { min-height: 36px; display: grid; grid-template-columns: 14px minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 0 8px; cursor: pointer; color: #c8d2dc; font-size: 10px; }
.component-summary::before { content: "›"; color: var(--muted-2); font-size: 16px; transition: .12s; }
.tree-component[open] > .component-summary::before { transform: rotate(90deg); }
.component-meta { color: var(--muted-2); font-size: 8px; }
.tree-branch { margin-left: 14px; padding-left: 9px; border-left: 1px solid #202a35; }
.tree-node-row { min-height: 30px; display: grid; grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; gap: 7px; width: 100%; padding: 4px 7px; border: 0; border-radius: 6px; text-align: left; background: transparent; cursor: pointer; }
.tree-node-row:hover { background: rgba(84,214,255,.055); }
.tree-node-row.selected { background: rgba(84,214,255,.12); box-shadow: inset 2px 0 var(--cyan); }
.tree-node-row.inferred { border: 1px dashed rgba(255,113,136,.28); }
.node-kind { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }
.node-copy { min-width: 0; }
.node-copy strong, .node-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-copy strong { color: #b9c5d0; font-size: 9px; font-weight: 580; }
.node-copy span { margin-top: 2px; color: #536173; font-size: 7px; }
.node-rank { color: #4d5a6a; font-size: 7px; font-variant-numeric: tabular-nums; }
.branch-summary { display: grid; grid-template-columns: 10px minmax(0,1fr); align-items: center; gap: 2px; cursor: pointer; }
.branch-summary::before { content: "›"; color: #465364; font-size: 13px; }
.tree-branch-item[open] > .branch-summary::before { transform: rotate(90deg); }
.tree-branch-item > .tree-branch { margin-left: 4px; }
.tree-foot { display: flex; align-items: center; justify-content: space-around; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size: 8px; }
.tree-foot span { display: flex; align-items: center; gap: 4px; }.tree-foot i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tree-placeholder { padding: 10px; }.tree-placeholder span { display: block; height: 28px; margin: 7px 0; border-radius: 7px; background: linear-gradient(90deg,#111821,#18212c,#111821); background-size: 200% 100%; animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

[data-kind="input"] { color: var(--green); } [data-kind="switch"] { color: var(--cyan); }
[data-kind="logic"] { color: var(--violet); } [data-kind="timer"] { color: var(--orange); }
[data-kind="receiver"] { color: #e1c16e; } [data-kind="missing"], [data-kind="inferred"] { color: var(--red); }
[data-kind="spawn"] { color: #7ef2c0; } [data-kind="portal-exit"] { color: #54d6ff; }
[data-kind="damage"] { color: #ff7188; } [data-kind="airwall"] { color: #62e8ff; }
[data-kind="door"] { color: #f1aa62; } [data-kind="gravity"], [data-kind="rappel"], [data-kind="ladder"] { color: #a89cff; }
[data-kind="wall"] { color: #54d6ff; }

.property-inspector { max-height: min(43vh, 390px); min-height: 172px; overflow: auto; border-top: 1px solid rgba(84,214,255,.24); background: #0a0f15; scrollbar-color: #283443 transparent; scrollbar-width: thin; }
.property-inspector[hidden] { display: none; }
.property-inspector header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 53px; padding: 9px 11px; border-bottom: 1px solid var(--line-soft); background: rgba(10,15,21,.96); backdrop-filter: blur(8px); }
.property-inspector header strong { display: block; max-width: 270px; margin-top: 4px; overflow: hidden; color: #d7e2eb; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.inspector-summary { padding: 9px 11px; color: var(--muted); font-size: 8px; line-height: 1.65; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.material-preview { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 10px; align-items: center; margin: 9px 11px 2px; padding: 9px; border: 1px solid rgba(84,214,255,.18); border-radius: 9px; background: rgba(84,214,255,.035); }
.material-preview[hidden] { display: none; }
.material-visual { width: 92px; height: 58px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; background-color: #26313d; background-image: linear-gradient(135deg, rgba(255,255,255,.09) 25%, transparent 25%), linear-gradient(225deg, rgba(255,255,255,.09) 25%, transparent 25%), linear-gradient(45deg, rgba(255,255,255,.09) 25%, transparent 25%), linear-gradient(315deg, rgba(255,255,255,.09) 25%, transparent 25%); background-position: 8px 0, 8px 0, 0 0, 0 0; background-size: 16px 16px; }
.material-visual img { width: 100%; height: 100%; display: block; object-fit: cover; image-rendering: auto; }
.material-copy { min-width: 0; }
.material-copy strong, .material-copy span { display: block; }
.material-copy strong { color: #d5e0e9; font-size: 10px; }
.material-copy span { margin-top: 6px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 7px; line-height: 1.5; overflow-wrap: anywhere; }
.portal-ports { margin: 9px 11px 2px; padding: 10px; border: 1px solid rgba(84,214,255,.18); border-radius: 8px; color: var(--cyan); background: rgba(84,214,255,.055); font-size: 9px; text-align: center; letter-spacing: .08em; }
.portal-ports[hidden] { display: none; }
.portal-ports .port-input, .portal-ports .port-output { display: inline-grid; place-items: center; min-width: 28px; height: 20px; margin: 0 3px; border: 1px solid currentColor; border-radius: 999px; }
.portal-ports .port-output { color: #e1c16e; }
.property-list { display: grid; grid-template-columns: minmax(94px, .75fr) minmax(0, 1.25fr); margin: 0; padding: 8px 11px 15px; gap: 0; }
.property-list dt, .property-list dd { min-width: 0; margin: 0; padding: 6px 4px; border-bottom: 1px solid rgba(130,154,184,.08); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; line-height: 1.5; overflow-wrap: anywhere; }
.property-list dt { color: #718196; }.property-list dd { color: #c3ced8; user-select: text; }

.processing { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(2,5,8,.76); backdrop-filter: blur(8px); }
.processing[hidden] { display: none; }
.processing-card { width: min(390px, calc(100vw - 36px)); padding: 28px; text-align: center; border: 1px solid #263341; border-radius: 16px; background: #0d131b; box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.processing-card h2 { margin: 9px 0 7px; font-size: 17px; }.processing-card p { margin: 0 0 22px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.scanner { width: 72px; height: 72px; margin: 0 auto 18px; border: 1px solid rgba(84,214,255,.22); border-radius: 50%; position: relative; overflow: hidden; }
.scanner::before, .scanner::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(84,214,255,.16); border-radius: 50%; }.scanner::after { inset: 26px; background: var(--cyan); box-shadow: 0 0 20px var(--cyan); }
.scanner span { position: absolute; left: 4px; right: 4px; top: 50%; height: 1px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: scan 1.2s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(-24px); } to { transform: translateY(24px); } }
.progress-track { height: 4px; border-radius: 9px; overflow: hidden; background: #1a2430; }.progress-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--cyan),var(--green)); transition: width .2s; }
.progress-label { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border: 1px solid #374554; border-radius: 9px; color: #dbe5ed; background: #111821; box-shadow: 0 16px 50px rgba(0,0,0,.45); font-size: 11px; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }.toast.error { border-color: rgba(255,113,136,.5); color: #ffc2cc; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: rgba(2,5,8,.76); backdrop-filter: blur(8px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(720px, calc(100vw - 36px)); max-height: min(82vh, 760px); overflow: auto; padding: 24px; border: 1px solid #2a3745; border-radius: 16px; background: #0d131b; box-shadow: 0 32px 110px rgba(0,0,0,.55); }
.modal-card-small { width: min(420px, calc(100vw - 36px)); text-align: center; }
.modal-card h2 { margin: 7px 0 10px; font-size: 18px; }
.modal-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #111821; cursor: pointer; }
.modal-confirm { min-width: 110px; margin-top: 20px; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-right: 34px; }
.ai-status { flex: none; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 8px; }
.ai-status.online { color: var(--green); border-color: rgba(101,230,180,.3); background: rgba(101,230,180,.06); }
.ai-status.offline { color: var(--orange); border-color: rgba(241,170,98,.3); background: rgba(241,170,98,.06); }
.selection-context { margin-top: 16px; padding: 11px 12px; border: 1px solid rgba(84,214,255,.16); border-radius: 9px; color: #aebdca; background: rgba(84,214,255,.045); font-size: 9px; line-height: 1.65; }
.ai-question { display: block; margin-top: 15px; }
.ai-question > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.ai-question textarea { width: 100%; resize: vertical; min-height: 72px; padding: 11px; outline: 0; border: 1px solid var(--line); border-radius: 9px; color: #dfe7ee; background: #080c12; font-size: 11px; line-height: 1.6; }
.ai-question textarea:focus { border-color: rgba(84,214,255,.5); }
.ai-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.ai-actions > span { color: var(--muted-2); font-size: 8px; }
.ai-answer { margin-top: 17px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; color: #cbd6df; background: #080c12; white-space: pre-wrap; font-size: 11px; line-height: 1.75; user-select: text; }
.ai-answer.loading { color: var(--cyan); }

:root[data-theme="light"] {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --line: #ccd6e0;
  --line-soft: rgba(66, 85, 104, .16);
  --text: #16222e;
  --muted: #617183;
  --muted-2: #8491a0;
  --cyan: #087ea4;
  --cyan-soft: rgba(8, 126, 164, .11);
  --green: #16865f;
  --orange: #c66f22;
  --violet: #6755c7;
  --red: #c83e59;
  color-scheme: light;
}
:root[data-theme="light"] body { background: radial-gradient(circle at 15% -15%, rgba(8,126,164,.1), transparent 34%), radial-gradient(circle at 92% 10%, rgba(103,85,199,.06), transparent 28%), var(--bg); }
:root[data-theme="light"] .brand-mark { background: linear-gradient(135deg, rgba(8,126,164,.12), #fff); }
:root[data-theme="light"] .map-identity h2 { color: #16222e; }
:root[data-theme="light"] .map-identity .map-description { color: #526476; }
:root[data-theme="light"] .server-pill, :root[data-theme="light"] .theme-toggle { background: rgba(255,255,255,.86); }
:root[data-theme="light"] .upload-bar { background: linear-gradient(90deg, rgba(8,126,164,.07), rgba(255,255,255,.8)); }
:root[data-theme="light"] .button-ghost { color: #425364; background: #f5f7fa; }
:root[data-theme="light"] .button-reserved { color: #617183; background: #f7f9fb; }
:root[data-theme="light"] .stats div { background: rgba(255,255,255,.96); }
:root[data-theme="light"] .workspace { background: rgba(255,255,255,.9); box-shadow: 0 24px 70px rgba(45,62,78,.12); }
:root[data-theme="light"] .viewer-toolbar, :root[data-theme="light"] .selection-bar { background: rgba(250,252,254,.97); }
:root[data-theme="light"] .segmented, :root[data-theme="light"] .search-box { background: #fff; }
:root[data-theme="light"] .segmented button.active, :root[data-theme="light"] .panel-tab.active { background: #e8eef4; }
:root[data-theme="light"] .select-wrap select { color: #2c3a48; background: #fff; }
:root[data-theme="light"] .tool-button, :root[data-theme="light"] .icon-button { color: #617183; background: #fff; }
:root[data-theme="light"] .switch { background: #c7d1dc; }
:root[data-theme="light"] .canvas-wrap { background-color: #f5f8fb; background-image: linear-gradient(rgba(67,86,105,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(67,86,105,.055) 1px, transparent 1px); }
:root[data-theme="light"] .zoom-readout { color: #617183; background: rgba(255,255,255,.86); }
:root[data-theme="light"] .tree-panel { background: #f8fafc; }
:root[data-theme="light"] .tree-component[open] { background: rgba(8,126,164,.025); }
:root[data-theme="light"] .component-summary { color: #354555; }
:root[data-theme="light"] .tree-branch { border-left-color: #d6dee7; }
:root[data-theme="light"] .node-copy strong { color: #435465; }
:root[data-theme="light"] .node-copy span, :root[data-theme="light"] .node-rank { color: #8b98a5; }
:root[data-theme="light"] .property-inspector, :root[data-theme="light"] .property-inspector header { background: rgba(255,255,255,.98); }
:root[data-theme="light"] .property-inspector header strong, :root[data-theme="light"] .property-list dd { color: #354555; }
:root[data-theme="light"] .material-preview { background: rgba(8,126,164,.035); }
:root[data-theme="light"] .material-copy strong { color: #354555; }
:root[data-theme="light"] .processing { background: rgba(225,232,239,.76); }
:root[data-theme="light"] .processing-card, :root[data-theme="light"] .toast { color: #243443; background: #fff; box-shadow: 0 24px 80px rgba(45,62,78,.18); }
:root[data-theme="light"] .modal { background: rgba(225,232,239,.76); }
:root[data-theme="light"] .modal-card, :root[data-theme="light"] .modal-close { color: #243443; background: #fff; box-shadow: 0 24px 80px rgba(45,62,78,.18); }
:root[data-theme="light"] .ai-question textarea, :root[data-theme="light"] .ai-answer { color: #263645; background: #f7f9fb; }
:root[data-theme="light"] .selection-context { color: #526476; background: rgba(8,126,164,.045); }

@media (max-width: 1400px) {
  .viewer-panel { grid-template-rows: 84px minmax(0,1fr) 58px; }
  .viewer-toolbar { align-content: center; flex-wrap: wrap; overflow: visible; }
  .toolbar-spacer, .search-box { display: none; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0,1fr) 310px; }
  .stats div { min-width: 88px; padding: 9px 11px; }
}
@media (max-width: 780px) {
  .app-shell { padding: 0 12px 12px; }
  .upload-bar, .map-summary { align-items: stretch; flex-direction: column; }
  .map-cover { width: 108px; height: 68px; }
  .upload-actions { justify-content: flex-end; }.limit { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }.stats div { min-width: 0; }
  .workspace { height: auto; grid-template-columns: 1fr; grid-template-rows: 620px 520px; }
  .viewer-panel { grid-template-rows: 112px minmax(0,1fr) 58px; }
  .tree-panel { border-left: 0; border-top: 1px solid var(--line); }
  .select-wrap > span, .switch-wrap > span:last-child { display: none; }
  .canvas-hint { display: none; }
}
