/* ===============================================
   WORLD MAP STYLES
   =============================================== */

.wm-page {
    background: var(--bg-dark);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.wm-page .study-workspace {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
}

.wm-page .study-main {
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.wm-topbar-title {
    font-size: 1rem;
    letter-spacing: 0;
}

/* Map Container */
.wm-game {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    background: radial-gradient(circle at center, #0B2C46 0%, #031424 100%); /* Deep ocean gradient */
}

/* Light mode override for ocean */
html:not([data-theme="dark"]) .wm-game {
     background: radial-gradient(circle at center, #E6F3FB 0%, #BFE5FF 100%);
}

.wm-map-container {
    flex: 1;
    position: relative;
    cursor: grab;
    z-index: 10;
}

.wm-map-container:active {
    cursor: grabbing;
}

.wm-map-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* While the download snapshot inlines computed styles, in-flight fill/opacity
   transitions must resolve to their final values instantly. */
.wm-map-svg.is-exporting,
.wm-map-svg.is-exporting * {
    transition: none !important;
}

/* Loading State */
.wm-map-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    z-index: 100;
    gap: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    transition: opacity 0.4s ease;
}

.wm-map-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.wm-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-glass);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: wmspin 1s linear infinite;
}

@keyframes wmspin {
    to { transform: rotate(360deg); }
}

/* Country Styles */
.country-path {
    stroke: rgba(255, 255, 255, 0.45);
    stroke-width: 0.9px;
    stroke-linejoin: round;
    transition: fill 0.35s ease, opacity 0.2s ease, stroke 0.2s ease;
    cursor: pointer;
    vector-effect: non-scaling-stroke; /* Keeps borders thin and crisp at all zoom levels */
}
html:not([data-theme="dark"]) .country-path {
    stroke: rgba(0, 0, 0, 0.2);
}

/* Hover/active must not repaint fills while a statistics choropleth is active */
.wm-game:not(.is-stat-mode) .country-path:hover {
    fill: rgba(16, 185, 129, 0.05) !important; /* Subtle green overlay */
    stroke: #10B981 !important; /* Glowing green outline */
    stroke-width: 0.8px !important; /* 80% thinner than before */
    filter: drop-shadow(0 0 1.5px rgba(16, 185, 129, 0.75)); /* Soft, tiny glow */
}
.wm-game.is-stat-mode .country-path:hover {
    stroke: #ffffff !important;
    stroke-width: 1.1px !important;
    filter: brightness(1.12) drop-shadow(0 0 2px rgba(255, 255, 255, 0.45));
}

.wm-game:not(.is-stat-mode) .country-path.active {
    fill: rgba(16, 185, 129, 0.12) !important;
    stroke: #10B981 !important;
    stroke-width: 1.2px !important;
    filter: drop-shadow(0 0 2.5px rgba(16, 185, 129, 0.85));
}
.wm-game.is-stat-mode .country-path.active {
    stroke: #10B981 !important;
    stroke-width: 1.3px !important;
    filter: brightness(1.15) drop-shadow(0 0 3px rgba(16, 185, 129, 0.8));
}

.wm-game.is-stat-mode .country-path.is-stat-nodata {
    stroke: rgba(148, 163, 184, 0.35);
}

.country-path.is-hidden-by-filter,
.country-label.is-hidden-by-filter,
.capital-group.is-hidden-by-filter {
    opacity: 0;
    pointer-events: none;
}

.country-path.is-dimmed-by-layer {
    opacity: 0.18;
}

.country-path.is-gray-by-layer {
    opacity: 0.78;
    stroke: rgba(71, 85, 105, 0.28);
    filter: none;
}

.country-label.is-dimmed-by-layer {
    opacity: 0.25;
}

.country-label.is-gray-by-layer {
    opacity: 0.58;
}

.country-path.is-layer-member {
    stroke-width: 1px;
    filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.2));
}

/* Lakes, seas, oceans, and tiny-country markers */
.water-feature {
    fill: rgba(56, 189, 248, 0.32);
    stroke: rgba(14, 165, 233, 0.65);
    stroke-width: 0.55px;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    cursor: help;
    transition: fill 0.2s ease, stroke 0.2s ease, opacity 0.2s ease;
}

.water-feature:hover {
    fill: rgba(56, 189, 248, 0.5);
    stroke: #38BDF8;
}

.water-label {
    fill: rgba(224, 242, 254, 0.9);
    stroke: rgba(15, 23, 42, 0.72);
    stroke-width: 0.75px;
    paint-order: stroke;
    font-family: var(--font-body);
    font-size: 8.8px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: all;
    cursor: help;
    transition: opacity 0.2s ease;
}

.water-label--ocean {
    fill: rgba(186, 230, 253, 0.72);
    font-size: 9.5px;
}

html:not([data-theme="dark"]) .water-label {
    fill: #075985;
    stroke: rgba(255, 255, 255, 0.86);
}

.small-country-group {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.small-country-marker {
    fill: #FACC15;
    stroke: #0F172A;
    stroke-width: 0.7px;
    vector-effect: non-scaling-stroke;
    opacity: 0.72;
}

.small-country-hit-area {
    fill: transparent;
    stroke: transparent;
    pointer-events: all;
}

.small-country-group:hover .small-country-marker,
.small-country-group.active .small-country-marker {
    fill: #10B981;
    stroke: white;
    opacity: 0.95;
}

.small-country-marker-label {
    fill: white;
    stroke: rgba(15, 23, 42, 0.82);
    stroke-width: 0.9px;
    paint-order: stroke;
    font-family: var(--font-body);
    font-size: 7.6px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

html:not([data-theme="dark"]) .small-country-marker-label {
    fill: #0F172A;
    stroke: rgba(255, 255, 255, 0.88);
}

.small-country-group.is-hidden-by-filter {
    opacity: 0;
    pointer-events: none;
}

.small-country-group.is-dimmed-by-layer {
    opacity: 0.25;
}

.small-country-group.is-gray-by-layer .small-country-marker {
    fill: #94A3B8;
    stroke: #475569;
    filter: none;
}

/* Labels */
.country-label,
.country-label tspan {
    fill: white;
    font-family: var(--font-body);
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none !important; /* Crucial: lets clicks pass through text lines to the path beneath */
    text-shadow: 0px 1px 3px rgba(0,0,0,0.8), 0px 0px 1px rgba(0,0,0,0.5);
    opacity: 1;
    transition: opacity 0.3s ease;
}
html:not([data-theme="dark"]) .country-label {
    fill: #0F172A;
    text-shadow: 0px 1px 3px rgba(255,255,255,0.8), 0px 0px 1px rgba(255,255,255,0.9);
}

.country-label--tiny {
    opacity: 0;
    stroke: rgba(15, 23, 42, 0.78);
    stroke-width: 1.35px;
    paint-order: stroke;
}

html:not([data-theme="dark"]) .country-label--tiny {
    stroke: rgba(255, 255, 255, 0.9);
}

/* Hide capital dots completely */
.capital-group {
    display: none;
}

/* Capitals */
.capital-marker {
    fill: #FCD34D;
    stroke: #0F172A;
    stroke-width: 0.5px;
    cursor: pointer;
    transition: all 0.2s flex;
    pointer-events: all;
}

.capital-marker:hover {
    fill: white;
    transform: scale(1.5);
}

.capital-glow {
    fill: rgba(252, 211, 77, 0.4);
    pointer-events: none;
    animation: wmpulse 2s infinite;
}

@keyframes wmpulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

/* UI Controls Layer */
.wm-ui-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; /* Let clicks pass to map */
    z-index: 20;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Search Bar */
.wm-search-container {
    position: absolute;
    top: 24px;
    right: 320px; /* Offset by panel width roughly */
    pointer-events: all;
    z-index: 30;
    width: 320px;
    transition: right 0.3s ease;
}
.wm-panel--active ~ .wm-search-container {
    right: 480px; /* Move out of way */
}

@media (max-width: 1100px) {
    .wm-search-container { right: 24px; }
    .wm-panel--active ~ .wm-search-container { right: 24px; top: -100px; } /* Hide behind top bar */
}

.wm-search-input-wrapper {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
    display: flex;
    align-items: center;
    padding: 10px 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.wm-search-input-wrapper i {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-right: 12px;
}

.wm-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
}

.wm-search-input::placeholder {
    color: var(--text-muted);
}

.wm-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--shadow-glass);
    display: none;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.wm-search-results.active {
    display: block;
}

.wm-search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-glass);
}
.wm-search-result-item:last-child {
    border-bottom: none;
}

