.map-page {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 700px;
    --map-footer-reserve: 4.5rem;
    padding-bottom: var(--map-footer-reserve);
    box-sizing: border-box;
}

.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.map-toolbar-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.map-coords {
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    opacity: 0.85;
}

.map-container {
    flex: 1;
    min-height: 480px;
    height: calc(100vh - 220px - var(--map-footer-reserve, 4.5rem));
    max-height: calc(900px - var(--map-footer-reserve, 4.5rem));
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
}

.map-container.leaflet-container {
    cursor: crosshair;
    background: #1a1a1a;
}

.map-marker-single,
.map-marker-cluster {
    background: transparent !important;
    border: none !important;
}

.map-zone-label {
    background: rgba(0, 0, 0, 0.75);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    padding: 3px 8px;
}

.map-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.map-modal.is-open {
    display: flex;
}

.map-modal[hidden] {
    display: none !important;
}

.map-modal.is-open[hidden] {
    display: flex !important;
}

.map-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.map-modal-dialog {
    position: relative;
    z-index: 1;
    background: var(--bg-color, #fff);
    color: inherit;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    max-height: min(90vh, 820px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-modal-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    z-index: 2;
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.map-modal-close:hover {
    opacity: 1;
}

.map-posts-modal-dialog {
    width: min(900px, 96vw);
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.map-posts-modal-title {
    margin: 0;
    padding: 1rem 2.5rem 0.5rem 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.map-posts-modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 1rem 1rem;
    max-height: min(70vh, 640px);
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

/* ширина контента как .view-main / список постов */
.map-posts-modal-body .post-item {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.map-posts-modal-body .post-info,
.map-posts-modal-body .post-detail {
    max-width: 100%;
    box-sizing: border-box;
}

.map-posts-modal-empty {
    margin: 0;
    padding: 1rem;
    text-align: center;
    opacity: 0.75;
}

.map-posts-empty--hidden {
    display: none;
}

.map-premium-modal-dialog {
    width: min(520px, 96vw);
    padding: 2rem 1.25rem 1.25rem;
}

.map-premium-modal-dialog .posts-premium-cta {
    margin: 0;
}

@media (max-width: 480px) {
    .map-page {
        --map-footer-reserve: 0;
        padding-bottom: 0;
        min-height: 400px;
    }

    .map-container {
        min-height: 360px;
        height: 480px;
        max-height: none;
    }

    .map-posts-modal.map-modal {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .map-posts-modal .map-modal-backdrop {
        display: none;
    }

    .map-posts-modal .map-posts-modal-dialog {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .map-posts-modal .map-posts-modal-body {
        max-height: none;
        flex: 1 1 auto;
        padding: 0.5rem 0.625rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
    }

    .map-posts-modal .map-posts-modal-title {
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
        padding-left: 0.75rem;
        padding-right: 2.5rem;
    }

    .map-posts-modal .map-posts-modal-body .post-info,
    .map-posts-modal .map-posts-modal-body .post-detail {
        flex: 1 1 100%;
        min-width: 0;
        width: auto;
        max-width: 100%;
    }

    .map-posts-modal .map-posts-modal-body .post-item .user {
        max-width: 100%;
    }
}
