/* ===============================================
   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;
}

/* 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.2s 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);
}

.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 */
}

.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));
}

.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 */
.wm-controls {
    display: none;
}

.wm-panel--active ~ .wm-controls {
    right: 480px;
}
@media (max-width: 1100px) {
    .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);
}


/* Tooltip */
.wm-tooltip {
    position: absolute;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--border-glass);
    z-index: 100;
    white-space: nowrap;
}
.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;
    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;
    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: 120px;
    top: 24px;
    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));
}

.wm-panel-titles {
    flex: 1;
}

.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);
}

.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;
}

/* 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;
    font-size: 4rem;
    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;
}

/* 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;
    }
}
