* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #1a1a2e;
}

/* ===== MAP ===== */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ===== STATUS BAR ===== */
#statusBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 48px 16px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  color: white;
}

#connectionStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status.connected .dot { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.status.disconnected .dot { background: #f87171; }
.status.connecting .dot {
  background: #facc15;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#speedDisplay {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

#gpsInfo {
  display: flex;
  align-items: center;
  gap: 8px;
}

#locateBtn {
  padding: 8px 10px;
  background: rgba(255,255,255,0.92);
  color: #1a1a2e;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ===== INSTRUCTION PANEL ===== */
#instructionPanel {
  position: fixed;
  top: 100px;
  left: 16px;
  right: 16px;
  z-index: 100;
  background: white;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

#instructionIcon {
  font-size: 32px;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

#instructionText {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  flex: 1;
}

#distanceText {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* ===== BOTTOM PANEL ===== */
#bottomPanel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px 34px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#gpsMessage {
  padding: 10px 12px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
}

/* Search */
#searchBox {
  display: flex;
  gap: 8px;
}

#destinationInput {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  color: #1a1a2e;
  background: #f9fafb;
}

#destinationInput:focus {
  border-color: #6366f1;
  background: white;
}

#searchBtn {
  padding: 12px 20px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#pickMapBtn {
  padding: 12px 14px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#pickMapBtn.active {
  background: #f59e0b;
  color: white;
}

#map.picking-destination {
  cursor: crosshair;
}

/* Route info */
#routeInfo {
  display: flex;
  align-items: center;
  gap: 8px;
}

#routeSummary {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#totalDistance {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

#totalTime {
  font-size: 13px;
  color: #6b7280;
}

#startBtn {
  padding: 12px 20px;
  background: #4ade80;
  color: #14532d;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

#cancelBtn {
  padding: 12px 16px;
  background: #f3f4f6;
  color: #6b7280;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}

/* Connect box */
#connectBox {
  display: flex;
  gap: 8px;
}

#espIP {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  color: #6b7280;
  font-family: 'Courier New', monospace;
}

#connectBtn {
  padding: 10px 16px;
  background: #1a1a2e;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

/* Custom marker */
.current-location-marker {
  width: 20px;
  height: 20px;
  background: #6366f1;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.dest-marker {
  width: 16px;
  height: 16px;
  background: #ef4444;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
