/* OptiWize region router — visual style after ARIA (precision NOC / HUD, monochromatic depth + single electric-cyan accent). */

:root {
	--bg-base: #04080f;
	--bg-container: #0a1018;
	--bg-elevated: #0e1620;
	--surface: rgba(255, 255, 255, 0.025);
	--surface-hover: rgba(255, 255, 255, 0.05);

	--accent: #00d4ff;
	--accent-hover: #33ddff;
	--accent-muted: rgba(0, 212, 255, 0.12);
	--accent-glow: rgba(0, 212, 255, 0.18);

	--soon: #ffb020; /* amber for "coming soon" regions */
	--soon-muted: rgba(255, 176, 32, 0.14);

	--up: #2ecc71; /* green — only ever a positive, measured signal, never a "down" state */
	--up-muted: rgba(46, 204, 113, 0.14);

	--border: rgba(255, 255, 255, 0.07);
	--border-active: rgba(0, 212, 255, 0.28);

	--text: #e8ecf1;
	--text-bright: #f4f6f8;
	--text-secondary: #8b9bb0;
	--text-muted: #6b7a8d;

	--font-sans: "Outfit", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
	--font-mono: "Space Mono", "JetBrains Mono", monospace;

	--radius: 12px;
	--ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
	box-sizing: border-box;
}
html,
body {
	height: 100%;
	margin: 0;
}
body {
	font-family: var(--font-sans);
	background: var(--bg-base);
	color: var(--text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow: hidden;
}

/* ---- scene ---- */
.scene {
	position: relative;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	background:
		radial-gradient(1200px 800px at 70% 35%, rgba(0, 212, 255, 0.06), transparent 60%),
		var(--bg-base);
}

/* ---- world map (ambient background) ---- */
.world-map {
	position: absolute;
	top: 50%;
	/* centering + subtle mouse parallax (--px/--py eased by app.js per frame).
	   scale > 1 keeps the translated map from revealing dark edges. */
	transform: translateY(-50%) translate(var(--px, 0px), var(--py, 0px)) scale(1.1);
	will-change: transform;
	right: 0;
	left: 540px; /* whole map (meet, no crop) framed to the right of the panel so no beacon is occluded or cut */
	width: auto;
	height: auto;
	opacity: 0.95;
}
.wm-countries path {
	fill: rgba(120, 150, 180, 0.07);
	stroke: rgba(0, 212, 255, 0.13);
	stroke-width: 0.4;
	vector-effect: non-scaling-stroke;
}

/* faint HUD grid + edge vignette to seat the map in deep space */
.grid-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(to right, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
	background-size: 64px 64px;
	mask-image: radial-gradient(900px 700px at 70% 40%, #000 30%, transparent 75%);
	-webkit-mask-image: radial-gradient(900px 700px at 70% 40%, #000 30%, transparent 75%);
}
.vignette {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(100% 115% at 70% 45%, transparent 30%, rgba(4, 8, 15, 0.86) 100%);
}

/* ---- CRT scanlines (purely atmospheric, no data) ---- */
.scanlines {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0.025) 0px,
		rgba(255, 255, 255, 0.025) 1px,
		transparent 1px,
		transparent 3px
	);
	animation: scanline-drift 9s linear infinite;
}
@keyframes scanline-drift {
	from {
		background-position-y: 0;
	}
	to {
		background-position-y: 200px;
	}
}

/* ---- beacons (SVG, created by app.js inside the map viewBox) ---- */
.beacon .ring {
	fill: none;
	stroke: var(--accent);
	stroke-width: 1.2;
	transform-box: fill-box;
	transform-origin: center;
	opacity: 0;
}
.beacon .halo {
	fill: var(--accent);
	opacity: 0.12;
}
.beacon .dot {
	fill: var(--accent);
}
.beacon .dot-core {
	fill: #eafcff;
}
.beacon.soon .halo {
	fill: var(--soon);
	opacity: 0.1;
}
.beacon.soon .dot {
	fill: var(--soon);
	opacity: 0.7;
}
.beacon.soon .dot-core {
	fill: #fff4e0;
	opacity: 0.7;
}
.beacon.navigable {
	cursor: pointer;
}
/* live pulse on navigable beacons */
.beacon.navigable .ring {
	opacity: 1;
	animation: beacon-pulse 2.8s var(--ease) infinite;
}
.beacon.selected .dot {
	r: 4;
}
.beacon.selected .halo {
	opacity: 0.28;
}
@keyframes beacon-pulse {
	0% {
		transform: scale(0.6);
		opacity: 0.9;
	}
	70% {
		transform: scale(2.6);
		opacity: 0;
	}
	100% {
		transform: scale(2.6);
		opacity: 0;
	}
}
.beacon-label {
	font-family: var(--font-mono);
	font-size: 8px;
	fill: var(--text-secondary);
	letter-spacing: 0.04em;
}
.beacon.selected .beacon-label,
.beacon.navigable:hover .beacon-label {
	fill: var(--text-bright);
}

/* ---- live lat/long readout (follows the mouse over the map) ---- */
.geo-readout {
	position: absolute;
	right: 24px;
	bottom: 22px;
	z-index: 2;
	padding: 6px 10px;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.03em;
	color: var(--accent);
	background: rgba(4, 8, 15, 0.6);
	border: 1px solid var(--border);
	border-radius: 6px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 160ms var(--ease);
}
.geo-readout.visible {
	opacity: 1;
}

/* ---- beacon tooltip (hover on any beacon; positioned in JS via SVG->screen CTM) ---- */
.beacon-tooltip {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 3;
	min-width: 168px;
	padding: 10px 12px;
	background: rgba(4, 8, 15, 0.86);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	opacity: 0;
	pointer-events: none;
	transform: translate(calc(-50% + var(--bt-shift-x, 0px)), calc(-100% - 14px));
	transition: opacity 140ms var(--ease);
}
.beacon-tooltip.flip-below {
	transform: translate(calc(-50% + var(--bt-shift-x, 0px)), 14px);
}
.beacon-tooltip.visible {
	opacity: 1;
}
.bt-row {
	display: flex;
	justify-content: space-between;
	gap: 14px;
	padding: 3px 0;
	font-family: var(--font-mono);
	font-size: 10.5px;
	letter-spacing: 0.03em;
	white-space: nowrap;
}
.bt-row + .bt-row {
	border-top: 1px solid var(--border);
}
.bt-key {
	color: var(--text-muted);
}
.bt-val {
	color: var(--text-bright);
}
.bt-val.status-online {
	color: var(--up);
}
.bt-val.status-soon {
	color: var(--soon);
}

/* ---- panel (the glass HUD on the left) ---- */
.panel {
	position: relative;
	z-index: 2;
	width: min(440px, 92vw);
	margin: 0;
	top: 50%;
	left: clamp(24px, 7vw, 96px);
	transform: translateY(-50%);
	padding: 36px 34px 30px;
	background: linear-gradient(180deg, rgba(14, 22, 32, 0.86), rgba(10, 16, 24, 0.78));
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow:
		0 12px 48px rgba(0, 0, 0, 0.55),
		0 0 64px rgba(0, 212, 255, 0.06);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 28px;
}
.brand-logo {
	display: block;
	height: 30px;
	width: auto;
}

.eyebrow {
	margin: 0 0 10px;
	font-family: var(--font-mono);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.22em;
	color: var(--accent);
}
.regions-online {
	margin-left: 6px;
	font-weight: 400;
	color: var(--text-muted);
}
.boot-log {
	margin: 0 0 6px;
	height: 14px;
	font-family: var(--font-mono);
	font-size: 10px;
	line-height: 14px;
	letter-spacing: 0.03em;
	color: var(--text-muted);
	overflow: hidden;
	white-space: nowrap;
	opacity: 1;
	transition: opacity 500ms var(--ease);
}
.boot-log.done {
	opacity: 0;
}
.title {
	margin: 0 0 8px;
	font-size: 27px;
	font-weight: 600;
	line-height: 1.15;
	color: var(--text-bright);
}
.sub {
	margin: 0 0 24px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--text-secondary);
}

