.ed-root[hidden]{display:none!important}.ed-root{position:fixed;inset:0;z-index:65000;outline:none;pointer-events:auto;touch-action:none;overscroll-behavior:none;font:14px Georgia,serif;color:#654124}
.ed-surface{position:absolute;inset:0;touch-action:none;cursor:crosshair;background:none}
.ed-tools,.ed-palette{position:absolute;right:15px;top:12%;width:240px;padding:15px;border:3px solid #b28b4a;border-radius:16px;background:linear-gradient(#fff1cf,#e8c78c);box-shadow:0 6px 24px #17242d77;display:grid;gap:9px;z-index:5;max-height:72vh;overflow:auto;touch-action:pan-y}
.ed-tools strong{font-size:19px}.ed-tools small{line-height:1.4;color:#80613f}.ed-tools p{font:13px/1.45 system-ui,sans-serif;margin:0;min-height:36px}
.ed-button{border:1px solid #58692a;border-radius:8px;padding:9px;background:linear-gradient(#92a84e,#50702b);color:#fff8de;font:700 14px Georgia,serif;cursor:pointer;min-height:36px}.ed-button:disabled{opacity:.5;cursor:not-allowed}.ed-button:focus-visible,.ed-point:focus-visible{outline:3px solid #4da1dd;outline-offset:2px}
.ed-ghost{position:absolute;pointer-events:none;transform:translate(-50%,-88%);border:2px solid #69c879;border-radius:12px;background:#4ea46c25;z-index:3;box-shadow:0 0 0 4px rgba(255,255,255,.8),0 16px 28px rgba(17,32,46,.12);box-sizing:border-box}.ed-ghost:after{content:'＋';position:absolute;bottom:0;left:50%;color:#254f23;font:20px sans-serif;transform:translateX(-50%)}.ed-ghost.ed-invalid{border-color:#db4b3d;background:#db4b3d44}
.ed-art{width:100%;height:100%;display:grid;place-items:center;pointer-events:none}.ed-art img,.ed-art svg{width:100%;height:100%;object-fit:contain;pointer-events:none}
#v3-scene-decor .v3-scene-item{border:0;padding:0;background:none;transform:translate(-50%,-88%);pointer-events:none;cursor:default;min-width:0;min-height:0;text-shadow:none;touch-action:manipulation;filter:none;font-size:0;isolation:isolate}
#v3-scene-decor .v3-scene-item:before{content:'';position:absolute;left:15%;right:15%;bottom:8%;height:12%;border-radius:50%;background:#32516b38;z-index:-1}#v3-scene-decor .v3-scene-item:focus-visible{outline:2px solid #f5d276;outline-offset:2px;border-radius:8px}
#v3-tree-ornaments .ed-tree-toy{position:absolute;transform:translate(-50%,-50%);width:18px;height:18px;filter:drop-shadow(0 1px 1px #65452088)}
#v3-tree-ornaments .ed-tree-topper{position:absolute;left:50%;top:5%;width:30px;height:32px;transform:translate(-50%,-50%)}
#v3-tree-ornaments .ed-tree-garland{position:absolute;inset:28% 23% auto;width:54%;height:49%;pointer-events:none;overflow:visible}
.ed-palette{left:15px;right:auto;width:250px;top:13%;max-height:74vh}.ed-palette h3{margin:0;font-size:20px}.ed-categories{display:flex;flex-wrap:wrap;gap:4px}.ed-categories .ed-button{font-size:11px;min-height:30px;padding:6px}.ed-selected{box-shadow:0 0 0 3px #f9c55d;border-color:#d5a148}.ed-palette-items{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ed-palette-items .ed-button{display:grid;gap:5px;justify-items:center;font-size:12px;color:#69451f;border-color:#bb9254;background:linear-gradient(#fff6e1,#e7c992)}.ed-palette-items .ed-art{height:55px;width:65px}.ed-palette-items small{font:10px system-ui,sans-serif}.ed-point{position:absolute;transform:translate(-50%,-50%);border:2px solid #fff6d0;border-radius:50%;background:#496b3799;color:#fff;box-shadow:0 0 0 2px #a58342;font:700 11px system-ui,sans-serif;width:27px;height:27px;z-index:4;cursor:pointer;padding:0}.ed-point.ed-occupied{background:#bb803d99}
.ed-active .scene-hint,.ed-active .v3-access{visibility:hidden}.ed-tree-mode .quest-card{visibility:hidden}
.ed-art{display:block;min-width:0;min-height:0}.ed-art img,.ed-art svg{display:block;max-width:100%;max-height:100%}.ed-tree-mode .tree-object .object-tag,.ed-tree-mode .tree-object .tree-upgrade-meter{visibility:hidden}
@media(max-height:520px){.ed-tree-mode .scene .tree-object{transform:scale(1.6)!important;transform-origin:50% 75%;z-index:30}.ed-palette{box-sizing:border-box;max-height:calc(75dvh - 62px)}.ed-tools{box-sizing:border-box;max-height:calc(75dvh - 62px)}}
@media(max-height:520px){.ed-tools{right:8px;top:25%;padding:9px;width:173px;max-height:calc(75dvh - 62px);gap:5px}.ed-tools strong{font-size:15px}.ed-tools small{font-size:10px}.ed-tools p{font-size:11px;min-height:20px}.ed-button{min-height:30px;padding:6px;font-size:12px}.ed-palette{left:8px;top:25%;padding:8px;width:185px;max-height:calc(75dvh - 62px);gap:5px}.ed-palette h3{font-size:15px}.ed-palette-items .ed-art{height:35px;width:45px}.ed-palette-items .ed-button{font-size:10px}.ed-point{width:20px;height:20px;font-size:9px}}

.ed-active .topbar,.ed-active .bottom-nav,.ed-active .quest-card,.ed-active .ref-rail,.ed-active .ref-activity,.ed-active .ref-dock,.ed-active .ref-develop,.ed-active .v3-access{visibility:hidden!important;opacity:0!important;pointer-events:none!important}
.ed-tools{top:auto;bottom:16px;right:16px;max-height:min(42dvh,320px);width:290px}
@media(max-width:900px){.ed-tools{left:12px;right:12px;bottom:12px;top:auto;width:auto;max-height:none;grid-template-columns:1fr 1fr;gap:8px;align-items:start}.ed-tools strong{grid-column:1/-1}.ed-tools small,.ed-tools p{grid-column:1/-1}.ed-tools .ed-button{min-height:44px}.ed-palette{left:10px;right:10px;top:10px;width:auto;max-height:40dvh}.ed-ghost{transform:translate(-50%,-92%)}}
@media(max-width:560px){.ed-tools{padding:12px;border-radius:18px}.ed-tools strong{font-size:18px}.ed-tools p{font-size:12px;min-height:0}.ed-button{font-size:13px}.ed-palette{max-height:45dvh}}

/* Free-placement management: the existing world stays clickable outside the editor. */
#v3-scene-decor,#v3-scene-decor .v3-scene-item{pointer-events:none!important}
.ed-instance-list{display:grid;gap:6px;max-height:min(38dvh,300px);overflow:auto}
.ed-instance-list .ed-button{display:flex;align-items:center;justify-content:space-between;text-align:left;gap:10px;min-height:44px}
.ed-layer-controls{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.ed-layer-controls .ed-button{min-height:44px}
.ed-tools .ed-tiny{font:12px/1.3 system-ui,sans-serif;color:#654124}
@media(max-width:560px){.ed-instance-list{max-height:22dvh}}

/* DEV07 R02: two non-interactive depth planes preserve primary hit areas. */
#v3-scene-decor-behind{position:absolute;inset:0;z-index:4;pointer-events:none!important}
#v3-scene-decor-behind .v3-scene-item{position:absolute;transform:translate(-50%,-88%);border:0;background:none;padding:0;min-width:0;min-height:0;pointer-events:none!important;isolation:isolate}
#v3-scene-decor-behind .ed-art{width:100%;height:100%}
.ed-size-tools{display:grid;grid-template-columns:44px 1fr 44px 68px;align-items:center;gap:6px}
.ed-size-tools .ed-scale-label{grid-column:2;grid-row:1;text-align:center;font:700 13px/1.4 system-ui,sans-serif}
.ed-size-tools .ed-scale-range{grid-column:1/-1;grid-row:2;width:100%;accent-color:#6a8c46;min-height:32px}
.ed-plane-controls{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.ed-plane-controls .ed-button{min-height:44px}
.ed-size-tools .ed-button{min-height:44px}
@media(max-width:560px){.ed-size-tools{grid-template-columns:44px minmax(0,1fr) 44px 60px}.ed-plane-controls .ed-button{font-size:11px}}

/* Draft behind buildings: draw in the actual scene depth rather than faking it on the modal overlay. */
.ed-depth-preview[hidden]{display:none!important}
.ed-depth-preview{position:absolute;z-index:4;transform:translate(-50%,-88%);pointer-events:none!important;box-sizing:border-box;border:0;border-radius:9px;background:none;filter:none}
.ed-depth-preview .ed-art{width:100%;height:100%}
@media(max-width:900px){.ed-tools{max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain}}
@media(max-width:900px){
  .ed-tools .ed-size-tools,.ed-tools .ed-plane-controls,.ed-tools .ed-layer-controls,.ed-tools #ed-confirm{grid-column:1/-1}
}
.ed-being-moved { visibility: hidden !important; }
.ed-ghost[hidden] { display: none; }
.ed-ghost-behind .ed-art { visibility: hidden; }

.ed-dock {
  touch-action:manipulation;
  position: absolute;
  z-index: 5;
  box-sizing: border-box;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 12px);
  color: #fff5da;
  font: 600 13px/1.35 system-ui, sans-serif;
}
.ed-dock-status {
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 5px;
  padding: 4px 10px;
  border-radius: 12px;
  background: #182b3bea;
  text-align: center;
}
.ed-dock-status:empty { display: none; }
.ed-dock-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid #c5a46b;
  border-radius: 15px;
  background: #172739ee;
  box-shadow: 0 4px 14px #0f1e2a99;
}
.ed-dock-name {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-inline: 4px;
}
.ed-dock-scale { min-width: 4ch; text-align: center; }
.ed-dock .ed-dock-button, .ed-dock-list summary {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid #a4d7ed;
  border-radius: 10px;
  background: linear-gradient(#4d97b6, #225879);
  box-shadow: inset 0 1px 2px #e4f8ff90;
  color: #fff;
}
.ed-dock .ed-dock-button { font: 700 25px/1 system-ui, sans-serif; }
.ed-dock-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ed-dock .ed-dock-confirm { border-color: #c5e58c; background: linear-gradient(#77a23e, #3e6422); }
.ed-dock .ed-selected { box-shadow: inset 0 0 0 2px #ffd682; }
.ed-dock-list summary { list-style: none; cursor: pointer; padding-inline: 7px; }
.ed-dock-list summary::-webkit-details-marker { display: none; }
.ed-dock-list summary:focus-visible { outline: 2px solid #ffd682; outline-offset: 2px; }
.ed-dock-list[open] > :not(summary) {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 100%;
}
.ed-dock .ed-instance-list {
  box-sizing: border-box;
  display: grid;
  gap: 5px;
  padding: 6px;
  margin-bottom: 5px;
  border-radius: 12px;
  background: #172739f5;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.ed-dock .ed-instance-list .ed-button { justify-content: flex-start; }
.ed-instance-list .ed-art { width: 28px; height: 28px; flex: none; }
@media (max-width: 530px) {
  .ed-dock-name { display: none; }
}
@media (max-width: 380px) {
  .ed-dock-bar { gap: 3px; }
  .ed-dock-scale { font-size: 11px; min-width: 3ch; }
}