.wm-search-result-item:hover, .wm-search-result-item.selected {
    background: rgba(16, 185, 129, 0.1);
}

.wm-search-result-flag {
    font-size: 1.2rem;
}
.wm-search-result-name {
    font-weight: 600;
    color: var(--text-primary);
}


/* Zoom Controls — floating bottom-right pill */
.wm-controls {
    position: absolute;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    z-index: 40;
    transition: right 0.3s ease;
}

.wm-page:has(#wm-panel.wm-panel--active) .wm-controls {
    right: 494px;
}
@media (max-width: 1100px) {
    .wm-page:has(#wm-panel.wm-panel--active) .wm-controls { right: 24px; }
}


.wm-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.wm-control-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-purple);
}

.wm-control-btn.is-busy {
    pointer-events: none;
    opacity: 0.55;
}

.wm-control-btn.is-busy i {
    animation: wmspin 1s linear infinite;
}


/* Tooltip */
.wm-tooltip {
    position: absolute;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    white-space: nowrap;
}

.wm-tooltip__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

.wm-tooltip__stat {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed var(--border-glass);
    font-size: 0.74rem;
}
.wm-tooltip__stat span {
    color: var(--text-muted);
    font-weight: 600;
}
.wm-tooltip__stat strong {
    color: var(--accent-purple);
    font-weight: 700;
}
.wm-tooltip.visible {
    opacity: 1;
}

/* Map Settings */
.wm-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.wm-settings-backdrop.is-open {
    opacity: 1;
    pointer-events: all;
}

.wm-settings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(940px, calc(100% - 48px));
    height: min(680px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 22px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
    padding: 22px;
    z-index: 80;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wm-settings.is-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.wm-settings__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.wm-settings__eyebrow {
    color: var(--accent-purple);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wm-settings h2 {
    margin: 4px 0 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.45rem;
}

.wm-settings__close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.wm-settings__body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    height: calc(100% - 82px);
    min-height: 0;
}

.wm-settings__panel {
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 18px;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.wm-settings__panel--layers {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.wm-settings__group {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.wm-settings__group label {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wm-settings__select {
    width: 100%;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    padding: 12px 14px;
    outline: none;
}

.wm-layer-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.wm-settings__switch {
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.wm-settings__switch-knob {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    position: relative;
    flex-shrink: 0;
}

.wm-settings__switch-knob::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.wm-settings__switch.is-active .wm-settings__switch-knob {
    background: var(--accent-purple);
}

.wm-settings__switch.is-active .wm-settings__switch-knob::after {
    transform: translateX(18px);
}

.wm-settings__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
}

.wm-settings__reset,
.wm-settings__apply {
    width: 100%;
    border: none;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.wm-settings__reset {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.wm-settings__apply {
    background: var(--accent-purple);
    color: white;
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.2);
}

.wm-layer-toolbar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.wm-layer-toolbar label {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wm-layer-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px 12px;
}

.wm-layer-search i {
    color: var(--text-muted);
}

.wm-layer-search input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
}

.wm-layer-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-shrink: 0;
    padding: 2px 0 12px;
    margin-bottom: 4px;
}

.wm-layer-category {
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 8px 12px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.wm-layer-category.is-active {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.34);
    color: var(--accent-purple);
}

.wm-layer-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 10px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.wm-layer-option {
    min-height: 72px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    display: grid;
    grid-template-columns: 12px 1fr 24px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.wm-layer-option:hover {
    transform: translateY(-1px);
    border-color: rgba(16, 185, 129, 0.32);
}

.wm-layer-option.is-selected {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.42);
}

.wm-layer-option__swatch {
    width: 10px;
    height: 42px;
    border-radius: 99px;
}

.wm-layer-option__text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.wm-layer-option__text strong {
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wm-layer-option__text span {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wm-layer-option__check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.18);
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.wm-layer-option.is-selected .wm-layer-option__check {
    background: var(--accent-purple);
    color: white;
}

.wm-layer-empty {
    grid-column: 1 / -1;
    color: var(--text-secondary);
    padding: 20px;
    text-align: center;
}

.wm-layer-legend {
    position: absolute;
    left: 24px;
    top: 84px; /* below the statistics pill */
    bottom: auto;
    max-width: min(460px, calc(100vw - 160px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
    color: var(--text-primary);
    padding: 16px 18px;
    z-index: 30;
    animation: wmLegendIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes wmLegendIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wm-layer-legend__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    margin-bottom: 6px;
}

.wm-layer-legend__layers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.wm-layer-legend__tab {
    align-items: center;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    display: inline-flex;
    overflow: hidden;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.wm-layer-legend__tab:hover {
    border-color: rgba(16, 185, 129, 0.35);
}

.wm-layer-legend__tab.is-active {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.45);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.14);
}

.wm-layer-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 0;
    padding: 7px 10px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.wm-layer-legend__close {
    align-items: center;
    align-self: stretch;
    background: transparent;
    border: 0;
    border-left: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 0.86rem;
    justify-content: center;
    min-width: 30px;
    padding: 0 8px 0 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.wm-layer-legend__tab.is-active .wm-layer-legend__close {
    border-left-color: rgba(15, 23, 42, 0.08);
    color: var(--text-secondary);
}

.wm-layer-legend__close:hover,
.wm-layer-legend__close:focus-visible {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    outline: none;
}

.wm-layer-legend__swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.wm-layer-legend__desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.wm-layer-profile {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-glass);
}

.wm-layer-profile__hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.wm-layer-profile__header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 900;
    margin-bottom: 10px;
}

.wm-layer-profile__grid {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 7px 10px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.wm-layer-profile__grid span {
    color: var(--text-muted);
    font-weight: 800;
}

.wm-layer-profile__grid strong {
    color: var(--text-primary);
}

.wm-layer-profile p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.45;
    margin: 0 0 10px;
}

.wm-layer-profile__section {
    display: grid;
    gap: 5px;
    margin-bottom: 10px;
}

.wm-layer-profile__label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wm-layer-profile__fact {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    padding: 10px 12px;
}

.wm-layer-profile__link {
    align-items: center;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 10px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 900;
    gap: 7px;
    justify-content: center;
    margin-top: 10px;
    padding: 10px 12px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    width: 100%;
}

.wm-layer-profile__link:hover {
    background: rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

/* ─── INFO PANEL ─── */
.wm-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 440px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-glass);
    box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    pointer-events: all;
    transform: translateX(110%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 50; /* ensure it is above search */
}

.wm-panel--active {
    transform: translateX(0);
}

.wm-panel-header {
    position: relative;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--gold-bg); /* fallback */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: white;
}

.wm-panel-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.7));
}

.wm-panel-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.wm-panel-close:hover {
    background: rgba(0,0,0,0.6);
}

.wm-panel-title-area {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.wm-panel-flag {
    font-size: 3.5rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    flex-shrink: 0;
}

.wm-panel-titles {
    flex: 1;
    min-width: 0; /* allow long country names to wrap instead of overflowing */
}

.wm-panel-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 4px 0;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    overflow-wrap: anywhere;
}

.wm-panel-continent {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.9);
}

