:root {
	--bg1: hsl(222, 18%, 19%);
	--bg2: hsl(222, 18%, 16%);
	--bg3: hsl(222, 18%, 13%);
	--bg4: hsl(222, 18%, 10%);
	--accent: hsl(222, 60%, 50%);
	--text: #f7f7f8;
	--text-muted: rgba(247, 247, 248, 0.5);
	--focus: #387ad1;
	--green: #26d07c;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
	background: var(--bg3);
	color: var(--text);
	font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app { display: flex; height: 100%; }

#sidebar {
	width: 400px;
	max-width: 45vw;
	display: flex;
	flex-direction: column;
	background: var(--bg2);
	border-right: 1px solid var(--bg4);
}

#sidebar header { padding: 14px; background: var(--bg1); border-bottom: 1px solid var(--bg4); }
h1 { font-size: 16px; margin: 0 0 10px; }

.row, #search { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
#search { margin-top: 0; }
#search input { flex: 1; }

input, select, button {
	background: var(--bg4);
	color: var(--text);
	border: 1px solid var(--bg3);
	border-radius: 5px;
	padding: 6px 8px;
	font: inherit;
	min-width: 0;
}
input[type=number] { width: 90px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button { cursor: pointer; background: var(--accent); border-color: var(--accent); }
button:hover { filter: brightness(1.15); }
label { color: var(--text-muted); }
.check { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.check input { padding: 0; }

#status { margin: 10px 0 0; color: var(--text-muted); }

#results { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }

.ep {
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--bg4);
	cursor: pointer;
}
.ep:hover, .ep.active { background: var(--bg1); }
.ep.active { box-shadow: inset 3px 0 0 var(--accent); }
.ep img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--bg4); }
.ep h2 { font-size: 14px; margin: 0 0 2px; }
.ep .meta { color: var(--text-muted); font-size: 12px; }
.ep .meta .dist { color: var(--green); font-weight: 600; }
.ep p { margin: 4px 0; color: var(--text-muted); font-size: 12px; }
.ep audio { width: 100%; height: 32px; margin-top: 4px; }
.empty { padding: 14px; color: var(--text-muted); }

#map { flex: 1; background: var(--bg4); }

/* OSM tiles are light; invert them to suit the dark theme. Attribution stays readable. */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
.leaflet-container { background: var(--bg4); }

@media (max-width: 720px) {
	html, body, #app { height: 100dvh; }
	#app { flex-direction: column-reverse; }
	#sidebar { width: 100%; max-width: none; height: 58%; border-right: 0; border-top: 1px solid var(--bg4); }
	#map { height: 42%; flex: none; }

	/* compact header so the results list gets the room; 16px inputs stop iOS zooming on focus */
	#sidebar header { padding: 8px 10px; }
	h1 { display: none; }
	#lat, #lon, #go-coords { display: none; }
	.row { margin-top: 6px; }
	input, select, button { font-size: 16px; min-height: 44px; padding: 6px 12px; }
	.check input { min-height: 0; width: 20px; height: 20px; }
	#status { margin-top: 6px; font-size: 13px; }
	.ep { padding: 10px; }
}
