.map-editor-panel {
  --map-editor-panel-width: min(390px, calc((100vw - 128px) / 2));
  width: var(--map-editor-panel-width);
  min-width: min(240px, var(--map-editor-panel-width));
}

.map-editor-layers-window {
  top: auto;
  bottom: 12px;
  right: auto;
  left: 96px;
  max-height: min(240px, calc(100vh - 70px));
  padding: 6px 8px;
}

.map-editor-layers-window .lab-panel-titlebar {
  top: -6px;
  margin-bottom: 2px;
  padding-bottom: 2px;
}

.map-editor-layers-window .lab-panel-resize-handle {
  margin: 4px 0 -6px auto;
}

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

.map-editor-road-tool {
  display: grid;
  gap: 7px;
}

.map-editor-overlay-toggle {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  border: 1px solid rgba(208, 184, 132, 0.3);
  border-radius: 4px;
  padding: 6px 9px;
  background: #252b2d;
  color: #e7dfce;
  cursor: pointer;
  font: 600 11px var(--sans);
}

.map-editor-overlay-toggle:has(input:checked) {
  border-color: #c9aa67;
  background: #4a402e;
}

.map-editor-layer-toggle {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
  padding: 1px 5px;
  border: 1px solid rgba(208, 184, 132, 0.18);
  border-radius: 4px;
  color: #e7dfce;
  cursor: pointer;
  font: 600 10px var(--sans);
  line-height: 1.15;
}

.map-editor-layer-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #c9aa67;
}

.map-editor-layer-toggle > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-editor-layer-toggle small {
  display: none;
}

.map-editor-layers-body {
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
}

@media (max-width: 720px) {
  .map-editor-layers-window {
    z-index: 34;
    top: 70px;
    bottom: auto;
    max-height: calc(100vh - 142px);
  }

  .map-editor-options-window,
  .map-editor-tools-window {
    max-height: calc(100vh - 142px);
  }
}
