:root {
  --bg: #121310;
  --panel: #1a1b17;
  --panel-2: #23241f;
  --line: #34362e;
  --text: #e4e1d6;
  --muted: #9a978b;
  --accent: #e0b354;
  --accent-ink: #1a1404;
  --link: #8cc6e0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; overflow: hidden; }
a { color: var(--link); }

#side {
  width: 320px; flex: none; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.brand h1 { margin: 0; font: 600 18px/1.2 Georgia, "Times New Roman", serif; letter-spacing: .02em; color: var(--accent); }
#side-body { overflow-y: auto; padding: 4px 16px 16px; flex: 1; }
section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sec { display: block; margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); font-size: 12px; }
footer { padding-top: 14px; line-height: 1.5; }
p { margin: 6px 0; }

select, input {
  width: 100%; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.icon-btn { background: none; border: 0; color: var(--text); font-size: 18px; cursor: pointer; display: none; }

.param { margin-bottom: 10px; }
.param label { display: block; margin-bottom: 4px; font-weight: 500; }
.param .row { display: flex; gap: 6px; }
.param .row button { flex: none; }
.param p { margin: 4px 0 0; }

button.btn, label.btn, #maps button, #maps a.btn {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
button.btn:hover, label.btn:hover, #maps button:hover, #maps a.btn:hover { border-color: var(--accent); }
#maps a.btn { text-decoration: none; display: inline-block; }
#maps .btns { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
#maps details summary { cursor: pointer; padding: 4px 0; font-size: 13px; color: var(--muted); }
#maps details summary:hover, #maps details[open] summary { color: var(--text); }
.file-row { margin-top: 6px; align-items: center; flex-wrap: wrap; }
.file-row .muted { flex-basis: 100%; }
.param label.file-btn { display: inline-block; font-weight: normal; margin: 0; white-space: nowrap; cursor: pointer; }
.pixels-crisp .leaflet-image-layer.pixel-image { image-rendering: pixelated; }
#maps button.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
#maps button.wide { min-width: 0; }

#results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
#results li { padding: 5px 8px; border-radius: 5px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
#results li:hover, #results li:focus { background: var(--panel-2); outline: none; }
#results .where { color: var(--muted); font-size: 12px; white-space: nowrap; }

#layers { list-style: none; margin: 0; padding: 0; }
#layers li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
#layers label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }
#layers input { width: auto; margin: 0; accent-color: var(--accent); }
#layers svg { width: 22px; height: 22px; flex: none; border-radius: 3px; }

#info h3 { margin: 0 0 6px; font-size: 14px; }
#info table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 6px 0; }
#info th, #info td { text-align: left; padding: 3px 6px 3px 0; border-bottom: 1px solid var(--line); font-weight: normal; }
#info th { color: var(--muted); }
#info td.num, #info th.num { text-align: right; font-variant-numeric: tabular-nums; }
#info ul { margin: 6px 0; padding-left: 18px; }

main { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #0b0c0a; }
#map-title {
  position: absolute; z-index: 500; top: 12px; left: 56px; pointer-events: none;
  font: 600 16px/1.2 Georgia, serif; color: var(--text);
  background: rgba(18, 19, 16, .85); padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line);
}
#map-title small { display: block; font: 12px system-ui, sans-serif; color: var(--muted); margin-top: 2px; }

/* Leaflet, dark */
.leaflet-container { font: inherit; background: #0b0c0a; cursor: default; }
.leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--panel-2); color: var(--text); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.5); }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 14px; color: var(--accent); }
.leaflet-popup-content p { margin: 4px 0; }
.leaflet-popup-content .xy { color: var(--muted); font-size: 12px; }
.leaflet-popup-content .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pixels-crisp .pixel-tile canvas { image-rendering: pixelated; }
.sign { font-family: Georgia, serif; letter-spacing: .08em; text-align: center; background: #2a2418; border: 1px solid #5a4a2a; border-radius: 4px; padding: 4px 8px; }
.tag { display: inline-block; font-size: 11px; padding: 0 5px; border-radius: 8px; background: var(--panel-2); color: var(--accent); white-space: nowrap; }
.leaflet-popup-content table { border-collapse: collapse; font-size: 13px; }
.leaflet-popup-content th { color: var(--muted); text-align: left; vertical-align: top; padding: 2px 8px 2px 0; font-weight: 600; width: 26%; overflow-wrap: anywhere; }
.leaflet-popup-content { overflow-wrap: anywhere; }
.leaflet-popup-content table { width: 100%; table-layout: fixed; }
.leaflet-popup-content ul { margin: 4px 0; padding-left: 18px; }
.leaflet-popup-content td { padding: 2px 0; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.coord-readout { background: rgba(18,19,16,.85); color: var(--muted); padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 12px; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  #side { width: auto; max-height: 55vh; border-right: 0; border-bottom: 1px solid var(--line); }
  #side.collapsed #side-body { display: none; }
  .icon-btn { display: block; }
  #map-title { left: 52px; }
}
