/* 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;
}

/* An icon's details, as the plugin's card. */
.card {
  top: 92px;
  right: 12px;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.card[hidden] { display: none; }
.card > div { overflow-wrap: anywhere; }
.card-close {
  float: right;
  margin: -6px -8px 0 6px;
  width: 26px;
  height: 26px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.card-close:hover { background: var(--hover); color: var(--text); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #fff; }
.card-title img { width: 15px; height: 15px; image-rendering: pixelated; flex: none; }
.card-muted { color: var(--muted); }
.card-note { margin-top: 8px; color: #ffc878; }
.card-heading { margin: 12px 0 4px; font-weight: 700; color: #fff; }
.card-need { padding-left: 14px; color: var(--muted); font-size: 12px; }
.card-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card-button, .card-buttons .card-link {
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.card-button:hover, .card-buttons .card-link:hover { background: var(--hover); }
.card-link { color: #c9c4b4; }
.card-jump {
  display: block;
  width: 100%;
  padding: 2px 0;
  background: none;
  border: 0;
  color: #9ecbff;
  text-align: left;
  cursor: pointer;
}
.card-jump:hover { text-decoration: underline; }
.card-ware { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.card-ware .card-link { text-decoration: none; }
.card-ware .card-link:hover { text-decoration: underline; }
.card-ware .card-muted { flex: none; font-size: 12px; }
.card-keeper { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* What a search found, as the plugin's search panel: pictures, tabs, sorts and rows lit under the mouse. */
#results li.heading {
  margin-top: 2px;
  padding: 5px 8px 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
#results li.heading:first-child { margin-top: 0; }
.res-title { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #fff; margin-top: 2px; }
.res-summary { margin-top: 6px; color: #cdcdd2; }
.res-tabs { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; border-bottom: 1px solid var(--edge); }
.res-tab, .res-option {
  padding: 2px 0;
  background: none;
  border: 0;
  color: #9ecbff;
  cursor: pointer;
}
.res-tab { padding-bottom: 4px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.res-tab:hover, .res-option:hover { color: #fff; }
.res-tab[aria-pressed="true"] { color: #fff; font-weight: 700; border-bottom-color: #fff; cursor: default; }
.res-sort { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 8px; font-size: 12px; }
.res-option[aria-pressed="true"] { color: #fff; font-weight: 700; cursor: default; }
.res-table, .res-filter {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  border-radius: 7px;
  outline: none;
}
.res-table option { background: var(--panel-solid); }
.res-filter:focus { border-color: rgba(255, 214, 64, 0.6); }
.res-row { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-top: 3px; }
.res-text { min-width: 0; flex: 1; }
.res-place { margin-top: 4px; padding: 2px 0; }
.res-click { border-radius: 7px; cursor: pointer; outline: none; }
.res-click:hover, .res-click:focus-visible { background: rgba(255, 255, 255, 0.07); }
.res-name { font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.res-link { color: #9ecbff; }
.res-click:hover .res-link { color: #fff; }
.res-sub { color: #cdcdd2; font-size: 12px; overflow-wrap: anywhere; }
.res-sub .card-link { color: #9ecbff; text-decoration: none; }
.res-sub .card-link:hover { color: #fff; text-decoration: underline; }
.res-undrawn { color: #ffbe78; font-size: 12px; }
.res-credit { margin-top: 12px; font-size: 12px; }
.card > .card-jump + .res-title { margin-top: 6px; }
.pic-item { width: 36px; height: 32px; flex: none; image-rendering: pixelated; }
.pic-npc { width: 72px; height: 72px; flex: none; object-fit: contain; }
.pic-dropper { width: 36px; height: 36px; flex: none; object-fit: contain; }
.pic-keeper { width: 48px; height: 48px; flex: none; object-fit: contain; }
.card-title img.badge { width: 18px; height: 18px; image-rendering: auto; }

/* The icon layers, as the plugin's settings. */
.layers-pick summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}
.layers-pick summary:hover { color: var(--text); }
.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 6px; font-size: 13px; }
.layer { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.layer input { margin: 0; accent-color: var(--accent); }

/* 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; }
  .card { top: auto; bottom: 58px; left: 8px; right: 8px; width: auto; max-height: 45vh; }
}

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