.wm-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.wm-panel-body::-webkit-scrollbar { width: 6px; }
.wm-panel-body::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 10px; }

/* Fact Grid */
.wm-fact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wm-fact-card {
    background: var(--bg-dark); /* Contrast with surface */
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wm-fact-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.wm-fact-info {
    flex: 1;
}

.wm-fact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wm-fact-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wm-fact-source {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Sections */
.wm-section {
    margin-bottom: 24px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
}

.wm-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

.wm-section-title i {
    color: var(--accent-purple);
}

.wm-desc-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.wm-country-wikipedia-link {
    align-items: center;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 10px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    padding: 10px 12px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    width: 100%;
}

.wm-country-wikipedia-link:hover {
    background: rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

.wm-country-wikipedia-link i {
    font-size: 1rem;
}

/* Highlight Box (Fun Fact) */
.wm-fun-fact {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.wm-fun-fact::before {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 4rem;
    height: 4rem;
    background: url('../images/emojis/bulb.svg') center / contain no-repeat;
    opacity: 0.1;
    transform: rotate(15deg);
}

.wm-fun-fact-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 8px;
}

.wm-fun-fact p {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 500;
    line-height: 1.5;
}

.wm-recognition-list,
.wm-membership-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.wm-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.wm-chip--layer {
    cursor: pointer;
    gap: 6px;
    padding: 7px 12px 7px 8px;
    font-family: inherit;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.16s ease, box-shadow 0.2s ease;
}

.wm-chip--layer:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

.wm-chip--layer:active {
    transform: translateY(0) scale(0.97);
}

.wm-chip--layer.is-active {
    background: rgba(6, 182, 212, 0.14);
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.wm-chip__swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .wm-panel {
        width: 100%;
        height: 60vh;
        top: auto;
        bottom: 0;
        transform: translateY(110%);
        border-left: none;
        border-top: 1px solid var(--border-glass);
        border-radius: 24px 24px 0 0;
    }
    
    .wm-panel--active {
        transform: translateY(0);
    }
    
    .wm-search-container {
        width: calc(100% - 48px);
        left: 24px;
        right: 24px;
    }

    .wm-settings {
        width: calc(100% - 24px);
        height: calc(100% - 16px);
        max-height: calc(100% - 16px);
        padding: 16px;
    }

    .wm-settings__body {
        grid-template-columns: 1fr;
        min-height: 0;
        height: calc(100% - 78px);
        max-height: none;
        overflow-y: auto;
    }

    .wm-layer-list {
        grid-template-columns: 1fr;
    }

    .wm-layer-legend {
        left: 16px;
        right: 16px;
        top: 96px;
        bottom: auto;
        max-width: none;
        max-height: 38vh;
    }
}

@media (max-width: 768px) {
    .wm-page,
    .wm-page .study-workspace,
    .wm-page .study-main {
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }

    .wm-content {
        width: 100%;
        min-width: 0;
    }

    .wm-search-container {
        top: 14px;
        left: 14px;
        right: 14px;
        width: auto;
        max-width: none;
    }

    .wm-panel--active ~ .wm-search-container {
        top: -120px;
        right: 14px;
    }

    .wm-search-input-wrapper {
        min-height: 48px;
        border-radius: 14px;
    }

    .wm-search-input {
        min-height: 44px;
        min-width: 0;
    }

    .wm-settings {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        height: min(88dvh, 720px);
        max-height: min(88dvh, 720px);
        padding: 14px;
        border-radius: 22px 22px 0 0;
        transform: translateY(105%);
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .wm-settings.is-open {
        transform: translateY(0);
    }

    .wm-settings__header {
        align-items: center;
        gap: 12px;
    }

    .wm-settings h2 {
        font-size: 1.15rem;
    }

    .wm-settings__close,
    .wm-settings__reset,
    .wm-settings__apply,
    .wm-settings__switch,
    .wm-layer-category,
    .wm-layer-option {
        min-height: 44px;
    }

    .wm-settings__close {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .wm-settings__body {
        grid-template-columns: 1fr;
        gap: 12px;
        height: calc(100% - 70px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }

    .wm-settings__panel {
        padding: 14px;
        overflow: hidden;
        max-width: 100%;
    }

    .wm-settings__panel--layers {
        min-height: 420px;
        overflow: hidden;
    }

    .wm-layer-search input {
        min-height: 44px;
    }

    .wm-layer-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        -webkit-overflow-scrolling: touch;
    }

    .wm-layer-category {
        flex: 0 0 auto;
        padding: 9px 14px;
    }

    .wm-layer-list {
        grid-template-columns: 1fr !important;
        overflow: visible;
    }

    .wm-layer-option {
        grid-template-columns: 12px minmax(0, 1fr) 28px;
    }

    .wm-layer-option__text strong {
        white-space: normal;
    }

    .wm-layer-legend {
        top: 84px;
        left: 12px;
        right: 12px;
        max-height: 34vh;
        border-radius: 14px;
    }

    .wm-fact-grid,
    .wm-layer-profile__grid {
        grid-template-columns: 1fr;
    }

    .wm-panel-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}


/* ════════════════════════════════════════════════════════════════════════════
   STATISTICS CHOROPLETH — metric picker + gradient legend
   ════════════════════════════════════════════════════════════════════════════ */
.wm-statbar {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(320px, calc(100vw - 48px));
}

.wm-statbar__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
    transition: all 0.2s ease;
}
.wm-statbar__toggle i:first-child { font-size: 1.05rem; }
.wm-statbar__caret { font-size: 0.75rem; opacity: 0.7; }
.wm-statbar__toggle:hover {
    border-color: rgba(16, 185, 129, 0.5);
    color: var(--accent-purple);
    transform: translateY(-1px);
}
.wm-statbar__toggle.is-active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 26px rgba(16, 185, 129, 0.4);
}
.wm-statbar__toggle.is-active:hover { color: #fff; }

.wm-statbar__menu {
    position: absolute;
    top: 52px;
    left: 0;
    width: 274px;
    max-height: min(440px, 62vh);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.26);
    z-index: 46;
    animation: wmStatMenuIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes wmStatMenuIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.wm-statbar__group {
    padding: 10px 10px 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.wm-statbar__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.wm-statbar__option:hover { background: rgba(16, 185, 129, 0.1); }
.wm-statbar__option.is-active {
    background: rgba(16, 185, 129, 0.14);
    color: var(--accent-purple);
}
.wm-statbar__option--none i:first-child {
    width: 26px;
    text-align: center;
    flex: none;
    font-size: 1rem;
}
.wm-statbar__swatch {
    width: 26px;
    height: 10px;
    border-radius: 5px;
    flex: none;
    border: 1px solid var(--border-glass);
}
.wm-statbar__check {
    margin-left: auto;
    color: var(--accent-purple);
    font-size: 0.9rem;
}

.wm-stat-backdrop { display: none; }

.wm-stat-legend {
    width: 252px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
}
.wm-stat-legend__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.wm-stat-legend__title {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}
.wm-stat-legend__close {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}
.wm-stat-legend__close:hover {
    color: #F87171;
    border-color: rgba(248, 113, 113, 0.5);
    transform: rotate(90deg);
}
.wm-stat-legend__bar {
    height: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
}
.wm-stat-legend__labels {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 5px;
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-muted);
}
.wm-stat-legend__labels span:nth-child(2) { text-align: center; }
.wm-stat-legend__labels span:last-child { text-align: right; }
.wm-stat-legend__nodata {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.wm-stat-legend__swatch {
    width: 14px;
    height: 10px;
    border-radius: 3px;
    background: rgba(100, 116, 139, 0.35);
    border: 1px solid var(--border-glass);
}
.wm-stat-legend__source {
    margin-top: 6px;
    font-size: 0.64rem;
    color: var(--text-muted);
    opacity: 0.85;
}

/* ════════════════════════════════════════════════════════════════════════════
   PANEL — stat cards, HDI, composition bars, "More about" CTA
   ════════════════════════════════════════════════════════════════════════════ */
.wm-more-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    margin: 2px 0 18px;
    border: none;
    border-radius: 16px;
    background: var(--gradient-primary);
    color: #fff;
    cursor: pointer;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(16, 185, 129, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.wm-more-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -70%;
    width: 42%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
}
.wm-more-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(16, 185, 129, 0.45); }
.wm-more-btn:hover::after { left: 130%; }
.wm-more-btn__icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}
.wm-more-btn__text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wm-more-btn__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.3;
}
.wm-more-btn__sub { font-size: 0.7rem; opacity: 0.85; font-weight: 500; }
.wm-more-btn__arrow { font-size: 1.1rem; transition: transform 0.25s ease; }
.wm-more-btn:hover .wm-more-btn__arrow { transform: translateX(4px); }

.wm-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.wm-stat-card {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 0;
}
.wm-stat-card__label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.wm-stat-card__label i { color: var(--accent-purple); font-size: 0.85rem; }
.wm-stat-card__value {
    font-family: var(--font-heading);
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.wm-stat-card.is-up .wm-stat-card__value { color: #10B981; }
.wm-stat-card.is-down .wm-stat-card__value { color: #F87171; }
.wm-stat-grid--sourced { gap: 10px; }
.wm-stat-card--sourced {
    display: flex;
    flex-direction: column;
    min-height: 112px;
    padding: 12px 13px;
}
.wm-stat-card--sourced .wm-stat-card__value { font-size: 1.02rem; margin-bottom: 10px; }
.wm-stat-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.62rem;
    line-height: 1.35;
}
.wm-stat-card__meta a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--accent-purple);
    text-decoration: none;
    font-weight: 700;
}
.wm-stat-card__meta a:hover { text-decoration: underline; }
.wm-stat-card__date,
.wm-stat-card__status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(148, 163, 184, 0.13);
    font-weight: 700;
}
.wm-stat-card__status--actual { color: #059669; background: rgba(16, 185, 129, 0.12); }
.wm-stat-card__status--estimate { color: #D97706; background: rgba(245, 158, 11, 0.13); }
.wm-stat-card__status--projection { color: #7C3AED; background: rgba(139, 92, 246, 0.13); }
.wm-stat-card__meta--missing { opacity: 0.75; font-size: 0.6rem; }
.wm-hdi-meta { margin: 10px 0 14px; }

.wm-source-line { margin: 10px 0 0; }

.wm-hdi-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.wm-hdi-value {
    font-family: var(--font-heading);
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--text-primary);
}
.wm-hdi-tier {
    padding: 3px 11px;
    border-radius: 100px;
    background: rgba(16, 185, 129, 0.14);
    color: var(--accent-purple);
    font-size: 0.72rem;
    font-weight: 700;
}
.wm-hdi-rank { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.wm-hdi-track {
    height: 8px;
    border-radius: 5px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}
.wm-hdi-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #34D399, #059669);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wm-comp-list { display: flex; flex-direction: column; gap: 9px; }
.wm-comp-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
    font-size: 0.8rem;
}
.wm-comp-name { font-weight: 600; color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }
.wm-comp-pct { font-weight: 700; color: var(--text-muted); flex: none; }
.wm-comp-track {
    height: 7px;
    border-radius: 5px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}
.wm-comp-fill {
    height: 100%;
    border-radius: 5px;
    background: var(--gradient-primary);
    opacity: calc(1 - min(var(--comp-index, 0) * 0.13, 0.55));
    transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.wm-comp-fill--religion { background: linear-gradient(90deg, #60A5FA, #818CF8); }

.wm-panel-body--fresh { animation: wmPanelFresh 0.32s ease; }
@keyframes wmPanelFresh {
    from { opacity: 0.35; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   COUNTRY PROFILE OVERLAY (.wm-cp)
   ════════════════════════════════════════════════════════════════════════════ */
body.wm-cp-open { overflow: hidden; }

.wm-cp {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.wm-cp.is-open { opacity: 1; visibility: visible; }
.wm-cp[hidden],
.wm-statbar__menu[hidden],
.wm-stat-legend[hidden],
.wm-more-btn[hidden] { display: none !important; }

.wm-cp__topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding-top: 9px;
    padding-right: max(clamp(14px, 3vw, 28px), env(safe-area-inset-right, 0px));
    padding-bottom: 9px;
    padding-left: max(clamp(14px, 3vw, 28px), env(safe-area-inset-left, 0px));
    border-bottom: 1px solid transparent;
    transition: all 0.25s ease;
    flex: none;
    z-index: 5;
}
.wm-cp__topbar.is-scrolled {
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--border-glass);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.wm-cp__topbar-name {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.25s ease;
}
.wm-cp__topbar.is-scrolled .wm-cp__topbar-name { opacity: 1; transform: none; }

.wm-cp__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: none;
}
.wm-cp__back:hover {
    color: var(--accent-purple);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateX(-2px);
}
.wm-cp__close {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.25s ease;
    flex: none;
}
.wm-cp__close:hover {
    color: #F87171;
    border-color: rgba(248, 113, 113, 0.5);
    transform: rotate(90deg);
}

.wm-cp__scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateY(18px);
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.wm-cp.is-open .wm-cp__scroll { transform: none; }

.wm-cp__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px clamp(16px, 4vw, 40px) 72px;
}

/* Hero */
.wm-cp__hero {
    border-radius: 22px;
    border: 1px solid var(--border-glass);
    padding: clamp(18px, 3vw, 30px);
    margin-bottom: 22px;
}
.wm-cp__hero-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0.6;
    margin-bottom: 12px;
}
.wm-cp__hero-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.wm-cp__hero-flag img {
    display: block;
    height: 66px;
    width: auto;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}
.wm-cp__flag-emoji { font-size: 3.4rem; line-height: 1; display: block; }
.wm-cp__hero-titles { min-width: 0; }
.wm-cp__hero-name {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3.4vw, 2.2rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 0;
}
.wm-cp__hero-sub {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 2px;
}
.wm-cp__badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wm-cp__badge {
    padding: 4px 12px;
    border-radius: 100px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
}
.wm-cp__badge--status {
    color: var(--accent-purple);
    border-color: rgba(16, 185, 129, 0.4);
}
.wm-cp__quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 10px;
    margin-top: 18px;
}
.wm-cp__quick-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.wm-cp__quick-value {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.wm-cp__quick-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Layout */
.wm-cp__grid {
    display: grid;
    grid-template-columns: 370px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.wm-cp__rail { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.wm-cp__main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.wm-cp__card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 20px 22px;
}
.wm-cp__card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 14px;
}
.wm-cp__card-title i { color: var(--accent-purple); font-size: 1.05rem; }
.wm-cp__card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.wm-cp__card-head .wm-cp__card-title { margin: 0; min-width: 0; }
.wm-data-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    border: 1px solid rgba(14, 165, 233, 0.22);
    border-radius: 14px;
    background: rgba(14, 165, 233, 0.08);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
}
.wm-data-note i { color: #0EA5E9; font-size: 1rem; margin-top: 1px; }
.wm-cp__subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 18px 0 10px;
}
.wm-cp__subtitle i { color: var(--accent-purple); }
.wm-cp__text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    margin: 0 0 10px;
}
.wm-cp__text:last-child { margin-bottom: 0; }
.wm-cp__text--muted { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.wm-cp__source {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 10px;
    opacity: 0.85;
}
.wm-cp__funfact {
    border-left: 3px solid #FCD34D;
    background: rgba(252, 211, 77, 0.09);
    border-radius: 0 12px 12px 0;
    padding: 12px 14px;
    margin-top: 12px;
}
.wm-cp__funfact-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #F59E0B;
    margin-bottom: 4px;
}
.wm-cp__funfact p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}
.wm-cp__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wm-chip__go { margin-left: 4px; opacity: 0; transition: opacity 0.2s ease; }
.wm-chip--layer:hover .wm-chip__go { opacity: 0.9; }
.wm-cp-neighbor-chip {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
}
.wm-cp-neighbor-chip:hover {
    color: var(--accent-purple);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}
.wm-cp-neighbor-chip__flag { display: flex; }
.wm-cp-neighbor-chip__flag img {
    height: 13px;
    width: auto;
    border-radius: 2px;
    display: block;
}

.wm-cp__figures { display: flex; flex-direction: column; }
.wm-cp__figure {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-glass);
    font-size: 0.84rem;
}
.wm-cp__figure:last-child { border-bottom: none; }
.wm-cp__figure-label { color: var(--text-muted); font-weight: 600; flex: none; }
.wm-cp__figure-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Downloadable national-currency media inside Key figures */
.wm-currency-media {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-glass);
}
.wm-currency-media__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}
.wm-currency-media__heading > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.wm-currency-media__heading i { color: var(--accent-purple); }
.wm-currency-media__code {
    padding: 3px 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.08);
    color: var(--accent-purple);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}
