* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, system-ui, sans-serif; background: #0f1117; color: #e4e6f0; overflow: hidden; }
#map { width: 100%; height: 100vh; }
.panel {
  position: absolute; top: 16px; left: 16px; z-index: 1000;
  background: rgba(15,17,23,0.92); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 14px;
  padding: 20px; width: 310px; max-height: calc(100vh - 32px);
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2a2d3a transparent;
}
.panel h1 { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.panel .sub { font-size: 0.78rem; color: #8b8fa3; margin-bottom: 14px; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #4ecdc4; margin-right: 6px; vertical-align: middle;
  animation: pulse 1.5s ease-in-out infinite;
}
.live-dot.err { background: #ff6b6b; animation: none; }
.live-dot.load { background: #ffe66d; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.stat-row { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { flex: 1; background: rgba(255,255,255,0.04); border-radius: 8px; padding: 10px; text-align: center; }
.stat .num { font-size: 1.3rem; font-weight: 700; }
.stat .lbl { font-size: 0.65rem; color: #8b8fa3; text-transform: uppercase; letter-spacing: 0.05em; }
.fsec { margin-bottom: 10px; }
.fsec label { font-size: 0.7rem; color: #8b8fa3; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 4px; }
.fsec select, .fsec input {
  width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: #e4e6f0; padding: 7px 10px; border-radius: 6px; font-size: 0.82rem; outline: none;
}
.fsec select:focus, .fsec input:focus { border-color: rgba(108,140,255,0.4); }
.stoggle { display: flex; gap: 5px; margin-bottom: 14px; }
.sbtn {
  flex: 1; padding: 5px 0; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); color: #8b8fa3; font-size: 0.72rem;
  cursor: pointer; text-align: center; transition: all 0.15s; user-select: none;
}
.sbtn.on { background: rgba(108,140,255,0.15); color: #6c8cff; border-color: rgba(108,140,255,0.3); }
.sbtn:hover { background: rgba(255,255,255,0.06); }
.legend { margin-top: 10px; }
.ltitle { font-size: 0.7rem; color: #8b8fa3; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.litem { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 0.78rem; cursor: pointer; }
.litem:hover { color: #fff; }
.ldot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lcnt { margin-left: auto; color: #8b8fa3; font-size: 0.72rem; }
.ibar { font-size: 0.75rem; color: #8b8fa3; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.cdbar { height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.cdfill { height: 100%; background: #6c8cff; border-radius: 2px; width: 100%; transition: width 0.3s linear; }
.leaflet-popup-content-wrapper {
  background: rgba(15,17,23,0.95); color: #e4e6f0; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.leaflet-popup-tip { background: rgba(15,17,23,0.95); }
.leaflet-popup-content { margin: 12px 14px; font-size: 0.82rem; line-height: 1.5; }
.pr { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.prow { display: flex; justify-content: space-between; padding: 1px 0; }
.plbl { color: #8b8fa3; }
.pbadge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 600; }
.pbadge.stp { background: rgba(255,230,109,0.15); color: #ffe66d; }
.pbadge.mov { background: rgba(78,205,196,0.15); color: #4ecdc4; }
.v-marker { filter: drop-shadow(0 0 4px rgba(0,0,0,0.5)); }

/* Route picker */
.route-dd {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 10;
  background: rgba(20,22,30,0.97); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0 0 6px 6px; max-height: 200px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #2a2d3a transparent;
}
.route-dd.open { display: block; }
.route-dd-item {
  padding: 6px 10px; font-size: 0.8rem; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background 0.1s;
}
.route-dd-item:hover { background: rgba(108,140,255,0.12); }
.route-dd-item .dd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.route-dd-item .dd-cnt { margin-left: auto; color: #8b8fa3; font-size: 0.7rem; }

.active-routes { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.route-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px; border-radius: 14px; font-size: 0.72rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s; border: 1px solid rgba(255,255,255,0.15);
}
.route-chip:hover { opacity: 0.7; }
.route-chip .chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.route-chip .chip-x { font-size: 0.8rem; margin-left: 2px; opacity: 0.6; }

/* Override MarkerCluster defaults */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: none !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: none !important; }

/* Stop markers */
.stop-marker {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.5); border: 1.5px solid rgba(255,255,255,0.8);
  transition: transform 0.15s;
}
.stop-marker:hover { transform: scale(1.6); }
.stop-marker.ada { background: rgba(78,205,196,0.7); border-color: #4ecdc4; }
.stop-marker.no-ada { background: rgba(255,107,107,0.6); border-color: #ff6b6b; }

/* Stop cluster */
.stop-cluster {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.65rem; font-weight: 700; color: #fff;
  background: rgba(108,140,255,0.7); border: 2px solid rgba(108,140,255,0.9);
  box-shadow: 0 0 8px rgba(108,140,255,0.4);
}

/* Stop popup */
.stop-popup { min-width: 240px; max-width: 300px; }
.stop-popup .stop-name { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.stop-popup .stop-desc { font-size: 0.75rem; color: #8b8fa3; margin-bottom: 8px; }
.stop-popup .stop-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.stop-popup .stop-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 8px; font-size: 0.65rem; font-weight: 600;
}
.stop-badge.ada-yes { background: rgba(78,205,196,0.15); color: #4ecdc4; }
.stop-badge.ada-no { background: rgba(255,107,107,0.15); color: #ff6b6b; }
.stop-badge.parkride { background: rgba(108,140,255,0.15); color: #6c8cff; }

/* Walking distance */
.walk-info {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px; margin-bottom: 10px;
  background: rgba(255,255,255,0.04); font-size: 0.75rem;
}
.walk-info .walk-icon { font-size: 1rem; }
.walk-info .walk-dist { font-weight: 600; color: #e4e6f0; }
.walk-info .walk-time { color: #8b8fa3; }

/* Departures */
.dep-section { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 8px; }
.dep-title { font-size: 0.68rem; color: #8b8fa3; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.dep-loading { font-size: 0.75rem; color: #8b8fa3; padding: 8px 0; }
.dep-none { font-size: 0.75rem; color: #8b8fa3; font-style: italic; padding: 4px 0; }
.dep-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.78rem;
}
.dep-row:last-child { border-bottom: none; }
.dep-route-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; padding: 2px 6px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 700; text-align: center;
}
.dep-dest { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ccc; }
.dep-time { font-weight: 600; white-space: nowrap; }
.dep-time.actual { color: #4ecdc4; }
.dep-time.scheduled { color: #ffe66d; }
.dep-dir { font-size: 0.65rem; color: #8b8fa3; }

/* Notify button */
.notify-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #8b8fa3; font-size: 0.68rem;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.notify-btn:hover { background: rgba(108,140,255,0.15); color: #6c8cff; border-color: rgba(108,140,255,0.3); }
.notify-btn.active { background: rgba(78,205,196,0.15); color: #4ecdc4; border-color: rgba(78,205,196,0.3); }

/* Alerts */
.stop-alert {
  padding: 6px 8px; border-radius: 6px; margin-bottom: 8px;
  background: rgba(255,107,107,0.1); border-left: 3px solid #ff6b6b;
  font-size: 0.72rem; color: #ff6b6b; line-height: 1.4;
}

/* Locate me button */
.locate-btn {
  position: absolute; bottom: 100px; right: 16px; z-index: 1000;
  width: 40px; height: 40px; border-radius: 8px;
  background: rgba(15,17,23,0.92); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #8b8fa3; font-size: 1.2rem;
  transition: all 0.15s;
}
.locate-btn:hover { color: #6c8cff; border-color: rgba(108,140,255,0.3); }
.locate-btn.tracking { color: #4ecdc4; border-color: rgba(78,205,196,0.3); }

/* Toggle stops button */
.toggle-stops {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); color: #8b8fa3; font-size: 0.75rem;
  cursor: pointer; transition: all 0.15s; margin-bottom: 10px; width: 100%;
}
.toggle-stops:hover { background: rgba(255,255,255,0.06); }
.toggle-stops.on { background: rgba(78,205,196,0.1); color: #4ecdc4; border-color: rgba(78,205,196,0.2); }
.toggle-stops .toggle-icon { font-size: 0.9rem; }
