#map_editor {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0s 0.28s;
  font-family: "Baloo Paaji", sans-serif;
  color: #efe4b4;
  text-shadow: 0 2px 0 #281806;
  cursor: url(../img/cursor0.png), auto;
}

#map_editor[data-active="true"] {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0s;
}

#map_editor .editor_panel {
  position: absolute;
  box-sizing: border-box;
  padding: 18px 12px 12px;
  background: #3a2a0d;
  border: 6px solid #513810;
  border-radius: 14px;
  box-shadow: 0 6px 0 #221605;
  pointer-events: auto;
  transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.25, 1);
}

#map_editor .editor_tab {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  box-sizing: border-box;
  min-width: 118px;
  height: 32px;
  padding: 0 14px;
  transform: translate(-50%, -58%);
  background: #443110;
  border: 5px solid #513810;
  box-shadow: 0 5px 0 #221605;
  border-radius: 14px;
  color: #e8c98a;
  font-size: 16px;
  line-height: 22px;
  text-align: center;
  pointer-events: none;
}

#map_editor .editor_inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  background: #1a1106;
  border-radius: 12px;
  box-shadow: inset 0 4px 0 #0e0903, 0 0 0 3px #2a1c08;
}

#map_editor .editor_top {
  top: 16px;
  left: 24px;
  right: 24px;
  padding: 16px 10px 10px;
  transform: translateY(-120%);
}

#map_editor .editor_top_inner {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  overflow: visible;
}

#map_editor .editor_title_block {
  flex: 1;
  min-width: 0;
}

#map_editor .editor_title_block strong {
  display: block;
  color: #fff;
  font-size: 20px;
  line-height: 1.1;
}

#editor_revision {
  display: block;
  margin-top: 2px;
  color: #c4a56a;
  font-size: 14px;
}

#map_editor .editor_live {
  flex: 0 0 auto;
  padding: 4px 10px;
  background: #221605;
  border: 2px solid #3d2a0c;
  border-radius: 8px;
  color: #c3d991;
  font-size: 13px;
}

#map_editor .editor_top_actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

#map_editor .editor_top_actions .ns_button {
  min-width: 118px;
}

#map_editor .editor_left,
#map_editor .editor_right {
  top: 134px;
  bottom: 114px;
  width: 276px;
  display: flex;
  flex-direction: column;
}

#map_editor .editor_left {
  left: 18px;
  transform: translateX(-130%);
}

#map_editor .editor_right {
  right: 18px;
  transform: translateX(130%);
}

#map_editor .editor_left .editor_inner,
#map_editor .editor_right .editor_inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

#map_editor .editor_bottom {
  left: 24px;
  right: 24px;
  bottom: 14px;
  padding: 12px 10px 8px;
  transform: translateY(160%);
}

#map_editor .editor_bottom_inner {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  min-height: 36px;
  overflow: visible;
}

#map_editor[data-active="true"] .editor_top,
#map_editor[data-active="true"] .editor_left,
#map_editor[data-active="true"] .editor_right,
#map_editor[data-active="true"] .editor_bottom {
  transform: none;
}

#map_editor h3 {
  margin: 0 0 6px;
  color: #edcd00;
  font-size: 16px;
  line-height: 1.1;
}

#map_editor .editor_section {
  min-width: 0;
}

#map_editor .editor_catalog_section {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

#map_editor [hidden] { display: none !important; }

#map_editor .editor_tools,
#map_editor .editor_fields,
#map_editor .editor_layers,
#map_editor .editor_actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

#map_editor #editor_hitbox_fields {
  grid-template-columns: minmax(0, 1fr);
}

#map_editor .editor_fields label,
#map_editor .editor_meta {
  display: block;
  min-width: 0;
  margin: 0;
  color: #c4a56a;
  font-size: 13px;
}

#map_editor .editor_meta {
  margin-top: 2px;
}

#map_editor select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  margin-top: 4px;
  padding: 2px 10px;
  font: 18px "Baloo Paaji", sans-serif;
  color: #fff;
  text-align: center;
  background: #120c03;
  border: 3px solid #513810;
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 4px 0 #0a0702;
  cursor: url(../img/cursor1.png), pointer;
}

#map_editor select:focus {
  border-color: #edcd00;
  box-shadow: inset 0 4px 0 #0a0702, 0 0 0 3px rgba(237, 205, 0, 0.22);
}

#map_editor input[type="number"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  margin-top: 4px;
  padding: 2px 10px;
  font: 18px "Baloo Paaji", sans-serif;
  color: #fff;
  text-align: center;
  background: #120c03;
  border: 3px solid #513810;
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 4px 0 #0a0702;
}