.wm-currency-media__name {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.45;
}
.wm-currency-media__sides {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.wm-currency-media__side { min-width: 0; margin: 0; }
.wm-currency-media__image-wrap {
    position: relative;
    min-height: 124px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.06) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.06) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.06) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.06) 75%),
        var(--bg-dark);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}
.wm-currency-media__image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.2));
}
.wm-currency-media__download {
    position: absolute;
    right: 8px;
    bottom: 8px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.82);
    color: #ffffff;
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.18s ease, background 0.18s ease;
}
.wm-currency-media__download:hover { transform: translateY(-1px); background: #059669; }
.wm-currency-media__download[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; pointer-events: none; transform: none; }
.wm-currency-media__side figcaption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 2px 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.4;
}
.wm-currency-media__side figcaption strong { color: var(--text-primary); flex: none; }
.wm-currency-media__side figcaption span { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.wm-currency-media__sources {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.64rem;
    line-height: 1.45;
}
.wm-currency-media__sources-label { font-weight: 700; color: var(--text-secondary); }
.wm-currency-media__sources a { color: var(--accent-purple); text-decoration: none; }
.wm-currency-media__sources a:hover { text-decoration: underline; }
.wm-currency-media__image-error {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 104px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.72rem;
}
.wm-currency-media__image-error i { font-size: 1.5rem; }
.wm-currency-media__side.is-error img { display: none; }
.wm-currency-media__side.is-error .wm-currency-media__image-error { display: flex; }
.wm-currency-media__empty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px dashed var(--border-glass);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}
.wm-currency-media__empty i { font-size: 1rem; flex: none; }

