/* Resources — World Map (scoped) */
#resources-resource-app-18.resources-app-panel.active,
#resourcesWorldMapRoot {
    overflow: visible;
}

.resources-world-map-card {
    --wm-radius: 12px;
    --wm-gap: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: var(--wm-gap);
    min-height: 0;
    padding: 0.35rem 0.35rem 0.45rem;
    box-sizing: border-box;
    /* Let the search suggestion list paint over the map below. */
    overflow: visible;
}

/*
 * Desktop: lock map + details into leftover Resources height, but NEVER taller
 * than a Reset-view-sized shell. Growing the shell letterboxes the map and
 * makes continent/country details stretch the page.
 */
@media (min-width: 961px) {
    body.resources-view-active #resources-resource-app-18.resources-app-panel.active {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    body.resources-view-active #resources-resource-app-18.resources-app-panel.active > .resources-world-map-root {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-card {
        flex: 1 1 auto;
        min-height: 0;
        max-height: 100%;
        height: 100%;
        overflow: hidden;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-card > .resources-header,
    body.resources-view-active #resources-resource-app-18 .resources-world-map-card > .resources-world-map-toolbar {
        flex: 0 0 auto;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-toolbar {
        overflow: visible;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-layout {
        flex: 1 1 auto;
        min-height: 0;
        /* Cap like Reset view — zooming a country/continent must not grow this shell. */
        height: min(68vh, 720px);
        max-height: min(68vh, 720px);
        overflow: hidden;
        grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
        grid-template-rows: minmax(0, 1fr);
        align-items: stretch;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-frame {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100%;
        min-height: 0;
        min-width: 0;
        align-self: stretch;
        overflow: hidden;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-canvas {
        aspect-ratio: auto !important;
        flex: 1 1 auto;
        width: 100%;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
    }

    body.resources-view-active #resources-resource-app-18 .resources-world-map-details {
        display: flex;
        flex-direction: column;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        min-width: 0;
        overflow: hidden !important;
        align-self: stretch;
    }
}

/* Match left edge of title with "Find country" (drop shared .table-header 20px pad). */
.resources-world-map-card > .table-header.resources-header {
    padding: 0.1rem 0 0.15rem;
    border-bottom: none;
    gap: 0.75rem 1rem;
    background: transparent !important;
    box-shadow: none !important;
}

.resources-world-map-toolbar {
    position: relative;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    padding: 0;
    overflow: visible;
}

/* Invisible but still clickable (same spot as Open reference). */
.resources-world-map-card .resources-reference-link {
    color: transparent;
    text-shadow: none;
    text-decoration: none;
    opacity: 0;
    cursor: pointer;
}

/* Hide Leaflet / OSM / CARTO attribution badge on the map. */
.resources-world-map-canvas .leaflet-control-attribution {
    display: none !important;
}

.resources-world-map-search {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: min(280px, 100%);
    flex: 1 1 220px;
    font-size: 0.8rem;
    color: #475569;
}

.resources-world-map-search-wrap {
    position: relative;
    width: 100%;
}

.resources-world-map-search input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: var(--wm-radius) !important;
    min-height: 38px;
    padding: 0.45rem 0.75rem;
    font: inherit;
    color: #0f172a;
    background: #fff;
    box-shadow: none;
}

.resources-world-map-search input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 1px;
    border-color: #2563eb;
    box-shadow: none;
}

.resources-world-map-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 40;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    max-height: min(280px, 42vh);
    overflow: auto;
    border: 1px solid #cbd5e1;
    border-radius: var(--wm-radius);
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.resources-world-map-suggestion {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    color: #0f172a;
}

.resources-world-map-suggestion:hover,
.resources-world-map-suggestion.is-active {
    background: #eff6ff;
}

.resources-world-map-suggestion-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.resources-world-map-suggestion-meta {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

.resources-world-map-suggestion-empty {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    color: #64748b;
}

.resources-world-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    align-items: center;
    font-size: 0.75rem;
    color: #475569;
}

.resources-world-map-legend-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    margin: 0;
    padding: 0.2rem 0.35rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.resources-world-map-legend-btn:hover,
.resources-world-map-legend-btn:focus-visible {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    outline: none;
}

