:root {
  color-scheme: dark;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.leaflet-container {
  background: transparent !important;
}

#imageMapContainer.leaflet-container,
#map.leaflet-container,
#imageMapContainer.leaflet-grab,
#imageMapContainer .leaflet-grab,
#map.leaflet-grab,
#imageMapContainer .leaflet-interactive,
#map .leaflet-interactive,
#imageMapContainer .leaflet-marker-icon,
#map .leaflet-marker-icon {
  cursor: crosshair !important;
}

#imageMapContainer.leaflet-dragging,
#map.leaflet-dragging,
#imageMapContainer.leaflet-container:active,
#map.leaflet-container:active,
.leaflet-dragging #imageMapContainer.leaflet-container,
.leaflet-dragging #map.leaflet-container,
#imageMapContainer.leaflet-dragging.leaflet-grab,
#map.leaflet-dragging.leaflet-grab,
.leaflet-dragging #imageMapContainer.leaflet-grab,
.leaflet-dragging #imageMapContainer .leaflet-grab,
.leaflet-dragging #map.leaflet-grab,
.leaflet-dragging #imageMapContainer .leaflet-interactive,
.leaflet-dragging #map .leaflet-interactive,
.leaflet-dragging #imageMapContainer .leaflet-marker-icon,
.leaflet-dragging #map .leaflet-marker-icon {
  cursor: grabbing !important;
}

.image-map-bg {
  background: #0a0f0a;
}

.leaflet-control-attribution.hide-attr {
  display: none;
}

.leaflet-tile {
  filter: brightness(0.8) contrast(1.1) saturate(0.9);
}

.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

button,
.touch-target,
select,
input {
  min-height: 44px;
}

input,
select {
  font-size: 16px;
}

.leaflet-touch .leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
}

.custom-gps-icon {
  background: none;
  border: none;
}

.gps-dot {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
}

.typed-cp-icon {
  background: transparent;
  border: 0;
}

.typed-cp {
  --cp-bg: #10b981;
  --cp-fg: #06110d;
  --cp-border: #ffffff;
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--cp-fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  background: var(--cp-bg);
  border: 3px solid var(--cp-border);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.42);
}

.typed-cp > span {
  position: relative;
  z-index: 2;
}

.typed-cp--image {
  width: 36px;
  height: 36px;
}

.typed-cp--nav {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.typed-cp--circle {
  border-radius: 999px;
}

.typed-cp--triangle {
  clip-path: polygon(50% 4%, 96% 92%, 4% 92%);
  padding-top: 7px;
}

.typed-cp--square {
  border-radius: 4px;
}

.typed-cp--pentagon {
  clip-path: polygon(50% 2%, 98% 38%, 80% 96%, 20% 96%, 2% 38%);
  padding-top: 2px;
}

.typed-cp--finish {
  --cp-bg: #ef4444;
  color: #ffffff;
  border-radius: 3px 12px 12px 3px;
}

.typed-cp--finish::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.typed-cp--pending {
  --cp-bg: #f59e0b;
}

.typed-cp--current {
  --cp-bg: #10b981;
  width: 46px;
  height: 46px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.28), 0 6px 18px rgba(0, 0, 0, 0.5);
}

.typed-cp--claimed {
  --cp-bg: #3f3f46;
  --cp-fg: #d4d4d8;
  --cp-border: #52525b;
  opacity: 0.72;
}

.typed-cp--skipped {
  --cp-bg: #7f1d1d;
  --cp-fg: #fecaca;
  --cp-border: #f87171;
}

.point-type-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(39, 39, 42, 0.82);
  color: #d4d4d8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.point-type-btn-active {
  border-color: rgba(16, 185, 129, 0.7);
  background: rgba(6, 78, 59, 0.88);
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.16);
}

.point-type-preview {
  width: 24px;
  height: 24px;
  border-width: 2px;
  font-size: 9px;
  box-shadow: none;
}

.points-table {
  min-width: 680px;
}

.points-table th {
  padding: 8px 10px;
  color: #71717a;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.points-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.point-type-select,
.point-name-input {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.38);
  color: #f4f4f5;
  padding: 0 10px;
  outline: none;
}

.point-name-input {
  min-width: 180px;
  font-weight: 600;
}

.point-row-btn {
  min-height: 44px;
  min-width: 64px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 24, 27, 0.92);
  font-size: 12px;
  font-weight: 700;
}

.point-row-btn-danger {
  color: #fca5a5;
}

.point-row-btn-danger:hover {
  background: rgba(127, 29, 29, 0.7);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0f0a;
}

::-webkit-scrollbar-thumb {
  background: #1f3924;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2a4d31;
}

#navClock {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  letter-spacing: -0.5px;
}

.nav-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(5, 8, 7, 0.78);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.nav-label {
  font-size: 10px;
  line-height: 1;
  color: #a1a1aa;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.nav-target-name {
  margin-top: 6px;
  color: #38bdf8;
  font-size: clamp(26px, 8vw, 48px);
  line-height: 1;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.nav-exit-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(127, 29, 29, 0.65);
  background: rgba(69, 10, 10, 0.82);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 700;
}

.nav-primary-stat {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-distance {
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(44px, 15vw, 88px);
  line-height: 0.95;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.nav-secondary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.nav-secondary-stats > div {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-stat-value {
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(17px, 4.6vw, 24px);
  line-height: 1;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.nav-recenter-btn {
  position: absolute;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 20;
  min-width: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 7, 0.86);
  color: #38bdf8;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-recenter-btn.hidden,
.nav-action-modal.hidden {
  display: none !important;
}

.nav-action-modal {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav-action-panel {
  max-width: 430px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(14, 165, 233, 0.32);
  background: rgba(0, 0, 0, 0.9);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-action-primary,
.nav-action-secondary {
  min-height: 58px;
  border-radius: 14px;
  font-weight: 800;
}

.nav-action-primary {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.34);
}

.nav-action-secondary {
  background: #27272a;
  color: #d4d4d8;
}

@media (min-width: 768px) {
  .nav-hud {
    top: 24px;
    left: 50%;
    right: auto;
    width: min(620px, calc(100vw - 48px));
    transform: translateX(-50%);
  }
}

@media (pointer: coarse), (max-width: 1023px) {
  #step1ImageWrapper,
  #mapWrapper {
    min-height: min(62vh, 560px);
  }

  #map {
    height: min(62vh, 560px) !important;
  }

  #step2 > .relative {
    height: 68vh;
    min-height: 430px;
  }
}
