:root {
	--panel: rgba(18, 22, 28, 0.88);
	--text: #e8eef5;
	--muted: #9aa8b8;
	--accent: #6bcb77;
	--line: rgba(255, 255, 255, 0.12);
}

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #87ceeb;
	font-family: "Segoe UI", Tahoma, sans-serif;
	color: var(--text);
	touch-action: none;
	-webkit-text-size-adjust: 100%;
}

.potree_container {
	position: absolute;
	inset: 0;
}

#potree_render_area {
	background: #87ceeb !important;
	touch-action: none;
}

.hud {
	position: absolute;
	top: 118px;
	left: 10px;
	width: min(300px, calc(100vw - 20px));
	max-height: calc(100vh - 128px);
	max-height: calc(100dvh - 128px);
	overflow: hidden;
	z-index: 10000;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 10px 12px;
	backdrop-filter: blur(8px);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
	user-select: none;
	-webkit-user-select: none;
	display: flex;
	flex-direction: column;
}

.hud.collapsed {
	width: auto;
	max-width: calc(100vw - 20px);
	max-height: none;
}

.hud.collapsed .hud-body {
	display: none !important;
}

.hud-body {
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	flex: 1 1 auto;
	min-height: 0;
	padding-right: 2px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
	touch-action: pan-y;
}

.hud-body::-webkit-scrollbar {
	width: 8px;
}

.hud-body::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.28);
	border-radius: 4px;
}

.hud-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin-bottom: 0;
	flex-shrink: 0;
}

.hud:not(.collapsed) .hud-header {
	margin-bottom: 8px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.hud-title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px;
	min-width: 0;
}

.brand {
	font-weight: 700;
	letter-spacing: 0.02em;
	font-size: 14px;
}

.version {
	color: var(--muted);
	font-size: 11px;
}

.hud-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.portal-back {
	color: var(--muted);
	font-size: 11px;
	text-decoration: none;
	white-space: nowrap;
	padding: 6px 4px;
}

.portal-back:hover {
	color: var(--accent, #7ec8e3);
}

.hud-toggle {
	appearance: none;
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 7px 10px;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
	touch-action: manipulation;
}

.hud-toggle:hover,
.hud-toggle:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
	outline: none;
}

.hud:not(.collapsed) .hud-toggle-label::after {
	content: " ▴";
}

.hud.collapsed .hud-toggle-label::after {
	content: " ▾";
}

.hud-section {
	border-top: 1px solid var(--line);
	padding: 10px 0;
}

.hud-section:first-child {
	border-top: none;
	padding-top: 2px;
}

.hud-section > .label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin-bottom: 6px;
}

details > summary {
	font-size: 12px;
	color: var(--muted);
	cursor: pointer;
	padding: 4px 0;
	list-style: none;
}

details > summary::before {
	content: "▸ ";
}

details[open] > summary::before {
	content: "▾ ";
}

details > summary:hover {
	color: var(--text);
}

.row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 6px 0;
	font-size: 14px;
	cursor: pointer;
	min-height: 28px;
}

.row.speed {
	flex-wrap: wrap;
	font-size: 12px;
	color: var(--muted);
}

.row.speed input[type="range"] {
	width: 100%;
	touch-action: manipulation;
}

.btn {
	display: block;
	width: 100%;
	margin: 6px 0;
	padding: 10px 10px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
	cursor: pointer;
	font-size: 13px;
	touch-action: manipulation;
}

.btn:hover {
	background: rgba(255, 255, 255, 0.12);
}

.btn.primary {
	background: rgba(107, 203, 119, 0.22);
	border-color: rgba(107, 203, 119, 0.45);
}

.map-goto {
	position: absolute;
	z-index: 10001;
	top: 10px;
	left: 10px;
	right: 10px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px 10px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	backdrop-filter: blur(8px);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.map-goto-label {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.map-goto-select {
	flex: 0 1 11rem;
	min-width: 8.5rem;
	margin: 0;
	padding: 8px 8px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.35);
	color: var(--text);
	font: inherit;
	font-size: 16px;
	color-scheme: dark;
	touch-action: manipulation;
}

.map-goto-select:focus {
	outline: none;
	border-color: var(--accent);
}

.map-goto-input {
	flex: 1 1 180px;
	min-width: 0;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.35);
	color: var(--text);
	font: inherit;
	font-size: 16px;
	font-variant-numeric: tabular-nums;
	user-select: text;
	-webkit-user-select: text;
	touch-action: manipulation;
}