.wm-cp__cities { display: flex; flex-direction: column; }
.wm-cp__city {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border-glass);
    font-size: 0.86rem;
}
.wm-cp__city:last-child { border-bottom: none; }
.wm-cp__city-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex-wrap: wrap;
}
.wm-cp__city-star { color: #F59E0B; }
.wm-cp__city-tag {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(252, 211, 77, 0.2);
    color: #B45309;
    padding: 2px 8px;
    border-radius: 100px;
}
[data-theme="dark"] .wm-cp__city-tag { color: #FCD34D; }
.wm-cp__city-pop { color: var(--text-muted); font-weight: 600; flex: none; }

.wm-cp__footer { display: flex; justify-content: center; padding: 8px 0 10px; }
.wm-cp__wiki {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 100px;
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(16, 185, 129, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.wm-cp__wiki:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(16, 185, 129, 0.45); }

/* Mini-map */
.wm-cp__map {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: radial-gradient(circle at 30% 30%, #0B2C46 0%, #031424 100%);
}
html:not([data-theme="dark"]) .wm-cp__map {
    background: radial-gradient(circle at 30% 30%, #E6F3FB 0%, #BFE5FF 100%);
}
.wm-cp__map svg { display: block; width: 100%; height: auto; }
.wm-cp-graticule { fill: none; stroke: rgba(148, 163, 184, 0.18); stroke-width: 0.5; }
.wm-cp-context { fill: rgba(148, 163, 184, 0.14); stroke: rgba(148, 163, 184, 0.3); stroke-width: 0.6; }
.wm-cp-country {
    stroke-width: 1.4;
    stroke-linejoin: round;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}
.wm-cp-city { cursor: pointer; }
.wm-cp-city-dot {
    fill: #10B981;
    stroke: #fff;
    stroke-width: 1.4;
    transition: r 0.15s ease;
}
.wm-cp-city:hover .wm-cp-city-dot { fill: #34D399; }
.wm-cp-city-ring { fill: none; stroke: rgba(252, 211, 77, 0.55); stroke-width: 1.6; }
.wm-cp-city-star { fill: #FCD34D; stroke: rgba(120, 53, 15, 0.55); stroke-width: 0.8; }
.wm-cp-city-label {
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    fill: #E2E8F0;
    paint-order: stroke;
    stroke: rgba(3, 20, 36, 0.85);
    stroke-width: 2.6px;
    stroke-linejoin: round;
    pointer-events: none;
}
html:not([data-theme="dark"]) .wm-cp-city-label {
    fill: #0F172A;
    stroke: rgba(255, 255, 255, 0.92);
}
.wm-cp__map-caption {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 10px;
}
.wm-map-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
}
.wm-map-download button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid var(--border-glass);
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.wm-map-download button:hover { color: var(--accent-purple); border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.09); }
.wm-map-download button:disabled { opacity: 0.55; cursor: wait; }

/* Country-composition donut charts */
.wm-comp-donut-wrap {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 10px 0 4px;
}
.wm-comp-donut {
    width: 146px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}
.wm-comp-donut > span {
    width: 58%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--bg-surface);
    box-shadow: 0 0 0 1px var(--border-glass);
}
.wm-comp-donut__legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.wm-comp-donut__legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 0.76rem;
}
.wm-comp-donut__legend strong { color: var(--text-primary); font-size: 0.74rem; }
.wm-comp-donut__swatch { width: 9px; height: 9px; border-radius: 3px; }
.wm-comp-donut-wrap--compact { grid-template-columns: 108px minmax(0, 1fr); gap: 12px; }
.wm-comp-donut-wrap--compact .wm-comp-donut { width: 106px; }
.wm-comp-donut-wrap--compact .wm-comp-donut__legend { gap: 5px; }
.wm-comp-donut-wrap--compact .wm-comp-donut__legend li { font-size: 0.7rem; }
.wm-comp-meta { margin: 7px 0 13px; }

/* Population pyramid */
.wm-pyramid__toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.wm-pyramid__toolbar .wm-cp__text { margin: 0; flex: 1; }
.wm-pyramid__toolbar .wm-map-download { flex-shrink: 0; }
.wm-pyramid__legend { display: flex; justify-content: center; gap: 22px; margin: 6px 0 8px; color: var(--text-secondary); font-size: 0.74rem; font-weight: 700; }
.wm-pyramid__legend span { display: inline-flex; align-items: center; gap: 6px; }
.wm-pyramid__key { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.wm-pyramid__key--male { background: #3B82F6; }
.wm-pyramid__key--female { background: #EC4899; }
.wm-pyramid { width: 100%; overflow: hidden; border-radius: 14px; background: rgba(148, 163, 184, 0.05); border: 1px solid var(--border-glass); }
.wm-pyramid svg { display: block; width: 100%; height: auto; }
.wm-pyramid-bar { transition: opacity 0.15s ease; }
.wm-pyramid-bar:hover { opacity: 0.75; }
.wm-pyramid-bar--male { fill: #3B82F6; }
.wm-pyramid-bar--female { fill: #EC4899; }
.wm-pyramid-age { fill: var(--text-secondary); font-family: var(--font-body); font-size: 10px; font-weight: 700; }
.wm-pyramid-tick { fill: var(--text-muted); font-family: var(--font-body); font-size: 9px; }
.wm-pyramid-grid { stroke: rgba(148, 163, 184, 0.2); stroke-width: 1; }
.wm-pyramid__meta { margin-top: 9px; }
.wm-cp-tooltip {
    position: absolute;
    z-index: 6;
    max-width: 160px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.78rem;
    color: var(--text-primary);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.wm-cp-tooltip.visible { opacity: 1; }
.wm-cp-tooltip__tag {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(252, 211, 77, 0.2);
    color: #B45309;
    padding: 1px 7px;
    border-radius: 100px;
    margin-left: 4px;
}
[data-theme="dark"] .wm-cp-tooltip__tag { color: #FCD34D; }
.wm-cp-tooltip__pop { color: var(--text-muted); font-weight: 600; margin-top: 2px; }

/* Focus visibility for all new interactive elements */
.wm-statbar__toggle:focus-visible,
.wm-statbar__option:focus-visible,
.wm-stat-legend__close:focus-visible,
.wm-more-btn:focus-visible,
.wm-cp__back:focus-visible,
.wm-cp__close:focus-visible,
.wm-cp__wiki:focus-visible,
.wm-currency-media__download:focus-visible,
.wm-currency-media__sources a:focus-visible,
.wm-chip--layer:focus-visible,
.wm-cp-neighbor-chip:focus-visible {
    outline: 2px solid var(--accent-purple);
    outline-offset: 2px;
}
.wm-map-download button:focus-visible,
.wm-stat-card__meta a:focus-visible {
    outline: 2px solid var(--accent-purple);
    outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .wm-cp__grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .wm-statbar { top: 74px; left: 12px; }
    .wm-statbar__toggle {
        width: 44px;
        height: 44px;
        justify-content: center;
        padding: 0;
        border-radius: 12px;
    }
    .wm-statbar__toggle span,
    .wm-statbar__caret { display: none; }

    .wm-statbar__menu {
        position: fixed;
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-height: 62vh;
        z-index: 120;
        animation: wmStatMenuUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
    .wm-stat-backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 110;
    }
    .wm-stat-legend { width: min(252px, calc(100vw - 24px)); }

    .wm-controls { right: 12px; bottom: 84px; }

    .wm-cp__hero-flag img { height: 52px; }
    .wm-cp__quick { grid-template-columns: repeat(2, 1fr); }
    .wm-cp__card { padding: 16px; border-radius: 16px; }
    .wm-cp__back span { display: none; }
    .wm-cp__back { width: 44px; height: 44px; justify-content: center; padding: 0; }
    .wm-comp-donut-wrap { grid-template-columns: 118px minmax(0, 1fr); gap: 14px; }
    .wm-comp-donut { width: 116px; }
    .wm-stat-card--sourced { min-height: 104px; }

    .wm-panel::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 4px;
        border-radius: 2px;
        background: var(--text-muted);
        opacity: 0.35;
        pointer-events: none;
    }
    .wm-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@keyframes wmStatMenuUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

/* Search results — richer rows + keyboard highlight (polish) */
.wm-search-result-main {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.wm-search-result-continent {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
}
.wm-search-result-capital {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
}
.wm-search-result-item.is-highlighted {
    background: rgba(16, 185, 129, 0.12);
}

/* ════════════════════════════════════════════════════════════════════════════
   UNIFIED MAP CHROME — island controls + consolidated layer drawer
   ════════════════════════════════════════════════════════════════════════════ */
.wm-map-identity,
.wm-layers-trigger {
    position: absolute;
    left: 20px;
    z-index: 48;
    border: 1px solid rgba(255, 255, 255, 0.68);
    background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.wm-map-identity {
    top: 20px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px 7px 8px;
    border-radius: 16px;
    color: var(--text-primary);
}

[data-theme="dark"] .wm-map-identity,
[data-theme="dark"] .wm-layers-trigger {
    border-color: rgba(255, 255, 255, 0.1);
    background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
}

.wm-map-menu-btn {
    width: 34px;
    height: 34px;
    display: none;
    align-items: center;
    justify-content: center;
    flex: none;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
}

.wm-map-menu-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-purple);
}

.wm-map-identity__divider {
    display: none;
    width: 1px;
    height: 22px;
    background: var(--border-glass);
}

.wm-map-identity__icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-purple);
    font-size: 1.1rem;
}

.wm-topbar-title {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
}

.wm-layers-trigger {
    top: 80px;
    min-width: 218px;
    min-height: 62px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 18px;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.wm-layers-trigger:hover,
.wm-layers-trigger[aria-expanded="true"] {
    transform: translateY(-1px);
    border-color: rgba(16, 185, 129, 0.46);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.2), 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.wm-layers-trigger__icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.16), rgba(6, 182, 212, 0.12));
    color: var(--accent-purple);
    font-size: 1.22rem;
}

.wm-layers-trigger__text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.wm-layers-trigger__text strong {
    font-size: 0.84rem;
    font-weight: 800;
}

.wm-layers-trigger__text small {
    max-width: 130px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.69rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wm-layers-trigger__count,
.wm-settings__tab-count {
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent-purple);
    color: white;
    font-size: 0.67rem;
    font-weight: 900;
}

.wm-layers-trigger__count[hidden],
.wm-settings__tab-count[hidden],
.wm-settings__tab-dot[hidden] {
    display: none !important;
}

.wm-layers-trigger__caret {
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.wm-layers-trigger[aria-expanded="true"] .wm-layers-trigger__caret {
    transform: rotate(180deg);
}

.wm-search-container {
    top: 20px;
    right: 20px;
    width: min(360px, calc(100% - 40px));
}

.wm-search-input-wrapper {
    min-height: 48px;
    border-radius: 16px;
    border-color: rgba(255, 255, 255, 0.68);
    background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

[data-theme="dark"] .wm-search-input-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
}

.wm-page:has(#wm-panel.wm-panel--active) .wm-search-container {
    right: 494px;
}

.wm-settings-backdrop {
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 75;
}

.wm-settings {
    top: 16px;
    bottom: 16px;
    left: 16px;
    width: min(460px, calc(100% - 32px));
    height: auto;
    max-height: none;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    padding: 0;
    border-radius: 24px;
    z-index: 80;
    transform: translateX(calc(-100% - 32px));
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
}

.wm-settings.is-open {
    transform: translateX(0);
}

.wm-settings__header {
    align-items: flex-start;
    margin: 0;
    padding: 22px 22px 16px;
}

.wm-settings__heading {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wm-settings__heading-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.17), rgba(6, 182, 212, 0.13));
    color: var(--accent-purple);
    font-size: 1.25rem;
}

.wm-settings__eyebrow {
    margin: 1px 0 3px;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
}

.wm-settings h2 {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.2;
}

.wm-settings__heading p,
.wm-settings__section-intro p,
.wm-layer-toolbar p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.wm-settings__close {
    width: 38px;
    height: 38px;
    flex: none;
    background: rgba(148, 163, 184, 0.1);
}

.wm-settings__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin: 0 18px;
    padding: 5px;
    border: 1px solid var(--border-glass);
    border-radius: 15px;
    background: var(--bg-dark);
}

.wm-settings__tab {
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.73rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.wm-settings__tab i {
    font-size: 1rem;
}

.wm-settings__tab:hover {
    color: var(--text-primary);
}

.wm-settings__tab.is-active {
    background: var(--bg-surface);
    color: var(--accent-purple);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.1);
}

.wm-settings__tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.wm-settings__tab-count {
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
}

.wm-settings__body {
    display: block;
    height: auto;
    min-height: 0;
    margin-top: 12px;
    overflow: hidden;
}

.wm-settings__view {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 20px 18px;
}

.wm-settings__view[hidden] {
    display: none !important;
}

.wm-settings__section-intro,
.wm-layer-toolbar > div:first-child {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.wm-settings__section-intro h3,
.wm-layer-toolbar h3 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.92rem;
}

.wm-settings__section-intro > i {
    color: var(--accent-purple);
    font-size: 1.25rem;
}

.wm-statbar--embedded {
    position: static;
    display: block;
    max-width: none;
}

.wm-statbar--embedded .wm-statbar__menu {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
}

.wm-statbar--embedded .wm-statbar__group {
    padding: 14px 2px 7px;
    color: var(--text-muted);
    font-size: 0.64rem;
}

.wm-statbar--embedded .wm-statbar__group:first-of-type {
    padding-top: 16px;
}

.wm-statbar--embedded .wm-statbar__option {
    min-height: 46px;
    margin-bottom: 5px;
    padding: 9px 11px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-dark);
}

.wm-statbar--embedded .wm-statbar__option:hover {
    border-color: rgba(16, 185, 129, 0.36);
    background: rgba(16, 185, 129, 0.08);
}

.wm-statbar--embedded .wm-statbar__option.is-active {
    border-color: rgba(16, 185, 129, 0.44);
    background: rgba(16, 185, 129, 0.12);
    box-shadow: inset 3px 0 0 var(--accent-purple);
}

.wm-layer-toolbar {
    display: grid;
    gap: 0;
    margin-bottom: 12px;
}

.wm-layer-search {
    min-height: 44px;
    background: var(--bg-dark);
}

.wm-layer-categories {
    padding-bottom: 9px;
    scrollbar-width: thin;
}

.wm-layer-category {
    padding: 7px 11px;
    font-size: 0.72rem;
}

.wm-layer-list {
    grid-template-columns: 1fr;
    gap: 7px;
    overflow: visible;
    padding-right: 0;
}

.wm-layer-option {
    min-height: 62px;
    grid-template-columns: 8px minmax(0, 1fr) 24px;
    padding: 9px 11px;
    border-radius: 13px;
    background: var(--bg-dark);
}

.wm-layer-option__swatch {
    width: 7px;
    height: 34px;
}

.wm-layer-option__text strong {
    font-size: 0.84rem;
}

.wm-layer-option__text span {
    font-size: 0.71rem;
}

.wm-layer-note {
    position: sticky;
    bottom: 0;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.wm-settings__group {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--bg-dark);
}

.wm-settings__group label {
    font-size: 0.72rem;
}

.wm-settings__select,
.wm-settings__switch {
    background: var(--bg-surface);
}

.wm-settings__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--border-glass);
    background: var(--bg-surface);
}

.wm-settings__footer > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.wm-settings__footer > span i {
    color: #f59e0b;
}

.wm-settings__reset {
    width: auto;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.wm-settings__reset:hover {
    border-color: rgba(16, 185, 129, 0.35);
    color: var(--accent-purple);
}

.wm-layer-legend,
.wm-stat-legend {
    top: auto;
    bottom: 20px;
    left: 20px;
    max-width: min(420px, calc(100vw - 120px));
    max-height: 38vh;
    z-index: 45;
}

.wm-stat-legend {
    position: absolute;
    width: 270px;
}

.wm-layers-trigger:focus-visible,
.wm-map-menu-btn:focus-visible,
.wm-settings__tab:focus-visible,
.wm-settings__close:focus-visible,
.wm-settings__reset:focus-visible {
    outline: 2px solid var(--accent-purple);
    outline-offset: 2px;
}

@media (max-width: 1100px) {
    .wm-map-menu-btn,
    .wm-map-identity__divider {
        display: inline-flex;
    }

    .wm-page:has(#wm-panel.wm-panel--active) .wm-search-container {
        right: 20px;
        top: -100px;
    }
}

@media (max-width: 768px) {
    .wm-map-identity {
        top: 12px;
        left: 12px;
        width: 48px;
        min-height: 48px;
        padding: 7px;
        border-radius: 15px;
    }

    .wm-map-menu-btn {
        width: 34px;
        height: 34px;
    }

    .wm-map-identity__divider,
    .wm-map-identity__icon,
    .wm-map-identity .wm-topbar-title {
        display: none;
    }

    .wm-search-container {
        top: 12px;
        left: 72px;
        right: 12px;
        width: auto;
    }

    .wm-layers-trigger {
        top: 72px;
        left: 12px;
        min-width: 48px;
        width: 48px;
        min-height: 48px;
        height: 48px;
        display: flex;
        justify-content: center;
        padding: 5px;
        border-radius: 15px;
    }

    .wm-layers-trigger__icon {
        width: 36px;
        height: 36px;
    }

    .wm-layers-trigger__text,
    .wm-layers-trigger__caret {
        display: none;
    }

    .wm-layers-trigger__count {
        position: absolute;
        top: -5px;
        right: -5px;
        min-width: 19px;
        height: 19px;
        border: 2px solid var(--bg-surface);
    }

    .wm-settings {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: min(88dvh, 760px);
        max-height: min(88dvh, 760px);
        border-radius: 26px 26px 0 0;
        transform: translateY(105%);
    }

    .wm-settings.is-open {
        transform: translateY(0);
    }

    .wm-settings__header {
        padding: 18px 16px 12px;
    }

    .wm-settings__heading-icon {
        width: 38px;
        height: 38px;
    }

    .wm-settings__heading p {
        display: none;
    }

    .wm-settings__close {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .wm-settings__tabs {
        margin: 0 12px;
    }

    .wm-settings__tab {
        min-height: 44px;
    }

    .wm-settings__tab span:not(.wm-settings__tab-count):not(.wm-settings__tab-dot) {
        display: none;
    }

    .wm-settings__tab i {
        font-size: 1.15rem;
    }

    .wm-settings__body {
        height: auto;
        margin-top: 10px;
    }

    .wm-settings__view {
        padding: 4px 14px 16px;
    }

    .wm-layer-search input {
        min-height: 24px;
    }

    .wm-layer-list {
        grid-template-columns: 1fr !important;
    }

    .wm-settings__footer {
        padding: 10px 14px max(12px, env(safe-area-inset-bottom, 0px));
    }

    .wm-settings__footer > span {
        max-width: 150px;
    }

    .wm-layer-legend,
    .wm-stat-legend {
        top: auto;
        bottom: 78px;
        left: 12px;
        right: 72px;
        width: auto;
        max-width: none;
        max-height: 34vh;
    }

    .wm-controls {
        right: 12px;
        bottom: 78px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wm-layers-trigger,
    .wm-layers-trigger__caret,
    .wm-settings {
        transition: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAP ENHANCEMENTS — categorical legends, rankings, physical overlays,
   profile trends, country comparison, geography facts
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Categorical stat legend ─────────────────────────────────────────────── */
.wm-stat-legend__cats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    max-height: 220px;
    overflow-y: auto;
}
.wm-stat-legend__cat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-primary);
}
.wm-stat-legend__cat-label {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}
.wm-stat-legend__cat-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    padding: 1px 7px;
}
.wm-stat-legend__rankings {
    width: 26px;
    height: 26px;
    min-width: 26px;
    margin-left: auto;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.wm-stat-legend__rankings:hover {
    color: var(--accent-purple);
    border-color: var(--accent-purple);
    transform: translateY(-1px);
}

/* ── Rankings modal ──────────────────────────────────────────────────────── */
.wm-rankings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 70;
}
.wm-rankings-backdrop.is-open { opacity: 1; }
.wm-rankings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.98);
    width: min(560px, calc(100% - 32px));
    max-height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 71;
    overflow: hidden;
}
.wm-rankings.is-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.wm-rankings__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-glass);
}
.wm-rankings__eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.wm-rankings__title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin: 2px 0 4px;
    color: var(--text-primary);
}
.wm-rankings__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.wm-rankings__close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s ease, transform 0.18s ease;
}
.wm-rankings__close:hover { color: #F87171; transform: rotate(90deg); }
.wm-rankings__body {
    overflow-y: auto;
    padding: 10px 12px 16px;
}
.wm-rankings__empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.wm-rankings__row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}
.wm-rankings__row:hover { background: var(--bg-dark); }
.wm-rankings__rank {
    width: 30px;
    min-width: 30px;
    text-align: right;
    font-weight: 700;
    font-size: 0.74rem;
    color: var(--text-muted);
}
.wm-rankings__flag img {
    height: 14px;
    width: auto;
    border-radius: 2px;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.wm-rankings__name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wm-rankings__value {
    position: relative;
    width: 168px;
    min-width: 128px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.wm-rankings__bar {
    position: absolute;
    right: 0;
    top: 3px;
    bottom: 3px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.35));
    pointer-events: none;
}
.wm-rankings__num {
    position: relative;
    font-weight: 700;
    font-size: 0.76rem;
    padding-right: 6px;
}
.wm-rankings__group { margin-bottom: 14px; }
.wm-rankings__group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 6px;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.wm-rankings__group-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    padding: 1px 7px;
}
.wm-rankings__group-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 8px;
}
.wm-rankings__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.74rem;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.wm-rankings__chip:hover { border-color: var(--accent-purple); transform: translateY(-1px); }
.wm-rankings__chip img { height: 12px; width: auto; border-radius: 2px; }

