/* HD Map Reforged's live map: the plugin's dark map, its controls floating over it. */
:root {
  --bg: #0a0c10;
  --panel: rgba(22, 24, 28, 0.9);
  --panel-solid: #16181c;
  --hover: rgba(52, 56, 64, 0.95);
  --edge: rgba(255, 255, 255, 0.14);
  --text: #e8e6e1;
  --muted: #9a9890;
  --accent: #ffd640;
  --accent-text: #1a1608;
  --live: #4ade80;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  overflow: hidden;
}

#map {
  position: fixed;
  inset: 0;
  background: var(--bg);
}
.leaflet-container { background: var(--bg); font: inherit; outline: none; }
/* The ground floor under an upper one, dimmed as the plugin draws it. */
.leaflet-layer.below { filter: brightness(0.41); }
/* Zoomed past the tiles' own size: crisp game pixels. */
.leaflet-container.pixelated .leaflet-tile { image-rendering: pixelated; }

.label-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 450;
}

.panel {
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

header.panel {
  top: 12px;
  left: 12px;
  width: min(340px, calc(100vw - 24px));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  text-shadow: 0 1px 0 #000;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.live.on .dot { background: var(--live); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
.live.off .dot { background: #f87171; }

input, select, button { font: inherit; color: inherit; }

.search { position: relative; }
#search {
  width: 100%;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  border-radius: 8px;
  outline: none;
}
#search:focus { border-color: rgba(255, 214, 64, 0.6); }
#search::placeholder { color: var(--muted); }

#results {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  max-height: min(50vh, 360px);
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--edge);
  border-radius: 8px;
}
#results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
#results li[aria-selected="true"], #results li:hover { background: var(--hover); }
#results .name { min-width: 0; overflow-wrap: anywhere; }
#results .kind { flex: none; font-size: 12px; color: var(--muted); }
#results .empty { color: var(--muted); cursor: default; }
#results .empty:hover { background: none; }

.row { display: flex; gap: 8px; align-items: stretch; }
.map-pick { flex: 1; min-width: 0; }
#map-select {
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  border-radius: 8px;
}
#map-select option { background: var(--panel-solid); }

.floors {
  display: inline-flex;
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.floors button {
  width: 32px;
  padding: 6px 0;
  background: rgba(0, 0, 0, 0.35);
  border: 0;
  border-left: 1px solid var(--edge);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.floors button:first-child { border-left: 0; }
.floors button:hover { background: var(--hover); }
.floors button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 700; }

.coords {
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  font: 13px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  pointer-events: none;
}

.notice {
  position: fixed;
  z-index: 1001;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  background: var(--panel-solid);
  border: 1px solid var(--edge);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

/* Leaflet's controls in the panels' colours. */
.leaflet-bar { border: 1px solid var(--edge) !important; border-radius: 8px; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45) !important; }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--panel);
  color: var(--text);
  border-bottom-color: var(--edge);
  width: 34px;
  height: 34px;
  line-height: 34px;
}
.leaflet-bar a:hover { background: var(--hover); }
.leaflet-bar a.leaflet-disabled { background: var(--panel); color: #555; }
.leaflet-top.leaflet-right { top: 2px; right: 2px; }
.leaflet-control-attribution {
  background: rgba(10, 12, 16, 0.78) !important;
  color: var(--muted);
  font-size: 11px;
  border-top-left-radius: 6px;
  max-width: calc(100vw - 24px);
}
.leaflet-control-attribution a { color: #c9c4b4; }

/* The spot a search picked: Leaflet places the icon by its transform, so the ring inside it pulses. */
.found-ring span {
  display: block;
  width: 100%;
  height: 100%;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(0, 0, 0, 0.6);
  animation: ring 1.6s ease-out 3 forwards;
}
@keyframes ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 600px) {
  header.panel { top: 8px; left: 8px; width: calc(100vw - 16px - 46px); padding: 10px; gap: 8px; }
  .leaflet-top.leaflet-right { top: -2px; right: -2px; }
  /* Above the credits, which take three lines here. */
  .coords { left: 8px; bottom: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .found-ring span { animation: none; }
}