/* ---- region rows ---- */
.regions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 22px;
}
.region {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 13px 15px;
	font-family: var(--font-sans);
	text-align: left;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}
.region:hover:not(.is-soon) {
	background: var(--surface-hover);
	border-color: var(--border-active);
}
.region.selected {
	border-color: var(--accent);
	background: var(--accent-muted);
	box-shadow: 0 0 0 1px var(--accent-glow), 0 0 22px rgba(0, 212, 255, 0.1);
}
.region:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
.region.is-soon {
	cursor: not-allowed;
	opacity: 0.55;
}
.region-code {
	font-family: var(--font-mono);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--accent);
	min-width: 30px;
}
.region.is-soon .region-code {
	color: var(--soon);
}
.region-text {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}
.region-label {
	font-size: 14.5px;
	font-weight: 500;
	color: var(--text-bright);
}
.region-city {
	font-family: var(--font-mono);
	font-size: 10.5px;
	letter-spacing: 0.04em;
	color: var(--text-muted);
}
.region-latency {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 2px;
	font-family: var(--font-mono);
	font-size: 10.5px;
	letter-spacing: 0.04em;
	color: var(--text-secondary);
}
.region-latency:empty {
	display: none;
}
.latency-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--up);
	box-shadow: 0 0 6px var(--up-muted);
	flex: none;
}
.region-badge {
	font-family: var(--font-mono);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.12em;
	color: var(--soon);
	border: 1px solid var(--soon-muted);
	background: var(--soon-muted);
	border-radius: 999px;
	padding: 3px 8px;
}
.region-check {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: transparent;
	border: 1.5px solid var(--text-muted);
	flex: none;
}
.region.selected .region-check {
	background: var(--accent);
	border-color: var(--accent);
	box-shadow: 0 0 10px var(--accent-glow);
}

