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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
}

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

/* --- Header --- */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(26, 26, 46, 0.92), rgba(26, 26, 46, 0));
    pointer-events: none;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    pointer-events: auto;
}

.header .subtitle {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 2px;
}

/* --- Search --- */
.search {
    position: absolute;
    top: 52px;
    left: 16px;
    z-index: 3;
    width: 280px;
}

.search input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    color: #e0e0e0;
    background: rgba(26, 26, 46, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    outline: none;
    backdrop-filter: blur(8px);
}

.search input::placeholder {
    color: #777;
}

.search input:focus {
    border-color: rgba(255, 255, 255, 0.35);
}

.search ul {
    list-style: none;
    margin-top: 4px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    display: none;
    backdrop-filter: blur(8px);
}

.search ul.active {
    display: block;
}

.search li {
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search li:last-child {
    border-bottom: none;
}

.search li:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* --- Legend --- */
.legend {
    position: absolute;
    bottom: 36px;
    left: 16px;
    z-index: 2;
    background: rgba(26, 26, 46, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.75rem;
    backdrop-filter: blur(8px);
    min-width: 160px;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* --- Tooltip --- */
.map-tooltip {
    position: absolute;
    z-index: 3;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.78rem;
    pointer-events: none;
    display: none;
    max-width: 220px;
    line-height: 1.5;
    backdrop-filter: blur(8px);
}

.map-tooltip .tip-name {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.map-tooltip .tip-label {
    color: #999;
    font-size: 0.7rem;
}

.map-tooltip .tip-value {
    font-weight: 600;
}

.map-tooltip .tip-section {
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 4px;
}

.map-tooltip .tip-subtitle {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #777;
    margin-bottom: 3px;
}

.map-tooltip .tip-source {
    margin-top: 5px;
    font-size: 0.6rem;
    color: #666;
}

/* --- Source line --- */
.source-line {
    position: absolute;
    bottom: 6px;
    left: 16px;
    z-index: 2;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.85);
}

.source-line a {
    color: rgba(255, 255, 255, 0.9);
}

/* --- Mobile --- */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1rem;
    }

    .search {
        top: 44px;
        left: 8px;
        right: 8px;
        width: auto;
    }

    .legend {
        bottom: 30px;
        left: 8px;
        right: 8px;
    }

    .legend-items {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 10px;
    }
}