.resources-world-map-legend-btn:active {
    background: #dbeafe;
}

.resources-world-map-legend-btn.is-active {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
    font-weight: 600;
}

.resources-world-map-legend-btn.is-active:hover,
.resources-world-map-legend-btn.is-active:focus-visible {
    background: #dbeafe;
    border-color: #60a5fa;
}

.resources-world-map-legend i,
.resources-world-map-legend-btn i {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 2px;
    display: inline-block;
    border: 1px solid rgba(15, 23, 42, 0.2);
    flex: 0 0 auto;
}

.resources-world-map-toolbar-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-left: auto;
}

.resources-world-map-toolbar-actions .btn {
    border-radius: var(--wm-radius);
}

.resources-world-map-lang {
    position: relative;
}

.resources-world-map-lang-btn {
    min-width: 5.5rem;
}

.resources-world-map-lang-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 40;
    min-width: 10.5rem;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    border: 1px solid #cbd5e1;
    border-radius: var(--wm-radius);
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.resources-world-map-lang-menu[hidden] {
    display: none !important;
}

.resources-world-map-lang-option {
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 600;
}

.resources-world-map-lang-option:hover,
.resources-world-map-lang-option.is-selected {
    background: #eff6ff;
    color: #1d4ed8;
}

.resources-world-map-card.is-fullview .resources-world-map-lang-menu {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.resources-world-map-card.is-fullview .resources-world-map-lang-option {
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-lang-option:hover,
.resources-world-map-card.is-fullview .resources-world-map-lang-option.is-selected {
    background: #1e293b;
    color: #93c5fd;
}

body.theme-dark .resources-world-map-lang-menu {
    background: #0f151d;
    border-color: #334155;
}

body.theme-dark .resources-world-map-lang-option {
    color: #e6edf3;
}

body.theme-dark .resources-world-map-lang-option:hover,
body.theme-dark .resources-world-map-lang-option.is-selected {
    background: #1e293b;
    color: #93c5fd;
}

.resources-world-map-flags-btn[aria-pressed="true"],
.resources-world-map-fullview-btn[aria-pressed="true"] {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

/* Flags gallery overlays the map frame; details panel stays on the right. */
.resources-world-map-flags-panel {
    position: absolute;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 0.8rem 0.85rem;
    background: #f8fafc;
    border-radius: inherit;
    box-sizing: border-box;
}

.resources-world-map-flags-panel[hidden] {
    display: none !important;
}

.resources-world-map-flags-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 1rem;
    flex: 0 0 auto;
}

.resources-world-map-flags-filter {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1 1 200px;
    min-width: min(220px, 100%);
    font-size: 0.78rem;
    color: #475569;
}

.resources-world-map-flags-filter input {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: var(--wm-radius);
    min-height: 36px;
    padding: 0.4rem 0.7rem;
    font: inherit;
    color: #0f172a;
    background: #fff;
    box-shadow: none;
}

.resources-world-map-flags-filter input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 1px;
    border-color: #2563eb;
}

.resources-world-map-flags-count {
    font-size: 0.78rem;
    color: #64748b;
    padding-bottom: 0.45rem;
}

.resources-world-map-flags-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 0.55rem;
    align-content: start;
    padding: 0.15rem 0.1rem 0.35rem;
}

.resources-world-map-flag-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin: 0;
    padding: 0.45rem 0.4rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.resources-world-map-flag-tile:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

.resources-world-map-flag-tile.is-selected {
    border-color: #ff5a1f;
    box-shadow: 0 0 0 2px rgba(255, 90, 31, 0.28);
}

.resources-world-map-flag-tile-media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 2;
    border-radius: 6px;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.resources-world-map-flag-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.resources-world-map-flags-placeholder {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
}

