/* ==========================================================================
   Design system (frontend-aesthetics: distinctive typography, color, motion)
   ========================================================================== */
body.map-page {
  /* Typography: Figtree on map */
  --app-font-body: "Figtree", system-ui, sans-serif;
  --app-font-display: "Figtree", system-ui, sans-serif;
  /* Color: cohesive light theme, accent (orange/darker yellow, matches stats page) */
  --app-bg: #f6f5f2;
  --app-surface: rgba(255, 255, 255, 0.92);
  --app-surface-hover: rgba(250, 250, 249, 0.98);
  --app-text: #1a1917;
  --app-text-muted: #57534e;
  --app-accent: #d4a017;
  --app-accent-hover: #b88a14;
  --app-discord: #5865f2;
  --app-success: #15803d;
  --app-error: #b91c1c;
  --app-border: #e7e5e4;
  --app-shadow: 0 1px 3px rgba(26, 25, 23, 0.06);
  --app-shadow-lg: 0 4px 20px rgba(26, 25, 23, 0.08);
  --app-radius: 10px;
  --app-radius-sm: 6px;
  /* Motion */
  --app-ease: 0.25s ease;
  --app-reveal-duration: 0.4s;
}

@font-face {
  font-family: Material Symbols Outlined;
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url(https://cdn.jsdelivr.net/npm/beercss@3.9.4/dist/cdn/material-symbols-outlined.woff2)
    format("woff2");
}

[v-cloak] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--app-font-body, system-ui, sans-serif);
}
body.map-page {
  background: var(--app-bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(212, 160, 23, 0.06), transparent),
    linear-gradient(180deg, var(--app-bg) 0%, #eeedea 100%);
  min-height: 100vh;
}
body:has(dialog[open])::after {
  content: "";
  position: absolute;
  z-index: 1049;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  backdrop-filter: blur(10px);
}

body:has(#app .loading)::before {
  content: "";
  position: absolute;
  z-index: 1049;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  backdrop-filter: grayscale(1) blur(2px);
  background-image: url("../img/loader.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 64px;
}

/* Staggered reveal on load (high-impact moment) */
body.map-page #app .stats {
  animation: map-reveal var(--app-reveal-duration) var(--app-ease) 0.05s both;
}
body.map-page #app .search {
  animation: map-reveal var(--app-reveal-duration) var(--app-ease) 0.12s both;
}
body.map-page #app .float-action-grid {
  animation: map-reveal var(--app-reveal-duration) var(--app-ease) 0.12s both;
}
body.map-page #app .float-action-btn:first-of-type {
  animation: map-reveal var(--app-reveal-duration) var(--app-ease) 0.15s both;
}
body.map-page #app .float-action-btn:last-of-type {
  animation: map-reveal var(--app-reveal-duration) var(--app-ease) 0.18s both;
}
@keyframes map-reveal {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

dialog[open] {
  z-index: 1050 !important;
}

#map {
  height: 100vh;
}
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 {
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-results {
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.search-results li {
  overflow: hidden;
}

.search-pkey {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#app {
  display: flex;
  justify-content: center;
}
.add-dialog {
  z-index: 1050;
  padding: 15px;
  max-height: 80vh;
}

.add-dialog .page {
  text-align: center;
}

.add-dialog .page img {
  max-width: 50%;
  max-height: 300px;
}

@media (max-width: 800px) {
  .add-dialog {
    width: 95%;
    max-height: 100vh;
  }
}

.pointer-help {
  cursor: help;
}

.stats {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto;
  align-items: center;
  min-height: 30px;
  width: 100%;
  min-width: 700px;
  overflow: visible;
  color: var(--app-text, #1a1917);
  background: var(--app-surface, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 15px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--app-border, #e7e5e4);
  box-shadow: var(--app-shadow, 0 1px 3px rgba(0, 0, 0, 0.04));
}

.stats-rows {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  row-gap: 6px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.stats-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 15px;
  row-gap: 4px;
  min-height: 26px;
  font-size: 1em;
}
.stats .stats-row > span {
  line-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
}

/* General stats icon: MDI chart-line (inline SVG) */
.stats-icon-wrap {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.stats a.stats-icon-wrap {
  color: inherit;
  text-decoration: none;
}
.stats a.stats-icon-wrap:hover {
  opacity: 0.85;
}
.stats .mdi-chart-line,
.stats .mdi-counter {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Logout: accent error */
.stats-auth .logout-link {
  color: var(--app-error, #b91c1c);
}
.stats-auth .logout-link .mdi-logout {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Auth + GitHub: right column, spans both rows – same font size as stats rows */
.stats-auth {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: center;
  margin-left: 15px;
  font-size: 1em;
}
.stats-auth .auth-text,
.stats-auth a[href="/auth/login"] {
  font-size: 1em;
}

/* Mobile responsiveness for top bar - single row with smart shrinking */
@media (max-width: 768px) {
  .stats {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 100% !important;
    width: 100% !important;
    min-height: auto;
    padding: 4px 6px;
    gap: 6px;
    overflow: hidden;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .stats-auth {
    grid-column: unset;
    grid-row: unset;
    margin-left: 0;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  /* Stats block: one row, can shrink to fit */
  .stats-rows {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    gap: 6px 10px;
    row-gap: 2px;
  }

  .stats-rows .stats-row {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.75em;
    column-gap: 6px;
    row-gap: 2px;
    min-height: 0;
  }

  .stats .stats-row > span {
    display: inline-flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Smaller icons on mobile to fit one row */
  .stats .stats-icon-wrap {
    flex-shrink: 0;
  }
  .stats .mdi-chart-line,
  .stats .mdi-counter {
    width: 18px;
    height: 18px;
  }
  .stats .node-type,
  .stats .stats-row img {
    width: 16px !important;
    height: 16px !important;
    margin-left: 4px !important;
    margin-right: 2px !important;
  }
  .stats i.node-type {
    font-size: 12px;
  }

  .stats-auth {
    font-size: 0.8em;
  }

  .stats-auth .logout-link .mdi-logout {
    width: 20px;
    height: 20px;
  }

  .stats a[href="/auth/login"],
  .stats a[href="/auth/logout"] {
    white-space: nowrap;
  }

  /* Show compact version of logged-in text on mobile */
  .auth-display .auth-full {
    display: none;
  }

  .auth-display .auth-compact {
    display: inline;
  }

  .auth-display {
    flex-shrink: 0;
    min-width: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logout-link {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Adjust search field position - will be set dynamically by JS */
  .search {
    top: 60px; /* Fallback, JS will adjust based on actual height */
  }
}

/* Very small screens - even more compact, still one row */
@media (max-width: 480px) {
  .stats {
    padding: 3px 4px;
    gap: 4px;
  }

  .stats-rows .stats-row {
    font-size: 0.7em;
    column-gap: 4px;
  }

  .stats .mdi-chart-line,
  .stats .mdi-counter {
    width: 16px;
    height: 16px;
  }

  .stats-auth {
    font-size: 0.75em;
  }

  .auth-display {
    max-width: 90px;
  }

  .logout-link {
    padding: 2px 4px;
  }

  .logout-link .mdi-logout {
    width: 18px;
    height: 18px;
  }
}

.stats i.node-type {
  background-color: var(--app-text-muted, #57534e);
  border-radius: 50%;
  font-size: 14px;
  color: var(--app-surface, #fff);
  margin-left: 7px;
  margin-right: 4px;
}

.stats a img {
  width: 16px;
  min-inline-size: 0px !important;
}

/* Leaflet bottom-left: same bottom offset as float-action-grid (64px) */
.leaflet-bottom.leaflet-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  bottom: 64px;
}
.leaflet-bottom.leaflet-left .leaflet-control {
  flex-shrink: 0;
}
/* Zoom control: same panel style as layers */
.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  border: none !important;
  margin: 0 0 0 10px !important;
  box-shadow: var(--app-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.08));
  border-radius: var(--app-radius-sm, 6px);
  overflow: hidden;
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom a {
  background: var(--app-surface, rgba(255, 255, 255, 0.92)) !important;
  color: var(--app-text, #1a1917) !important;
  border: 1px solid var(--app-border, #e7e5e4) !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  transition: background var(--app-ease), color var(--app-ease);
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom .leaflet-control-zoom-in {
  border-radius: var(--app-radius-sm, 6px) var(--app-radius-sm, 6px) 0 0 !important;
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom .leaflet-control-zoom-out {
  border-radius: 0 0 var(--app-radius-sm, 6px) var(--app-radius-sm, 6px) !important;
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom a:hover {
  background: var(--app-surface-hover, rgba(250, 250, 249, 0.98)) !important;
  color: var(--app-accent, #0d9488) !important;
}
.leaflet-bottom.leaflet-left .leaflet-control-zoom a.leaflet-disabled {
  opacity: 0.5;
  cursor: default;
}
/* Layer control: compact when collapsed (toggle only), same panel style when expanded */
.leaflet-bottom.leaflet-left .leaflet-control-layers {
  flex-shrink: 0;
  padding: 0;
  background: var(--app-surface, rgba(255, 255, 255, 0.92));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--app-radius-sm, 6px);
  box-shadow: var(--app-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.08));
  border: 1px solid var(--app-border, #e7e5e4);
  box-sizing: border-box;
}
.leaflet-control-layers.leaflet-control-layers-expanded {
  padding: 6px 10px !important;
  color: var(--app-text, #1a1917);
}
.leaflet-control-layers label {
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  color: var(--app-text, #1a1917);
}
.leaflet-control-layers-separator {
  border-top-color: var(--app-border, #e7e5e4);
}
/* Footer links (site, docs, Discord, GitHub): one square, 2×2 grid of icons inside */
.float-action-grid {
  position: fixed;
  z-index: 1000;
  bottom: 64px; /* 8px below Add (122 - 8 - 50), same gap as Stats–Add */
  right: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: var(--app-radius-sm, 6px);
  background: var(--app-accent, #0d9488);
  box-shadow: var(--app-shadow, 0 1px 3px rgba(0, 0, 0, 0.08));
  overflow: hidden;
}
.float-action-grid a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  color: #fff;
  text-decoration: none;
  transition: background var(--app-ease), transform var(--app-ease);
}
.float-action-grid a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.float-action-grid .app-footer-icon,
.float-action-grid img {
  width: 18px;
  height: 18px;
  display: block;
  color: inherit;
  flex-shrink: 0;
}
.float-action-grid .app-footer-icon {
  fill: currentColor;
}
.float-action-grid img {
  filter: brightness(0) invert(1);
}
.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;
}
.leaflet-touch .leaflet-control-layers-toggle {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  background-size: 30px 30px;
}

/* Default: show full auth text, hide compact */
.auth-compact {
  display: none;
}

.auth-full {
  display: inline;
}
.search {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 10px;
  top: 30px;
  max-width: 600px;
  flex-grow: 1;
  width: calc(100% - 20px);
  align-self: center;
  justify-content: center;
  gap: 8px;
}

/* Search bar: input and filter as separate blocks in one row */
.search-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.search-input-wrap {
  flex: 1;
  min-width: 0;
}

.search-input-wrap .field.border {
  margin: 0;
  height: 100%;
}

.search-input-wrap .field.border input {
  width: 100%;
  min-width: 0;
}

.search-filter-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
}

.search-filter-wrap .filter {
  min-height: 44px;
  border-radius: var(--app-radius-sm, 6px);
  font-weight: 500;
}

body.map-page .search .search-input-wrap .field.border,
body.map-page .search .search-filter-wrap .filter {
  transition: box-shadow var(--app-ease), border-color var(--app-ease), background var(--app-ease);
}
body.map-page .search .search-input-wrap .field.border:focus-within {
  box-shadow: 0 0 0 2px var(--app-accent);
}
body.map-page .search .search-filter-wrap .filter:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--app-accent);
}

.search .field {
  width: 100%;
  display: flex;
}

.search .submit {
  width: 12px;
  height: 35px;
}

.search-text b {
  background: rgba(212, 160, 23, 0.25);
  color: var(--app-text, #1a1917);
}
/* Floating action buttons: same class, same formatting */
.float-action-btn {
  position: fixed;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  right: 10px;
  bottom: 122px; /* Add: above footer links */
  border-radius: var(--app-radius-sm, 6px);
  color: #fff;
  background: var(--app-accent, #0d9488);
  box-shadow: var(--app-shadow, 0 1px 3px rgba(0, 0, 0, 0.08));
  text-decoration: none;
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  transition: transform var(--app-ease), box-shadow var(--app-ease), background var(--app-ease);
}
/* Order top to bottom: Stats, Add, footer links (site/docs/Discord/GitHub) */
.float-action-btn:first-of-type {
  bottom: 180px; /* Stats at top */
}
.float-action-btn:last-of-type {
  bottom: 122px; /* Add between Stats and footer */
  background: #1976d2;
}
.float-action-btn:hover {
  background: var(--app-accent-hover, #0f766e);
  color: #fff;
  transform: scale(1.05);
  box-shadow: var(--app-shadow-lg);
}
.float-action-btn:last-of-type:hover {
  background: #1565c0;
}
.float-action-btn .extra {
  font-size: 28px;
  line-height: 1;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leaflet-bottom {
  position: fixed !important;
}
.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);
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 280px;
  max-width: 360px;
}

.node-popup {
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--app-text, #1a1917);
  padding: 10px 12px;
}

.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: 100px;
  max-width: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--app-text-muted, #57534e);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-right: 10px;
}

.node-popup .node-info tr td:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  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-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--app-border, #e7e5e4);
}

.node-popup .node-popup-actions table {
  width: 100%;
  border-collapse: collapse;
}

.node-popup .node-popup-actions td {
  width: 33.33%;
  text-align: center;
  padding: 2px 6px;
}

.node-popup .node-popup-actions a {
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.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;
}

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

/* Filter menu: block layout so title always sits above options (no overlap) */
#node-filter.filter-menu,
#node-filter {
  padding: 6px 8px !important;
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-size: 0.875rem;
  color: var(--app-text, #1a1917);
  min-width: 200px;
  max-height: min(85vh, 600px);
  overflow-y: auto;
  overflow-x: hidden;
}
/* When closed: hide so search row is first and doesn't get covered; only filter button opens menu */
#node-filter:not(.active) {
  display: none !important;
}
#node-filter.active {
  display: block !important;
}

#node-filter > li {
  margin: 0 !important;
  padding: 0 !important;
  min-height: auto !important;
  display: block !important;
}

#node-filter > li.padding {
  padding: 2px 6px !important;
  margin: 0 !important;
}

#node-filter > li .field {
  margin: 0 !important;
  padding: 0 !important;
}

#node-filter > li label {
  margin: 0 !important;
  padding: 1px 0 !important;
}

#node-filter > li .checkbox {
  margin: 0 !important;
  padding: 1px 0 !important;
}

/* Reduce vertical height of clustering zoom slider track and thumb */
#node-filter .slider.tiny input[type="range"] {
  height: 14px !important;
}

#node-filter .slider.tiny input[type="range"]::-webkit-slider-runnable-track {
  height: 4px !important;
}

#node-filter .slider.tiny input[type="range"]::-moz-range-track {
  height: 4px !important;
}

#node-filter .slider.tiny input[type="range"]::-webkit-slider-thumb {
  height: 14px !important;
  width: 14px !important;
}

#node-filter .slider.tiny input[type="range"]::-moz-range-thumb {
  height: 14px !important;
  width: 14px !important;
}

/* Auth and filter panel – design tokens */
.stats-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--app-accent, #0d9488);
  text-decoration: none;
  margin-right: 12px;
  font-weight: 500;
  transition: color var(--app-ease, 0.2s ease);
}
.stats-link:hover { color: var(--app-accent-hover, #0f766e); }
.stats-auth .auth-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  white-space: nowrap;
}
.stats-auth .auth-text { color: var(--app-text, #1a1917); }
.stats-auth .auth-full strong,
.stats-auth .auth-compact strong { color: var(--app-success, #15803d); text-decoration: underline; }
.stats-auth .discord-label { color: var(--app-discord, #5865f2); }
.stats-auth .logout-link {
  display: inline-flex;
  align-items: center;
  color: var(--app-error, #b91c1c);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity var(--app-ease);
}
.stats-auth .logout-link:hover { opacity: 0.85; }
.stats-auth .login-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--app-discord, #5865f2);
  text-decoration: none;
  margin-right: 8px;
  font-weight: 500;
  transition: color var(--app-ease);
}
.stats-auth .login-link:hover { color: var(--app-accent, #0d9488); }
.stats-auth .discord-icon { width: 18px; height: 18px; vertical-align: middle; }
/* Each section: title on top, options below in normal flow (no overlap possible) */
#node-filter .filter-section {
  list-style: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--app-border, #e7e5e4);
}
#node-filter .filter-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
#node-filter .filter-section-title {
  font-family: var(--app-font-body, "Figtree", system-ui, sans-serif);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-text-muted, #57534e);
  display: block;
  line-height: 1.3;
  margin-bottom: 4px;
}
#node-filter .filter-section-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#node-filter .filter-section-options .checkbox {
  display: flex;
  align-items: center;
  padding: 1px 0;
  line-height: 1.25;
}
#node-filter > li:not(.filter-section) {
  line-height: 1.25;
}
