html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    box-sizing: border-box;
}
body, main {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
#map {
    height: 100vh;
    width: 100vw;
    z-index: 1;
    position: absolute;
    left: 0;
    top: 0;
}
#legend {
    position: fixed;
    top: 12px;
    right: 12px;
    background: rgba(30,60,114,0.88);
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 0.93em;
    z-index: 1001;
    min-width: 160px;
    box-shadow: 0 2px 8px #0003;
    pointer-events: none;
    user-select: none;
}
#legend span {
    display: inline-block;
    width: 18px;
    height: 8px;
    margin-right: 7px;
    border-radius: 4px;
    vertical-align: middle;
}

/* Controls container */
#custom-controls {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}
#layer-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: auto;
}
#custom-layer-toggle {
    background: #fff;
    color: #1976d2;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 8px #0003;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    transition: background 0.18s, box-shadow 0.18s;
    padding: 0;
    outline: none;
}
#custom-layer-toggle svg {
    width: 28px;
    height: 28px;
}
#custom-layer-toggle:active, #custom-layer-toggle.open {
    background: #e3eaf7;
}
#custom-layer-content {
    background: rgba(30,60,114,0.98);
    border-radius: 12px;
    box-shadow: 0 2px 8px #0005;
    min-width: 170px;
    max-width: 260px;
    padding: 10px 14px 12px 14px;
    margin-top: 4px;
    display: none;
}
#custom-layer-content.open {
    display: block;
}
#custom-layer-content label {
    cursor: pointer;
    font-size: 1em;
}
#locate-btn {
    width: 48px;
    height: 48px;
    background: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 8px #0003;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
    padding: 0;
    outline: none;
}
#locate-btn svg {
    width: 25px;
    height: 25px;
    display: block;
}
#locate-btn:active {
    background: #e3eaf7;
    box-shadow: 0 4px 16px #1976d255;
}
.leaflet-popup-content-wrapper {
    background: #263159;
    color: #fff;
    border-radius: 10px !important;
}
.leaflet-popup-tip {
    background: #263159 !important;
}
.leaflet-control-zoom {
    left: 16px;
    top: 120px;
    right: auto;
    bottom: auto;
}
@media (max-width: 800px) {
    #legend { min-width: 110px; font-size: 0.83em; right: 8px; top: 8px;}
    #custom-layer-content { min-width: 90px; max-width: 99vw; font-size: 0.92em; }
    #custom-layer-toggle, #locate-btn { width: 38px; height: 38px; }
    #custom-layer-toggle svg, #locate-btn svg { width: 20px; height: 20px; }
    #custom-controls { gap: 8px; left: 8px; top: 8px;}
    .leaflet-control-zoom { left: 8px; top: 98px;}
}
@media (max-width: 600px) {
    #legend { font-size: 0.76em; padding: 6px 8px;}
    #custom-controls { left: 4px; top: 4px; }
    #custom-layer-content { min-width: 74px; }
}