.resources-world-map-flag-tile-name {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resources-world-map-flags-empty {
    grid-column: 1 / -1;
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: #64748b;
    font-size: 0.88rem;
}

/*
 * Only Full View resets page zoom (same as Solar System). Do not change
 * html zoom while the World Map tab is merely active — that made the whole
 * page jump in size vs other Resources apps.
 */
html:has(body.resources-world-map-fullview-open) {
    --app-ui-zoom: 1;
    zoom: 1 !important;
}

@supports not (zoom: 1) {
    html:has(body.resources-world-map-fullview-open) {
        --app-ui-zoom: 1;
        transform: none !important;
        width: 100% !important;
        min-height: 100% !important;
    }
}

body.resources-world-map-fullview-open {
    overflow: hidden !important;
}

body.resources-world-map-fullview-open .sidebar,
body.resources-world-map-fullview-open .main-content {
    /* Keep page underneath inert while the overlay owns the screen. */
    pointer-events: none;
}

.resources-world-map-card.is-fullview {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    max-height: 100dvh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    z-index: 2147483000 !important;
    border-radius: 0 !important;
    padding: 0.85rem 1rem 1rem !important;
    background: #0b1220 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
    pointer-events: auto;
    color: #e2e8f0;
    box-sizing: border-box !important;
}

.resources-world-map-card.is-fullview .resources-header,
.resources-world-map-card.is-fullview .resources-world-map-toolbar {
    flex: 0 0 auto;
}

.resources-world-map-card.is-fullview .resources-header h3,
.resources-world-map-card.is-fullview .resources-header p {
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-header p {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-search {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-search input {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
    border-radius: var(--wm-radius) !important;
}

.resources-world-map-card.is-fullview .resources-world-map-suggestions {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 50;
}

.resources-world-map-card.is-fullview .resources-world-map-suggestion {
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-suggestion:hover,
.resources-world-map-card.is-fullview .resources-world-map-suggestion.is-active {
    background: #1e293b;
}

.resources-world-map-card.is-fullview .resources-world-map-suggestion-meta,
.resources-world-map-card.is-fullview .resources-world-map-suggestion-empty {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-search input::placeholder {
    color: #64748b;
}

.resources-world-map-card.is-fullview .resources-world-map-search input:focus {
    outline-color: rgba(96, 165, 250, 0.45);
    border-color: #60a5fa;
}

.resources-world-map-card.is-fullview .resources-world-map-legend {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-legend i {
    border-color: rgba(226, 232, 240, 0.25);
}

.resources-world-map-card.is-fullview .resources-world-map-legend-btn:hover,
.resources-world-map-card.is-fullview .resources-world-map-legend-btn:focus-visible {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-toolbar-actions .btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
    border-radius: var(--wm-radius);
}

.resources-world-map-card.is-fullview .resources-world-map-toolbar-actions .btn:hover {
    background: #334155;
    border-color: #475569;
    color: #fff;
}

.resources-world-map-card.is-fullview .resources-world-map-flags-btn[aria-pressed="true"],
.resources-world-map-card.is-fullview .resources-world-map-fullview-btn[aria-pressed="true"] {
    background: #f8fafc;
    border-color: #f8fafc;
    color: #0f172a;
}

.resources-world-map-card.is-fullview .resources-world-map-flags-panel {
    background: #0f172a;
}

.resources-world-map-card.is-fullview .resources-world-map-flags-filter {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-flags-filter input {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-flags-count {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-flag-tile {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-flag-tile:hover {
    border-color: #60a5fa;
}

.resources-world-map-card.is-fullview .resources-world-map-flag-tile.is-selected {
    border-color: #ff5a1f;
}

.resources-world-map-card.is-fullview .resources-world-map-flag-tile-media {
    background: #1e293b;
    border-color: rgba(226, 232, 240, 0.12);
}

.resources-world-map-card.is-fullview .resources-world-map-flags-placeholder,
.resources-world-map-card.is-fullview .resources-world-map-flags-empty {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-layout {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    gap: 0.65rem;
    overflow: hidden;
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    grid-template-rows: minmax(0, 1fr);
}

.resources-world-map-card.is-fullview .resources-world-map-frame,
.resources-world-map-card.is-fullview .resources-world-map-details {
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
}

.resources-world-map-card.is-fullview .resources-world-map-frame {
    border-radius: var(--wm-radius);
    border-color: #334155;
    /* Match map ocean so zoom controls sit on the map, not a dark header strip. */
    background: #e2e8f0;
    box-shadow: none;
    display: flex !important;
    flex-direction: column !important;
}

.resources-world-map-card.is-fullview .resources-world-map-canvas {
    width: 100% !important;
    aspect-ratio: auto !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    background: #e2e8f0;
    border-radius: var(--wm-radius);
}

.resources-world-map-card.is-fullview .resources-world-map-canvas.leaflet-container {
    background: #e2e8f0;
    border-radius: var(--wm-radius);
}

.resources-world-map-card.is-fullview .resources-world-map-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: none;
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    border-color: #334155;
    border-radius: var(--wm-radius);
    box-shadow: none;
    color: #e2e8f0;
}

/* Keep More Details pinned at the bottom in Full View; scroll content above it. */
.resources-world-map-card.is-fullview .resources-world-map-details-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.resources-world-map-card.is-fullview .resources-world-map-details-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 0.1rem;
}

.resources-world-map-card.is-fullview .resources-world-map-details-empty {
    flex: 1 1 auto;
}

.resources-world-map-card.is-fullview .resources-world-map-details-empty h4,
.resources-world-map-card.is-fullview .resources-world-map-details-card h4 {
    color: #f1f5f9;
}

.resources-world-map-card.is-fullview .resources-world-map-details-empty p,
.resources-world-map-card.is-fullview .resources-world-map-details-card > .resources-world-map-details-title p {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-stats > div {
    background: #1e293b;
    border-color: #334155;
}

.resources-world-map-card.is-fullview .resources-world-map-stats dt {
    color: #94a3b8;
}

.resources-world-map-card.is-fullview .resources-world-map-stats dd {
    color: #f8fafc;
}

.resources-world-map-card.is-fullview .resources-world-map-locator {
    background: #1e293b;
    border-color: #334155;
}

.resources-world-map-card.is-fullview .resources-world-map-locator-canvas {
    background: #1e293b;
}

.resources-world-map-card.is-fullview .resources-world-map-flag {
    border-color: rgba(226, 232, 240, 0.25);
    background: #1e293b;
}

.resources-world-map-card.is-fullview .resources-world-map-swatch {
    border-color: rgba(226, 232, 240, 0.3);
}

.resources-world-map-card.is-fullview .resources-world-map-more-btn {
    flex: 0 0 auto;
    margin-top: 0.85rem;
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.resources-world-map-card.is-fullview .resources-world-map-more-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #fff;
}

.resources-world-map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 1rem;
    min-height: 0;
    /* Shared locked shell for Reset / country / continent — details scrolls inside. */
    height: min(68vh, 720px);
    max-height: min(68vh, 720px);
    overflow: hidden;
    align-items: stretch;
}

/* Outer frame owns the border so Leaflet tiles cannot clip corner strokes. */
.resources-world-map-frame {
    position: relative;
    min-width: 0;
    min-height: 0;
    border: 1px solid #94a3b8;
    border-radius: var(--wm-radius);
    background: #e2e8f0;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

.resources-world-map-canvas {
    /* ~2:1 world-map frame so Antarctica/Australia stay in view */
    width: 100%;
    aspect-ratio: 2 / 1;
    min-height: 420px;
    height: auto;
    max-height: min(72vh, 820px);
    border: 0;
    border-radius: var(--wm-radius);
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: none;
    box-sizing: border-box;
}

.resources-world-map-canvas.leaflet-container {
    position: relative;
    width: 100%;
    height: 100%;
    font: inherit;
    background: #e2e8f0;
    border-radius: var(--wm-radius);
    overflow: hidden;
}

/* Do not round Leaflet panes themselves — that can leave a gap above the tiles
   so zoom controls look like they sit on their own header row. Clip via the frame. */

.resources-world-map-canvas .leaflet-control-container {
    position: absolute;
    inset: 0;
    z-index: 800;
    pointer-events: none;
}

.resources-world-map-canvas .leaflet-top,
.resources-world-map-canvas .leaflet-bottom {
    pointer-events: none;
}

.resources-world-map-canvas .leaflet-control {
    pointer-events: auto;
}

/* Keep +/- overlaid on the map surface (not above it). */
.resources-world-map-canvas .leaflet-top.leaflet-left {
    top: 0;
    left: 0;
    margin-top: 10px;
    margin-left: 10px;
}

.resources-world-map-canvas .leaflet-interactive {
    outline: none;
}

/* Selected fill keeps a light edge; top-pane outline carries the full white border. */
.resources-world-map-canvas path.resources-world-map-selected-country {
    stroke: #ffffff !important;
    stroke-width: 1.2px !important;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter:
        drop-shadow(0 0 4px #ff5a1f)
        drop-shadow(0 0 10px rgba(255, 90, 31, 0.85));
}

.resources-world-map-canvas .leaflet-selectionPane,
.resources-world-map-canvas .leaflet-pane.leaflet-selectionPane {
    pointer-events: none !important;
}

.resources-world-map-canvas path.resources-world-map-selected-outline {
    fill: none !important;
    stroke: #ffffff !important;
    stroke-width: 3.8px !important;
    stroke-linejoin: round;
    stroke-linecap: round;
    pointer-events: none !important;
    filter:
        drop-shadow(0 0 1.5px #ffffff)
        drop-shadow(0 0 5px #ff5a1f);
}

/* Geology.com-style country names (non-interactive overlay). */
.resources-world-map-country-label,
.resources-world-map-country-label.leaflet-marker-icon,
.resources-world-map-country-label .resources-world-map-country-label-text {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.resources-world-map-country-label-text {
    display: inline-block;
    transform: translate(-50%, -50%);
    font-family: Arial, Helvetica, "Segoe UI", sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #111827;
    line-height: 1.05;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    text-shadow:
        0 0 2px #fff,
        0 0 3px #fff,
        1px 0 0 #fff,
        -1px 0 0 #fff,
        0 1px 0 #fff,
        0 -1px 0 #fff;
}

.resources-world-map-card.is-flags-view .resources-world-map-country-label {
    display: none !important;
}

/* Capital city pin (shown when a country is selected). */
.resources-world-map-capital-marker-wrap {
    background: none !important;
    border: none !important;
}

.resources-world-map-capital-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
    transform: translate(-50%, -85%);
    text-decoration: none !important;
    cursor: pointer;
    pointer-events: auto;
}

.resources-world-map-capital-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #dc2626;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35), 0 1px 3px rgba(15, 23, 42, 0.35);
    flex: 0 0 auto;
}

.resources-world-map-capital-name {
    font-family: Arial, Helvetica, "Segoe UI", sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    white-space: nowrap;
    text-shadow:
        0 0 2px #fff,
        0 0 3px #fff,
        1px 0 0 #fff,
        -1px 0 0 #fff,
        0 1px 0 #fff,
        0 -1px 0 #fff;
}

.resources-world-map-country-label-text.is-selected {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.resources-world-map-capital-marker:hover .resources-world-map-capital-dot,
.resources-world-map-capital-marker:focus-visible .resources-world-map-capital-dot {
    background: #b91c1c;
    transform: scale(1.12);
}

.resources-world-map-card.is-flags-view .resources-world-map-capital-marker-wrap {
    display: none !important;
}

/* Keep Leaflet zoom buttons from sticking in a blue focused/active look after map clicks. */
.resources-world-map-canvas .leaflet-bar {
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.resources-world-map-canvas .leaflet-bar a,
.resources-world-map-canvas .leaflet-bar a:hover,
.resources-world-map-canvas .leaflet-bar a:focus,
.resources-world-map-canvas .leaflet-bar a:active,
.resources-world-map-canvas .leaflet-bar a:focus-visible {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border-bottom-color: #e2e8f0 !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.resources-world-map-canvas .leaflet-bar a:hover {
    background: #f1f5f9 !important;
}

.resources-world-map-canvas .leaflet-bar a.leaflet-disabled {
    background: #f8fafc !important;
    color: #94a3b8 !important;
}

.resources-world-map-details {
    display: flex;
    flex-direction: column;
    border: 1px solid #94a3b8;
    border-radius: var(--wm-radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.1rem 1.15rem;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    align-self: stretch;
}

/* Country / continent cards: pin More Details; scroll facts above it. */
.resources-world-map-details-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.resources-world-map-details-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.15rem;
}

.resources-world-map-details-empty {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Dark theme: keep World Map chrome radii/spacing consistent (no pill search vs square map). */
body.theme-dark .resources-world-map-card > .table-header.resources-header {
    background: transparent !important;
    border-bottom: none !important;
}

body.theme-dark .resources-world-map-search {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-search input {
    background: #0f151d !important;
    border-color: #334155 !important;
    color: #e6edf3 !important;
    border-radius: var(--wm-radius) !important;
    box-shadow: none !important;
}

body.theme-dark .resources-world-map-suggestions {
    background: #121922;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

body.theme-dark .resources-world-map-suggestion {
    color: #e6edf3;
}

body.theme-dark .resources-world-map-suggestion:hover,
body.theme-dark .resources-world-map-suggestion.is-active {
    background: #1e2834;
}

body.theme-dark .resources-world-map-suggestion-meta,
body.theme-dark .resources-world-map-suggestion-empty {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-legend {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-legend-btn:hover,
body.theme-dark .resources-world-map-legend-btn:focus-visible {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .resources-world-map-legend-btn.is-active {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #bfdbfe;
}

body.theme-dark .resources-world-map-toolbar-actions .btn {
    border-radius: var(--wm-radius);
}

body.theme-dark .resources-world-map-frame {
    border-color: #334155;
}

body.theme-dark .resources-world-map-flags-panel {
    background: #0f172a;
}

body.theme-dark .resources-world-map-flags-filter {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-flags-filter input {
    background: #0f151d !important;
    border-color: #334155 !important;
    color: #e6edf3 !important;
}

body.theme-dark .resources-world-map-flags-count,
body.theme-dark .resources-world-map-flags-placeholder,
body.theme-dark .resources-world-map-flags-empty {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-flag-tile {
    background: #121922;
    border-color: #334155;
    color: #e6edf3;
}

body.theme-dark .resources-world-map-flag-tile:hover {
    border-color: #60a5fa;
}

body.theme-dark .resources-world-map-flag-tile.is-selected {
    border-color: #ff5a1f;
}

body.theme-dark .resources-world-map-flag-tile-media {
    background: #1a2330;
    border-color: rgba(226, 232, 240, 0.12);
}

body.theme-dark .resources-world-map-details {
    background: linear-gradient(180deg, #121922 0%, #0f151d 100%);
    border-color: #334155;
    color: #e6edf3;
}

body.theme-dark .resources-world-map-details-empty h4,
body.theme-dark .resources-world-map-details-card h4 {
    color: #f1f5f9;
}

body.theme-dark .resources-world-map-details-empty p,
body.theme-dark .resources-world-map-details-card > .resources-world-map-details-title p {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-stats > div {
    background: #1a2330;
    border-color: #334155;
}

body.theme-dark .resources-world-map-stats dt {
    color: #94a3b8;
}

body.theme-dark .resources-world-map-stats dd {
    color: #f8fafc;
}

body.theme-dark .resources-world-map-locator {
    background: #1a2330;
    border-color: #334155;
}

body.theme-dark .resources-world-map-locator-canvas {
    background: #1a2330;
}

.resources-world-map-details-empty h4,
.resources-world-map-details-card h4 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    color: #0f172a;
}

.resources-world-map-details-empty p,
.resources-world-map-details-card > .resources-world-map-details-title p {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
}

.resources-world-map-details-title {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.resources-world-map-swatch {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 4px;
    border: 1px solid rgba(15, 23, 42, 0.25);
    flex: 0 0 auto;
    margin-top: 0.2rem;
}

.resources-world-map-flag {
    width: 3.4rem;
    height: 2.55rem;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    flex: 0 0 auto;
    background: #e2e8f0;
}

.resources-world-map-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 0;
    text-decoration: none;
    flex: 0 0 auto;
}

.resources-world-map-locator {
    margin: 0.75rem 0;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f3f4f6;
    padding: 0.55rem;
    display: flex;
    justify-content: center;
}

.resources-world-map-locator-canvas {
    display: block;
    width: min(100%, 240px);
    height: auto;
    background: #f3f4f6;
    border-radius: 6px;
}

.resources-world-map-locator-canvas.is-globe {
    aspect-ratio: 1 / 1;
}

.resources-world-map-stats {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.resources-world-map-stats > div {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.resources-world-map-stats dt {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.resources-world-map-stats dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.resources-world-map-muted {
    font-weight: 500;
    color: #64748b;
    font-size: 0.92em;
}

.resources-world-map-religion-list,
.resources-world-map-un-list {
    margin: 0.15rem 0 0;
    padding: 0 0 0 1.1rem;
    list-style: disc;
}

.resources-world-map-religion-list li,
.resources-world-map-un-list li {
    margin: 0.12rem 0;
    font-weight: 600;
    line-height: 1.35;
}

.resources-world-map-stats-continent dd {
    font-size: 0.95rem;
}

.resources-world-map-wiki-link {
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.45);
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.resources-world-map-wiki-link:hover,
.resources-world-map-wiki-link:focus-visible {
    color: #1d4ed8;
    text-decoration-color: #1d4ed8;
    outline: none;
}

.resources-world-map-details-title h4 .resources-world-map-wiki-link {
    font-size: inherit;
    font-weight: inherit;
}

.resources-world-map-religion-pct {
    font-weight: 600;
    color: #475569;
}

.resources-world-map-religion-sep {
    color: #94a3b8;
    font-weight: 500;
}

/* Wiki-style hover preview (Wikipedia page summary).
 * Must sit above World Map Full View (card z-index ~2147483000). */
.resources-world-map-wiki-preview {
    position: fixed;
    z-index: 2147483646;
    max-width: min(380px, calc(100vw - 20px));
    background: #fff;
    border: 1px solid #c8ccd1;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    pointer-events: auto;
}

.resources-world-map-wiki-preview.has-media {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 200px;
}

.resources-world-map-wiki-preview[hidden] {
    display: none !important;
}

.resources-world-map-wiki-preview-media {
    flex: 0 0 160px;
    width: 160px;
    background: #eaecf0;
    overflow: hidden;
    align-self: stretch;
}

.resources-world-map-wiki-preview-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Keep faces / tops of portraits in frame (Wiki-like). */
    object-position: top center;
}

.resources-world-map-wiki-preview-media.is-portrait {
    flex-basis: 140px;
    width: 140px;
}

.resources-world-map-wiki-preview-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.75rem 0.85rem 0.8rem;
    display: flex;
    flex-direction: column;
}

.resources-world-map-wiki-preview-body.is-loading {
    min-height: 3rem;
    display: flex;
    align-items: center;
}

.resources-world-map-wiki-preview-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.resources-world-map-wiki-preview-extract {
    margin: 0 0 0.65rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #202122;
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resources-world-map-wiki-preview-extract strong {
    font-weight: 700;
    color: #000;
}

.resources-world-map-wiki-preview-status {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.resources-world-map-wiki-preview-open {
    display: inline-block;
    margin-top: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #36c;
    text-decoration: none;
}

.resources-world-map-wiki-preview-open:hover {
    text-decoration: underline;
}

body.theme-dark .resources-world-map-wiki-link:hover,
body.theme-dark .resources-world-map-wiki-link:focus-visible {
    color: #93c5fd;
    text-decoration-color: #93c5fd;
}

.resources-world-map-card.is-fullview .resources-world-map-wiki-link:hover,
.resources-world-map-card.is-fullview .resources-world-map-wiki-link:focus-visible {
    color: #93c5fd;
    text-decoration-color: #93c5fd;
}

@media (max-width: 960px) {
    .resources-world-map-layout {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    .resources-world-map-frame,
    .resources-world-map-canvas {
        min-height: 0;
        max-height: none;
    }

    .resources-world-map-canvas {
        aspect-ratio: 16 / 10;
        min-height: 280px;
        height: auto;
        max-height: min(50vh, 480px);
    }

    .resources-world-map-details {
        height: min(50vh, 480px) !important;
        max-height: min(50vh, 480px) !important;
        min-height: 0;
        overflow: hidden;
    }

    .resources-world-map-card.is-fullview {
        padding: 0.75rem 0.85rem 0.9rem !important;
    }

    .resources-world-map-card.is-fullview .resources-world-map-layout {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        flex: 1 1 0 !important;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(180px, 38%);
    }

    .resources-world-map-card.is-fullview .resources-world-map-canvas {
        aspect-ratio: auto !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    .resources-world-map-card.is-fullview .resources-world-map-details {
        height: 100% !important;
        max-height: none !important;
        min-height: 0 !important;
    }
}
