:root {
	--dark: #071426;
	--dark-2: #0b1d36;
	--navy: #0b1e3f;
	--cyan: #22d3ee;
	--cyan-bright: #00b4d8;
	--cyan-soft: #a5f3fc;
	--yellow: #fbbf24;
	--orange: #f97316;
	--pink: #ec4899;
	--text: #f6f9fc;
	--text-muted: #9aacc4;
	--border: rgba(165, 243, 252, 0.14);
	--surface: rgba(8, 25, 49, 0.82);
	--surface-strong: rgba(8, 25, 49, 0.96);
	--nav-w: 308px;
	--top-h: 88px;
	color-scheme: dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: var(--dark);
}

body {
	font-family:
		Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
		sans-serif;
	color: var(--text);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overscroll-behavior: none;
}

button,
input,
a {
	font: inherit;
}

button {
	color: inherit;
}

button,
a {
	-webkit-tap-highlight-color: transparent;
}

:focus-visible {
	outline: 3px solid var(--cyan);
	outline-offset: 3px;
}

.skip-link {
	position: fixed;
	z-index: 10000;
	top: 10px;
	left: 50%;
	padding: 10px 16px;
	border-radius: 999px;
	background: #fff;
	color: var(--dark);
	font-weight: 800;
	transform: translate(-50%, -160%);
	transition: transform 160ms ease;
}

.skip-link:focus {
	transform: translate(-50%, 0);
}

/* ── Loading + map surface ───────────────────────── */

#preloader {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: grid;
	place-content: center;
	justify-items: center;
	background:
		radial-gradient(circle at 50% 42%, rgba(34, 211, 238, 0.16), transparent 30%),
		var(--dark);
	transition:
		opacity 420ms ease,
		visibility 420ms ease;
}

#preloader.done {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.loader-bloom {
	position: relative;
	width: 84px;
	height: 84px;
	margin-bottom: 24px;
}

