:root {
  --bar-bg: rgba(255, 255, 255, 0.92);
  --bar-border: rgba(0, 0, 0, 0.1);
  --text: #1b1f24;
  --muted: #5a646f;
  --button-bg: #ffffff;
  --button-border: #cfd7df;
  --button-hover: #f1f5f8;
  --top-bar-offset: 52px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--text);
}

body {
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

.leaflet-top {
  top: var(--top-bar-offset);
}

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-border);
  backdrop-filter: blur(8px);
}

.left-controls {
  display: flex;
  gap: 0.5rem;
}

#share-btn {
  font-weight: 600;
}

.profile-toggle {
  display: flex;
  gap: 0.3rem;
  padding: 0.2rem;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.profile-btn {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.85rem;
}

.profile-btn.is-active {
  border-color: #9fb9cd;
  background: #e9f3fb;
}

.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

button {
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--button-hover);
}

button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.75;
}

.distance-display {
  font-size: 0.95rem;
  white-space: nowrap;
}

#status {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 7rem;
  text-align: right;
}

@media (max-width: 640px) {
  :root {
    --top-bar-offset: 48px;
  }

  .top-bar {
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .distance-display {
    font-size: 0.88rem;
  }

  button {
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
  }

  .profile-toggle {
    gap: 0.2rem;
    padding: 0.15rem;
  }

  .profile-btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.8rem;
  }

  .icon-btn {
    width: 1.95rem;
    height: 1.95rem;
  }

  #status {
    min-width: 0;
    font-size: 0.8rem;
  }
}
