/* Main map page: the shared #BEmesh top bar over a full-height Leaflet map, with floating panels. */
[v-cloak] {
  display: none !important;
}

body.map-page {
  /* Older popup rules read these names; they follow the shared tokens, so dark mode works. */
  --app-font-body: "Figtree", system-ui, sans-serif;
  --app-font-display: "Figtree", system-ui, sans-serif;
  --app-surface: var(--panel);
  --app-surface-hover: var(--bar);
  --app-text: var(--ink);
  --app-text-muted: var(--mut);
  --app-accent: var(--gold);
  --app-accent-hover: var(--warn);
  --app-discord: #5865f2;
  --app-success: var(--ok);
  --app-error: var(--bad);
  --app-border: var(--line);
  --app-shadow: 0 1px 3px var(--shadow);
  --app-shadow-lg: 0 4px 20px var(--shadow);
  --app-radius: 8px;
  --app-radius-sm: 6px;
  --app-ease: 0.25s ease;
  --map-safe-bottom: env(safe-area-inset-bottom, 0px);
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

/* The Vue root only groups the header and the overlay, so they join the body grid. */
#app {
  display: contents;
}

.topbar {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  z-index: 1100;
}

#map {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 0;
  width: 100%;
  min-height: 0;
}

.map-overlay {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  z-index: 900;
  pointer-events: none;
}

.map-overlay > * {
  pointer-events: auto;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 1049;
  backdrop-filter: grayscale(1) blur(2px);
  background: url("../img/loader.svg") center / 64px no-repeat;
}

/* Top bar */
.counts-chip,
.recent-chip {
  gap: 10px;
}

.count-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mut);
}

.dot-1 {
  background: #2563eb;
}

.dot-2 {
  background: #3fa34d;
}

.dot-3 {
  background: #8e3fb8;
}

.dot-4 {
  background: #1497a8;
}

.recent-chip {
  gap: 0;
}

.recent-chip > span + span::before {
  content: "·";
  margin: 0 6px;
}

/* Search and filters */
.search-box {
  top: 10px;
  left: 10px;
  width: 320px;
  max-width: calc(100% - 20px);
  padding: 4px;
}

.search-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.search-row .input {
  border: 0;
  background: transparent;
  min-width: 0;
}

