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

.map-editor-symmetry-controls {
  min-width: 0;
}

.map-editor-symmetry-picker {
  position: relative;
  min-width: 0;
}

.map-editor-symmetry-trigger,
.map-editor-symmetry-option {
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(208, 184, 132, 0.28);
  border-radius: 5px;
  padding: 5px 8px;
  background: #111619;
  color: #eee6d4;
  font: 600 11px var(--sans);
  text-align: left;
  cursor: pointer;
}

.map-editor-symmetry-trigger:hover,
.map-editor-symmetry-trigger:focus-visible,
.map-editor-symmetry-option:hover:not(:disabled),
.map-editor-symmetry-option:focus-visible,
.map-editor-symmetry-option[aria-selected="true"] {
  border-color: #c9aa67;
  background: #252b2d;
  outline: none;
}

.map-editor-symmetry-option {
  grid-template-columns: 62px minmax(0, 1fr);
  border-color: transparent;
  border-radius: 3px;
}

.map-editor-symmetry-option:disabled {
  cursor: default;
  opacity: 0.38;
}

.map-editor-symmetry-option-label {
  min-width: 0;
  line-height: 1.3;
}

.map-editor-symmetry-chevron {
  color: #d8c79f;
  font-size: 14px;
}

.map-editor-symmetry-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid rgba(208, 184, 132, 0.4);
  border-radius: 6px;
  background: rgba(23, 25, 23, 0.99);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.map-editor-symmetry-menu:not(:popover-open) {
  display: none;
}

.map-editor-symmetry-menu::-webkit-scrollbar {
  width: 9px;
}

.map-editor-symmetry-menu::-webkit-scrollbar-track {
  background: rgba(6, 9, 10, 0.65);
  border-radius: 5px;
}

.map-editor-symmetry-menu::-webkit-scrollbar-thumb {
  background: rgba(208, 184, 132, 0.55);
  border: 2px solid rgba(6, 9, 10, 0.65);
  border-radius: 5px;
}

.map-editor-symmetry-preview {
  display: block;
  width: 60px;
  height: 46px;
}

.map-editor-symmetry-preview-background {
  fill: rgba(10, 14, 15, 0.72);
  stroke: rgba(208, 184, 132, 0.22);
  stroke-width: 1.5;
}

.map-editor-symmetry-preview-guide {
  stroke: rgba(201, 170, 103, 0.42);
  stroke-width: 1.35;
  stroke-dasharray: 3 3;
}

.map-editor-symmetry-preview-copy {
  fill: #918a78;
  stroke: #171b1c;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.map-editor-symmetry-preview-source {
  fill: #d7b86f;
}

.map-editor-symmetry-preview-centre {
  fill: #d7b86f;
  stroke: #171b1c;
  stroke-width: 0.8;
}

.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-minimap-preview {
  position: fixed;
  z-index: 45;
  display: grid;
  width: min(320px, calc(100vw - 16px));
  min-height: 80px;
  box-sizing: border-box;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(208, 184, 132, 0.48);
  border-radius: 7px;
  background: rgba(18, 22, 23, 0.98);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.58);
  color: #d8c79f;
  pointer-events: none;
}

.map-editor-minimap-preview[hidden],
.map-editor-minimap-preview-frame {
  display: none !important;
}

.map-editor-minimap-preview img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.map-editor-minimap-preview span {
  padding: 14px;
  color: #8f897b;
  font: 11px var(--mono);
  text-align: center;
}

.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(5, 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);
  align-items: stretch;
  gap: 8px;
  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: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.map-editor-context-summary .map-editor-field {
  grid-column: 1 / -1;
  min-width: 0;
}

.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;
  }
}
