.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Pretendard", "SUIT", "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 240, 213, 0.85), transparent 42%),
    linear-gradient(180deg, #f9f2e6 0%, #f3eadb 52%, #efe4d2 100%);
  color: #2f241b;
}

.map-editor-page {
  max-width: 1780px;
  margin: 0 auto;
  padding: 18px 18px 48px;
}

.map-editor-card {
  background: rgba(255, 251, 244, 0.92);
  border: 1px solid rgba(176, 135, 94, 0.22);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(91, 63, 31, 0.08);
  backdrop-filter: blur(12px);
}

.map-editor-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 22px;
  margin-bottom: 14px;
}

.map-editor-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: #b9773f;
  font-weight: 800;
  text-transform: uppercase;
}

.map-editor-title {
  margin: 8px 0 6px;
  font-size: 2rem;
  font-weight: 900;
  color: #2b2018;
}

.map-editor-copy {
  margin: 0;
  max-width: 760px;
  line-height: 1.55;
  color: #6d5643;
}

.map-editor-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(161, 119, 73, 0.24);
  background: rgba(255, 249, 239, 0.98);
  color: #463021;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(180, 120, 58, 0.4);
  box-shadow: 0 8px 18px rgba(108, 73, 39, 0.12);
}

.btn.primary {
  background: linear-gradient(135deg, #d98a41 0%, #c96933 100%);
  color: #fff9f3;
  border-color: transparent;
}

.btn.ghost {
  background: rgba(255, 248, 238, 0.75);
}

.btn.danger {
  background: #fff0ea;
  color: #b24a2d;
  border-color: rgba(178, 74, 45, 0.22);
}

.map-editor-meta {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.map-editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
}

.map-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-field.field-span-2 {
  grid-column: span 2;
}

.map-field.field-span-3 {
  grid-column: span 3;
}

.map-field.field-span-4 {
  grid-column: span 4;
}

.map-field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #8d694b;
}

.map-field input,
.map-field select,
.map-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(172, 136, 96, 0.26);
  background: rgba(255, 252, 246, 0.96);
  color: #3a2b1e;
  font: inherit;
  box-sizing: border-box;
}

.map-field textarea {
  min-height: 96px;
  resize: vertical;
}

.map-field input:focus,
.map-field select:focus,
.map-field textarea:focus {
  outline: none;
  border-color: rgba(214, 124, 42, 0.58);
  box-shadow: 0 0 0 4px rgba(214, 124, 42, 0.12);
}

.map-editor-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 360px;
  gap: 14px;
}

.map-editor-panel {
  padding: 16px;
}

.map-editor-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.map-editor-panel-title {
  font-size: 1.05rem;
  font-weight: 900;
  color: #342418;
}

.map-editor-panel-copy {
  font-size: 0.82rem;
  color: #826451;
}

.map-editor-panel-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(232, 201, 170, 0.42);
  color: #7d5634;
  font-size: 0.76rem;
  font-weight: 800;
}

.map-editor-section {
  padding-top: 12px;
  border-top: 1px dashed rgba(176, 135, 94, 0.24);
  margin-top: 12px;
}

.map-editor-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

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

.map-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tool-chip,
.layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid rgba(176, 135, 94, 0.22);
  background: rgba(255, 248, 238, 0.76);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5e412c;
  transition: 140ms ease;
}

.tool-chip.active,
.layer-chip.active {
  background: #fce6ca;
  border-color: rgba(207, 123, 51, 0.45);
  color: #8a4f20;
  box-shadow: inset 0 0 0 1px rgba(207, 123, 51, 0.18);
}

.map-editor-canvas-card {
  padding: 14px 14px 18px;
}

.map-editor-canvas-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.map-editor-canvas-status {
  font-size: 0.85rem;
  color: #7a5f4c;
}

.map-editor-canvas-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-editor-metric {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(247, 236, 221, 0.88);
  border: 1px solid rgba(176, 135, 94, 0.18);
  color: #614632;
  font-size: 0.8rem;
  font-weight: 700;
}

