/* Nearby-location UI: a compact, map-native layer that leaves existing controls intact. */
.nearby-locations {
    position: absolute;
    z-index: 115;
    left: max(1.25rem, env(safe-area-inset-left));
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: calc(90px + env(safe-area-inset-bottom));
    max-width: 620px;
    color: #f7f2fb;
    font-family: inherit;
    pointer-events: none;
}

.nearby-locations [hidden],
#nearby-expand[hidden],
#map-location-toast[hidden] {
    display: none !important;
}

#nearby-panel {
    padding: 0.55rem 0.65rem 0.6rem;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.48);
    border-radius: 12px;
    background: rgba(26, 15, 36, 0.95);
    box-shadow: 0 8px 24px rgba(12, 5, 19, 0.38);
    backdrop-filter: blur(12px);
    pointer-events: auto;
}

.nearby-locations-header {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.15rem 0.35rem;
}

.nearby-locations-heading {
    min-width: 0;
    margin: 0;
    color: #f7f2fb;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    line-height: 1.2;
}

#nearby-collapse,
#nearby-expand {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(167, 139, 250, 0.55);
    border-radius: 999px;
    background: #2d1b3d;
    color: #f7f2fb;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 650;
    cursor: pointer;
    touch-action: manipulation;
    pointer-events: auto;
}

#nearby-collapse {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    color: #c4b5fd;
    font-size: 1.05rem;
    line-height: 1;
}

#nearby-collapse:hover,
#nearby-expand:hover {
    border-color: #a78bfa;
    background: #3a2450;
}

#nearby-expand {
    position: absolute;
    left: 0;
    bottom: 0;
    padding: 0.45rem 0.9rem;
    box-shadow: 0 6px 18px rgba(12, 5, 19, 0.4);
}

#nearby-list {
    display: flex;
    gap: 0.55rem;
    width: 100%;
    margin: 0;
    padding: 0.05rem 0.05rem 0.2rem;
    overflow-x: auto;
    overflow-y: hidden;
    list-style: none;
    overscroll-behavior-x: contain;
    scrollbar-color: #765b91 transparent;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

#nearby-list > li {
    flex: 0 0 auto;
    min-width: 0;
}

#nearby-list .nearby-card {
    display: flex;
    width: 208px;
    min-height: 72px;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 9px;
    background: rgba(45, 27, 61, 0.92);
    color: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

#nearby-list .nearby-card:hover {
    border-color: rgba(167, 139, 250, 0.85);
    background: #39234b;
}

#nearby-list .nearby-card img {
    display: block;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 6px;
    background: #1a0f24;
    object-fit: cover;
}

.nearby-card-copy {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.24rem;
    overflow: hidden;
}

.nearby-card-name,
.nearby-card-meta {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nearby-card-name {
    color: #fbf8ff;
    font-size: 0.79rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.nearby-card-meta {
    color: #c9b9d9;
    font-size: 0.69rem;
    line-height: 1.25;
    white-space: nowrap;
}

#nearby-collapse:focus-visible,
#nearby-expand:focus-visible,
#nearby-list .nearby-card:focus-visible {
    outline: 3px solid #c4b5fd;
    outline-offset: 2px;
}

#map-location-toast {
    position: absolute;
    z-index: 125;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    width: max-content;
    max-width: min(440px, calc(100% - 2rem));
    padding: 0.7rem 0.95rem;
    transform: translateX(-50%);
    border: 1px solid rgba(167, 139, 250, 0.58);
    border-radius: 9px;
    background: rgba(26, 15, 36, 0.96);
    box-shadow: 0 6px 20px rgba(12, 5, 19, 0.4);
    color: #f7f2fb;
    font-size: 0.83rem;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
}

.map-location-control.mapboxgl-ctrl.mapboxgl-ctrl-group {
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.56);
    border-radius: 8px;
    background: rgba(26, 15, 36, 0.96);
    box-shadow: 0 2px 8px rgba(12, 5, 19, 0.38);
}

.map-location-control.mapboxgl-ctrl.mapboxgl-ctrl-group button#locate-me-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #c4b5fd;
    cursor: pointer;
    touch-action: manipulation;
}

.map-location-control.mapboxgl-ctrl.mapboxgl-ctrl-group button#locate-me-button:hover {
    background: #39234b;
    color: #ffffff;
}

.map-location-control.mapboxgl-ctrl.mapboxgl-ctrl-group button#locate-me-button:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid #c4b5fd;
    outline-offset: -4px;
}

.map-location-control #locate-me-button[aria-busy="true"] {
    color: #a78bfa;
}

.map-location-control #locate-me-button svg {
    display: block;
    width: 20px;
    height: 20px;
}

.map-user-marker {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    overflow: visible;
}

.map-user-dot {
    position: relative;
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid #f8f4ff;
    border-radius: 50%;
    background: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(26, 15, 36, 0.88), 0 0 12px 4px rgba(167, 139, 250, 0.78);
}

.map-user-dot::after {
    position: absolute;
    inset: -8px;
    border: 2px solid rgba(167, 139, 250, 0.82);
    border-radius: 50%;
    content: "";
    animation: map-user-pulse 2.2s ease-out infinite;
}

@keyframes map-user-pulse {
    0% { opacity: 0.85; transform: scale(0.48); }
    85%, 100% { opacity: 0; transform: scale(1.42); }
}

@media (max-width: 600px) {
    .nearby-locations {
        left: max(0.75rem, env(safe-area-inset-left));
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: calc(88px + env(safe-area-inset-bottom));
    }

    #nearby-panel {
        padding: 0.45rem 0.5rem 0.5rem;
    }

    #nearby-list .nearby-card {
        width: min(198px, calc(100vw - 5.5rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-user-dot::after {
        animation: none;
        opacity: 0.55;
        transform: scale(1);
    }

}
