.map-container {
    position: relative;
    width: 90%;       /* Allow it to take full width of the #main div */
    margin-top: 0px;
    margin-bottom: 0px;
    height: 70vh;      /* Set height relative to the screen height */
    min-height: 600px; /* Prevent it from getting too squashed on mobile */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible
}

.legend{
    color: #f2f3f5
    #EBEDEF
    #2E3338
    #747F8D
    #5865F2
}

#world-map {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateX(10%);
}

.legend {
    position: absolute;
    left: clamp(6px, 1.5vw, 20px);
    top: 50%;
    transform: translateY(-50%);
    padding: clamp(8px, 1.5vh, 20px) clamp(10px, 1.6vw, 20px);
    border-radius: 8px;
    z-index: 10;
    background: rgba(74, 202, 168, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid #4acaa8;
    overflow: hidden;
    white-space: nowrap;
}

body.dark-mode .legend {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(6px, 1vw, 14px);
}

.legend-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.7;
    flex-shrink: 0;
}

.legend-toggle:hover {
    opacity: 1;
}

.legend-body {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.25s ease;
    max-height: 500px;
    opacity: 1;
}

.legend.collapsed .legend-body {
    max-height: 0;
    opacity: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-top: clamp(4px, 0.9vh, 11px);
    white-space: nowrap;
}

.color-box {
    width: clamp(12px, 2vh, 18px);
    height: clamp(12px, 2vh, 18px);
    margin-right: clamp(6px, 1.1vh, 12px);
    flex-shrink: 0;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.3);
}

@media (max-width: 600px) {
    .legend {
        top: auto;
        bottom: 60px;
        transform: none;
        left: 8px;
    }
}

#globe-pause-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    background: rgba(74, 202, 168, 0.2);
    border: 1px solid #4acaa8;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#globe-pause-btn:hover {
    background: rgba(74, 202, 168, 0.45);
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    min-width: 120px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
    left: 0;
    top: 0;
}