.map-goto-input::placeholder {
	color: rgba(154, 168, 184, 0.85);
}

.map-goto-input:focus {
	outline: none;
	border-color: var(--accent);
}

.map-goto-btn {
	appearance: none;
	flex: 0 0 auto;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid rgba(107, 203, 119, 0.45);
	border-radius: 6px;
	background: rgba(107, 203, 119, 0.22);
	color: var(--text);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	touch-action: manipulation;
}

.map-goto-btn:hover,
.map-goto-btn:focus-visible {
	background: rgba(107, 203, 119, 0.34);
	outline: none;
}

.map-goto-msg {
	flex: 1 1 100%;
	order: -1;
	margin: 0;
	font-size: 16px;
	font-weight: 650;
	line-height: 1.3;
	color: #f4f7fb;
	font-variant-numeric: tabular-nums;
	user-select: text;
	-webkit-user-select: text;
}

.map-goto-msg:empty {
	display: none;
}

.map-goto-msg.is-bad {
	color: #f0a0a0;
}

.metric {
	margin-bottom: 10px;
}

.metric .label,
.legend .label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}

.metric .value {
	font-size: 20px;
	font-variant-numeric: tabular-nums;
	color: var(--accent);
	margin-top: 2px;
}

.metric .sub {
	font-size: 12px;
	color: var(--muted);
	margin-top: 2px;
	word-break: break-all;
}

.legend .bar {
	height: 12px;
	margin-top: 8px;
	border-radius: 4px;
	background: linear-gradient(90deg, #2ecc71, #f1c40f, #e67e22, #c0392b);
}

.legend-scale {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--muted);
	margin-top: 4px;
}

.hint {
	margin: 0;
	font-size: 11px;
	line-height: 1.45;
	color: var(--muted);
}

#crosshair {
	display: none;
	position: absolute;
	left: 50%;
	top: 50%;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	z-index: 9999;
	pointer-events: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

#crosshair.fps-on {
	display: block;
}

#boot-error {
	position: absolute;
	inset: 0;
	z-index: 20000;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
	background: #12161c;
	color: var(--text);
}

#boot-error[hidden] {
	display: none !important;
}

#boot-error strong {
	font-size: 1.15rem;
}

#boot-error p {
	max-width: 28rem;
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
}

.boot-error-hint {
	font-size: 12px !important;
}

#potree_sidebar_container {
	display: none !important;
}

/* —— sterowanie dotykowe —— */
.touch-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9998;
	pointer-events: none;
	padding: max(16px, env(safe-area-inset-bottom, 16px)) 18px 20px;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 16px;
}

.touch-controls[hidden] {
	display: none !important;
}

.touch-joy {
	pointer-events: auto;
	width: 132px;
	height: 132px;
	border-radius: 50%;
	background: rgba(18, 22, 28, 0.62);
	border: 2px solid rgba(107, 203, 119, 0.55);
	position: relative;
	touch-action: none;
	backdrop-filter: blur(6px);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.touch-joy-knob {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 52px;
	height: 52px;
	margin: -26px 0 0 -26px;
	border-radius: 50%;
	background: rgba(107, 203, 119, 0.7);
	border: 2px solid rgba(180, 255, 190, 0.9);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
	pointer-events: none;
}

.touch-vert {
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.touch-btn {
	appearance: none;
	width: 58px;
	height: 58px;
	border-radius: 14px;
	border: 2px solid rgba(107, 203, 119, 0.45);
	background: rgba(18, 22, 28, 0.62);
	color: var(--text);
	font-size: 24px;
	line-height: 1;
	backdrop-filter: blur(6px);
	touch-action: manipulation;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.touch-btn:active {
	background: rgba(107, 203, 119, 0.4);
}

.touch-controls.touch-orbit-hint .touch-joy::after {
	content: "ruch";
	position: absolute;
	left: 50%;
	bottom: -18px;
	transform: translateX(-50%);
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(232, 238, 245, 0.75);
	pointer-events: none;
}

@media (max-width: 700px) {
	.map-goto {
		top: 8px;
		left: 8px;
		right: 8px;
	}

	.map-goto-label {
		display: none;
	}

	.map-goto-select {
		flex-basis: 7.4rem;
		min-width: 6.6rem;
	}

	.map-goto-input {
		flex-basis: 0;
	}

	.hud {
		top: 112px;
		left: 8px;
		right: 8px;
		width: auto;
		max-height: calc(100dvh - 120px);
	}

	.hud.collapsed {
		right: auto;
	}

	.brand {
		font-size: 13px;
	}
}
