.cw-halls-dashboard {
    --cw-halls-surface: color-mix(in srgb, var(--bg-elevated) 92%, var(--cw-blue) 4%);
    --cw-halls-border: color-mix(in srgb, var(--border-strong) 76%, var(--cw-blue) 24%);
    padding: 10px 0 66px;
}

.cw-halls-data-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 16px 18px;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--warning) 12%, var(--bg-elevated));
    border: 1px solid color-mix(in srgb, var(--warning) 48%, var(--border-strong));
    border-radius: 7px;
}

.cw-halls-data-notice .fas {
    color: var(--warning);
}

.cw-halls-data-notice p {
    margin: 0;
}

.cw-halls-map-section {
    padding-top: 10px;
}

.cw-halls-map-layout {
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
}

.cw-halls-map-panel {
    min-width: 0;
}

.cw-halls-map-search {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 800;
    width: 230px;
    max-width: calc(100% - 24px);
}

.cw-halls-map-search-bar {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) 22px 18px;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 5px 6px 5px 10px;
    background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg-primary));
    backdrop-filter: blur(12px);
    border: 1px solid var(--cw-halls-border);
    border-radius: 7px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.30);
    cursor: text;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.cw-halls-map-search-bar:focus-within,
.cw-halls-map-search-bar:hover {
    border-color: var(--cw-blue);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), 0 0 0 3px color-mix(in srgb, var(--cw-blue) 10%, transparent);
    transform: translateY(-1px);
}

.cw-halls-map-search-bar > .fas {
    color: var(--cw-blue);
    font-size: 0.76rem;
    flex-shrink: 0;
}

.cw-halls-map-search-bar input {
    width: 100%;
    min-width: 0;
    min-height: 26px;
    padding: 1px 0 2px;
    color: var(--text-heading);
    font-size: 0.85rem;
    font-weight: 650;
    line-height: 1.35;
    background: transparent;
    border: 0;
    border-bottom: 2px solid color-mix(in srgb, var(--cw-blue) 48%, transparent);
    caret-color: var(--cw-blue);
    outline: 0;
}

.cw-halls-map-search-bar:focus-within input {
    border-bottom-color: var(--cw-blue);
}

.cw-halls-map-search-bar input::placeholder {
    color: var(--text-muted);
}

.cw-halls-icon-button {
    display: grid;
    width: 22px;
    height: 22px;
    padding: 0;
    place-items: center;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.cw-halls-icon-button:hover {
    color: var(--cw-blue);
    background: color-mix(in srgb, var(--cw-blue) 12%, transparent);
}

.cw-halls-search-submit {
    display: grid;
    width: 18px;
    height: 18px;
    padding: 0;
    place-items: center;
    color: var(--cw-black);
    background: var(--cw-blue);
    border: 0;
    border-radius: 5px;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.cw-halls-search-submit .fas {
    font-size: 0.58rem;
}

.cw-halls-search-submit:hover,
.cw-halls-search-submit:focus-visible {
    background: var(--cw-blue-dark);
    outline: 0;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--cw-blue) 24%, transparent);
    transform: translateY(-1px);
}

.cw-halls-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    overflow: hidden;
    background: color-mix(in srgb, var(--bg-elevated) 94%, #102b30 6%);
    border: 1px solid color-mix(in srgb, var(--border-strong) 72%, var(--cw-blue) 28%);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
    z-index: 850;
}

.cw-halls-search-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    width: 100%;
    min-height: 54px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.cw-halls-search-result:last-child {
    border-bottom: 0;
}

.cw-halls-search-result:hover,
.cw-halls-search-result:focus-visible {
    color: var(--cw-blue);
    background: color-mix(in srgb, var(--cw-blue) 9%, transparent);
    outline: 0;
}

.cw-halls-search-result strong,
.cw-halls-search-result small {
    display: block;
}

.cw-halls-search-result strong {
    font-size: 0.86rem;
}

.cw-halls-search-result small {
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.cw-halls-search-result > span {
    align-self: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.cw-halls-map-frame {
    position: relative;
    min-height: 470px;
    background: #142d34;
}

#halls-world-map {
    width: 100%;
    height: 470px;
    background: #142d34;
}

.cw-halls-map-loading {
    position: absolute;
    z-index: 20;
    top: 50%;
    left: 50%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    color: #dcf0ee;
    font-size: 0.82rem;
    background: rgba(7, 24, 28, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 5px;
    transform: translate(-50%, -50%);
}

.cw-halls-map-loading.is-hidden {
    display: none;
}

.cw-halls-map-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    padding: 10px 15px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    font-size: 0.74rem;
}

.cw-halls-map-footer > span:first-child {
    color: var(--text-secondary);
    font-weight: 700;
}

.cw-halls-legend {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    white-space: nowrap;
}

.cw-halls-legend i {
    display: block;
    width: 128px;
    height: 7px;
    background: linear-gradient(90deg, #2176a4 0%, #16a8a2 34%, #e0ad43 66%, #de6857 100%);
    border-radius: 999px;
}

.cw-halls-map-frame .leaflet-container {
    font-family: inherit;
}

.cw-halls-map-frame .leaflet-control-zoom a {
    color: #102b30;
}

.cw-halls-map-frame .leaflet-control-attribution {
    color: #adc3c6;
    background: rgba(16, 43, 48, 0.78);
    font-size: 9px;
}

.cw-halls-map-frame .leaflet-control-attribution a {
    color: #d7f2ef;
}

.cw-halls-map-tooltip {
    min-width: 210px;
    max-width: 280px;
    padding: 10px 11px;
    color: #eafafa;
    background: #102b30;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
    font-family: inherit;
    font-size: 0.76rem;
    line-height: 1.45;
    white-space: normal;
}

.cw-halls-map-tooltip::before {
    border-top-color: #102b30;
}

.cw-halls-tooltip-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.17);
}