/* ---- CTA ---- */
.cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px;
	font-family: var(--font-sans);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #04141b;
	background: var(--accent);
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: background 160ms var(--ease), box-shadow 160ms var(--ease), transform 120ms var(--ease);
}
.cta:hover:not(:disabled) {
	background: var(--accent-hover);
	box-shadow: 0 0 28px rgba(0, 212, 255, 0.35);
}
.cta:active:not(:disabled) {
	transform: translateY(1px);
}
.cta:focus-visible {
	outline: 2px solid var(--accent-hover);
	outline-offset: 3px;
}
.cta:disabled {
	background: rgba(255, 255, 255, 0.07);
	color: var(--text-muted);
	cursor: not-allowed;
}
.cta-arrow {
	font-size: 17px;
	line-height: 1;
}

.hint {
	margin: 12px 0 0;
	min-height: 16px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	letter-spacing: 0.02em;
	color: var(--soon);
}

/* ---- responsive ---- */
@media (max-width: 720px) {
	.panel {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		transform: none;
		width: 100%;
		border-radius: 16px 16px 0 0;
		border-bottom: 0;
		padding: 26px 22px calc(22px + env(safe-area-inset-bottom));
	}
	.vignette {
		background: radial-gradient(120% 90% at 50% 25%, transparent 30%, rgba(4, 8, 15, 0.9) 95%);
	}
	.title {
		font-size: 23px;
	}
	.world-map {
		left: 0; /* full-bleed behind the bottom sheet on small screens */
	}
	.geo-readout {
		display: none;
	}
	.beacon-tooltip {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.beacon.navigable .ring {
		animation: none;
		opacity: 0.5;
	}
	.scanlines {
		display: none;
	}
	* {
		transition: none !important;
	}
}
