* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
    width: 100%;
    height: 100%;
}

#controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    min-width: 180px;
}

#controls h3 {
    margin-bottom: 10px;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: #555;
    cursor: pointer;
    padding: 0 0 0 10px;
    line-height: 1;
}

#controls label {
    display: block;
    margin: 6px 0;
    font-size: 14px;
    cursor: pointer;
    color: #444;
}

#controls input[type="checkbox"] {
    margin-right: 6px;
}

.slider-group {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.slider-group label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

#opacity-slider {
    width: 100%;
    margin-top: 4px;
}

#legend {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

#legend h4 {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.legend-bar {
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #00cc00, #cccc00, #cc0000);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.tower-popup .tower-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
}

.tower-popup .tower-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tower-popup .tower-image.loaded {
    opacity: 1;
}

.tower-popup .tower-image-attribution {
    font-size: 10px;
    color: #999;
    margin-bottom: 8px;
    line-height: 1.3;
}

.tower-popup .tower-image-attribution a {
    color: #999;
}

.tower-popup h4 {
    margin-bottom: 6px;
    color: #222;
}

.popup-operator {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.popup-meta {
    font-size: 12px;
    color: #555;
    margin-bottom: 6px;
}

.tower-popup .tech-badges {
    margin-bottom: 6px;
}

.popup-detail-link {
    display: block;
    text-align: center;
    font-size: 12px;
    color: #3388ff;
    text-decoration: none;
    padding: 4px 0 0;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}

.popup-detail-link:hover {
    text-decoration: underline;
}

.tech-badge {
    display: inline-block;
    background: #f0f0f0;
    color: #444;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    margin: 2px 4px 2px 0;
}

.badge-count {
    color: #999;
    font-weight: 400;
    margin-left: 2px;
}

/* Locate + Info buttons */
.locate-btn,
.info-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #333;
}

.locate-btn:hover,
.info-btn:hover {
    background: #f4f4f4;
    color: #000;
}

/* Info overlay + modal */
.info-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-overlay.hidden {
    display: none;
}

.info-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 28px 32px;
    max-width: 420px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.info-modal h2 {
    font-size: 20px;
    color: #222;
    margin-bottom: 2px;
}

.info-subtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 18px;
}

.info-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.info-close:hover {
    color: #333;
}

.info-stats h3 {
    font-size: 14px;
    color: #555;
    margin: 16px 0 8px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 4px 0;
    font-size: 13px;
    color: #444;
}

.info-table td:last-child {
    text-align: right;
}

.info-table tr:not(:last-child) td {
    border-bottom: 1px solid #f0f0f0;
}

.info-commit {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: #ccc;
    font-family: monospace;
    text-align: center;
}

/* Tower detail overlay */
.tower-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tower-detail-overlay.hidden {
    display: none;
}

.tower-detail-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.tower-detail-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    font-size: 20px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    z-index: 1;
}

.tower-detail-close:hover {
    background: rgba(0, 0, 0, 0.6);
}

.detail-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-image.loaded {
    opacity: 1;
}

.detail-attribution {
    font-size: 10px;
    color: #999;
    padding: 6px 20px;
    line-height: 1.3;
}

.detail-attribution a { color: #999; }

#tower-detail-content h2 {
    font-size: 20px;
    color: #222;
    margin: 0 20px 4px;
}

#tower-detail-content h2:first-child {
    margin-top: 20px;
}

.detail-operator {
    font-size: 13px;
    color: #888;
    margin: 0 20px 10px;
}

.detail-meta {
    font-size: 13px;
    color: #555;
    margin: 0 20px 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.detail-meta span {
    margin-right: 14px;
}

.detail-section {
    margin: 0 20px 16px;
}

.detail-section h3 {
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-section table {
    width: 100%;
    border-collapse: collapse;
}

.detail-section td {
    padding: 6px 8px 6px 0;
    font-size: 12px;
    color: #444;
    border-bottom: 1px solid #f8f8f8;
    white-space: nowrap;
}

.detail-section td:first-child {
    white-space: normal;
    width: 100%;
}

.detail-section td:last-child {
    text-align: right;
    color: #888;
    padding-right: 0;
}

.detail-section:last-child {
    padding-bottom: 20px;
}

/* Mobile */
@media (max-width: 600px) {
    #controls {
        min-width: 0;
        padding: 10px 14px;
    }

    .controls-toggle {
        display: block;
    }

    #controls.collapsed h3 {
        margin-bottom: 0;
    }

    #controls.collapsed .controls-body {
        display: none;
    }

}