/* ── Tooltip categorical swatch ──────────────────────────────────────────── */
.wm-tooltip__catswatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: baseline;
}

/* ── Physical feature overlays ───────────────────────────────────────────── */
.wm-phys-river {
    fill: none;
    stroke: #2E86C1;
    stroke-width: 1.1px;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.75;
    vector-effect: non-scaling-stroke;
    pointer-events: stroke;
}
.wm-phys-river:hover { stroke-width: 2.2px; opacity: 1; }
.wm-phys-desert {
    fill: rgba(234, 179, 8, 0.16);
    stroke: rgba(202, 138, 4, 0.45);
    stroke-width: 0.5px;
    vector-effect: non-scaling-stroke;
}
.wm-phys-desert:hover { fill: rgba(234, 179, 8, 0.26); }
.wm-phys-desert-label,
.wm-phys-range-label {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-anchor: middle;
    fill: #92400E;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.85);
    pointer-events: none;
}
.wm-phys-range-label {
    fill: #6B21A8;
    font-style: italic;
    letter-spacing: 0.1em;
}
.wm-phys-peak-marker {
    fill: #7C2D12;
    stroke: #FFF7ED;
    stroke-width: 0.7px;
}
.wm-phys-peak-label {
    font-weight: 600;
    text-anchor: middle;
    fill: #431407;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.88);
    pointer-events: none;
}
.wm-phys-peak { cursor: pointer; }

