/* Explorator: front-end widget. Dark, hero-grade, theme-driven. */

.expl-root {
	--expl-bg: #05070f;
	--expl-bg2: #0a1024;
	--expl-land: #1b2a4a;
	--expl-land-glow: #24407a;
	--expl-pin: #39d6ff;
	--expl-pin-core: #ffffff;
	--expl-ripple: #39d6ff;
	--expl-arc: #7c5cff;
	--expl-text: #e8eefc;
	--expl-text-dim: #7a89b8;
	--expl-grid: #101a33;
	--expl-radius: 18px;
	--expl-font: inherit;

	position: relative;
	width: 100%;
	min-height: 240px;
	border-radius: var(--expl-radius);
	overflow: hidden;
	color: var(--expl-text);
	font-family: var(--expl-font);
	isolation: isolate;
	box-shadow: 0 24px 80px -32px rgba(0, 0, 0, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.expl-bg-gradient { background: radial-gradient(120% 140% at 50% -10%, var(--expl-bg2), var(--expl-bg) 60%); }
.expl-bg-solid { background: var(--expl-bg); }
.expl-bg-transparent { background: transparent; box-shadow: none; }

.expl-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}
.expl-canvas:focus-visible {
	outline: 2px solid var(--expl-pin-core);
	outline-offset: -2px;
}

/* HUD layers */
.expl-hud {
	position: absolute;
	z-index: 3;
	pointer-events: none;
	font-family: var(--expl-font);
}

.expl-hud-top {
	top: 18px;
	left: 22px;
	display: flex;
	gap: 28px;
}

.expl-stat { display: flex; flex-direction: column; line-height: 1.05; }
/* One stat leads (Online now in Live mode, Visitors otherwise); the rest form a quiet secondary row. */
.expl-hud-top { align-items: flex-end; }
.expl-stat.expl-lead { order: -1; margin-right: 10px; }
.expl-stat.expl-lead .expl-num { font-size: clamp(36px, 5vw, 60px); }
.expl-stat.expl-lead .expl-lbl { color: var(--expl-text); }
.expl-stat:not(.expl-lead) .expl-num { font-size: clamp(16px, 1.8vw, 22px); text-shadow: none; }
.expl-stat:not(.expl-lead) .expl-lbl { margin-top: 2px; }
.expl-num {
	font-size: clamp(22px, 3.4vw, 40px);
	font-weight: 700;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	text-shadow: 0 0 22px color-mix(in srgb, var(--expl-pin) 35%, transparent);
}
.expl-lbl {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	color: var(--expl-text-dim);
	margin-top: 4px;
}

/* Demo mode label. Plain, high-contrast and always shown while demo data is on screen. */
.expl-demo-badge {
	align-self: center;
	padding: 4px 9px;
	border: 1px solid var(--expl-text);
	color: var(--expl-text);
	background: color-mix(in srgb, var(--expl-bg) 75%, transparent);
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	white-space: nowrap;
}
@media (forced-colors: active) {
	.expl-demo-badge { border-color: CanvasText; color: CanvasText; background: Canvas; }
}

.expl-hud-controls {
	bottom: 42px; /* clear of the 30px ticker band */
	right: 18px;
	display: flex;
	gap: 10px;
	align-items: center;
	pointer-events: auto;
}

.expl-segmented {
	display: inline-flex;
	background: color-mix(in srgb, var(--expl-bg) 55%, transparent);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 999px;
	padding: 3px;
	backdrop-filter: blur(8px);
}
.expl-segmented button {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--expl-text-dim);
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: color .18s, background .18s;
	line-height: 1;
}
.expl-segmented button:hover { color: var(--expl-text); }
.expl-segmented button.is-active {
	color: var(--expl-bg);
	background: var(--expl-pin);
	box-shadow: 0 0 18px -2px var(--expl-pin);
}
.expl-segmented button:focus-visible {
	outline: 2px solid var(--expl-pin-core);
	outline-offset: 2px;
}