.map-editor-viewport {
  position: relative;
  min-height: 760px;
  max-height: 76vh;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(177, 137, 95, 0.22);
  background:
    radial-gradient(circle at top, rgba(255, 252, 248, 0.62), transparent 32%),
    linear-gradient(180deg, #fcf5e8 0%, #f2e3cc 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.map-editor-surface-wrap {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  padding: 24px;
  box-sizing: border-box;
}

.map-editor-surface {
  position: relative;
  transform-origin: top left;
  background-image:
    linear-gradient(rgba(192, 160, 124, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(192, 160, 124, 0.1) 1px, transparent 1px);
  background-color: rgba(253, 246, 235, 0.88);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 2px rgba(174, 133, 89, 0.28),
    0 20px 40px rgba(80, 55, 28, 0.1);
}

.map-editor-surface[data-layer="ground"] {
  cursor: crosshair;
}

.map-editor-preview {
  position: absolute;
  border: 2px dashed rgba(201, 106, 37, 0.75);
  background: rgba(255, 196, 145, 0.18);
  border-radius: 10px;
  pointer-events: none;
  z-index: 200;
}

.map-editor-node {
  position: absolute;
  box-sizing: border-box;
  pointer-events: auto;
  user-select: none;
}

.map-editor-node.selectable:hover {
  outline: 2px solid rgba(88, 155, 206, 0.55);
  outline-offset: 0;
}

.map-editor-node.selected {
  outline: 3px solid rgba(207, 123, 51, 0.8);
  box-shadow: 0 0 0 4px rgba(207, 123, 51, 0.16);
}

.map-editor-tile {
  border: 1px solid rgba(117, 82, 48, 0.08);
  background-size: cover;
  background-position: center;
  image-rendering: auto;
}

.map-editor-prop {
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  border-radius: 10px;
}

.map-editor-prop.placeholder,
.map-editor-tile.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(55, 35, 21, 0.78);
  border: 1px dashed rgba(112, 83, 52, 0.2);
}

.map-editor-rect {
  background: rgba(68, 135, 190, 0.12);
  border: 2px solid rgba(68, 135, 190, 0.54);
  border-radius: 10px;
}

.map-editor-rect.collider {
  background: rgba(169, 64, 41, 0.12);
  border-color: rgba(169, 64, 41, 0.55);
}

.map-editor-rect.portal {
  background: rgba(69, 149, 126, 0.16);
  border-color: rgba(69, 149, 126, 0.55);
}

.map-editor-point {
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(48, 35, 22, 0.18);
}

.map-editor-point.spawnPoints {
  background: #4e9ae7;
}

.map-editor-point.questionSlots {
  background: #f3a132;
}

.map-editor-point.bonusSlots {
  background: #b06cf3;
}

.map-editor-node-label {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(41, 28, 16, 0.84);
  color: #fff7f0;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.map-editor-palette-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
}

.map-editor-palette-card {
  appearance: none;
  padding: 0;
  text-align: left;
  color: inherit;
  border: 1px solid rgba(176, 135, 94, 0.22);
  border-radius: 16px;
  background: rgba(255, 251, 243, 0.82);
  overflow: hidden;
  cursor: pointer;
  transition: 140ms ease;
}

.map-editor-palette-card.active {
  border-color: rgba(205, 119, 48, 0.44);
  box-shadow: 0 0 0 2px rgba(205, 119, 48, 0.14);
}

.map-editor-palette-preview {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.88), rgba(244, 229, 208, 0.95));
  border-bottom: 1px solid rgba(176, 135, 94, 0.14);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.map-editor-palette-preview.placeholder {
  font-size: 0.78rem;
  font-weight: 900;
  color: #714d31;
  padding: 8px;
  text-align: center;
}

.map-editor-palette-copy {
  padding: 10px 11px 12px;
}

.map-editor-palette-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #402d1d;
}

.map-editor-palette-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #836654;
}

.map-editor-layer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-editor-layer-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.layer-chip-secondary {
  padding-inline: 10px;
  font-size: 0.76rem;
}

.layer-chip-secondary.is-muted {
  opacity: 0.56;
}

.map-editor-selection-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.map-editor-inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-grid {
  align-items: start;
}

.map-editor-inspector-empty {
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(247, 236, 221, 0.6);
  color: #7b5f4b;
  font-size: 0.86rem;
  line-height: 1.5;
}

.map-editor-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(247, 236, 221, 0.78);
  color: #6c543f;
  font-size: 0.84rem;
  line-height: 1.45;
}

.map-editor-status.error {
  background: #fff0ea;
  color: #a64a30;
}

.map-editor-footer-note {
  margin-top: 10px;
  font-size: 0.76rem;
  color: #856650;
}

@media (max-width: 1500px) {
  .map-editor-layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .map-editor-layout > .inspector-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .map-editor-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-field.field-span-2,
  .map-field.field-span-3,
  .map-field.field-span-4 {
    grid-column: span 2;
  }

  .map-editor-layout {
    grid-template-columns: 1fr;
  }

  .map-editor-palette-grid {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .map-editor-page {
    padding: 12px 12px 36px;
  }

  .map-editor-hero {
    flex-direction: column;
  }

  .map-editor-title {
    font-size: 1.6rem;
  }

  .map-editor-meta-grid {
    grid-template-columns: 1fr;
  }

  .map-field.field-span-2,
  .map-field.field-span-3,
  .map-field.field-span-4 {
    grid-column: span 1;
  }

  .map-editor-palette-grid {
    grid-template-columns: 1fr 1fr;
  }

  .map-editor-viewport {
    min-height: 62vh;
  }
}