.cw-halls-tooltip-head strong,
.cw-halls-tooltip-head span,
.cw-halls-tooltip-head small {
    display: block;
}

.cw-halls-tooltip-head strong {
    color: #ffffff;
    font-size: 0.9rem;
}

.cw-halls-tooltip-head small {
    margin-top: 2px;
    color: #a8cfca;
    font-size: 0.68rem;
}

.cw-halls-tooltip-head span {
    padding: 2px 5px;
    color: #84ece1;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: rgba(59, 216, 199, 0.14);
    border-radius: 3px;
}

.cw-halls-tooltip-score {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.cw-halls-tooltip-score strong {
    color: #ffffff;
    font-size: 1.45rem;
    line-height: 1;
}

.cw-halls-tooltip-score span {
    color: #b2d5d0;
    font-size: 0.7rem;
    text-align: right;
}

.cw-halls-tooltip-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 9px;
}

.cw-halls-tooltip-scores span {
    display: block;
    padding: 4px 3px;
    color: #b7d6d2;
    font-size: 0.63rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.cw-halls-tooltip-scores b {
    margin-left: 3px;
    color: #ffffff;
}

.cw-halls-tooltip-label {
    color: #84ece1 !important;
    font-weight: 800;
    white-space: nowrap;
}

.cw-halls-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--cw-blue);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    line-height: 1.35;
    text-transform: uppercase;
}

.cw-halls-country-dialog {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: grid;
    place-items: center;
    padding: 18px;
}

.cw-halls-country-dialog[hidden] {
    display: none;
}

.cw-halls-country-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 20, 23, 0.68);
    backdrop-filter: blur(7px);
}

.cw-halls-country-dialog-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: min(660px, calc(100vh - 36px));
    overflow: auto;
    padding: 25px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-elevated) 94%, #102b30 6%);
    border: 1px solid color-mix(in srgb, var(--border-strong) 72%, var(--cw-blue) 28%);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.cw-halls-country-dialog-close {
    position: absolute;
    top: 13px;
    right: 13px;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--text-muted) 10%, transparent);
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
}

.cw-halls-country-dialog-close:hover,
.cw-halls-country-dialog-close:focus-visible {
    color: var(--text-heading);
    background: color-mix(in srgb, var(--cw-blue) 12%, transparent);
    border-color: color-mix(in srgb, var(--cw-blue) 35%, transparent);
    outline: 0;
}

.cw-halls-country-dialog-panel h2 {
    max-width: calc(100% - 48px);
    margin: 7px 0 8px;
    color: var(--text-heading);
    font-size: 1.55rem;
    line-height: 1.18;
}

.cw-halls-country-dialog-panel > p:not(.cw-halls-kicker) {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.cw-halls-country-dialog-scores {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 18px;
}

.cw-halls-country-dialog-score {
    min-width: 0;
    padding: 11px;
    background: color-mix(in srgb, var(--cw-blue) 8%, var(--bg-primary));
    border: 1px solid color-mix(in srgb, var(--cw-blue) 24%, var(--border-color));
    border-radius: 7px;
}

.cw-halls-country-dialog-score span,
.cw-halls-country-dialog-score strong,
.cw-halls-country-dialog-score small {
    display: block;
}

.cw-halls-country-dialog-score span {
    color: var(--cw-blue);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.2;
}

.cw-halls-country-dialog-score strong {
    margin-top: 5px;
    color: var(--text-heading);
    font-size: 1.35rem;
    line-height: 1;
}

.cw-halls-country-dialog-score small {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.3;
}

.cw-halls-country-dialog-score.cw-halls-dialog-score-context span {
    color: var(--cw-blue);
}

.cw-halls-country-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.cw-halls-dialog-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 15px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 800;
    background: var(--bg-primary);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    cursor: pointer;
}

.cw-halls-dialog-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 17px;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
    background: var(--cw-blue);
    border: 1px solid transparent;
    border-radius: 7px;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.cw-halls-dialog-primary:hover,
