:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #121416;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #168b45;
  --accent-dark: #0f6d35;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: relative;
  z-index: 1000;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 12px rgba(16, 24, 40, 0.05);
}

.brand {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#gpxInput {
  display: none;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--text);
  color: #fff;
}

.button-primary:hover {
  background: #30343a;
}

.button-secondary {
  background: #eef0f2;
  color: var(--text);
}

.button-secondary:hover {
  background: #e3e6e9;
}

.status {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.map-shell {
  position: relative;
  min-height: 0;
  flex: 1;
}

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

.map-consent {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(246, 247, 248, 0.94);
  text-align: center;
}

.map-consent p {
  max-width: 36ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.photo-popup {
  width: min(320px, 70vw);
}

.photo-popup__name {
  margin-bottom: 6px;
  font-weight: 750;
  word-break: break-word;
}

.photo-popup img {
  display: block;
  width: 100%;
  max-height: 360px;
  margin: 8px 0;
  border-radius: 8px;
  background: #eef0f2;
  object-fit: contain;
}

.photo-popup__meta {
  display: grid;
  gap: 3px;
  color: #667085;
  font-size: 12px;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

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

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 9px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .brand {
    flex: 1 1 100%;
  }

  .actions {
    flex: 1 1 auto;
  }

  .button {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 13px;
  }

  .status {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: left;
  }
}
