html, body {
  margin: 0;
  height: 100%;
  font: 14px/1.4 system-ui, -apple-system, sans-serif;
  background: #1f2a1f;
}

#map {
  position: absolute;
  inset: 0;
}

.hidden { display: none !important; }

#status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  max-width: calc(100% - 140px);
  text-align: center;
  z-index: 2;
}

#panel-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#panel {
  position: absolute;
  top: 62px;
  left: 10px;
  z-index: 3;
  width: min(300px, calc(100% - 52px));
  max-height: calc(100% - 120px);
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin: 10px 0 6px;
}
#panel h2:first-child { margin-top: 0; }
#panel h2 small { text-transform: none; letter-spacing: 0; font-weight: normal; }

#panel select, #panel input[type=text], #panel input[type=range] {
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  padding: 6px;
}

.key {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #555;
}

#legend label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}

.swatch {
  width: 28px;
  height: 0;
  border-top-width: 4px;
  border-top-style: solid;
  flex-shrink: 0;
}
.swatch.dashed { border-top-style: dashed; }

.hint {
  font-size: 12px;
  color: #777;
  margin: 8px 0 0;
}

.maplibregl-popup-content {
  font-size: 13px;
  padding: 10px 12px;
}
.maplibregl-popup-content table { border-collapse: collapse; }
.maplibregl-popup-content td { padding: 1px 6px 1px 0; vertical-align: top; }
.maplibregl-popup-content td:first-child { color: #777; }

.route-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.route-actions button {
  flex: 1;
  white-space: nowrap;
  border: none;
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 14px;
  background: #2563eb;
  color: #fff;
}
.route-actions button.secondary {
  background: #e5e7eb;
  color: #111;
}

#route-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 34px;
  max-width: 420px;
  margin: 0 auto;
  z-index: 2;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
}
#route-clear {
  border: none;
  background: none;
  font-size: 18px;
  padding: 2px 6px;
}
#route-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 6px;
  background: #eee;
}
#route-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: #444;
}
#route-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 4px;
}
.route-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
#route-profile {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 4px;
}
#route-go {
  border: none;
  border-radius: 6px;
  padding: 6px 22px;
  font-size: 16px;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
}

#nav-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 34px;
  max-width: 420px;
  margin: 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.nav-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.nav-info strong { font-size: 20px; }
.nav-info span { font-size: 13px; color: #555; }
#nav-bar button {
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  background: #e5e7eb;
  color: #111;
}
#nav-bar #nav-exit { background: #dc2626; color: #fff; }

/* Rider position: arrow pointing the way you're heading, plain dot until a heading is known. */
.user-loc {
  width: 36px;
  height: 36px;
}
.user-loc svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.user-loc path {
  fill: #2563eb;
  stroke: #fff;
  stroke-width: 3;
  stroke-linejoin: round;
}
.user-loc .dot {
  display: none;
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.user-loc.no-heading svg { display: none; }
.user-loc.no-heading .dot { display: block; }
