:root {
	--bg: #fff;
	--fg: #1d2327;
	--muted: #66707a;
	--line: #dde1e5;
	--accent: #1d5fa8;
	--shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	font: 14px/1.4 system-ui, sans-serif;
	color: var(--fg);
	background: #e8e8e8;
}

#map { position: absolute; inset: 0; }

#panel, #layers, #legend {
	position: absolute;
	background: var(--bg);
	border-radius: 6px;
	box-shadow: var(--shadow);
}

/* ─── Panel: search + status ──────────────────────────────── */

#panel {
	top: 10px;
	left: 10px;
	width: 340px;
	max-width: calc(100vw - 20px);
	padding: 10px;
	z-index: 3; /* its suggestion list overlaps the layer and legend boxes */
}

.input-wrap { position: relative; }

#search {
	width: 100%;
	padding: 7px 9px;
	font: inherit;
	border: 1px solid var(--line);
	border-radius: 4px;
}
#search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.dropdown {
	position: absolute;
	z-index: 2;
	left: 0;
	right: 0;
	top: 100%;
	margin-top: 2px;
	max-height: 320px;
	overflow-y: auto;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 4px;
	box-shadow: var(--shadow);
}
.dropdown .row { padding: 5px 9px; cursor: pointer; }
.dropdown .row.active, .dropdown .row:hover { background: #eef3f9; }

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

/* ─── Layer switcher ──────────────────────────────────────── */

#layers {
	top: 10px;
	right: 50px;
	padding: 6px 10px;
	font-size: 13px;
}
#layers fieldset { border: 0; margin: 0; padding: 2px 0; }
#layers legend { font-weight: 600; padding: 0; color: var(--muted); font-size: 12px; }
#layers label { display: block; white-space: nowrap; cursor: pointer; }

/* ─── Legend ──────────────────────────────────────────────── */

#legend {
	left: 10px;
	bottom: 28px;
	width: 240px;
	padding: 8px 10px 6px;
	font-size: 12px;
}
#legend-gradient { height: 10px; border-radius: 3px; }
#legend-labels { display: flex; justify-content: space-between; color: var(--muted); }
#legend-note { margin: 2px 0 0; color: var(--muted); }
.help {
	display: inline-block;
	width: 16px;
	height: 16px;
	line-height: 16px;
	text-align: center;
	border-radius: 50%;
	background: var(--line);
	color: var(--fg);
	cursor: help;
	font-weight: 600;
}
#field-status { float: right; }

/* ─── Hover tooltip ───────────────────────────────────────── */

#tip {
	position: absolute;
	pointer-events: none;
	z-index: 5;
	padding: 4px 8px;
	background: rgba(29, 35, 39, 0.92);
	color: #fff;
	border-radius: 4px;
	font-size: 13px;
	white-space: nowrap;
	transform: translate(12px, 12px);
}

@media (max-width: 640px) {
	#panel { width: auto; right: 10px; }
	#layers { top: auto; bottom: 110px; right: 10px; }
}