.bloom-dot,
.bloom-ring-1,
.bloom-ring-2,
.bloom-breathe {
	position: absolute;
	inset: 50% auto auto 50%;
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.bloom-dot {
	width: 10px;
	height: 10px;
	background: var(--cyan);
	box-shadow: 0 0 24px rgba(34, 211, 238, 0.75);
}

.bloom-ring-1 {
	width: 42px;
	height: 42px;
	border: 2px solid var(--cyan);
	animation: loader-ring 1.35s ease-in-out infinite;
}

.bloom-ring-2 {
	width: 74px;
	height: 74px;
	border: 1px solid rgba(165, 243, 252, 0.36);
	animation: loader-ring 1.35s 160ms ease-in-out infinite;
}

.bloom-breathe {
	width: 52px;
	height: 52px;
	background: radial-gradient(circle, rgba(34, 211, 238, 0.25), transparent 70%);
	animation: loader-breathe 1.8s ease-in-out infinite;
}

@keyframes loader-ring {
	0%,
	100% {
		opacity: 0.28;
		transform: translate(-50%, -50%) scale(0.8);
	}
	50% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
}

@keyframes loader-breathe {
	50% {
		opacity: 0.55;
		transform: translate(-50%, -50%) scale(1.45);
	}
}

.loader-text {
	color: var(--cyan-soft);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.loader-sub {
	margin-top: 7px;
	color: var(--text-muted);
	font-size: 12px;
}

.universe-stage {
	position: fixed;
	inset: 0;
	isolation: isolate;
	background:
		radial-gradient(circle at 72% 18%, rgba(37, 99, 235, 0.11), transparent 30%),
		radial-gradient(circle at 70% 82%, rgba(236, 72, 153, 0.08), transparent 31%),
		linear-gradient(135deg, #071426 0%, #09182d 48%, #0b1024 100%);
}

.universe-stage::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0.22;
	background-image:
		linear-gradient(rgba(165, 243, 252, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(165, 243, 252, 0.025) 1px, transparent 1px);
	background-size: 72px 72px;
	mask-image: radial-gradient(circle at 64% 48%, black, transparent 72%);
}

#universeCanvas {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	touch-action: manipulation;
}

#universeCanvas:focus-visible {
	outline-offset: -5px;
}

/* ── Navigation ───────────────────────────────────── */

.nav-panel {
	position: fixed;
	z-index: 110;
	inset: 0 auto 0 0;
	display: flex;
	width: var(--nav-w);
	flex-direction: column;
	border-right: 1px solid rgba(34, 211, 238, 0.13);
	background:
		linear-gradient(180deg, rgba(11, 30, 63, 0.96), rgba(7, 20, 38, 0.94));
	box-shadow: 24px 0 64px rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(20px);
	transition:
		transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
		visibility 300ms;
}

.nav-header {
	flex: 0 0 auto;
	padding: 22px 20px 17px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-brand {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	color: #fff;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: -0.02em;
	text-decoration: none;
}

.nav-brand .spark {
	color: var(--cyan);
	font-size: 14px;
}

.nav-brand .sub {
	margin-left: 3px;
	color: var(--cyan-soft);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.nav-tagline {
	max-width: 29ch;
	margin: 7px 0 0;
	color: var(--text-muted);
	font-size: 12px;
	line-height: 1.5;
}

.nav-stats {
	display: flex;
	gap: 13px;
	margin-top: 12px;
}

.nav-stats span {
	color: var(--text-muted);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.nav-stats b {
	color: var(--cyan);
}

.nav-back {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 15px;
	color: var(--cyan-soft);
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
}

.nav-back:hover {
	color: #fff;
}

.nav-scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 8px 8px 22px;
	overscroll-behavior: contain;
	scrollbar-color: rgba(34, 211, 238, 0.25) transparent;
}

.nav-topic {
	margin: 4px 0;
	border: 1px solid transparent;
	border-radius: 12px;
	transition:
		border-color 160ms ease,
		background 160ms ease;
}

.nav-topic.is-active {
	border-color: rgba(34, 211, 238, 0.2);
	background: rgba(34, 211, 238, 0.055);
}

.nav-topic__head {
	display: grid;
	width: 100%;
	min-height: 48px;
	grid-template-columns: auto 1fr auto auto;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	cursor: pointer;
	text-align: left;
	transition: background 140ms ease;
}

.nav-topic__head:hover {
	background: rgba(34, 211, 238, 0.09);
}

.nav-topic__dot {
	display: grid;
	width: 22px;
	height: 22px;
	place-items: center;
	border: 1px solid color-mix(in srgb, var(--topic-color) 70%, white);
	border-radius: 50%;
	background: color-mix(in srgb, var(--topic-color) 24%, transparent);
	color: #fff;
	font-size: 8px;
	font-weight: 800;
	box-shadow: 0 0 14px color-mix(in srgb, var(--topic-color) 35%, transparent);
}

.nav-topic__name {
	min-width: 0;
	overflow: hidden;
	color: var(--text);
	font-size: 14px;
	font-weight: 750;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nav-topic__count {
	padding: 3px 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.055);
	color: var(--text-muted);
	font-size: 10px;
	font-weight: 700;
}

.nav-topic__chev {
	color: var(--text-muted);
	font-size: 11px;
	transition: transform 180ms ease;
}

.nav-topic__head[aria-expanded='true'] .nav-topic__chev {
	transform: rotate(90deg);
}

.nav-children {
	display: grid;
	gap: 2px;
	padding: 2px 8px 9px 35px;
}

.nav-children[hidden] {
	display: none;
}

.nav-item {
	display: grid;
	width: 100%;
	min-height: 44px;
	grid-template-columns: auto 1fr;
	align-items: center;
	gap: 9px;
	padding: 7px 9px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	text-align: left;
	transition:
		background 120ms ease,
		color 120ms ease;
}

.nav-item:hover,
.nav-item.is-active {
	background: rgba(34, 211, 238, 0.1);
	color: #fff;
}

.nav-item__badge {
	min-width: 31px;
	padding: 3px 5px;
	border: 1px solid currentColor;
	border-radius: 6px;
	font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
	font-size: 9px;
	font-weight: 800;
	text-align: center;
}

.nav-item--beginner .nav-item__badge {
	color: var(--yellow);
}

.nav-item--advanced .nav-item__badge {
	color: var(--orange);
}

.nav-item--lesson .nav-item__badge {
	color: #f472b6;
}

.nav-item__label {
	min-width: 0;
	overflow: hidden;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nav-toggle {
	position: fixed;
	z-index: 140;
	top: 16px;
	left: 16px;
	display: none;
	width: 46px;
	height: 46px;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(34, 211, 238, 0.3);
	border-radius: 13px;
	background: rgba(8, 25, 49, 0.9);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
	color: var(--cyan);
	cursor: pointer;
	backdrop-filter: blur(14px);
}

.nav-scrim {
	position: fixed;
	z-index: 105;
	inset: 0;
	display: none;
	border: 0;
	background: rgba(3, 10, 22, 0.62);
	backdrop-filter: blur(3px);
}

/* ── Search ───────────────────────────────────────── */

.search {
	position: fixed;
	z-index: 120;
	top: 20px;
	left: calc(var(--nav-w) + 28px);
	right: 28px;
	width: min(560px, calc(100vw - var(--nav-w) - 56px));
	margin-inline: auto;
	pointer-events: none;
}

.search-box {
	position: relative;
	pointer-events: auto;
}

.search-icon {
	position: absolute;
	top: 50%;
	left: 18px;
	color: var(--cyan);
	opacity: 0.85;
	transform: translateY(-50%);
	pointer-events: none;
}

.search-input {
	width: 100%;
	min-height: 48px;
	padding: 12px 58px 12px 48px;
	border: 1px solid rgba(34, 211, 238, 0.25);
	border-radius: 999px;
	outline: 0;
	background: rgba(8, 25, 49, 0.78);
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
	color: var(--text);
	font-size: 14px;
	backdrop-filter: blur(18px);
	transition:
		border-color 160ms ease,
		box-shadow 160ms ease,
		background 160ms ease;
}

.search-input::placeholder {
	color: var(--text-muted);
}

.search-input:focus {
	border-color: rgba(34, 211, 238, 0.75);
	background: rgba(8, 25, 49, 0.96);
	box-shadow:
		0 0 0 4px rgba(34, 211, 238, 0.12),
		0 16px 40px rgba(0, 0, 0, 0.35);
}

.search-kbd {
	position: absolute;
	top: 50%;
	right: 14px;
	padding: 3px 7px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--cyan-soft);
	font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
	font-size: 10px;
	transform: translateY(-50%);
	pointer-events: none;
}

.search-input:focus ~ .search-kbd {
	opacity: 0;
}

.search-results {
	max-height: min(62vh, 510px);
	margin-top: 9px;
	overflow-y: auto;
	border: 1px solid rgba(34, 211, 238, 0.22);
	border-radius: 16px;
	background: var(--surface-strong);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(22px);
	pointer-events: auto;
}

.search-results[hidden] {
	display: none;
}

.search-result {
	display: grid;
	width: 100%;
	min-height: 58px;
	grid-template-columns: 92px 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 10px 15px;
	border: 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.045);
	background: transparent;
	cursor: pointer;
	text-align: left;
}

.search-result:last-child {
	border-bottom: 0;
}

.search-result:hover,
.search-result.is-active {
	background: linear-gradient(
		90deg,
		rgba(34, 211, 238, 0.15),
		rgba(34, 211, 238, 0.035)
	);
}

.search-result__kind {
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.search-result__main {
	min-width: 0;
}

.search-result__label,
.search-result__desc {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.search-result__label {
	color: var(--text);
	font-size: 13px;
	font-weight: 700;
}

.search-result__desc {
	margin-top: 3px;
	color: var(--text-muted);
	font-size: 11px;
}

.search-result__chev {
	color: var(--cyan);
	font-size: 18px;
}

.search-empty {
	padding: 18px;
	color: var(--text-muted);
	font-size: 12px;
	text-align: center;
}

.kind-topic {
	color: var(--cyan);
}

.kind-beginner {
	color: var(--yellow);
}

.kind-advanced {
	color: var(--orange);
}

.kind-lesson {
	color: #f472b6;
}

/* ── Orientation + detail UI ─────────────────────── */

.map-intro {
	position: fixed;
	z-index: 80;
	top: 104px;
	right: 26px;
	width: min(320px, calc(100vw - var(--nav-w) - 52px));
	padding: 18px 19px;
	border: 1px solid rgba(34, 211, 238, 0.15);
	border-radius: 18px;
	background: rgba(8, 25, 49, 0.65);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
	backdrop-filter: blur(16px);
	transition:
		opacity 220ms ease,
		transform 220ms ease;
	pointer-events: none;
}

body.has-selection .map-intro {
	opacity: 0;
	transform: translateY(-8px);
}

.map-intro__eyebrow,
.focus-panel__eyebrow {
	color: var(--cyan);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.map-intro h1 {
	margin: 7px 0 6px;
	font-size: clamp(20px, 2.2vw, 30px);
	line-height: 1.06;
	letter-spacing: -0.035em;
}

.map-intro p {
	margin: 0;
	color: var(--text-muted);
	font-size: 12px;
	line-height: 1.55;
}

.map-intro__cue {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 13px;
	color: var(--cyan-soft);
	font-size: 11px;
	font-weight: 700;
}

.map-intro__cue::before {
	content: '';
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--cyan);
	box-shadow: 0 0 12px var(--cyan);
}

.breadcrumb {
	position: fixed;
	z-index: 94;
	top: 88px;
	left: calc(var(--nav-w) + 24px);
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 7px 11px;
	border: 1px solid rgba(34, 211, 238, 0.14);
	border-radius: 999px;
	background: rgba(8, 25, 49, 0.7);
	color: var(--text-muted);
	font-size: 11px;
	backdrop-filter: blur(14px);
	transition:
		opacity 180ms ease,
		transform 180ms ease;
}

.breadcrumb[hidden] {
	display: none;
}

#breadcrumbTrail {
	display: flex;
	align-items: center;
	gap: 8px;
}

.breadcrumb button {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cyan-soft);
	font-weight: 700;
	cursor: pointer;
}

.focus-panel {
	position: fixed;
	z-index: 95;
	top: 94px;
	right: 22px;
	bottom: 22px;
	width: 334px;
	overflow: hidden;
	border: 1px solid rgba(34, 211, 238, 0.2);
	border-radius: 22px;
	background:
		linear-gradient(180deg, rgba(12, 34, 65, 0.96), rgba(7, 20, 38, 0.97));
	box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(22px);
	transform: translateX(calc(100% + 32px));
	transition:
		transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
		visibility 420ms;
	visibility: hidden;
}

.focus-panel.is-open {
	visibility: visible;
	transform: translateX(0);
}

.focus-panel__scroll {
	height: 100%;
	overflow-y: auto;
	padding: 22px;
	overscroll-behavior: contain;
}

.focus-panel__close {
	position: absolute;
	z-index: 2;
	top: 14px;
	right: 14px;
	display: grid;
	width: 40px;
	height: 40px;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.055);
	color: var(--text-muted);
	cursor: pointer;
}

.focus-panel__close:hover {
	background: rgba(34, 211, 238, 0.12);
	color: #fff;
}

.focus-panel__glyph {
	display: grid;
	width: 58px;
	height: 58px;
	margin: 22px 0 16px;
	place-items: center;
	border: 1px solid color-mix(in srgb, var(--focus-color, var(--cyan)) 70%, white);
	border-radius: 18px;
	background: color-mix(in srgb, var(--focus-color, var(--cyan)) 18%, transparent);
	box-shadow: 0 0 34px color-mix(in srgb, var(--focus-color, var(--cyan)) 25%, transparent);
	color: #fff;
	font-size: 15px;
	font-weight: 850;
}

.focus-panel h2 {
	margin: 0;
	padding-right: 32px;
	font-size: 26px;
	line-height: 1.12;
	letter-spacing: -0.035em;
}

.focus-panel__desc {
	margin: 10px 0 0;
	color: var(--text-muted);
	font-size: 13px;
	line-height: 1.55;
}

.focus-panel__stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin-top: 18px;
}

