body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Lekton', sans-serif;
    background-color: #ffffff;
    color: #252E6B;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
}

.map-title {
    pointer-events: none;
    text-align: center;
    margin: 0;
    padding: 16px 0 9px 0;
    font-family: "Lekton", sans-serif;
    font-weight: 400;
    font-size: clamp(18px, 4vw, 24px);
    letter-spacing: 0.5px;
    background: #fff;
    color: #252E6B;
    z-index: 1000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
    position: relative;
    text-transform: uppercase;
}

.map-subtitle {
    font-family: "Lekton", sans-serif;
    text-align: center;
    margin: 0;
    padding: 0 0 16px 0;
    font-size: clamp(14px, 3vw, 19px);
    letter-spacing: 0.5px;
    color: #252E6B;
    background: #fff;
    font-weight: 300;
    z-index: 1000;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: translateZ(0);
}

.top-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    z-index: 10;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-controls span {
    color: #252e6b;
    font-size: 18px;
    font-weight: 400;
    white-space: nowrap;
}

/* Custom Dropdown Styles (copied for consistency) */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    font-family: 'Lekton', monospace;
    font-size: 20px;
    color: #252e6b;
    z-index: 1000;
}

.custom-select-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 25px 2px 10px;
    font-weight: 400;
    cursor: pointer;
    border-bottom: 2px solid #252e6b;
    background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 140 140' width='20' height='20' xmlns='http://www.w3.org/2000/svg'><g><polyline points='0,40 50,100 100,40' fill='none' stroke='rgb(37,46,107)' stroke-width='12px'/></g></svg>") no-repeat right 5px center;
    background-size: 14px;
    min-width: 260px;
    transition: all 150ms ease;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    line-height: 1.4;
}

.trigger-text {
    position: absolute;
    left: 10px;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
}

.longest-option-ghost {
    visibility: hidden;
    pointer-events: none;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 5px;
    background: #ffffff;
    border: 2px solid #252e6b;
    display: none;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    box-sizing: border-box;
    max-height: 300px;
    overflow-y: auto;
}

.custom-select-wrapper.open .custom-select-options {
    display: flex;
}

.custom-option {
    padding: 10px 20px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    background: #ffffff;
    white-space: nowrap;
}

.custom-option:hover {
    background: #e6e6e6;
}

.custom-option.selected {
    background: #f0f0f0;
}


.chart-wrapper {
    flex-grow: 1;
    position: relative;
    padding: 10px;
    min-height: 0;
    box-sizing: border-box;
    background: #fff;
}

#chart-container {
    width: 100%;
    height: 100%;
}

.back-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: #f4f4f4;
    color: #1a1a1a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: none;
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
}

.back-button:hover {
    transform: scale(1.05);
    background: #e8e8e8;
}

.back-button svg {
    width: 40px !important;
    height: 40px !important;
}

.back-button path,
.back-button:hover path {
    stroke: none !important;
}

.bubble-label {
    fill: #ffffff;
    font-family: 'Lekton', monospace;
    font-weight: 700;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.node:hover circle {
    filter: brightness(1.2);
}

.tooltip {
    position: absolute;
    width: max-content;
    background: #ffffff;
    border: none;
    padding: 8px 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    pointer-events: none;
    z-index: 10000;
    font-family: 'Lekton', monospace;
    color: #252e6b;
    transition: opacity 0.15s ease-out, transform 0.2s ease-out;
    opacity: 0;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: var(--pointer-left, 50%);
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

.tooltip.flipped::after {
    top: -8px;
    bottom: auto;
    border-top: none;
    border-bottom: 8px solid #ffffff;
}

.tooltip.no-arrow::after {
    display: none;
}

/* ========================================== */
/* Mobile Responsiveness                      */
/* ========================================== */
@media (max-width: 768px) {
    .container {
        height: 100dvh;
        overflow: hidden;
    }

    .map-title {
        padding: 10px 10px 5px 10px;
    }

    .top-controls {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
        padding: 5px 10px 10px 10px;
    }

    .control-group span {
        font-size: 16px !important;
    }

    .custom-select-wrapper {
        font-size: 15px !important;
        min-width: 0 !important;
    }

    #year-select-container .custom-select-wrapper {
        z-index: 1010;
    }

    .custom-select-trigger {
        min-width: 0 !important;
        padding: 2px 25px 2px 10px;
    }

    .custom-option {
        font-size: 15px !important;
    }

    .chart-wrapper {
        flex: 1;
        min-height: 0;
        height: auto;
        width: 100%;
        padding: 0;
    }

    .back-button {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .back-button svg {
        width: 30px !important;
        height: 30px !important;
    }
}