:root {
  --bg: #121110;
  --panel: #1b1916;
  --panel-2: #24211c;
  --line: #3a342a;
  --text: #ece4d4;
  --muted: #a59a86;
  --gold: #f0c35a;
  --gold-dim: #b58b2c;
  --quest: #ffd23f;
  --hostile: #e5533d;
  --friendly: #4fb3ff;
  --service: #6fdc8c;
  --object: #c58cff;
  --sidebar: 380px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; overflow: hidden; font-size: 14px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }

#sidebar {
  width: var(--sidebar); flex: none; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); z-index: 2;
}
.brand { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 8px; }
.logo { font-size: 20px; font-weight: 700; letter-spacing: .3px; color: var(--text); }
.logo span { color: var(--gold); }
.logo:hover { text-decoration: none; }
.build { color: var(--muted); font-size: 11px; }

.search { padding: 4px 16px 12px; border-bottom: 1px solid var(--line); }
#q {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px; outline: none;
}
#q:focus { border-color: var(--gold-dim); }
.chips { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--line); background: transparent; border-radius: 99px;
  padding: 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.chips button.on { background: var(--gold); border-color: var(--gold); color: #1b1408; font-weight: 600; }

#panel { flex: 1; overflow-y: auto; }
#results { list-style: none; margin: 0; padding: 4px 0; }
#results li {
  display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; padding: 8px 16px; cursor: pointer;
  border-left: 3px solid transparent;
}
#results li:hover, #results li.sel { background: var(--panel-2); border-left-color: var(--gold); }
#results .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .sub { grid-column: 2; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .empty { display: block; color: var(--muted); cursor: default; }

.ico {
  width: 18px; height: 18px; border-radius: 4px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #120f0a; margin-top: 1px;
}
.ico.n { background: var(--friendly); }
.ico.n.hostile { background: var(--hostile); }
.ico.q { background: var(--quest); }
.ico.o { background: var(--object); }
.ico.i { background: var(--service); }

#detail { padding: 16px; }
#detail:empty { display: none; }
#detail h2 { margin: 0 0 2px; font-size: 19px; line-height: 1.25; }
#detail .tag { color: var(--muted); margin-bottom: 10px; }
#detail h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--gold);
  margin: 18px 0 6px; font-weight: 700;
}
#detail p { margin: 6px 0; line-height: 1.45; }
#detail ul { list-style: none; padding: 0; margin: 0; }
#detail li { padding: 4px 0; line-height: 1.35; }
#detail li .meta { color: var(--muted); font-size: 12px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.facts span { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.facts .comm { color: var(--service); border-color: var(--service); }
.facts .A { color: var(--friendly); } .facts .H { color: var(--hostile); }
.back { background: none; border: none; color: var(--muted); padding: 0; cursor: pointer; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.maplinks a { margin-right: 10px; display: inline-block; }
.legend { display: grid; gap: 6px; }
.legend div { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1.5px solid #120f0a; }
.zone-intro p { color: var(--muted); }
.zone-list a { display: block; padding: 3px 0; }

.foot .help { font-weight: 600; font-size: 12px; }
.foot { padding: 10px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.5; }

#main { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #0b0a09; }
#crumbs {
  position: absolute; top: 12px; left: 12px; z-index: 500; display: flex; gap: 6px; align-items: center;
  background: rgba(18,17,16,.88); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
#crumbs select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font: inherit;
}
#crumbs .sep { color: var(--muted); }
#layers {
  position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; flex-direction: column; gap: 4px;
  background: rgba(18,17,16,.88); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
#layers summary { cursor: pointer; color: var(--gold); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
#layers details[open] summary { margin-bottom: 4px; }
#layers label { display: flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; }
#layers:empty { display: none; }

.leaflet-container { font: inherit; background: #0b0a09; }
#map.dim .leaflet-overlay-pane, #map.dim .leaflet-marker-pane { opacity: .28; transition: opacity .2s; }
.leaflet-tooltip {
  background: rgba(18,17,16,.95); color: var(--text); border: 1px solid var(--gold-dim); border-radius: 6px;
  box-shadow: none; padding: 4px 8px;
}
.leaflet-tooltip .tsub { color: var(--muted); font-size: 12px; }
.leaflet-tooltip-top:before { border-top-color: var(--gold-dim); }

.pin {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; color: #1b1408; border: 2px solid #1b1408; box-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.pin.start { background: var(--quest); }
.pin.end { background: #ffe9a3; }
.pin.focus { background: var(--gold); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(240,195,90,.8); } 100% { box-shadow: 0 0 0 16px rgba(240,195,90,0); } }

@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  #sidebar { width: 100%; height: 48%; border-right: none; border-top: 1px solid var(--line); }
  #main { height: 52%; flex: none; }
  .foot .help { font-weight: 600; font-size: 12px; }
.foot { display: none; }
  #layers { top: auto; bottom: 12px; }
}

#hoverlabel {
  position: absolute; z-index: 600; pointer-events: none; transform: translate(14px, 14px);
  font-family: "Friz Quadrata", Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 700;
  color: #ffd100; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 8px #000; white-space: nowrap;
}
#maphint {
  position: absolute; bottom: 12px; left: 12px; z-index: 500; pointer-events: none; font-size: 12px; color: var(--muted);
  background: rgba(18,17,16,.8); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
}
.zone-intro .lv { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
@media (max-width: 760px) { #maphint { display: none; } }