.cw-halls-dialog-primary:focus-visible {
    color: #fff;
    background: color-mix(in srgb, var(--cw-blue) 84%, #000);
    outline: 0;
}

.cw-halls-dialog-secondary:hover,
.cw-halls-dialog-secondary:focus-visible {
    color: var(--text-heading);
    border-color: color-mix(in srgb, var(--cw-blue) 55%, var(--border-strong));
    outline: 0;
}

body.cw-halls-dialog-open {
    overflow: hidden;
}

body.light-mode .cw-halls-map-frame,
body.light-mode #halls-world-map {
    background: #d6e8ea;
}

@media (max-width: 820px) {
    .cw-halls-dashboard {
        padding-top: 30px;
    }
}

@media (max-width: 600px) {
    .cw-halls-dashboard {
        padding-bottom: 50px;
    }

    .cw-halls-map-section {
        padding-top: 6px;
    }

    .cw-halls-map-layout {
        margin-right: -2%;
        margin-left: -2%;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .cw-halls-map-search {
        top: 9px;
        right: 9px;
        left: 9px;
        width: auto;
        max-width: none;
    }

    .cw-halls-map-search-bar {
        min-height: 36px;
    }

    .cw-halls-map-frame,
    #halls-world-map {
        height: 360px;
        min-height: 360px;
    }

    .cw-halls-map-footer {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .cw-halls-map-footer > span:last-child {
        display: none;
    }

    .cw-halls-country-dialog-panel {
        padding: 22px 17px;
    }

    .cw-halls-country-dialog-panel h2 {
        font-size: 1.35rem;
    }

    .cw-halls-country-dialog-scores {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cw-halls-country-dialog-actions {
        justify-content: stretch;
    }

    .cw-halls-dialog-secondary,
    .cw-halls-dialog-primary {
        width: 100%;
    }
}

/* Polish: consistent ~12px radius on every contained surface.
   The map box keeps its corners (rounded on desktop, full-bleed
   flat on the smallest screens). */
.cw-halls-data-notice,
.cw-halls-search-results,
.cw-halls-country-dialog-panel {
    border-radius: 12px;
}

@media (min-width: 601px) {
    .cw-halls-map-layout,
    .cw-halls-map-search-bar,
    .cw-halls-map-frame {
        border-radius: 12px;
    }
}

@media (max-width: 600px) {
    .cw-halls-map-layout {
        border-radius: 0;
    }
}

/* =====================================================
   Small-screen map compaction and expansion
   ===================================================== */
.cw-halls-map-expand {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 810;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 11px;
    color: var(--text-heading);
    background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg-primary));
    border: 1px solid var(--cw-halls-border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.cw-halls-map-expand:hover,
.cw-halls-map-expand:focus-visible {
    color: var(--cw-blue);
    border-color: var(--cw-blue);
    outline: 0;
}

body.cw-lab-map-expanded {
    overflow: hidden;
}

.cw-halls-map-frame.is-map-expanded {
    position: fixed;
    inset: 12px;
    z-index: 1500;
    height: auto !important;
    min-height: 0 !important;
    border: 1px solid color-mix(in srgb, var(--cw-blue) 38%, var(--border-strong));
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
}

.cw-halls-map-frame.is-map-expanded #halls-world-map {
    height: 100% !important;
    min-height: 0 !important;
}

.cw-halls-map-frame.is-map-expanded .cw-halls-map-search {
    width: min(360px, calc(100% - 24px));
}

@media (max-width: 820px) {
    .cw-halls-dashboard {
        padding-top: 16px;
        padding-bottom: 46px;
    }

    .cw-halls-map-section {
        padding-top: 8px;
    }
}

@media (max-width: 600px) {
    .cw-halls-dashboard {
        padding-top: 10px;
        padding-bottom: 36px;
    }

    .cw-halls-map-frame,
    #halls-world-map {
        height: 270px;
        min-height: 270px;
    }

    .cw-halls-map-expand {
        bottom: 10px;
        left: 9px;
        min-height: 30px;
        padding: 0 9px;
        font-size: 0.72rem;
    }

    .cw-halls-map-frame.is-map-expanded {
        inset: 8px;
    }

    .cw-halls-map-footer {
        min-height: 38px;
        padding: 8px 10px;
    }

    .cw-halls-country-dialog-panel {
        max-height: min(560px, calc(100vh - 28px));
    }
}

@media (max-width: 430px) {
    .cw-halls-map-frame,
    #halls-world-map {
        height: 235px;
        min-height: 235px;
    }

    .cw-halls-map-frame.is-map-expanded {
        height: auto !important;
        min-height: 0 !important;
    }

    .cw-halls-legend i {
        width: 86px;
    }

    .cw-halls-country-dialog-scores {
        gap: 7px;
    }

    .cw-halls-country-dialog-score {
        padding: 9px;
    }
}
