.election-map {
    position: relative;
    display: grid;
    grid-template-columns: minmax(240px, 32%) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    width: 100%;
    min-height: 560px;
    margin: 40px auto;
    padding: 20px;
    background: #f8faff;
    box-sizing: border-box;
    grid-column: 1/-1;
}

.election-map__filters {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    width: calc(32% - 12px);
}
.election-map__filters label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #053769;
    font-family: 'OpenSans-Bold', sans-serif;
    font-size: 12px;
}
.election-map__field { display: grid; gap: 7px; min-width: 0; }
.election-map__filters select[hidden], .election-map__dropdown-panel[hidden] { display: none; }
.election-map__dropdown { position: relative; min-width: 0; }
.election-map__dropdown-toggle {
    position: relative;
    width: 100%;
    min-height: 46px;
    padding: 12px 32px 12px 14px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 6px #05376908;
    color: #053769;
    font-family: 'OpenSans-SemiBold', sans-serif;
    font-size: 13px;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}
.election-map__dropdown-toggle::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 18px;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .15s;
}
.election-map__dropdown-toggle[aria-expanded="true"] { border-color: #377cd7; box-shadow: 0 0 0 3px #377cd714; }
.election-map__dropdown-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
.election-map__dropdown-toggle:disabled { color: #7c8c9e; cursor: wait; }
.election-map__dropdown:has(.election-map__dropdown-toggle[aria-expanded="true"]) { z-index: 4; }
.election-map__dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 4;
    width: max(100%, 240px);
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #e1e8f1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px #05376924;
}
.election-map__dropdown-search {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    margin-bottom: 6px;
    border: 1px solid #dbe4f0;
    border-radius: 9px;
    background: #f8faff;
    color: #053769;
    font-family: 'OpenSans-Regular', sans-serif;
    font-size: 13px;
}
.election-map__dropdown-options { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; color: #6e6e6e; font-size: 13px; scrollbar-width: thin; }
.election-map__dropdown-options button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 28px 11px 12px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: #053769;
    font-family: 'OpenSans-Regular', sans-serif;
    font-size: 13px;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}
.election-map__dropdown-options button:hover,
.election-map__dropdown-options button:focus-visible { background: #f0f5fc; }
.election-map__dropdown-options button[aria-pressed="true"] { position: relative; background: #eaf2ff; font-family: 'OpenSans-Bold', sans-serif; }
.election-map__dropdown-options button[aria-pressed="true"]::after { content: '✓'; position: absolute; right: 10px; color: #377cd7; }
.election-map__dropdown button:focus-visible,
.election-map__dropdown-search:focus-visible { outline: 2px solid #377cd7; outline-offset: 2px; }
@media (max-width: 768px) {
    .election-map__field:last-child .election-map__dropdown-panel { left: auto; right: 0; }
}
.election-map__filters select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 10px;
    border: 1px solid #d8dde5;
    border-radius: 7px;
    background: #fff;
    color: #053769;
    font-family: 'OpenSans-Regular', sans-serif;
    font-size: 13px;
    text-transform: none;
}
.election-map__filters select:focus-visible { outline: 2px solid #053769; outline-offset: 2px; }

.election-map__intro { align-self: end; padding-bottom: 36px; }
.election-map__intro > span {
    color: #053769;
    font-family: 'OpenSans-Bold', sans-serif;
    font-size: 12px;
    letter-spacing: 2px;
}
.election-map h2 {
    margin: 14px 0 20px;
    color: #181818;
    font-family: 'OpenSans-Bold', sans-serif;
    font-size: clamp(32px, 3.5vw, 46px);
    line-height: 1.1;
    text-wrap: nowrap;
}
.election-map__intro p {
    max-width: 390px;
    margin: 0;
    color: #6e6e6e;
    font-size: 18px;
    line-height: 1.35;
}
.election-map__intro p strong {
    font-family: 'OpenSans-Bold', sans-serif;
}
.election-map__visual { position: relative; min-width: 0; padding-bottom: 42px; }
.election-map__canvas svg { display: block; width: 100%; height: auto; }
.election-map__canvas svg [id^="AL-"] {
    cursor: pointer;
    pointer-events: visiblePainted;
    fill: #053769;
    transition: fill .15s ease;
}
.election-map__canvas.has-selection svg [id^="AL-"]:not(.is-selected) { fill: #99abc0; }
.election-map__canvas svg [id^="AL-"]:not(.is-selected):hover,
.election-map__canvas svg [id^="AL-"]:not(.is-selected):focus-visible,
.election-map__canvas.has-selection svg [id^="AL-"]:not(.is-selected):hover,
.election-map__canvas.has-selection svg [id^="AL-"]:not(.is-selected):focus-visible { fill: #377cd7; }
.election-map__canvas svg [id^="AL-"]:focus-visible { outline: none; }
.election-map__canvas svg [id^="AL-"].is-selected,
.election-map__canvas svg [id^="AL-"].is-selected:hover,
.election-map__canvas svg [id^="AL-"].is-selected:focus-visible { fill: #053769; }
.election-map__canvas svg :not([id^="AL-"]) { pointer-events: none; }

.election-map__result {
    position: absolute;
    z-index: 2;
    right: 0;
    bottom: 0;
    width: min(360px, 90%);
    padding: 18px 18px 12px;
    border: 1px solid #e0e5ea;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px #0000001a;
    color: #181818;
    box-sizing: border-box;
}
.election-map__result[hidden] { display: none; }
.election-map__close {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 0;
    background: transparent;
    color: #6e6e6e;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.election-map__result-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px 10px 0;
    border-bottom: 1px solid #e0e5ea;
    font-family: 'OpenSans-Bold', sans-serif;
    text-transform: uppercase;
}
.election-map__result-header strong {
    font-family: 'OpenSans-ExtraBold', sans-serif;
}
.election-map__result-header span { color: #6e6e6e; font-size: 12px; font-family: 'OpenSans-Bold', sans-serif; }
.election-map__candidate {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}
.election-map__candidate + .election-map__candidate { border-top: 1px solid #e0e5ea; }
.election-map__avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid #053769;
    border-radius: 50%;
    color: #053769;
    font-family: 'OpenSans-Bold', sans-serif;
    font-size: 13px;
}
.election-map__candidate-info { min-width: 0; }
.election-map__candidate-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-family: 'OpenSans-Medium', sans-serif; }
.election-map__candidate-info small,
.election-map__candidate-numbers small { display: block; margin-top: 2px; color: #053769; font-size: 10px; font-family: 'OpenSans-Regular', sans-serif; }
.election-map__candidate-numbers { text-align: right; }
.election-map__candidate-numbers strong { color: #053769; font-size: 14px; font-family: 'OpenSans-SemiBold', sans-serif; }
.election-map__candidate-numbers small { color: #333; }
.election-map__elected { margin-left: 5px; padding: 2px 5px; border-radius: 50%; background: #053769; color: #fff; font-size: 10px; }
.election-map__note { margin: 5px 0 0; color: #6e6e6e; font-size: 11px; }

@media (max-width: 768px) {
    .election-map__intro { grid-row: 1; }
    .election-map__filters { position: static; width: 100%; margin: 24px 0; grid-row: 2; }
    .election-map__visual { grid-row: 3; }
    .election-map { grid-template-columns: 1fr; min-height: 0; padding: 40px 20px; }
    .election-map__intro { padding-bottom: 0; }
    .election-map__visual { padding-bottom: 0; }
    .election-map__result { position: relative; width: 100%; margin-top: 16px; }
}
.election-map__search,
.election-map__full-results { display: none; }

@media (max-width: 768px) {
    .election-map { gap: 0; margin: 0 auto; padding: 20px; background: #f8faff; }
    .election-map__intro > span { font-size: 13px; }
    .election-map h2 { margin: 8px 0 14px; font-size: 24px; line-height: 1.2; }
    .election-map__intro p { max-width: none; font-size: 14px; line-height: 1.3; }
    .election-map__search {
        display: flex;
        height: 42px;
        margin: 26px 0 24px;
        border: 1px solid #d8dde5;
        border-radius: 7px;
        background: #fff;
        box-shadow: 0 3px 8px #00000008;
    }
    .election-map__search input {
        flex: 1;
        min-width: 0;
        padding: 0 15px;
        border: 0;
        background: transparent;
        color: #053769;
        font-family: 'OpenSans-Bold', sans-serif;
        font-size: 12px;
        outline: none;
    }
    .election-map__search button {
        position: relative;
        width: 42px;
        border: 0;
        background: transparent;
        cursor: pointer;
    }
    .election-map__search button::before {
        content: '';
        position: absolute;
        top: 11px;
        left: 10px;
        width: 15px;
        height: 15px;
        border: 1.5px solid #053769;
        border-radius: 50%;
    }
    .election-map__search button::after {
        content: '';
        position: absolute;
        top: 25px;
        left: 24px;
        width: 8px;
        height: 1.5px;
        background: #053769;
        transform: rotate(45deg);
        transform-origin: left center;
    }
    .election-map__canvas { margin: 0 -2px 18px; }
    .election-map__result {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .election-map__result-header,
    .election-map__close,
    .election-map__note { display: none; }
    .election-map__candidate { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; }
    .election-map__candidate + .election-map__candidate { border-top: 0; }
    .election-map__avatar { width: 46px; height: 46px; }
    .election-map__candidate-name { font-size: 14px; }
    .election-map__candidate-info small { margin-top: 5px; font-size: 10px; }
    .election-map__candidate-numbers strong { font-size: 13px; }
    .election-map__full-results {
        display: block;
        margin-top: 12px;
        padding: 11px 16px;
        border-radius: 7px;
        background: #053769;
        color: #fff;
        font-size: 13px;
        text-align: center;
        text-decoration: none;
    }
}
.election-map__avatar {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
}
.election-map__avatar > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
}
