.map-bound-legend {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 8px);
    right: 10px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--line-white);
    font-size: 11px;
    box-shadow: var(--shadow-card);
    pointer-events: none;
    max-width: 180px;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .5);
}

.map-legend-landmark {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 700;
}

.map-legend-landmark .map-landmark-glyph { position: relative; top: auto; left: auto; width: 12px; height: 12px; margin: 0 2px; border-radius: 2px; }
.map-legend-landmark .map-landmark-glyph svg { width: 8px; height: 8px; }

.map-entry-anchor,
.map-landmark-anchor {
    background: none;
    border: 0;
}

.map-entry-symbol {
    position: relative;
    width: 0;
    height: 0;
    pointer-events: none;
}

.map-entry-hit {
    position: absolute;
    left: -22px;
    top: -22px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 50%;
}

.map-entry-hit::before {
    content: '';
    position: absolute;
    inset: 15px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: var(--bound-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

.map-entry-symbol.is-selected .map-entry-hit::before {
    inset: 13px;
    border-width: 2px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--bound-color) 30%, transparent), 0 1px 5px rgba(0, 0, 0, .45);
}

.map-km-label {
    position: absolute;
    display: none;
    width: 70px;
    height: 28px;
    min-height: 28px;
    padding: 3px 5px;
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--bound-color) 72%, #fff);
    font: 700 10px/1.2 var(--font-ui);
    white-space: nowrap;
    text-align: center;
    text-shadow: 0 1px 2px #000, 0 -1px 2px #000;
    box-shadow: none;
    pointer-events: none;
    border-radius: var(--radius-xs);
}

.map-entry-symbol.is-selected .map-km-label { display: block; }

.map-entry-hit:focus-visible,
.map-landmark-pin:focus-visible {
    outline: 3px solid var(--bound-color, var(--line-yellow));
    outline-offset: 2px;
    background: var(--panel);
}

.map-landmark-pin {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.map-landmark-glyph {
    position: absolute;
    top: 9px;
    left: 11px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: #f4b400;
    color: #17212a;
    box-shadow: 0 2px 7px rgba(0, 0, 0, .28);
    transform: rotate(45deg);
}

.map-landmark-glyph svg { display: block; width: 14px; height: 14px; transform: rotate(-45deg); }
.map-landmark-pin.is-wide .map-landmark-glyph { top: 17px; left: 14px; width: 16px; height: 16px; border-radius: 3px; }
.map-landmark-pin.is-wide .map-landmark-glyph svg { width: 11px; height: 11px; }

.leaflet-tooltip.map-landmark-label {
    border: 0;
    background: transparent;
    color: #f5f7f8;
    box-shadow: none;
    text-shadow: 0 1px 2px #000, 0 -1px 2px #000;
    font: 650 10px/1.25 var(--font-ui);
    letter-spacing: -.01em;
}

.leaflet-tooltip.map-landmark-label::before {
    display: none;
}

.map-landmark-details {
    font: 12px/1.5 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

html[data-theme="light"] .map-km-label {
    background: transparent;
    color: color-mix(in srgb, var(--bound-color) 72%, #17212a);
    text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff;
    box-shadow: none;
}

html[data-theme="light"] .leaflet-tooltip.map-landmark-label {
    color: #20272c;
    text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff;
}

#edit-modal {
    z-index: 1200;
}

.leaflet-tooltip.map-landmark-label {
    max-width: 190px;
    white-space: normal;
    text-align: center;
}

.leaflet-tooltip.map-landmark-label {
    width: max-content;
    max-width: 180px;
}

.map-cluster-anchor { background: none; border: 0; }
.map-entry-symbol.is-imported .map-entry-hit { border-style: dashed; opacity: .8; }
.map-workspace-scope { max-width: calc(100% - 72px); display: flex; flex-wrap: wrap; gap: 4px; }
.map-workspace-scope small { flex-basis: 100%; max-width: 280px; font-size: 10px; line-height: 1.3; }
.map-workspace-scope button { border: 1px solid var(--ds-border); border-radius: 6px; background: transparent; color: var(--ds-fg); padding: 6px; font: inherit; font-size: 11px; }
.map-location-choice { display: block; width: 100%; padding: 10px; margin-block: 4px; text-align: left; color: inherit; background: transparent; border: 1px solid var(--ds-border); border-radius: 6px; }
.map-entry-cluster { position: relative; width: 56px; height: 56px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ds-primary-fg); font: 700 12px/1 var(--font-ui); cursor: pointer; isolation: isolate; }
.map-entry-cluster::before { content: ''; position: absolute; z-index: -1; left: 50%; top: 50%; width: var(--cluster-size, 38px); height: var(--cluster-size, 38px); transform: translate(-50%, -50%); border: 2px solid #fff; border-radius: 50%; background: var(--ds-primary); box-shadow: var(--ds-shadow); }
