.field-map-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.field-map-heading h2 { margin: 0; font: 700 24px/1.2 Georgia, serif; }
.field-map-heading p:not(.wiki-eyebrow) { max-width: 650px; margin: 7px 0 0; color: var(--wiki-muted); font-size: 13px; }
.field-map-heading .wiki-eyebrow { margin-bottom: 7px; }
.map-controls { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.map-controls button { width: 34px; height: 34px; border: 1px solid var(--wiki-line); border-radius: 6px; color: #fff; background: rgba(255,255,255,.07); font-size: 18px; cursor: pointer; }
.map-controls button:hover { background: rgba(255,255,255,.15); }
.map-controls output { min-width: 44px; color: var(--wiki-muted); font-size: 11px; text-align: center; }
.field-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; align-items: start; }
.map-viewport { min-width: 0; overflow: auto; border: 1px solid var(--wiki-line); border-radius: 7px; background: rgba(12,18,37,.44); scrollbar-color: rgba(255,255,255,.26) rgba(0,0,0,.12); }
.map-viewport:focus-visible { outline: 2px solid var(--wiki-accent); outline-offset: 3px; }
.map-board { position: relative; min-width: 100%; overflow: hidden; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 35px 30px; }
.map-lines, .map-locations { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-lines { overflow: visible; pointer-events: none; }
.map-lines line { stroke: rgba(255,214,155,.78); stroke-width: 3; stroke-dasharray: 8 6; }
.map-location { position: absolute; z-index: 1; display: grid; justify-items: center; gap: 5px; padding: 5px; border: 1px solid rgba(255,255,255,.22); border-radius: 6px; color: #fff; background: rgba(31,35,67,.94); box-shadow: 0 5px 15px rgba(0,0,0,.2); cursor: pointer; transform: translate(-50%, -50%); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.map-location:hover, .map-location[aria-pressed="true"] { z-index: 2; border-color: var(--wiki-accent); background: rgba(64,45,91,.98); box-shadow: 0 0 0 3px rgba(255,182,213,.16), 0 7px 18px rgba(0,0,0,.28); }
.map-location img, .map-location-placeholder { width: 100%; aspect-ratio: 1.45; border-radius: 3px; object-fit: cover; background: linear-gradient(135deg, rgba(42,81,147,.7), rgba(222,81,147,.48)); }
.map-location-placeholder { display: grid; place-items: center; color: rgba(255,255,255,.76); font-size: 23px; }
.map-location-name { max-width: 100%; overflow: hidden; font-size: 10px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.map-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 20px; color: var(--wiki-muted); text-align: center; pointer-events: none; }
.map-empty[hidden] { display: none; }
.map-empty strong { color: #fff; font: 700 17px/1.2 Georgia, serif; }
.map-empty span { max-width: 300px; font-size: 12px; }
.map-location-details { min-height: 195px; padding: 14px; border: 1px solid var(--wiki-line); border-radius: 7px; background: rgba(255,255,255,.045); }
.map-details-empty { color: var(--wiki-muted); font-size: 12px; }
.map-details-image { width: 100%; max-height: 145px; margin-bottom: 11px; border-radius: 4px; object-fit: cover; }
.map-location-details h3 { margin: 0; color: #fff; font: 700 17px/1.2 Georgia, serif; }
.map-location-details p { margin: 7px 0 0; color: var(--wiki-muted); font-size: 12px; overflow-wrap: anywhere; }
.map-connected { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--wiki-line); }
.map-connected > span { display: block; margin-bottom: 6px; color: var(--wiki-accent); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.map-connection-link { margin: 0 5px 5px 0; padding: 4px 7px; border: 1px solid var(--wiki-line); border-radius: 4px; color: #fff; background: rgba(255,255,255,.07); font: inherit; font-size: 10px; cursor: pointer; }
.map-connection-link:hover { border-color: var(--wiki-accent); }
.map-status { min-height: 18px; margin: 10px 0 0 !important; color: var(--wiki-muted) !important; font-size: 11px !important; }
.map-status[data-state="error"] { color: #ffd0d0 !important; }

.map-editor-page { width: min(1440px, 100%); margin: 0 auto; padding: 28px 24px 54px; }
.map-editor-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.map-editor-heading h1 { margin: 0; font: 700 32px/1.1 Georgia, serif; }
.map-editor-heading p { margin: 0 0 6px; color: var(--wiki-accent); font-size: 11px; font-weight: 700; }
.map-editor-heading .map-editor-subtitle { margin: 8px 0 0; color: var(--wiki-muted); font-size: 13px; font-weight: 400; }
.map-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-editor-button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--wiki-line); border-radius: 5px; color: #fff; background: rgba(255,255,255,.08); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.map-editor-button:hover { background: rgba(255,255,255,.15); }
.map-editor-button.primary { border-color: transparent; background: linear-gradient(105deg, var(--wiki-violet), #b45193); }
.map-editor-button:disabled { opacity: .55; cursor: wait; }
.map-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.map-editor-board-wrap { min-width: 0; overflow: auto; border: 1px solid var(--wiki-line); border-radius: 7px; background: rgba(12,18,37,.44); }
.map-editor-board { position: relative; width: 1120px; height: 720px; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 140px 120px; touch-action: none; }
.map-editor-board .map-location { width: 124px; min-height: 92px; }
.map-editor-board .map-location[draggable="true"] { cursor: grab; }
.map-editor-board .map-location.is-dragging { z-index: 5; cursor: grabbing; opacity: .83; }
.map-editor-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 20px; color: var(--wiki-muted); text-align: center; pointer-events: none; }
.map-editor-empty[hidden] { display: none; }
.map-editor-empty strong { color: #fff; font: 700 17px/1.2 Georgia, serif; }
.map-editor-empty span { font-size: 12px; }
.map-editor-panel { padding: 16px; border: 1px solid var(--wiki-line); border-radius: 7px; background: var(--wiki-glass); }
.map-editor-panel h2 { margin: 0 0 14px; font: 700 18px/1.2 Georgia, serif; }
.map-editor-field { display: grid; gap: 5px; margin-bottom: 12px; }
.map-editor-field > span { color: var(--wiki-muted); font-size: 11px; font-weight: 700; }
.map-editor-field input, .map-editor-field textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--wiki-line); border-radius: 5px; color: #fff; background: rgba(12,12,35,.38); font: inherit; font-size: 12px; }
.map-editor-field textarea { min-height: 90px; resize: vertical; }
.map-editor-field input:focus, .map-editor-field textarea:focus { outline: 2px solid var(--wiki-accent); outline-offset: 1px; }
.map-editor-coordinates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.map-editor-file { display: grid; gap: 7px; margin-bottom: 12px; }
.map-editor-file input { width: 100%; color: var(--wiki-muted); font-size: 11px; }
.map-editor-file img { display: block; width: 100%; max-height: 150px; border-radius: 4px; object-fit: contain; background: rgba(0,0,0,.2); }
.map-editor-file img[hidden] { display: none; }
.map-editor-hint { margin: 0 0 12px; color: var(--wiki-muted); font-size: 10px; line-height: 1.45; }
.map-connection-list { display: grid; gap: 5px; max-height: 170px; overflow: auto; margin: 8px 0 13px; }
.map-connection-option { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.82); font-size: 11px; }
.map-connection-option input { accent-color: #e58db6; }
.map-editor-delete { width: 100%; min-height: 36px; border: 1px solid rgba(255,160,175,.35); border-radius: 5px; color: #ffc1c8; background: transparent; font: inherit; font-size: 11px; cursor: pointer; }
.map-editor-delete:hover { background: rgba(222,81,147,.12); }
.map-editor-status { min-height: 20px; margin: 0 0 14px; color: var(--wiki-muted); font-size: 12px; }
.map-editor-status[data-state="error"] { color: #ffd0d0; }
.map-editor-status[data-state="success"] { color: #b7f1cf; }

@media (max-width: 900px) {
    .field-map-layout { grid-template-columns: 1fr; }
    .map-location-details { min-height: 0; }
    .map-editor-grid { grid-template-columns: 1fr; }
    .map-editor-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
    .map-editor-panel h2, .map-editor-panel .map-editor-hint, .map-editor-panel .map-connection-list, .map-editor-panel .map-editor-delete { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .field-map-heading { flex-direction: column; }
    .map-editor-page { padding: 22px 14px 40px; }
    .map-editor-heading { align-items: flex-start; flex-direction: column; }
    .map-editor-heading h1 { font-size: 27px; }
    .map-editor-panel { display: block; }
}