/* ── Profile trends ──────────────────────────────────────────────────────── */
.wm-cp-trends__loading {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 6px 0;
}
.wm-cp-trends__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.wm-cp-trend {
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--bg-dark);
    padding: 10px 12px;
}
.wm-cp-trend__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.wm-cp-trend__chart svg {
    width: 100%;
    height: 46px;
    display: block;
}
.wm-cp-trend__range {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.wm-cp-trend__range strong {
    color: var(--text-primary);
    font-size: 0.78rem;
}

/* ── Geography facts ─────────────────────────────────────────────────────── */
.wm-cp__geo-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.wm-cp__geo-fact {
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-dark);
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.wm-cp__geo-fact-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.wm-cp__geo-fact-value {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Country comparison ──────────────────────────────────────────────────── */
/* These panels set their own display, which would defeat the [hidden]
   attribute's UA default and leave an invisible full-screen layer eating
   wheel/click events — force them closed explicitly. */
.wm-compare[hidden],
.wm-rankings[hidden],
.wm-rankings-backdrop[hidden] { display: none !important; }
.wm-compare:not(.is-open),
.wm-rankings:not(.is-open) { pointer-events: none; }
.wm-cp__compare {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 14px;
    margin-left: auto;
    margin-right: 10px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease;
}
.wm-cp__compare:hover { border-color: var(--accent-purple); transform: translateY(-1px); }
.wm-compare {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.wm-compare.is-open { opacity: 1; }
.wm-compare__inner {
    width: min(880px, 100%);
    max-height: min(84vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.5);
    overflow: hidden;
}
.wm-compare__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border-glass);
}
.wm-compare__head h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 3px;
}
.wm-compare__head p {
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.wm-compare__close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s ease, transform 0.18s ease;
}
.wm-compare__close:hover { color: #F87171; transform: rotate(90deg); }
.wm-compare__picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
}
.wm-compare__chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 6px 5px 12px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
}
.wm-compare__chip img { height: 13px; width: auto; border-radius: 2px; }
.wm-compare__chip button {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
}
.wm-compare__chip button:hover { color: #F87171; background: rgba(248, 113, 113, 0.12); }
.wm-compare__search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    background: var(--bg-dark);
    padding: 5px 12px;
    color: var(--text-muted);
}
.wm-compare__search input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    width: 170px;
}
.wm-compare__results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.3);
    padding: 6px;
    z-index: 10;
}
.wm-compare__results button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
}
.wm-compare__results button:hover { background: var(--bg-dark); }
.wm-compare__results img { height: 12px; width: auto; border-radius: 2px; }
.wm-compare__empty {
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}
.wm-compare__table-wrap {
    overflow: auto;
    padding: 0 20px 20px;
}
.wm-compare__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text-primary);
}
.wm-compare__table th,
.wm-compare__table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-glass);
    text-align: right;
    white-space: nowrap;
}
.wm-compare__table th:first-child,
.wm-compare__table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-surface);
    font-weight: 600;
    color: var(--text-muted);
    z-index: 1;
}
.wm-compare__table th { font-size: 0.78rem; }
.wm-compare__country {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    font-family: var(--font-heading);
}
.wm-compare__country img { height: 15px; width: auto; border-radius: 2px; }
.wm-compare__table td.is-best {
    color: #059669;
    font-weight: 700;
}

@media (max-width: 640px) {
    .wm-rankings { max-height: 84vh; }
    .wm-rankings__value { width: 118px; }
    .wm-cp__compare span { display: none; }
    .wm-cp__compare { width: 40px; padding: 0; justify-content: center; }
    .wm-compare { padding: 10px; }
    .wm-compare__search input { width: 120px; }
}
