.map-editor-panel[hidden],
.map-editor-tool-rail[hidden] {
  display: none !important;
}

.map-editor-interact-clean .map-editor-panel,
.map-editor-interact-clean .map-editor-toolbar,
.map-editor-interact-clean .map-editor-tool-rail,
.map-editor-interact-clean .map-editor-status-dock {
  display: none !important;
}

.map-editor-tools-window {
  right: 12px;
  left: auto;
  height: min(720px, calc(100vh - 98px));
}

.map-editor-toolbar {
  position: absolute;
  z-index: 31;
  top: 8px;
  right: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  box-sizing: border-box;
  border: 1px solid rgba(208, 184, 132, 0.3);
  border-radius: 7px;
  padding: 7px 9px;
  overflow-x: auto;
  background: rgba(18, 22, 23, 0.96);
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.42);
  color: #d8c79f;
}

.map-editor-toolbar-identity {
  display: grid;
  min-width: 130px;
  margin-right: auto;
  line-height: 1.15;
}

.map-editor-toolbar-identity strong {
  overflow: hidden;
  color: #eee6d4;
  font: 700 12px var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-editor-toolbar-identity span {
  color: #8f897b;
  font: 10px var(--mono);
}

.map-editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.map-editor-toolbar .map-editor-button {
  min-height: 32px;
  white-space: nowrap;
}

.map-editor-toolbar-zoom {
  box-sizing: border-box;
  width: 58px;
  min-height: 32px;
  border: 1px solid rgba(208, 184, 132, 0.28);
  border-radius: 4px;
  padding: 5px;
  background: #111619;
  color: #eee6d4;
  text-align: right;
}

.map-editor-tool-rail {
  position: absolute;
  z-index: 30;
  top: 70px;
  left: 12px;
  display: grid;
  width: 72px;
  gap: 5px;
  box-sizing: border-box;
  border: 1px solid rgba(208, 184, 132, 0.3);
  border-radius: 7px;
  padding: 8px;
  background: rgba(18, 22, 23, 0.96);
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.42);
}

.map-editor-tool-rail-label {
  padding: 2px 0 4px;
  color: #8f897b;
  font: 700 9px var(--mono);
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.map-editor-tool-rail .map-editor-button {
  min-height: 38px;
  padding: 5px 2px;
  font-size: 10px;
}

.map-editor-status-dock {
  position: absolute;
  z-index: 29;
  right: 420px;
  bottom: 12px;
  left: 96px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.map-editor-status-dock .map-editor-status {
  max-width: 620px;
  background: rgba(18, 22, 23, 0.94);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
}

.map-editor-tools-window .map-editor-panel-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  overflow: hidden;
}

.map-editor-category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.map-editor-category-tab {
  min-height: 36px;
  padding: 5px 3px;
}

.map-editor-category-content {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.map-editor-context-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 1fr);
  align-items: end;
  gap: 10px;
  border-top: 1px solid rgba(208, 184, 132, 0.22);
  padding: 9px 4px 1px;
  color: #aaa28f;
  font: 10px var(--mono);
}

.map-editor-current-tool {
  display: grid;
  gap: 3px;
}

.map-editor-context-summary .map-editor-field {
  grid-column: auto;
}

.map-editor-context-summary .map-editor-readout {
  grid-column: 1 / -1;
}

.map-editor-context-summary strong {
  color: #d8c79f;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .map-editor-tools-window {
    height: calc(100vh - 142px);
  }

  .map-editor-toolbar {
    right: 8px;
    left: 8px;
  }

  .map-editor-toolbar-identity {
    display: none;
  }

  .map-editor-tool-rail {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    display: flex;
    width: auto;
    overflow-x: auto;
  }

  .map-editor-tool-rail-label {
    display: none;
  }

  .map-editor-tool-rail .map-editor-button {
    min-width: 62px;
  }

  .map-editor-status-dock {
    right: 8px;
    bottom: 62px;
    left: 8px;
  }
}
