/* 地图编辑器布局：左资源 / 中视口 / 右属性 / 底工具栏；移动端左右面板变抽屉 */
body.editor { overflow: hidden; height: 100dvh; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.ed-top { display: flex; align-items: center; gap: 10px; padding: calc(6px + var(--safe-t)) 10px 6px; background: #0d0b09; border-bottom: 1px solid var(--line); flex: none; z-index: 30; }
.ed-title { display: flex; flex-direction: column; line-height: 1.15; }
.ed-title .t { font-family: var(--font); color: var(--gold2); letter-spacing: 2px; font-size: 15px; }
.ed-title .sub { color: var(--text2); font-size: 11px; }
.ed-top .sp { flex: 1; }
.ed-stats { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-stats b { color: var(--text2); font-weight: normal; }
.ed-stats .warn { color: #d08a5a; }
.mob { display: none; }

.ed-main { flex: 1; display: flex; min-height: 0; position: relative; }
.ed-left, .ed-right { width: 252px; flex: none; background: var(--panel); display: flex; flex-direction: column; min-height: 0; z-index: 20; }
.ed-left { border-right: 1px solid var(--line); }
.ed-right { border-left: 1px solid var(--line); width: 272px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line); font-family: var(--font); color: var(--gold); letter-spacing: 2px; font-size: 13px; }
.pane-head .lnk { font-family: var(--sans); font-size: 11px; letter-spacing: 0; }
.res-search { padding: 8px 10px 4px; }
.res-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.res-tabs button { padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--text2); cursor: pointer; }
.res-tabs button.on { border-color: var(--gold); color: var(--gold2); background: #2a2116; }
.res-list { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 6px; align-content: start; }
.res-item { position: relative; min-height: 0; flex: none; border: 1px solid var(--line); border-radius: 3px; background: #14110d; cursor: grab; overflow: hidden; touch-action: none; }
.res-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; pointer-events: none; filter: saturate(.85); }
.res-item .n { font-size: 11px; padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.res-item .tri { position: absolute; right: 3px; top: 3px; font-size: 9px; background: rgba(0, 0, 0, .6); padding: 0 4px; border-radius: 2px; color: var(--text2); }
.res-item.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.res-item:hover { border-color: var(--line2); }
.res-hint { font-size: 11px; color: var(--dim); padding: 6px 10px; border-top: 1px solid var(--line); }
.drag-ghost { position: fixed; z-index: 999; width: 64px; height: 64px; border: 1px solid var(--gold); border-radius: 3px; pointer-events: none; opacity: .85; transform: translate(-50%, -50%); background-size: cover; box-shadow: 0 6px 20px rgba(0, 0, 0, .6); }

.ed-view { flex: 1; position: relative; min-width: 0; background: #000; overflow: hidden; }
#canvas { width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.view-hud { position: absolute; z-index: 5; font-size: 12px; pointer-events: none; }
.view-hud > * { pointer-events: auto; }
.view-hud.tl { left: 8px; top: 8px; color: var(--text2); background: rgba(10, 8, 6, .6); padding: 4px 8px; border-radius: 3px; border: 1px solid rgba(84, 69, 47, .5); }
.view-hud.tl:empty { display: none; }
.view-hud.tr { right: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.view-hud.bl { left: 8px; bottom: 8px; color: var(--dim); font-size: 11px; max-width: 60%; }
.cam-tools { display: flex; gap: 4px; }
.cam-tools .btn { background: rgba(20, 17, 13, .8); font-family: var(--font); }
.cam-tools .btn.on { background: rgba(150, 110, 60, .9); color: #fff3dc; }
.cam-snaps { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.cam-snaps .snap { display: flex; gap: 2px; }
.cam-snaps .snap button { font-size: 11px; padding: 2px 8px; background: rgba(20, 17, 13, .8); border: 1px solid var(--line2); color: var(--text2); border-radius: 2px; cursor: pointer; }
.cam-snaps .snap button:hover { color: var(--gold2); border-color: var(--gold); }
.cam-snaps .snap .del { padding: 2px 5px; }
.brush-ring { position: absolute; pointer-events: none; display: none; }

.right-body { flex: 1; overflow-y: auto; padding: 12px; }
.right-body .empty { color: var(--dim); text-align: center; padding: 30px 10px; line-height: 1.8; font-size: 12px; }
.prop-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.prop-head img { width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 3px; object-fit: cover; }
.prop-head .nm { font-family: var(--font); color: var(--gold2); font-size: 15px; }
.prop-head .id { color: var(--dim); font-size: 11px; }
.vec3 { display: grid; grid-template-columns: 16px 1fr 16px 1fr 16px 1fr; gap: 4px; align-items: center; margin-bottom: 6px; }
.vec3 span { font-size: 11px; text-align: center; }
.vec3 span.x { color: #b86a52; } .vec3 span.y { color: #8aa86a; } .vec3 span.z { color: #6a8ab0; }
.vec3 input { padding: 4px 5px; font-size: 12px; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.btn-row .btn { flex: 1 1 auto; }
.ent-list { max-height: 210px; overflow-y: auto; border: 1px solid var(--line); border-radius: 3px; }
.ent-list .it { display: flex; gap: 6px; align-items: center; padding: 4px 8px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #221d16; }
.ent-list .it:hover { background: #221d16; }
.ent-list .it.sel { background: #2e2518; color: var(--gold2); }
.ent-list .it .k { color: var(--dim); font-size: 10px; margin-left: auto; }

.ed-bottom { flex: none; background: #0d0b09; border-top: 1px solid var(--line); z-index: 25; padding-bottom: var(--safe-b); position: relative; }
.toolbar { display: flex; justify-content: center; gap: 2px; padding: 4px 6px; overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.tb { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 5px 8px 4px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--text2); cursor: pointer; }
.tb i { font-style: normal; font-size: 18px; line-height: 1.1; font-family: var(--font); }
.tb span { font-size: 11px; }
.tb:hover { color: var(--text); }
.tb.on { color: var(--gold2); border-color: var(--line2); background: #1f1913; }
.tb.shot { color: #c9a26a; }
.tool-panel { display: none; border-bottom: 1px solid var(--line); background: var(--panel); padding: 10px 14px; max-height: 42vh; overflow-y: auto; }
.tool-panel.show { display: block; }
.tool-panel .cols { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.tool-panel .col { flex: 1 1 230px; min-width: 210px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.seg button { padding: 4px 10px; font-size: 12px; border: 1px solid var(--line); border-radius: 2px; background: #15120e; color: var(--text2); cursor: pointer; }
.seg button.on { border-color: var(--gold); color: var(--gold2); background: #2a2116; }
.layer-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 8px; }
.layer-pick .lp { border: 1px solid var(--line); border-radius: 3px; cursor: pointer; overflow: hidden; background: #15120e; position: relative; }
.layer-pick .lp img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.layer-pick .lp span { display: block; font-size: 10px; text-align: center; padding: 2px 0; color: var(--text2); white-space: nowrap; }
.layer-pick .lp.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.layer-pick .lp .eye { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center; background: rgba(0, 0, 0, .65); border-radius: 2px; color: var(--text); }
.layer-pick .lp .eye.off { color: #7a4a3a; text-decoration: line-through; }
.kv { font-size: 12px; color: var(--text2); line-height: 1.8; }
.kv b { color: var(--text); font-weight: normal; }

/* 平板 / 触屏：左右面板改为浮层抽屉，3D 视口占满全宽（保证渲染分辨率与可读性） */
@media (max-width: 1366px) and (pointer: coarse), (max-width: 1100px) {
  .mob { display: inline-flex; }
  .ed-left, .ed-right { position: absolute; top: 0; bottom: 0; width: min(80vw, 320px); transition: transform .25s; box-shadow: 0 0 30px rgba(0, 0, 0, .7); background: rgba(22, 18, 14, .96); }
  .ed-left { left: 0; transform: translateX(-102%); }
  .ed-right { right: 0; transform: translateX(102%); }
  .ed-left.open, .ed-right.open { transform: none; }
  .tb { min-width: 72px; padding: 7px 10px 6px; }
  .tb i { font-size: 20px; }
  .tb span { font-size: 12px; }
  .cam-tools .btn { min-width: 40px; min-height: 36px; font-size: 14px; }
  .cam-snaps .snap button { font-size: 13px; padding: 6px 10px; }
}
/* 手机 */
@media (max-width: 860px) {
  .ed-stats { display: none; }
  .res-list { grid-template-columns: repeat(3, 1fr); }
  .tb { min-width: 56px; padding: 4px 4px 3px; }
  .tb span { font-size: 10px; }
  .toolbar { justify-content: flex-start; }
  .tool-panel { max-height: 46vh; padding: 8px 10px; }
  .view-hud.bl { display: none; }
  .layer-pick { grid-template-columns: repeat(3, 1fr); }
}

/* 小地图（maps 编辑器同款：地表 + 物体 + 视野框，点击跳转） */
.minimap { position: absolute; right: 8px; bottom: 8px; width: 168px; height: 168px; z-index: 6; border: 1px solid rgba(120, 98, 66, .7); border-radius: 3px; background: #0c0a08; box-shadow: 0 2px 10px rgba(0, 0, 0, .6); cursor: crosshair; touch-action: none; }
@media (max-width: 760px) { .minimap { width: 112px; height: 112px; } }
.ps-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 4px; max-height: 190px; overflow: auto; }
.ps-list .lp { position: relative; }
.ps-list .lp.on::after { content: '✓'; position: absolute; right: 4px; top: 2px; color: #ffd36a; font-weight: bold; }
