.editor-body {
  overflow: auto;
  justify-content: flex-start;
  align-items: stretch;
  padding: 12px;
  background: #152018;
}

#editor-app {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

#editor-toolbar h1 {
  font-size: 18px;
  margin: 0 8px 0 0;
  font-weight: 700;
}

.toolbar-check {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
}

#editor-status {
  font-size: 12px;
  opacity: 0.85;
  margin-left: auto;
  max-width: 360px;
  text-align: right;
}

#editor-main {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: start;
}

#editor-palette,
#editor-props {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.palette-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin: 4px 0;
}

.tool-btn {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #eef7ee;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.tool-btn:hover { background: rgba(255, 255, 255, 0.12); }
.tool-btn.active {
  background: #3a8f4a;
  border-color: #5ecf70;
}

#editor-stage-wrap {
  display: flex;
  justify-content: center;
}

#editor-stage {
  position: relative;
  width: 800px;
  height: 500px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
  overflow: hidden;
  background: #3a7d44;
}

#editor-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 800px;
  height: 500px;
  touch-action: none;
  cursor: crosshair;
  z-index: 0;
}

#editor-test-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
  z-index: 5;
}

#editor-test-hud .hint {
  font-weight: 500;
  opacity: 0.85;
  font-size: 11px;
}

/* Same escape hatch as the game — above canvas so clicks land on the button. */
#editor-respawn-offer {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(12, 18, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}
#editor-respawn-offer.hidden {
  display: none !important;
}
#editor-respawn-offer p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
  color: #eef7ee;
}
#editor-respawn-offer button {
  min-width: 160px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: #3d8f5a;
  color: #fff;
  pointer-events: auto;
}
#editor-respawn-offer button:hover {
  background: #48a86a;
}

#editor-power {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 16px;
  background: rgba(0,0,0,0.55);
  pointer-events: none;
  transform: translate(-50%, -140%);
}

#editor-props label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  margin-bottom: 6px;
}

#editor-props input,
#editor-props select,
#import-modal select {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  color: #eef7ee;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
}

#editor-props hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 8px 0;
}

.muted { opacity: 0.65; font-size: 12px; }

.editor-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.editor-modal.hidden { display: none; }

.editor-modal-card {
  background: #1e2e22;
  border-radius: 12px;
  padding: 20px 22px;
  min-width: 300px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-modal-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.editor-modal-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  #editor-main {
    grid-template-columns: 1fr;
  }
  #editor-palette {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
}