#map_editor input[type="number"]:focus {
  border-color: #edcd00;
  box-shadow: inset 0 4px 0 #0a0702, 0 0 0 3px rgba(237, 205, 0, 0.22);
}

#map_editor .editor_chip,
#map_editor .editor_selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 38px;
  padding: 4px 8px;
  background: #221605;
  border: 2px solid #513810;
  border-radius: 10px;
  color: #efe4b4;
  font: 15px "Baloo Paaji", sans-serif;
  text-shadow: 0 2px 0 #281806;
}

#map_editor .editor_chip {
  cursor: url(../img/cursor1.png), pointer;
}

#map_editor .editor_chip:hover {
  border-color: #8a6420;
}

#map_editor .editor_chip[data-on="true"],
#map_editor .editor_tools .ns_button[data-on="true"] {
  border-color: #edcd00;
  box-shadow: 0 0 0 3px rgba(237, 205, 0, 0.2);
  color: #fff4c8;
}

#map_editor .editor_selected {
  justify-content: flex-start;
  margin: 0;
  color: #efe4b4;
}

#map_editor .editor_selected[data-empty="true"] {
  color: #8a6a3a;
}

#map_editor .editor_catalog {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
}

#map_editor .editor_catalog::-webkit-scrollbar,
#map_editor .editor_inner::-webkit-scrollbar {
  width: 10px;
}

#map_editor .editor_catalog::-webkit-scrollbar-track,
#map_editor .editor_inner::-webkit-scrollbar-track {
  background: #221605;
  border-radius: 8px;
}

#map_editor .editor_catalog::-webkit-scrollbar-thumb,
#map_editor .editor_inner::-webkit-scrollbar-thumb {
  background: #8a590e;
  border: 2px solid #513810;
  border-radius: 8px;
}

#map_editor .editor_choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  padding: 6px 4px 4px;
  background: #221605;
  border: 2px solid #513810;
  border-radius: 10px;
  color: #efe4b4;
  font: 13px "Baloo Paaji", sans-serif;
  line-height: 1.1;
  text-shadow: 0 2px 0 #281806;
  cursor: url(../img/cursor1.png), pointer;
}

#map_editor .editor_choice:hover {
  border-color: #8a6420;
}

#map_editor .editor_choice[data-on="true"] {
  border-color: #edcd00;
  box-shadow: 0 0 0 3px rgba(237, 205, 0, 0.2);
}

#map_editor .editor_choice img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 0 #160e03);
}

#map_editor .editor_choice em {
  color: #8a6a3a;
  font-style: normal;
  font-size: 11px;
}

#editor_mode {
  flex: 0 0 auto;
  padding: 2px 10px;
  background: #443110;
  border: 2px solid #513810;
  border-radius: 8px;
  color: #edcd00;
  font-size: 16px;
  line-height: 22px;
}

#editor_coords {
  color: #c4a56a;
  font-size: 15px;
}

#editor_status {
  flex: 1;
  min-width: 0;
  color: #efe4b4;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editor_cursor {
  position: absolute;
  box-sizing: border-box;
  width: 100px;
  height: 100px;
  display: none;
  border: 2px solid #edcd00;
  background: rgba(237, 205, 0, 0.1);
  box-shadow: 0 0 0 2px #2b1909;
  pointer-events: none;
}

#editor_marquee {
  position: absolute;
  box-sizing: border-box;
  display: none;
  border: 1px dashed #edcd00;
  background: rgba(237, 205, 0, 0.16);
  box-shadow: 0 0 0 1px #2b1909;
  pointer-events: none;
}

.editor_sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  #map_editor,
  #map_editor .editor_panel {
    transition: none !important;
  }
}

@media (max-width: 980px) {
  #map_editor .editor_left,
  #map_editor .editor_right {
    width: 210px;
  }

  #map_editor .editor_live {
    display: none;
  }

  #map_editor .editor_top_actions .ns_button {
    min-width: 0;
  }
}

#map_editor #editor_search {
  box-sizing: border-box; width: 100%; min-width: 0; height: 34px;
  margin: 0 0 8px; padding: 4px 9px; border: 2px solid #513810;
  border-radius: 8px; background: #120c03; color: #efe4b4;
  font: 14px "Baloo Paaji", sans-serif;
}
#map_editor #editor_search:focus {outline: 2px solid #edcd00;outline-offset: 1px}
#map_editor .editor_catalog {align-content: start}
#map_editor .editor_choice {min-width: 0; overflow-wrap: anywhere}
@media (max-height: 700px) {
  #map_editor .editor_left, #map_editor .editor_right {top: 126px;bottom: 88px}
  #map_editor .editor_inner {gap: 7px;padding: 8px}
  #map_editor .editor_bottom {bottom: 10px}
}
