html[data-theme='dark'] {
  color-scheme: dark;
}

body {
  transition: background-color 0.22s ease, color 0.22s ease;
}

:root {
  --desktop-surface-gap: 0.5rem;
  --desktop-nav-clearance: 4.5rem;
}

#navigation {
  z-index: 930;
}

#mobile-controls-shell {
  z-index: 960;
}

#building-modal > div,
#search-results-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.72) transparent;
}

#building-modal > div::-webkit-scrollbar,
#search-results-list::-webkit-scrollbar {
  width: 10px;
}

#building-modal > div::-webkit-scrollbar-track,
#search-results-list::-webkit-scrollbar-track {
  background: transparent;
}

#building-modal > div::-webkit-scrollbar-thumb,
#search-results-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.62);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#building-modal > div::-webkit-scrollbar-thumb:hover,
#search-results-list::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.82);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.maplibregl-ctrl-group {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.maplibregl-ctrl button {
  background: rgba(255, 255, 255, 0.95);
}

.maplibregl-ctrl-top-right .maplibregl-ctrl {
  margin: 90px 18px 0 0;
}

.maplibregl-ctrl-top-right .maplibregl-ctrl-group {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.maplibregl-ctrl-top-right .maplibregl-ctrl button {
  width: 36px;
  height: 36px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #334155;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.maplibregl-ctrl-top-right .maplibregl-ctrl button + button {
  border-top: 1px solid rgba(148, 163, 184, 0.24);
}

.maplibregl-ctrl-top-right .maplibregl-ctrl button:hover {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
}

.maplibregl-ctrl-top-right .maplibregl-ctrl button:active {
  background: rgba(226, 232, 240, 0.95);
}

html[data-theme='dark'] .theme-track-icon-sun,
html[data-theme='dark'] .theme-track-icon-moon {
  color: #ffffff;
}

html[data-theme='dark'] #building-modal > div,
html[data-theme='dark'] #search-results-list {
  scrollbar-color: rgba(71, 85, 105, 0.84) transparent;
}

html[data-theme='dark'] #building-modal > div::-webkit-scrollbar-thumb,
html[data-theme='dark'] #search-results-list::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.78);
  border: 2px solid transparent;
  background-clip: padding-box;
}

html[data-theme='dark'] #building-modal > div::-webkit-scrollbar-thumb:hover,
html[data-theme='dark'] #search-results-list::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.94);
  border: 2px solid transparent;
  background-clip: padding-box;
}

html[data-theme='dark'] body {
  background: #0b1220;
  color: #e2e8f0;
}

html[data-theme='dark'] .text-brand-ink,
html[data-theme='dark'] .text-black,
html[data-theme='dark'] .text-slate-900,
html[data-theme='dark'] .text-slate-800,
html[data-theme='dark'] .text-slate-700,
html[data-theme='dark'] .text-gray-900 {
  color: #e2e8f0 !important;
}

html[data-theme='dark'] .text-slate-600,
html[data-theme='dark'] .text-slate-500,
html[data-theme='dark'] .text-gray-500,
html[data-theme='dark'] .text-gray-400 {
  color: #94a3b8 !important;
}

html[data-theme='dark'] .bg-white,
html[data-theme='dark'] .bg-white\/95,
html[data-theme='dark'] .bg-slate-50,
html[data-theme='dark'] .bg-gray-50,
html[data-theme='dark'] .bg-white\/90 {
  background-color: #111a2d !important;
}

html[data-theme='dark'] .bg-slate-100 {
  background-color: #0b1220 !important;
}

html[data-theme='dark'] .border-slate-300,
html[data-theme='dark'] .border-slate-200,
html[data-theme='dark'] .border-gray-300,
html[data-theme='dark'] .border-gray-200,
html[data-theme='dark'] .border-white\/40 {
  border-color: #2a3650 !important;
}

html[data-theme='dark'] .hover\:bg-slate-50:hover,
html[data-theme='dark'] .hover\:bg-slate-100:hover,
html[data-theme='dark'] .hover\:bg-gray-100:hover {
  background-color: #18233a !important;
}

html[data-theme='dark'] #filter-shell,
html[data-theme='dark'] #building-modal > div,
html[data-theme='dark'] #auth-modal .relative.rounded-xl,
html[data-theme='dark'] #search-modal > div,
html[data-theme='dark'] #admin-edits-modal .relative.rounded-xl,
html[data-theme='dark'] #modal-content .rounded-2xl,
html[data-theme='dark'] #modal-content details,
html[data-theme='dark'] #modal-content pre,
html[data-theme='dark'] #building-edit-form {
  background-color: #111a2d !important;
  border-color: #2a3650 !important;
  color: #e2e8f0 !important;
}

html[data-theme='dark'] #auth-modal,
html[data-theme='dark'] #admin-edits-modal {
  background: rgba(2, 6, 23, 0.65) !important;
}

html[data-theme='dark'] .maplibregl-ctrl-group {
  border-color: rgba(74, 85, 104, 0.45);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] .maplibregl-ctrl button {
  background: rgba(15, 23, 42, 0.92);
  color: #dbeafe;
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl-group {
  border-color: rgba(71, 85, 105, 0.7);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.62);
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl button {
  color: #cbd5e1;
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl button + button {
  border-top-color: rgba(71, 85, 105, 0.62);
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl button:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #f1f5f9;
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl button:active {
  background: rgba(51, 65, 85, 0.9);
}

html[data-theme='dark'] .maplibregl-ctrl-top-right .maplibregl-ctrl .maplibregl-ctrl-icon {
  filter: brightness(0) invert(1);
}

@media (max-width: 640px) {
  .maplibregl-ctrl-top-right .maplibregl-ctrl {
    margin-top: 82px;
  }
}

@media (min-width: 768px) {
  #navigation {
    z-index: 1100;
  }

  #mobile-controls-shell {
    z-index: 1110;
  }

  #building-modal > div {
    top: calc(var(--desktop-nav-clearance) + var(--desktop-surface-gap));
    bottom: 1rem;
  }

  #search-modal > div {
    top: calc(var(--desktop-nav-clearance) + var(--desktop-surface-gap));
    bottom: 1rem;
  }

  #filter-shell {
    top: calc(100% + var(--desktop-surface-gap));
  }
}