/* live button + online tally */
.expl-live-btn { display: inline-flex; align-items: center; gap: 6px; }
.expl-live-dot {
	width: 7px; height: 7px; border-radius: 50%;
	background: #ff4d6d; box-shadow: 0 0 8px #ff4d6d;
	display: inline-block;
}
.expl-segmented button.is-active .expl-live-dot { background: var(--expl-bg); box-shadow: none; }
.expl-root.expl-live .expl-live-btn:not(.is-active) .expl-live-dot { animation: expl-blink 1.3s steps(2, start) infinite; }
@keyframes expl-blink { 50% { opacity: 0.25; } }

.expl-stat-online .expl-num { display: inline-flex; align-items: center; gap: 8px; color: #43f5b0; }
.expl-stat-online .expl-live-dot { background: #43f5b0; box-shadow: 0 0 10px #43f5b0; width: 9px; height: 9px; animation: expl-blink 1.6s steps(2, start) infinite; }

/* panel tabs */
.expl-panel-tabs { backdrop-filter: none; background: color-mix(in srgb, var(--expl-bg) 70%, transparent); }
.expl-panel-tabs button { font-size: 11.5px; padding: 5px 12px; }

@media (prefers-reduced-motion: reduce) {
	.expl-live-dot { animation: none !important; }
}

/* screen-reader only */
.expl-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* icon button (table toggle) */
.expl-iconbtn {
	appearance: none;
	display: inline-grid;
	place-items: center;
	width: 30px; height: 30px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: color-mix(in srgb, var(--expl-bg) 55%, transparent);
	color: var(--expl-text-dim);
	cursor: pointer;
	backdrop-filter: blur(8px);
	transition: color .18s, background .18s;
}
.expl-iconbtn:hover { color: var(--expl-text); }
.expl-iconbtn[aria-pressed="true"] { color: var(--expl-bg); background: var(--expl-pin); }
.expl-iconbtn:focus-visible { outline: 2px solid var(--expl-pin-core); outline-offset: 2px; }

/* tooltip */
.expl-tooltip {
	position: absolute;
	z-index: 5;
	transform: translate(-50%, -130%);
	background: color-mix(in srgb, var(--expl-bg) 80%, #000);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	padding: 8px 11px;
	font-size: 12px;
	pointer-events: none;
	white-space: nowrap;
	box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
}
.expl-tooltip strong { display: block; font-size: 13px; }
.expl-tooltip span { color: var(--expl-text-dim); }

/* legend */
.expl-legend {
	position: absolute;
	left: 22px; bottom: 42px;
	z-index: 3;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	max-width: 58%;
	pointer-events: none;
	transition: opacity .3s;
}
.expl-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	color: var(--expl-text-dim);
}
.expl-legend-item b { color: var(--expl-text); font-variant-numeric: tabular-nums; }
.expl-legend .expl-dot {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--expl-pin); box-shadow: 0 0 8px var(--expl-pin);
}

/* recent feed marquee */
.expl-feed {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	z-index: 2;
	height: 30px;
	overflow: hidden;
	white-space: nowrap;
	display: flex;
	align-items: center;
	mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
	pointer-events: none;
	transition: opacity .3s;
}
.expl-feed-item {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 11.5px;
	color: var(--expl-text-dim);
	padding: 0 22px;
}
.expl-feed .expl-dot {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--expl-pin);
	box-shadow: 0 0 8px var(--expl-pin);
}
.expl-feed > * { animation: expl-marquee 38s linear infinite; }

@keyframes expl-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