.focus-stat {
	padding: 11px 12px;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.035);
}

.focus-stat b {
	display: block;
	color: #fff;
	font-size: 18px;
}

.focus-stat span {
	color: var(--text-muted);
	font-size: 10px;
}

.focus-panel__section {
	margin-top: 22px;
}

.focus-panel__section h3 {
	margin: 0 0 9px;
	color: var(--text-muted);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.focus-actions,
.focus-list {
	display: grid;
	gap: 8px;
}

.focus-action,
.focus-list__item {
	display: grid;
	width: 100%;
	min-height: 52px;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 9px 11px;
	border: 1px solid rgba(255, 255, 255, 0.075);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.035);
	color: var(--text);
	cursor: pointer;
	text-align: left;
	transition:
		border-color 140ms ease,
		background 140ms ease,
		transform 140ms ease;
}

.focus-action:hover,
.focus-list__item:hover {
	border-color: rgba(34, 211, 238, 0.3);
	background: rgba(34, 211, 238, 0.09);
	transform: translateY(-1px);
}

.focus-action__badge {
	display: grid;
	width: 32px;
	height: 32px;
	place-items: center;
	border: 1px solid currentColor;
	border-radius: 9px;
	font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
	font-size: 9px;
	font-weight: 800;
}

.focus-action--beginner .focus-action__badge {
	color: var(--yellow);
}

