html,
body {
	height: 100%;
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	background: #1a1a2e;
}
body {
	display: flex;
}
.map-wrap {
	position: relative;
	flex: 1;
	height: 100%;
	overflow: hidden;
}
#map {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
.map-loading {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #aaa;
	font-size: 1.1rem;
	background: rgba(0, 0, 0, 0.3);
	z-index: 2;
	pointer-events: none;
}

/* ── Control Panel ─────────────────────────────────────────────── */
.ctrl {
	width: 340px;
	min-width: 340px;
	height: 100%;
	overflow-y: auto;
	background: #16213e;
	color: #e0e0e0;
	padding: 16px;
	box-sizing: border-box;
	border-left: 2px solid #1a1a3e;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 14px;
	scrollbar-width: thin;
	scrollbar-color: #2a2a5e #16213e;
}
.ctrl::-webkit-scrollbar {
	width: 6px;
}
.ctrl::-webkit-scrollbar-thumb {
	background: #2a2a5e;
	border-radius: 3px;
}

.ctrl h1 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: #facc15;
	letter-spacing: 0.02em;
}

.ctrl section {
	background: #1a1a3e;
	border-radius: 8px;
	padding: 12px 14px;
}
.ctrl section h2 {
	margin: 0 0 10px;
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #888;
}

/* ── Slider row ────────────────────────────────────────────────── */
.slider-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}
.slider-row label {
	font-size: 0.75rem;
	color: #bbb;
	width: 76px;
	min-width: 76px;
	text-align: right;
}
.slider-row input[type='range'] {
	flex: 1;
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	background: #2a2a5e;
	border-radius: 3px;
	outline: none;
}
.slider-row input[type='range']::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #facc15;
	cursor: pointer;
	border: none;
}
.slider-row .val {
	font-size: 0.7rem;
	color: #facc15;
	width: 38px;
	min-width: 38px;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* ── Color input ───────────────────────────────────────────────── */
.color-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}
.color-row label {
	font-size: 0.75rem;
	color: #bbb;
	width: 76px;
	min-width: 76px;
	text-align: right;
}
.color-row input[type='color'] {
	width: 32px;
	height: 28px;
	border: 1px solid #444;
	border-radius: 4px;
	background: transparent;
	cursor: pointer;
	padding: 1px;
}
.color-row .val {
	font-size: 0.7rem;
	color: #facc15;
	width: 62px;
	font-variant-numeric: tabular-nums;
}

/* ── Curve canvas ──────────────────────────────────────────────── */
.curve-wrap {
	position: relative;
	width: 100%;
	height: 100px;
	margin-bottom: 6px;
	border-radius: 4px;
	overflow: hidden;
	background: #0f0f23;
}
.curve-wrap canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* ── Compositing test ──────────────────────────────────────────── */
.comp-bars {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 6px;
}
.comp-row {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.7rem;
	color: #888;
}
.comp-swatch {
	width: 100%;
	height: 16px;
	border-radius: 2px;
}
.comp-result {
	font-size: 0.75rem;
	color: #facc15;
	font-weight: 600;
	width: 38px;
	text-align: right;
	font-variant-numeric: tabular-nums;
}
.comp-match {
	font-size: 0.7rem;
	text-align: center;
	margin-top: 2px;
	font-weight: 600;
	padding: 2px 6px;
	border-radius: 3px;
}

/* ── Preset buttons ────────────────────────────────────────────── */
.presets {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.presets button {
	flex: 1;
	min-width: 60px;
	padding: 6px 10px;
	font-size: 0.7rem;
	font-weight: 600;
	border: 1px solid #3a3a6e;
	border-radius: 4px;
	background: #1a1a3e;
	color: #ccc;
	cursor: pointer;
	transition: all 0.15s;
}
.presets button:hover {
	background: #2a2a5e;
	border-color: #facc15;
	color: #facc15;
}
.presets button.active {
	background: #facc15;
	color: #16213e;
	border-color: #facc15;
}

/* ── Toggle ────────────────────────────────────────────────────── */
.toggle-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}
.toggle-row label {
	font-size: 0.75rem;
	color: #bbb;
	width: 76px;
	min-width: 76px;
	text-align: right;
}
.toggle-row input[type='checkbox'] {
	accent-color: #facc15;
	width: 16px;
	height: 16px;
}

/* ── Popup overrides ───────────────────────────────────────────── */
.maplibregl-popup-content {
	padding: 8px 12px;
	font-size: 0.9rem;
	line-height: 1.4;
	background: #16213e;
	color: #e0e0e0;
	border-radius: 6px;
}
.maplibregl-popup-tip {
	border-top-color: #16213e !important;
}
.maplibregl-popup-content strong {
	display: block;
	margin-bottom: 2px;
	color: #facc15;
}

/* ── Collapse toggle ───────────────────────────────────────────── */
.ctrl-toggle {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 11;
	width: 36px;
	height: 36px;
	border-radius: 6px;
	background: #16213e;
	border: 1px solid #3a3a6e;
	color: #facc15;
	font-size: 1.1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s;
}
.ctrl-toggle:hover {
	background: #1a1a3e;
	border-color: #facc15;
}

/* Collapsed */
.ctrl.collapsed {
	width: 0;
	min-width: 0;
	padding: 0;
	border-left: none;
	overflow: hidden;
}