/* data table panel */
.expl-panel {
	position: absolute;
	inset: 0;
	z-index: 7;
	background: color-mix(in srgb, var(--expl-bg) 92%, #000);
	backdrop-filter: blur(4px);
	overflow: auto;
	padding: 18px 22px 22px;
}
.expl-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}
.expl-panel-head h3 { margin: 0; font-size: 15px; color: var(--expl-text); }
.expl-textbtn {
	appearance: none; border: 1px solid rgba(255, 255, 255, 0.14);
	background: transparent; color: var(--expl-text);
	font: inherit; font-size: 12px; font-weight: 600;
	padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.expl-textbtn:hover { border-color: var(--expl-pin); color: var(--expl-pin); }
.expl-textbtn:focus-visible { outline: 2px solid var(--expl-pin-core); outline-offset: 2px; }
.expl-panel table { width: 100%; border-collapse: collapse; font-size: 13px; outline: none; }
.expl-panel th, .expl-panel td {
	text-align: left; padding: 8px 10px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.expl-panel th { color: var(--expl-text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; position: sticky; top: 0; background: var(--expl-bg); }
.expl-panel td { color: var(--expl-text); }
.expl-panel .num { text-align: right; font-variant-numeric: tabular-nums; }
.expl-empty-msg { color: var(--expl-text-dim); padding: 28px 4px; text-align: center; }

/* empty state */
.expl-emptyhint {
	position: absolute;
	left: 50%; bottom: 18%;
	transform: translateX(-50%);
	z-index: 4;
	max-width: 70%;
	text-align: center;
	color: var(--expl-text-dim);
	font-size: 13px;
	opacity: 0;
	transition: opacity .4s;
	pointer-events: none;
}
.expl-empty .expl-emptyhint { opacity: 1; }
.expl-empty .expl-feed,
.expl-empty .expl-legend { opacity: 0; }

/* states */
.expl-loading::after {
	content: "";
	position: absolute;
	top: 0; left: -40%;
	width: 40%; height: 2px;
	z-index: 6;
	background: linear-gradient(90deg, transparent, var(--expl-pin), transparent);
	animation: expl-sweep 1.1s linear infinite;
}
@keyframes expl-sweep { to { left: 100%; } }

.expl-error::after {
	content: "Map data unavailable";
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--expl-text-dim);
	font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
	.expl-feed > * { animation: none; }
	.expl-loading::after { animation: none; }
}

/* High-contrast / forced-colors accommodation */
@media (prefers-contrast: more) {
	.expl-num { text-shadow: none; }
	.expl-segmented, .expl-iconbtn { border-color: var(--expl-text); }
	.expl-segmented button.is-active { outline: 1px solid var(--expl-text); }
}
@media (forced-colors: active) {
	.expl-segmented, .expl-iconbtn, .expl-panel { forced-color-adjust: none; }
}

@media (max-width: 640px) {
	/* ponytail: inline height is a desktop value; a square box keeps the fitted map legible on phones */
	.expl-root { height: auto !important; aspect-ratio: 4 / 5; min-height: 380px; }
	.expl-hud-top { gap: 14px; top: 12px; left: 14px; right: 14px; flex-wrap: wrap; }
	.expl-stat.expl-lead .expl-num { font-size: 34px; }
	.expl-stat:not(.expl-lead) .expl-num { font-size: 16px; }
	.expl-lbl { font-size: 10px; letter-spacing: 0.08em; }
	.expl-hud-controls { bottom: 38px; left: 10px; right: 10px; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
	.expl-legend { display: none; }
}

/* Hero-grade depth: vignette + faint grid overlay (decorative) */
.expl-root::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		linear-gradient(var(--expl-grid) 1px, transparent 1px) 0 0 / 100% 56px,
		linear-gradient(90deg, var(--expl-grid) 1px, transparent 1px) 0 0 / 56px 100%,
		radial-gradient(120% 120% at 50% 40%, transparent 55%, rgba(0,0,0,0.55) 100%);
	opacity: 0.5;
	mix-blend-mode: normal;
	mask-image: radial-gradient(120% 120% at 50% 40%, #000 60%, transparent 92%);
}
.expl-bg-transparent::before { display: none; }