.focus-action--advanced .focus-action__badge {
	color: var(--orange);
}

.focus-action__copy,
.focus-list__copy {
	min-width: 0;
}

.focus-action__copy strong,
.focus-list__copy strong {
	display: block;
	overflow: hidden;
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.focus-action__copy small,
.focus-list__copy small {
	display: block;
	margin-top: 2px;
	overflow: hidden;
	color: var(--text-muted);
	font-size: 10px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.focus-open {
	display: inline-flex;
	width: 100%;
	min-height: 48px;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
	border: 1px solid rgba(165, 243, 252, 0.65);
	border-radius: 12px;
	background: linear-gradient(135deg, #22d3ee, #00a8cc);
	box-shadow: 0 12px 28px rgba(0, 180, 216, 0.2);
	color: #061323;
	font-size: 13px;
	font-weight: 850;
	cursor: pointer;
}

.focus-back {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: 18px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--cyan-soft);
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
}

.relation-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.relation-chip {
	padding: 6px 9px;
	border: 1px solid rgba(34, 211, 238, 0.17);
	border-radius: 999px;
	background: rgba(34, 211, 238, 0.055);
	color: var(--cyan-soft);
	font-size: 10px;
	cursor: pointer;
}

/* ── Map controls, legend, tooltip ────────────────── */

.map-controls {
	position: fixed;
	z-index: 90;
	right: 22px;
	bottom: 22px;
	display: flex;
	gap: 7px;
	transition: right 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-selection .map-controls {
	right: 374px;
}

.map-control {
	display: inline-flex;
	min-width: 44px;
	min-height: 44px;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 8px 11px;
	border: 1px solid rgba(34, 211, 238, 0.18);
	border-radius: 12px;
	background: rgba(8, 25, 49, 0.78);
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
	backdrop-filter: blur(16px);
}

.map-control:hover,
.map-control[aria-pressed='true'] {
	border-color: rgba(34, 211, 238, 0.42);
	background: rgba(34, 211, 238, 0.11);
	color: #fff;
}

.map-control svg {
	flex: 0 0 auto;
}

.legend {
	position: fixed;
	z-index: 78;
	bottom: 22px;
	left: calc(var(--nav-w) + 22px);
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 9px 12px;
	border: 1px solid rgba(34, 211, 238, 0.12);
	border-radius: 13px;
	background: rgba(8, 25, 49, 0.62);
	color: var(--text-muted);
	font-size: 10px;
	backdrop-filter: blur(14px);
}

.legend strong {
	color: var(--cyan-soft);
	font-size: 9px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.legend-row {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.legend-shape {
	display: inline-block;
	width: 9px;
	height: 9px;
	background: currentColor;
}

.legend-shape--topic {
	border-radius: 50%;
	color: var(--cyan);
}

.legend-shape--beginner {
	color: var(--yellow);
	transform: rotate(45deg);
}

.legend-shape--advanced {
	border-radius: 3px;
	color: var(--orange);
	clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
}

.legend-shape--lesson {
	border-radius: 2px;
	color: var(--pink);
}

.hint {
	position: fixed;
	z-index: 78;
	right: 22px;
	bottom: 78px;
	max-width: 270px;
	padding: 8px 11px;
	border: 1px solid rgba(34, 211, 238, 0.11);
	border-radius: 11px;
	background: rgba(8, 25, 49, 0.56);
	color: var(--text-muted);
	font-size: 10px;
	backdrop-filter: blur(12px);
	transition:
		opacity 220ms ease,
		right 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-selection .hint {
	right: 374px;
}

.node-tooltip {
	position: fixed;
	z-index: 200;
	max-width: 260px;
	padding: 9px 12px;
	border: 1px solid rgba(34, 211, 238, 0.34);
	border-radius: 10px;
	background: rgba(8, 25, 49, 0.94);
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
	opacity: 0;
	color: var(--text);
	font-size: 11px;
	line-height: 1.4;
	pointer-events: none;
	transform: translateY(4px);
	transition:
		opacity 120ms ease,
		transform 120ms ease;
}

.node-tooltip.show {
	opacity: 1;
	transform: translateY(0);
}

.node-tooltip strong {
	display: block;
	color: #fff;
	font-size: 12px;
}

.node-tooltip span {
	display: block;
	margin-top: 3px;
	color: var(--text-muted);
}

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

/* ── Modal ────────────────────────────────────────── */

.modal {
	position: fixed;
	z-index: 1000;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(3, 10, 22, 0.82);
	backdrop-filter: blur(10px);
}

.modal.open {
	display: flex;
	animation: modal-fade 180ms ease-out;
}

@keyframes modal-fade {
	from {
		opacity: 0;
	}
}

.modal-shell {
	display: flex;
	width: min(1100px, 100%);
	height: min(820px, calc(100vh - 48px));
	overflow: hidden;
	flex-direction: column;
	border: 1px solid rgba(34, 211, 238, 0.25);
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 32px 96px rgba(0, 0, 0, 0.7);
	animation: modal-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.97);
	}
}

.modal-bar {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 11px;
	min-height: 58px;
	padding: 10px 12px 10px 16px;
	background: var(--navy);
}

.modal-bar .kind {
	padding: 4px 8px;
	border-radius: 5px;
	background: rgba(34, 211, 238, 0.12);
	color: var(--cyan);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.modal-bar .title {
	min-width: 0;
	flex: 1;
	overflow: hidden;
	font-size: 13px;
	font-weight: 750;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.modal-bar button,
.modal-bar .open-tab {
	display: inline-flex;
	min-width: 40px;
	min-height: 40px;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.07);
	color: #fff;
	cursor: pointer;
	text-decoration: none;
}

.modal-bar .open-tab {
	gap: 6px;
	padding: 0 11px;
	font-size: 11px;
	font-weight: 700;
}

.modal-frame-wrap {
	position: relative;
	min-height: 0;
	flex: 1;
	overflow: hidden;
	background: #f6f9fc;
}

.modal-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #fff;
}

.modal-loader {
	position: absolute;
	z-index: 2;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	background: var(--dark);
	transition:
		opacity 240ms ease,
		visibility 240ms ease;
}

.modal-loader.done {
	visibility: hidden;
	opacity: 0;
}

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 1040px) {
	:root {
		--nav-w: min(88vw, 340px);
	}

	.nav-toggle {
		display: inline-flex;
	}

	.nav-panel {
		visibility: hidden;
		transform: translateX(-102%);
	}

	body.nav-open .nav-panel {
		visibility: visible;
		transform: translateX(0);
	}

	body.nav-open .nav-scrim {
		display: block;
	}

	.search {
		top: 15px;
		left: 76px;
		right: 14px;
		width: auto;
	}

	.map-intro {
		top: 82px;
		right: 14px;
		width: min(300px, calc(100vw - 28px));
	}

	.breadcrumb {
		top: 80px;
		left: 14px;
	}

	.legend {
		left: 14px;
	}

	.focus-panel {
		top: auto;
		right: 10px;
		bottom: 10px;
		left: 10px;
		width: auto;
		max-height: min(45vh, 390px);
		border-radius: 20px;
		transform: translateY(calc(100% + 20px));
	}

	.focus-panel.is-open {
		transform: translateY(0);
	}

	.focus-panel__scroll {
		padding: 18px 18px 22px;
	}

	.focus-panel__glyph {
		width: 46px;
		height: 46px;
		margin: 4px 0 11px;
		border-radius: 14px;
	}

	.focus-panel h2 {
		font-size: 22px;
	}

	.map-controls,
	body.has-selection .map-controls {
		right: 14px;
		bottom: 14px;
	}

	body.has-selection .map-controls {
		bottom: calc(min(45vh, 390px) + 20px);
	}

	.hint,
	body.has-selection .hint {
		right: 14px;
		bottom: 68px;
	}

	body.has-selection .hint {
		bottom: calc(min(45vh, 390px) + 75px);
	}
}

@media (max-width: 600px) {
	.search-input {
		padding-right: 18px;
		font-size: 13px;
	}

	.search-kbd {
		display: none;
	}

	.search-result {
		grid-template-columns: 72px 1fr auto;
		padding-inline: 12px;
	}

	.map-intro {
		top: 80px;
		padding: 14px 15px;
	}

	.map-intro h1 {
		font-size: 21px;
	}

	.map-intro p {
		font-size: 11px;
	}

	.legend {
		max-width: calc(100vw - 126px);
		gap: 8px;
		overflow: hidden;
		padding: 8px 10px;
	}

	.legend strong,
	.legend-row span:last-child {
		display: none;
	}

	.hint {
		display: none;
	}

	.map-control__label {
		display: none;
	}

	.focus-panel__stats {
		margin-top: 14px;
	}

	.focus-panel__section {
		margin-top: 16px;
	}

	.modal {
		padding: 0;
	}

	.modal-shell {
		height: 100%;
		max-height: none;
		border: 0;
		border-radius: 0;
	}

	.modal-bar .open-tab span {
		display: none;
	}
}

@media (max-width: 1040px) and (max-height: 680px) {
	.map-intro {
		padding: 10px 13px 11px;
	}

	.map-intro__eyebrow {
		font-size: 8px;
	}

	.map-intro h1 {
		margin: 4px 0 0;
		font-size: 18px;
	}

	.map-intro p {
		display: none;
	}

	.map-intro__cue {
		margin-top: 8px;
		font-size: 10px;
	}
}

@media (max-width: 1040px) and (max-height: 520px) and (orientation: landscape) {
	:root {
		--landscape-panel-w: min(42vw, 340px);
	}

	.map-intro {
		top: 72px;
		right: 14px;
		width: min(280px, calc(42vw - 20px));
	}

	.focus-panel {
		top: 72px;
		right: 10px;
		bottom: 10px;
		left: auto;
		width: var(--landscape-panel-w);
		max-height: none;
		transform: translateX(calc(100% + 20px));
	}

	.focus-panel.is-open {
		transform: translateX(0);
	}

	body.has-selection .map-controls {
		right: calc(var(--landscape-panel-w) + 20px);
		bottom: 14px;
	}

	.legend {
		max-width: calc(58vw - 104px);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}