.search-row .input:focus {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.filter-toggle.active {
  background: var(--gold-bg);
  border-color: var(--gold);
}

.search-results {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  max-height: min(50vh, 360px);
  overflow-y: auto;
}

.search-results ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-results li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.search-results li:last-child {
  border-bottom: 0;
}

.search-results li:hover,
.search-results li:focus-visible {
  background: var(--bar);
  outline: none;
}

.search-text {
  min-width: 0;
}

.search-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-pkey {
  color: var(--mut);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-name b,
.search-pkey b {
  background: var(--gold-bg);
  color: inherit;
}

.filter-panel {
  top: 54px;
  left: 10px;
  width: 320px;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 70px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-panel[style*="display: none"] {
  display: none !important;
}

.filter-label {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip.toggle {
  cursor: pointer;
}

.chip.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip.toggle:has(input:checked) {
  background: var(--gold-bg);
  border-color: var(--gold);
}

.chip.toggle:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.filter-more summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.filter-more[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-more[open] summary {
  margin-bottom: 2px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--mut);
}

.filter-field input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.filter-panel > .btn {
  align-self: flex-start;
}

.totals-chip {
  display: none;
  top: 48px;
  left: 8px;
  padding: 3px 8px;
}

/* Add node */
.add-node {
  position: absolute;
  right: 10px;
  bottom: calc(24px + var(--map-safe-bottom));
  z-index: 800;
  text-decoration: none;
  box-shadow: 0 2px 8px var(--shadow);
}

.add-short {
  display: none;
}

/* Leaflet controls, bottom-left in the panel look */
.leaflet-bottom.leaflet-left {
  display: flex;
  flex-direction: column;
  /* Each control keeps its own width; an open layers panel must not stretch the zoom bar. */
  align-items: flex-start;
  gap: 6px;
  bottom: calc(10px + var(--map-safe-bottom));
  left: max(10px, env(safe-area-inset-left, 0px));
}

.leaflet-bottom.leaflet-left .leaflet-control {
  flex-shrink: 0;
  margin: 0 !important;
}

.leaflet-bar,
.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
}

.leaflet-bottom.leaflet-left .leaflet-control-zoom a {
  /* Same size as the layers button below, so the stack lines up. */
  width: 36px;
  height: 36px;
  line-height: 36px;
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}

.leaflet-bottom.leaflet-left .leaflet-control-zoom a:hover {
  background: var(--bar) !important;
}

.leaflet-bottom.leaflet-left .leaflet-control-zoom a.leaflet-disabled {
  opacity: 0.5;
  cursor: default;
}

.leaflet-bottom.leaflet-left .leaflet-control-layers {
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-control-layers.leaflet-control-layers-expanded {
  padding: 6px 10px !important;
}

.leaflet-control-layers label {
  font-family: var(--app-font-body);
  color: var(--ink);
}

.leaflet-control-layers-separator {
  border-top-color: var(--line);
}

.leaflet-control-layers-list {
  margin-block-start: 0 !important;
}

.leaflet-control-layers-toggle {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  background-image: url(../lib/css/images/layers-2x.png);
  background-size: 26px 26px;
  background-position: 50% 50%;
  background-repeat: no-repeat;
}

[data-theme="dark"] .leaflet-control-layers-toggle {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-control-layers-toggle {
    filter: invert(1);
  }
}

.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-bottom.leaflet-right {
  margin-right: max(0px, env(safe-area-inset-right, 0px));
  margin-bottom: var(--map-safe-bottom);
  opacity: 0.7;
  z-index: 1000 !important;
}

.pointer-help {
  cursor: help;
}

/* Popup chrome */
.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--ink);
}

.leaflet-popup-tip {
  background: var(--panel);
  border: 1px solid var(--line);
}

.node-popup {
  border-radius: 8px;
}

/* Phone */
@media (max-width: 600px) {
  .counts-chip,
  .recent-chip {
    display: none;
  }

  .totals-chip {
    display: block;
  }

  .search-box,
  .filter-panel {
    width: calc(100% - 16px);
    left: 8px;
    top: 8px;
  }

  .filter-panel {
    top: 52px;
    max-height: calc(100% - 64px);
  }

  .add-long {
    display: none;
  }

  .add-short {
    display: inline;
  }

  .leaflet-popup-content {
    min-width: 0;
  }

  /* A tall node card scrolls instead of running under the search box. */
  .node-popup {
    max-height: calc(100dvh - 200px);
    overflow-y: auto;
  }

  .leaflet-bottom.leaflet-left {
    bottom: calc(34px + var(--map-safe-bottom));
  }

  .leaflet-bottom.leaflet-right {
    max-width: calc(100% - 60px);
  }
}
table.node-info {
  table-layout: fixed;
  width: 100%;
}
table.node-info td {
  padding: 2px 0;
}

table.node-info tr td:first-child {
  width: 150px;
}
table.node-info tr td:last-child {
  word-break: break-all;
}

/* OSM attribution: clear home indicator / curved corners */
body.map-page .leaflet-bottom.leaflet-right {
  margin-right: max(0px, env(safe-area-inset-right, 0px));
  margin-bottom: var(--map-safe-bottom, 0px);
}
.leaflet-control-layers-list {
  margin-block-start: 0 !important;
}
.leaflet-bottom .leaflet-control-layers {
  margin-bottom: 0 !important; /* spacing via gap on .leaflet-bottom.leaflet-left */
}
.marker-cluster span {
  color: var(--app-text, #1a1917);
  font-weight: 800;
  font-family: var(--app-font-body, system-ui, sans-serif);
}

.leaflet-popup-close-button {
  color: var(--app-text-muted, #57534e) !important;
  font-size: 22px !important;
  padding: 4px 8px !important;
  right: 4px !important;
  top: 4px !important;
}
.leaflet-popup-close-button:hover {
  color: var(--app-text, #1a1917) !important;
}
.leaflet-container a.leaflet-popup-close-button {
  width: auto !important;
  height: auto !important;
}

/* Node popup: layout and typography */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: var(--app-radius, 10px);
  box-shadow: var(--app-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.12));
  border: 1px solid var(--app-border, #e7e5e4);
  /* visible so .coords-menu (position absolute) is not clipped */
  overflow: visible;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 288px;
  max-width: 384px;
  overflow: visible !important;
}

/* Node card: freshness accent (left edge) + layout */
.node-popup {
  --node-fresh-accent: #9e9e9e;
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--app-text, #1a1917);
  padding: 0;
  border-left: 3px solid var(--node-fresh-accent);
  background: var(--panel);
  border-radius: inherit;
}

.node-popup[data-status="recent"] {
  --node-fresh-accent: #2e7d32;
}

.node-popup[data-status="stale"] {
  --node-fresh-accent: #f9a825;
}

.node-popup[data-status="old"] {
  --node-fresh-accent: #ef6c00;
}

.node-popup[data-status="extinct"] {
  --node-fresh-accent: #757575;
}

.node-popup[data-status="none"] {
  --node-fresh-accent: #9e9e9e;
}

/* Beer.css sets `header { flex-direction: column; }` — must override for this row. */
.node-popup__header {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-block-size: 0;
  min-height: 0;
  padding: 12px 30px 12px 14px;
  border-bottom: 1px solid var(--app-border, #e7e5e4);
  background: var(--bar);
}

.node-popup__header > * {
  margin-block: 0;
}

.node-popup__type-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(
    145deg,
    rgba(212, 160, 23, 0.14),
    rgba(212, 160, 23, 0.06)
  );
  border: 1px solid rgba(212, 160, 23, 0.22);
}

.node-popup__type-icon i {
  font-family: "Material Symbols Outlined", sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--app-accent, #d4a017);
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.node-popup__freshness {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}

/* Title + city stack; sits between type icon and source icon */
.node-popup__head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 2px;
  margin-block: 0;
}

.node-popup__header h3.node-popup__title,
.node-popup__title {
  flex: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-family: var(--app-font-display, "Figtree", sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  height: auto;
  display: block;
  color: var(--app-text, #1a1917);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-popup__cityline {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--app-text-muted, #57534e);
  line-height: 1.35;
  min-width: 0;
  /* do not overflow:hidden — it clips the absolute .coords-menu */
}

.node-popup__cityline .coords-menu-wrap {
  max-width: 100%;
  vertical-align: bottom;
}

.node-popup__cityline .coords-menu-toggle {
  color: inherit;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.node-popup__cityline--plain {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Source (uploader / app / web / …): Material icon, right-aligned in header */
.node-popup__source-icon {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  box-sizing: border-box;
  border-radius: 9px;
  border: 1px solid var(--app-border, #e7e5e4);
  background: var(--bar);
  color: var(--app-text-muted, #57534e);
  text-decoration: none !important;
  cursor: help;
  transition:
    border-color var(--app-ease, 0.25s ease),
    color var(--app-ease, 0.25s ease),
    background var(--app-ease, 0.25s ease);
}

a.node-popup__source-icon {
  cursor: pointer;
}

.node-popup__source-icon:hover {
  border-color: rgba(212, 160, 23, 0.4);
  color: var(--app-text, #1a1917);
  background: var(--panel);
}

.node-popup__source-icon i {
  font-family: "Material Symbols Outlined", sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 1.2rem;
  line-height: 1;
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.node-popup__source-icon--uploader {
  color: var(--app-success, #15803d);
  border-color: rgba(21, 128, 61, 0.28);
  background: rgba(21, 128, 61, 0.06);
}

.node-popup__source-icon--app {
  color: var(--node);
  border-color: rgba(21, 101, 192, 0.28);
  background: rgba(21, 101, 192, 0.06);
}

.node-popup__source-icon--web {
  color: var(--ok);
  border-color: rgba(0, 105, 92, 0.28);
  background: rgba(0, 105, 92, 0.06);
}

.node-popup__source-icon--discord {
  color: var(--app-discord, #5865f2);
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.08);
}

.node-popup__source-icon--other {
  color: var(--app-text-muted, #57534e);
}

/* Inserted / updated / last advert — slim row; gradient tint follows header freshness (cf. --owner block). */
.node-popup__activity {
  list-style: none;
  margin: 0;
  padding: 5px 10px 6px;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  border-bottom: 1px solid var(--app-border, #e7e5e4);
  background: linear-gradient(
    100deg,
    rgba(158, 158, 158, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup[data-status="recent"] .node-popup__activity {
  background: linear-gradient(
    100deg,
    rgba(46, 125, 50, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup[data-status="stale"] .node-popup__activity {
  background: linear-gradient(
    100deg,
    rgba(249, 168, 37, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup[data-status="old"] .node-popup__activity {
  background: linear-gradient(
    100deg,
    rgba(239, 108, 0, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup[data-status="extinct"] .node-popup__activity {
  background: linear-gradient(
    100deg,
    rgba(117, 117, 117, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup__activity-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 3px;
  border-radius: 6px;
  background: var(--bar);
  border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.node-popup__activity-item:hover {
  background: var(--bar);
  border-color: rgba(212, 160, 23, 0.18);
}

.node-popup__activity-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(212, 160, 23, 0.12);
}

.node-popup__activity-icon i {
  font-family: "Material Symbols Outlined", sans-serif;
  font-style: normal;
  font-size: 1rem;
  line-height: 1;
  color: var(--app-accent-hover, #b88a14);
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.node-popup__activity-copy {
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15em 0.3em;
  line-height: 1.1;
}

.node-popup__activity-label {
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted, #57534e);
  white-space: nowrap;
}

.node-popup__activity-label::after {
  content: "·";
  margin-left: 0.28em;
  margin-right: 0.1em;
  font-weight: 400;
  color: var(--app-border, #d6d3d1);
}

.node-popup__activity-value {
  font-size: 0.65625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--app-text, #1a1917);
  min-width: 0;
  flex: 1 1 auto;
}

.node-popup__activity-value time {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 1px;
}

.node-popup__body {
  padding: 0;
}

.node-popup__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--app-border, #e7e5e4);
  background: var(--bar);
}

.node-popup__panel-block {
  padding: 8px 14px 9px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 6%, transparent);
}

.node-popup__panel-block:last-child {
  border-bottom: none;
}

.node-popup__panel-block--owner {
  background: linear-gradient(
    100deg,
    rgba(88, 101, 242, 0.13) 0%,
    rgba(255, 255, 255, 0) 55%
  );
}

.node-popup__panel-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--app-text-muted, #57534e);
  margin-bottom: 4px;
}

.node-popup__panel-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(212, 160, 23, 0.12);
  color: var(--app-accent-hover, #b88a14);
}

.node-popup__panel-icon i {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 0.95rem;
  font-style: normal;
  line-height: 1;
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 20;
}

.node-popup__panel-icon--discord {
  background: rgba(88, 101, 242, 0.15);
  color: var(--app-discord, #5865f2);
}

.node-popup__panel-body {
  padding-left: 28px;
  font-size: 0.8125rem;
  line-height: 1.45;
  min-width: 0;
}

.node-popup__panel-body--prov {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.node-popup__prov-row {
  display: grid;
  grid-template-columns: minmax(6.75rem, 34%) 1fr;
  gap: 4px 10px;
  align-items: start;
}

.node-popup__prov-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-text-muted, #57534e);
  padding-top: 2px;
}

.node-popup__prov-value {
  min-width: 0;
  word-break: break-all;
  font-size: 0.75rem;
}

.node-popup__pk-wrap .copyable,
.node-qr-card .node-popup__pk-wrap .node-qr-card__field-text {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--app-text, #1a1917) !important;
  text-decoration: none !important;
  border: 1px solid var(--app-border, #e7e5e4);
  border-radius: 8px;
  padding: 5px 8px;
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bar);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.node-popup__pk-wrap .copyable:hover,
.node-qr-card__header:hover .node-popup__pk-wrap .node-qr-card__field-text,
.node-qr-card__footer:hover .node-popup__pk-wrap .node-qr-card__field-text {
  border-color: rgba(212, 160, 23, 0.45);
  background: var(--panel);
}

.node-popup__discord-user {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--app-discord, #5865f2);
  text-decoration: none;
}

.node-popup__discord-user:hover {
  text-decoration: underline;
}

.node-popup__discord-user--bare {
  color: var(--app-text, #1a1917);
}

.node-popup__radio-preset {
  display: inline-block;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--app-text, #1a1917);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.12);
  border: 1px solid rgba(212, 160, 23, 0.28);
}

.node-popup__radio-custom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.node-popup__chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.node-popup__chip {
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--app-text, #1a1917);
}

.node-popup__chip[title],
.node-popup__radio-preset[title] {
  cursor: help;
}

.node-popup__chip-hint {
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--app-text-muted, #57534e);
  margin-left: 2px;
}

.node-popup__chip-hint--lead {
  margin-left: 0;
  margin-bottom: 0;
}

.node-popup__muted {
  color: var(--app-text-muted, #57534e);
  font-size: 0.8125rem;
}

.node-popup__map-jump {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  color: var(--app-success, #15803d);
  margin-left: 5px;
  text-decoration: none;
}

.node-popup__map-jump:hover {
  opacity: 0.85;
}

.node-popup .node-info--extras {
  margin: 8px 14px 10px;
  width: calc(100% - 28px);
}

.node-qr-card {
  margin: 0 14px 12px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--app-border, #e7e5e4);
  background: var(--panel);
  box-shadow: var(--app-shadow, 0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent));
  cursor: pointer;
  outline: none;
  transition:
    border-color var(--app-ease, 0.25s ease),
    box-shadow var(--app-ease, 0.25s ease),
    transform 0.15s ease;
}

.node-qr-card:hover {
  border-color: rgba(212, 160, 23, 0.45);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 8%, transparent);
}

.node-qr-card:focus-visible {
  border-color: var(--app-accent, #d4a017);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.25);
}

.node-qr-card:active {
  transform: scale(0.99);
}

.node-qr-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--app-border, #e7e5e4);
  background: linear-gradient(
    90deg,
    rgba(212, 160, 23, 0.1),
    color-mix(in srgb, var(--ink) 3%, transparent)
  );
  border-radius: 11px 11px 0 0;
  cursor: pointer;
}

.node-qr-card__inner {
  padding: 12px 12px 8px;
  text-align: center;
  background: var(--panel);
  border-radius: 0;
}

.node-popup .node-qr-slot {
  text-align: center;
}

.node-popup .node-qr-slot:has(svg.node-qr) {
  cursor: zoom-in;
}

.node-popup svg.node-qr {
  display: block;
  margin: 0 auto;
}

/* Modal: enlarged QR — ~520px panel: room around QR without old 640px stretch */
.node-qr-enlarge-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.node-qr-enlarge-panel {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(520px, calc(100vw - 36px));
  padding: 48px 20px 32px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--app-border, #e7e5e4);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--ink) 18%, transparent);
}

.node-qr-enlarge-title {
  margin: 0 0 10px;
  padding: 0 28px;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--app-text, #1c1917);
  text-align: center;
}

.node-qr-enlarge-subtitle {
  margin: 0 0 8px;
  padding: 0 28px;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--mut);
  text-align: center;
}

.node-qr-enlarge-pk-wrap {
  margin: 0 0 20px;
  width: 100%;
  max-width: 100%;
  text-align: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.node-qr-enlarge-pk {
  display: inline-block;
  margin: 0;
  padding: 0;
  max-width: none;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  font-size: clamp(0.5rem, calc(0.52rem + 0.22vw), 0.625rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--mut);
  text-align: center;
  white-space: nowrap;
}

.node-qr-enlarge-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--app-text, #1c1917);
  font-size: 1.5rem;
  line-height: 0;
  /* Figtree / system × sits slightly low in the em box; nudge for optical center */
  transform: translateY(-2px);
  cursor: pointer;
  transition: background 0.15s ease;
}

.node-qr-enlarge-close:hover {
  background: rgba(212, 160, 23, 0.2);
}

.node-qr-enlarge-close:focus-visible {
  outline: 2px solid var(--app-accent, #d4a017);
  outline-offset: 2px;
}

.node-qr-enlarge-qr {
  line-height: 0;
}

.node-qr-enlarge-qr svg.node-qr--enlarged {
  width: 400px;
  max-width: 100%;
  height: auto;
}

.node-qr-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--app-border, #e7e5e4);
  background: linear-gradient(
    90deg,
    rgba(212, 160, 23, 0.1),
    color-mix(in srgb, var(--ink) 3%, transparent)
  );
  border-radius: 0 0 11px 11px;
  cursor: pointer;
}

.node-qr-card__bar-start {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

/* Grow to fill the bar so swapping “Copied!” for a long pubkey/link doesn’t shrink the row. */
.node-qr-card__bar-start .node-popup__pk-wrap {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
}

.node-qr-card__bar-start .node-popup__pk-wrap .copyable {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-qr-card__bar-start .node-popup__pk-wrap .node-qr-card__field-text {
  width: 100%;
  max-width: 100%;
}

/* Pill is a flex row; truncation lives on the inner slice only. */
.node-qr-card .node-popup__pk-wrap .node-qr-card__field-text {
  display: flex;
  align-items: center;
  width: 100%;
  line-height: 1.35;
  min-height: calc(1.35 * 0.6875rem + 10px + 2px);
}

.node-qr-card .node-popup__pk-wrap .node-qr-card__field-slice {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-qr-wrap-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
  width: 100%;
  min-height: calc(0.6875rem + 10px + 2px);
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 600;
}

.node-qr-wrap-feedback--ok {
  color: var(--app-success, #15803d);
}

.node-qr-wrap-feedback--ok i {
  font-size: 1.05rem;
  line-height: 1;
}

.node-qr-wrap-feedback--err {
  color: var(--app-error, #b91c1c);
}

.node-qr-wrap-feedback--err i {
  font-size: 1.05rem;
  line-height: 1;
}

/* Inside `.node-qr-card__field-text`: no extra box; pill padding/border stay on parent. */
.node-qr-wrap-feedback.node-qr-wrap-feedback--inline {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  min-height: 0;
  width: auto;
  max-width: 100%;
  gap: 0.2em;
  justify-content: flex-start;
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
}

.node-qr-card .node-qr-card__field-text .node-qr-wrap-feedback--inline i {
  font-size: 1em;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.node-qr-card .node-qr-card__field-text .node-qr-wrap-feedback--inline.node-qr-wrap-feedback--ok i,
.node-qr-card .node-qr-card__field-text .node-qr-wrap-feedback--inline.node-qr-wrap-feedback--err i {
  font-size: 1em;
}

.node-qr-card__hint {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--app-accent-hover, #b88a14);
  white-space: nowrap;
}

.node-qr-feedback--error {
  color: var(--app-error, #b91c1c) !important;
}

.node-popup .status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px var(--panel),
    0 0 0 3px var(--node-fresh-accent, #9e9e9e);
}

.node-popup .status-dot.update-recent {
  background-color: #2e7d32;
}

.node-popup .status-dot.update-stale {
  background-color: #f9a825;
}

.node-popup .status-dot.update-old {
  background-color: #ef6c00;
}

.node-popup .status-dot.update-extinct {
  background-color: #757575;
}

.node-popup .status-dot.update-none {
  background-color: #9e9e9e;
}

.coords-menu-wrap {
  position: relative;
  display: inline-block;
}

.coords-menu-wrap .coords-menu-toggle {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  color: var(--app-accent, #d4a017);
}

.coords-menu-wrap .coords-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 2000;
  min-width: 11rem;
  margin-top: 4px;
  padding: 6px 0;
  background: var(--app-surface, #fff);
  border: 1px solid var(--app-border, #e7e5e4);
  border-radius: var(--app-radius-sm, 6px);
  box-shadow: var(--app-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.12));
  flex-direction: column;
}

.coords-menu-wrap.open .coords-menu {
  display: flex;
  flex-direction: column;
}

.coords-menu-wrap .coords-menu a,
.coords-menu-wrap .coords-menu .copyable {
  display: block;
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--app-text, #1a1917) !important;
  text-decoration: none !important;
}

.coords-menu-wrap .coords-menu a:hover,
.coords-menu-wrap .coords-menu .copyable:hover {
  background: var(--app-surface-hover, rgba(250, 250, 249, 0.98));
}

.node-popup .node-info {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

.node-popup .node-info tr td {
  padding: 2px 0;
  vertical-align: top;
}

.node-popup .node-info tr td:first-child {
  width: 108px;
  max-width: 108px;
  font-size: 0.65625rem;
  font-weight: 600;
  color: var(--app-text-muted, #57534e);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-right: 10px;
}

.node-popup .node-info tr td:last-child {
  word-break: break-all;
}

.node-popup .node-info a:not(.node-popup-action) {
  color: var(--app-accent, #0d9488);
  text-decoration: none;
}

.node-popup .node-info a:not(.node-popup-action):hover {
  text-decoration: underline;
}

.node-popup .node-popup-actions {
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--app-border, #e7e5e4);
  background: var(--bar);
}

.node-popup .node-popup-actions__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px 8px;
  width: 100%;
}

.node-popup .node-popup-actions__slot {
  min-width: 0;
  display: flex;
  align-items: center;
}

.node-popup .node-popup-analyzer-menu {
  display: inline-block;
}

.node-popup .node-popup-analyzer-menu__toggle {
  text-decoration: none;
}

.node-popup .node-popup-actions__slot--start {
  justify-content: flex-start;
}

.node-popup .node-popup-actions__slot--center {
  justify-content: center;
}

.node-popup .node-popup-actions__slot--end {
  justify-content: flex-end;
}

.node-popup .node-popup-action {
  flex: 0 0 auto;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--app-border, #e7e5e4);
  background: var(--panel);
  color: var(--app-text-muted, #57534e);
  transition:
    background var(--app-ease, 0.25s ease),
    border-color var(--app-ease, 0.25s ease),
    color var(--app-ease, 0.25s ease);
}

.node-popup .node-popup-action:hover {
  border-color: rgba(212, 160, 23, 0.35);
  color: var(--app-text, #1a1917);
  background: var(--panel);
}

.node-popup .node-popup-action--external {
  color: var(--app-success, #15803d);
  border-color: rgba(21, 128, 61, 0.25);
  background: rgba(21, 128, 61, 0.06);
}

.node-popup .node-popup-action--external:hover {
  color: var(--ok);
  border-color: rgba(21, 128, 61, 0.45);
}

.node-popup .node-popup-action--claim {
  color: var(--app-discord, #5865f2);
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.08);
}

.node-popup .node-popup-action--claim:hover {
  color: var(--app-discord);
  border-color: rgba(88, 101, 242, 0.55);
}

.node-popup .node-popup-action--danger {
  color: var(--app-error, #b91c1c);
  border-color: rgba(185, 28, 28, 0.25);
  background: rgba(185, 28, 28, 0.06);
}

.node-popup .node-popup-action--danger:hover {
  color: var(--bad);
  border-color: rgba(185, 28, 28, 0.45);
}

/* Icon-only actions (e.g. request deletion = trash); keep ligature names case-sensitive */
.node-popup .node-popup-action--icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 6px 8px;
  text-transform: none;
  letter-spacing: 0;
}

.node-popup .node-popup-action--icon-only i {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1;
}

.node-popup .copyable {
  cursor: pointer;
  color: var(--app-accent, #0d9488);
  text-decoration: underline;
}

.node-popup .copyable:hover {
  color: var(--app-accent-hover, #0f766e);
}

.node-popup time {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

/* Styling for relative time display */
time {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Color coding for nodes with source 'uploader' based on update status */
.leaflet-marker-icon.update-recent {
  filter: saturate(5) hue-rotate(260deg);
}

.leaflet-marker-icon.update-stale {
  filter: saturate(28) hue-rotate(228deg);
}

.leaflet-marker-icon.update-old {
  filter: saturate(5) hue-rotate(165deg);
}

.leaflet-marker-icon.update-extinct {
  filter: grayscale(100) contrast(16);
  opacity: 0.6;
}

.svg-node-icon {
  background: none !important;
  border: none !important;
}

/* Yellow glow for claimed nodes (any owner) – medium (between subtle and original) */
.leaflet-marker-icon.claimed {
  filter: drop-shadow(0 0 3px rgba(240, 200, 80, 0.55))
    drop-shadow(0 0 6px rgba(240, 200, 80, 0.45))
    drop-shadow(0 0 10px rgba(240, 200, 80, 0.4));
  z-index: 999 !important;
}

/* Purple Discord glow for user-owned nodes – stronger medium (overrides yellow when ours) */
.leaflet-marker-icon.user-owned {
  filter: drop-shadow(0 0 4px rgba(88, 101, 242, 0.65))
    drop-shadow(0 0 8px rgba(88, 101, 242, 0.55))
    drop-shadow(0 0 12px rgba(88, 101, 242, 0.5));
  z-index: 1000 !important;
}

/* Yellow glow for claimed nodes with uploader color coding – medium */
.leaflet-marker-icon.update-recent.claimed {
  filter: saturate(5) hue-rotate(260deg)
    drop-shadow(0 0 3px rgba(240, 200, 80, 0.55))
    drop-shadow(0 0 6px rgba(240, 200, 80, 0.45))
    drop-shadow(0 0 10px rgba(240, 200, 80, 0.4));
  z-index: 999 !important;
}
.leaflet-marker-icon.update-stale.claimed {
  filter: saturate(28) hue-rotate(228deg)
    drop-shadow(0 0 3px rgba(240, 200, 80, 0.55))
    drop-shadow(0 0 6px rgba(240, 200, 80, 0.45))
    drop-shadow(0 0 10px rgba(240, 200, 80, 0.4));
  z-index: 999 !important;
}
.leaflet-marker-icon.update-old.claimed {
  filter: saturate(5) hue-rotate(165deg)
    drop-shadow(0 0 3px rgba(240, 200, 80, 0.55))
    drop-shadow(0 0 6px rgba(240, 200, 80, 0.45))
    drop-shadow(0 0 10px rgba(240, 200, 80, 0.4));
  z-index: 999 !important;
}
.leaflet-marker-icon.update-extinct.claimed {
  filter: grayscale(100) contrast(16)
    drop-shadow(0 0 3px rgba(240, 200, 80, 0.55))
    drop-shadow(0 0 6px rgba(240, 200, 80, 0.45))
    drop-shadow(0 0 10px rgba(240, 200, 80, 0.4));
  opacity: 0.6;
  z-index: 999 !important;
}

/* Combine color coding with purple glow for owned nodes – stronger medium */
.leaflet-marker-icon.update-recent.user-owned {
  filter: saturate(5) hue-rotate(260deg)
    drop-shadow(0 0 4px rgba(88, 101, 242, 0.65))
    drop-shadow(0 0 8px rgba(88, 101, 242, 0.55))
    drop-shadow(0 0 12px rgba(88, 101, 242, 0.5));
  z-index: 1000 !important;
}

.leaflet-marker-icon.update-stale.user-owned {
  filter: saturate(28) hue-rotate(228deg)
    drop-shadow(0 0 4px rgba(88, 101, 242, 0.65))
    drop-shadow(0 0 8px rgba(88, 101, 242, 0.55))
    drop-shadow(0 0 12px rgba(88, 101, 242, 0.5));
  z-index: 1000 !important;
}

.leaflet-marker-icon.update-old.user-owned {
  filter: saturate(5) hue-rotate(165deg)
    drop-shadow(0 0 4px rgba(88, 101, 242, 0.65))
    drop-shadow(0 0 8px rgba(88, 101, 242, 0.55))
    drop-shadow(0 0 12px rgba(88, 101, 242, 0.5));
  z-index: 1000 !important;
}

.leaflet-marker-icon.update-extinct.user-owned {
  filter: grayscale(100) contrast(16)
    drop-shadow(0 0 4px rgba(88, 101, 242, 0.65))
    drop-shadow(0 0 8px rgba(88, 101, 242, 0.55))
    drop-shadow(0 0 12px rgba(88, 101, 242, 0.5));
  opacity: 0.6;
  z-index: 1000 !important;
}

.user-actions {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 15px;
}

