html,
body,
#map {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
.segmented-menu {
    position: fixed;
    top: 10px;
    right: 10px;
    background: white;
    display: flex;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
.segmented-menu button {
    flex: 1;
    border: none;
    background: #f2f2f2;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}
.segmented-menu button:hover {
    background: #e0e0e0;
}
.segmented-menu button.active {
    background: #2563eb;
    color: white;
}
.map-nav-links {
    position: fixed;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 1000;
}
.map-nav-links a {
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
}
.map-nav-links a:hover {
    background: #f0f0f0;
}
.backoffice-link {
    color: #2563eb;
}
.bifrost-link {
    color: #888;
}
.track-legend {
    position: fixed;
    bottom: 50px;
    left: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 0.85rem;
    display: none;
}
.track-legend.has-tracks {
    display: block;
}
.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}
.legend-header h4 {
    margin: 0;
    font-size: 0.9rem;
}
.legend-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s;
}
.legend-toggle.collapsed {
    transform: rotate(180deg);
}
.legend-body {
    max-height: 35vh;
    overflow-y: auto;
    padding: 0 12px 10px;
}
.legend-body.hidden {
    display: none;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    cursor: pointer;
}
.legend-item:hover {
    opacity: 0.7;
}
.legend-swatch {
    width: 20px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}
.track-popup h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}
.track-popup .stats {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 6px;
}
.track-popup .stats span {
    font-weight: 600;
}
.track-popup canvas {
    width: 100%;
    height: 140px;
    display: block;
    border-radius: 4px;
}
@media (max-width: 600px) {
    .legend-body {
        max-height: 25vh;
    }
}
