.sos-map-root {
	--sos-green: #3bb042;
	--sos-orange: #f09a1f;
	--sos-pink: #da65c8;
	--sos-grey: #dbe2e7;
	--sos-grey-border: #ffffff;
	--sos-ink: #171a1c;
	--sos-brand-blue: #094977;
	--sos-brand-grey: #3f484d;
	--sos-bg: #ffffff;
	--sos-radius: 14px;

	position: relative;
	width: 100%;
	background: var(--sos-bg);
	color: var(--sos-ink);
	font-family: inherit;
	border-radius: var(--sos-radius);
	overflow: hidden;
}

.sos-map-logo {
	width: 150px;
	max-width: 100%;
	height: auto;
	display: block;
	margin-bottom: 16px;
}

.sos-map-quarter {
	display: block;
	font-size: 12px;
	font-weight: 400;
	color: #5b666b;
	letter-spacing: 0.2px;
	margin-top: 10px;
}

.sos-map-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	min-height: 360px;
}

.sos-map-svg {
	width: 100%;
	height: 100%;
	display: block;
	background: transparent;
	cursor: grab;
	touch-action: none;
}

.sos-map-svg:active { cursor: grabbing; }

.sos-map-svg .sos-zoom-g { will-change: transform; }

.sos-map-svg path.sos-country {
	stroke: var(--sos-grey-border);
	stroke-width: 0.5;
	vector-effect: non-scaling-stroke;
	transition: filter 120ms ease;
}

.sos-map-svg path.sos-country.sos-clickable { cursor: pointer; }
.sos-map-svg path.sos-country.sos-clickable:hover,
.sos-map-svg path.sos-country.sos-hover,
.sos-map-svg path.sos-country.sos-active {
	filter: brightness(0.9);
}

.sos-map-legend {
	position: absolute;
	left: 28px;
	bottom: 24px;
	background: rgba(255,255,255,0.92);
	border-radius: 10px;
	padding: 20px 24px;
	box-shadow: 0 2px 10px rgba(23,26,28,0.06);
	z-index: 2;
}

.sos-map-count {
	font-size: 13px;
	line-height: 1.2;
	margin: 0 0 4px;
}

.sos-map-count strong { font-size: 16px; }
.sos-map-count-label { font-weight: 700; }

.sos-map-legend ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.sos-map-legend li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	line-height: 1.25;
	margin: 3px 0;
	padding: 1px 0;
}

.sos-dot {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
}

.sos-map-legend-heading {
	font-size: 13px;
	font-weight: 700;
	margin-bottom: 6px;
	color: var(--sos-ink);
}

.sos-map-controls {
	position: absolute;
	bottom: 18px;
	right: 18px;
	display: flex;
	flex-direction: row;
	gap: 6px;
	z-index: 2;
}

.sos-map-btn {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border-radius: 8px;
	border: 1px solid rgba(23,26,28,0.08);
	background: #fff;
	color: var(--sos-ink);
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(23,26,28,0.08);
}

.sos-map-btn:hover { background: #f4f9fb; }

.sos-map-btn svg {
	width: 18px;
	height: 18px;
	display: block;
}

.sos-map-btn-download {
	width: auto;
	padding: 0 14px;
	letter-spacing: 0.5px;
}

.sos-map-btn .sos-icon-fs-exit { display: none; }
.sos-map-root.is-fullscreen .sos-map-btn[data-act="fullscreen"] .sos-icon-fs-enter { display: none; }
.sos-map-root.is-fullscreen .sos-map-btn[data-act="fullscreen"] .sos-icon-fs-exit { display: block; }

/* Collapse / expand the legend + control bar (mobile-first; hidden on desktop).
   Lives outside .sos-map-controls so it stays visible when the rest is hidden, but
   visually sits at the right end of the controls row (bottom-right corner). */
.sos-map-btn-collapse {
	position: absolute;
	bottom: 18px;
	right: 18px;
	z-index: 4;
	display: none;
}
.sos-map-btn-collapse .sos-icon-expand { display: none; }
.sos-map-root.is-ui-collapsed .sos-map-btn-collapse .sos-icon-collapse { display: none; }
.sos-map-root.is-ui-collapsed .sos-map-btn-collapse .sos-icon-expand { display: block; }
.sos-map-root.is-ui-collapsed .sos-map-controls { display: none; }
.sos-map-root.is-ui-collapsed .sos-map-legend { display: none; }
.sos-map-root.is-ui-collapsed .sos-map-popup { display: none; }

/* Show the collapse button on small screens and whenever the map is fullscreen.
   When it's visible, shift the controls bar left so the X sits to its right (not on top). */
@media (max-width: 640px) {
	.sos-map-btn-collapse { display: inline-flex; bottom: 12px; right: 12px; width: 32px; height: 32px; }
	.sos-map-controls { bottom: 12px; right: 48px; } /* 12 + 32 + 4 gap */
}
.sos-map-root.is-fullscreen .sos-map-btn-collapse,
.sos-map-root.is-fullscreen-fallback .sos-map-btn-collapse { display: inline-flex; }
.sos-map-root.is-fullscreen .sos-map-controls,
.sos-map-root.is-fullscreen-fallback .sos-map-controls { right: 62px; } /* 18 + 38 + 6 gap */

.sos-map-root.is-fullscreen,
.sos-map-root.is-fullscreen-fallback {
	position: fixed !important;
	inset: 0;
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	max-height: 100vh;
	margin: 0;
	border-radius: 0;
	z-index: 99999;
	background: #fff;
	display: flex;
	flex-direction: column;
}

.sos-map-root.is-fullscreen .sos-map-stage,
.sos-map-root.is-fullscreen-fallback .sos-map-stage {
	flex: 1 1 auto;
	aspect-ratio: auto;
	min-height: 0;
	height: auto;
}

.sos-map-rotate-hint {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 100;
	background: rgba(255,255,255,0.96);
	color: var(--sos-ink);
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 12px;
	text-align: center;
	padding: 24px;
	font-size: 16px;
	font-weight: 600;
}

.sos-map-rotate-hint p { margin: 0; max-width: 280px; line-height: 1.3; }

@media (max-width: 900px) and (orientation: portrait) {
	.sos-map-root.is-fullscreen .sos-map-rotate-hint,
	.sos-map-root.is-fullscreen-fallback .sos-map-rotate-hint {
		display: flex;
	}
}

.sos-map-popup {
	position: absolute;
	right: 28px;
	top: 28px;
	width: min(360px, calc(100% - 56px));
	max-height: calc(100% - 96px);
	overflow-y: auto;
	background: #fff;
	border-radius: 16px;
	padding: 20px 24px;
	box-shadow: 0 10px 30px rgba(23,26,28,0.15);
	display: none;
	z-index: 3;
}

.sos-map-popup.is-open { display: block; }

.sos-map-popup p { margin: 0; }

.sos-map-popup .sos-popup-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: 0;
	padding: 0;
	color: var(--sos-brand-grey);
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	margin: 0 0 10px;
}

