/* Applied before the JS bundle; prevents white flash and font swap on first paint */
html {
  background-color: #121212;
  color-scheme: dark;
  /* Match Fomantic early so the skeleton doesn't jump when the bundle CSS lands */
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  background-color: #121212;
  color: #f0f0f0;
  font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  --app-top-bar-height: 30px;
}

/* Skeleton topbar: paints immediately, swapped out when TopBar mounts */
.app-top-bar-skeleton {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  height: var(--app-top-bar-height);
  min-height: var(--app-top-bar-height);
  max-height: var(--app-top-bar-height);
  overflow: hidden;
  z-index: 10050;
  display: flex;
  align-items: stretch;
  pointer-events: none;
  background: linear-gradient(180deg, #1c1c1e 0%, #141416 100%);
  border-bottom: 1px solid #2a2a2a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  /* Pin typography so Fomantic body (Lato + emoji stack, 1.4285em lh) can't inflate flex min-size */
  font-family: 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

.app-top-bar-skeleton-brand {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #e0e0e0;
  opacity: 0.92;
  border-right: 1px solid #2a2a2a;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-top-bar-skeleton-menus {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
}

.app-top-bar-skeleton-search {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px 0 12px;
  max-width: min(320px, 42vw);
  min-height: 0;
}

.app-top-bar-skeleton-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  flex-shrink: 0;
  min-height: 0;
}

.app-top-bar-skel-bone {
  display: block;
  height: 12px;
  flex-shrink: 0;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    #2a2a2a 0%,
    #3a3a3a 40%,
    #2a2a2a 80%
  );
  background-size: 200% 100%;
  animation: app-top-bar-skel-shimmer 1.4s ease-in-out infinite;
}

.app-top-bar-skel-search {
  width: min(220px, 36vw);
  height: 18px;
  border-radius: 4px;
}

.app-top-bar-skel-icon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

@keyframes app-top-bar-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (max-width: 768px) {
  .app-top-bar-skeleton {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    height: var(--app-top-bar-height);
    min-height: var(--app-top-bar-height);
    max-height: var(--app-top-bar-height);
  }

  .app-top-bar-skeleton-brand {
    border-right: none;
  }

  .app-top-bar-skeleton-menus {
    display: none;
  }

  .app-top-bar-skeleton-search {
    margin-left: 0;
    max-width: none;
    width: 100%;
    padding: 0 6px;
    justify-content: center;
  }

  .app-top-bar-skel-search {
    width: 100%;
  }

  .app-top-bar-skeleton-hamburger {
    display: flex;
  }
}

.map-loading-overlay {
  position: fixed;
  top: var(--app-top-bar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.map-loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.map-loading-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

/* Ring rotates inside a fixed box so size does not pulse during animation */
.map-loading-spinner::before {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 8px solid #2a2a2a;
  border-top-color: #8a8a8a;
  border-radius: 50%;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.45);
  animation: horizon-spin 1s linear infinite;
  will-change: transform;
}

@keyframes horizon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