.sos-popup-back svg { width: 10px; height: 10px; }

.sos-map-popup .sos-popup-back:hover,
.sos-map-popup .sos-popup-back:focus,
.sos-map-popup .sos-popup-back:focus-visible {
	background: transparent;
	background-color: transparent;
	color: #23292c;
	box-shadow: none;
	outline: none;
}

.sos-map-popup hr {
	border: 0;
	border-top: 1px solid #e6eaef;
	margin: 0 0 14px;
}

.sos-map-popup h3 {
	margin: 0 0 2px;
	font-size: 30px;
	font-weight: 800;
	color: var(--sos-brand-grey);
	line-height: 1.1;
}

/* These margin rules must out-rank the `.sos-map-popup p { margin: 0 }` theme reset
   above (0,1,1) — hence the extra .sos-map-popup qualifier (0,2,0). */
.sos-map-popup .sos-popup-region {
	color: var(--sos-ink);
	font-size: 14px;
	margin: 0 0 8px;
}

.sos-popup-chip {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 999px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.3px;
	margin: 0 0 12px;
}

.sos-map-popup .sos-popup-desc {
	color: var(--sos-ink);
	font-size: 14px;
	margin: 0 0 24px;
	line-height: 1.4;
}

.sos-map-popup .sos-popup-news-title {
	color: var(--sos-brand-grey);
	font-weight: 800;
	font-size: 15px;
	margin: 0 0 8px;
}

.sos-popup-news {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* Reset any theme li margin — the flex gap above is the only spacing we want. */
.sos-popup-news li {
	margin: 0;
}

.sos-popup-news a {
	display: flex;
	gap: 10px;
	color: var(--sos-brand-grey);
	text-decoration: none;
	font-weight: 700;
	font-size: 16px;
	line-height: 1.3;
}

.sos-popup-news a::before {
	content: "→";
	flex-shrink: 0;
}

.sos-popup-news a:hover { text-decoration: underline; }

.sos-popup-empty {
	font-style: italic;
	color: #667;
	font-size: 14px;
}

@media (max-width: 640px) {
	.sos-map-stage { aspect-ratio: 4 / 3; min-height: 320px; }
	.sos-map-popup {
		left: 12px;
		right: 12px;
		top: 12px;
		width: auto;
		max-height: calc(100% - 120px);
		padding: 16px 18px;
	}
	.sos-map-popup h3 { font-size: 22px; }
	.sos-map-legend {
		left: 12px;
		top: 12px;
		right: auto;
		bottom: auto;
		padding: 10px 12px;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px 10px;
	}
	.sos-map-legend .sos-map-logo { width: 100px; margin: 0; flex-basis: 100%; }
	.sos-map-legend .sos-map-quarter { font-size: 10px; margin: 0; flex-basis: 100%; }
	.sos-map-legend .sos-map-count { font-size: 10px; margin: 0; }
	.sos-map-legend .sos-map-count strong { font-size: 11px; }
	.sos-map-legend ul { flex-direction: row; gap: 8px; flex-wrap: wrap; }
	.sos-map-legend li { font-size: 10px; gap: 4px; }
	.sos-dot { width: 7px; height: 7px; }
	.sos-map-controls { bottom: 12px; right: 48px; gap: 4px; } /* leave room for the collapse X at right: 12px */
	.sos-map-btn { width: 32px; height: 32px; }
	.sos-map-btn svg { width: 14px; height: 14px; }
	.sos-map-btn-download { padding: 0 10px; font-size: 12px; }
}
