html, body { height:100%; margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background:#0b1320; color:#fff; touch-action: pan-y; }
.wrap { display:flex; flex-direction:column; height:100%; }
header { display:flex; align-items:center; gap:16px; padding:14px 18px; background:linear-gradient(135deg, #0b1320 0%, #1a2332 100%); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
header img.logo { height:44px; width:auto; display:block; }
header h1 { margin:0; font-size:22px; font-weight:600; letter-spacing:.3px; }
header .sub { opacity:.95; font-size:14px; margin:0 }
.title { display:flex; flex-direction:column; }
#map { flex: 1 1 auto; min-height: 420px; }
.legend { position:absolute; z-index:2; right:12px; top:76px; background:rgba(28,36,54,0.97); border:1px solid rgba(255,255,255,0.14); border-radius:12px; padding:12px 14px 14px 12px; font-size:13px; backdrop-filter: blur(8px); transition: transform 220ms ease, opacity 220ms ease; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.legend h3 { margin:0 0 6px 0; font-size:12px; font-weight:600; letter-spacing:.2px; text-transform:uppercase; opacity:.85 }
.legend.hidden { transform: translateX(120%); opacity:0; pointer-events:none; }
.legend .toggle { position:absolute; right:8px; bottom:8px; background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.06); color:#fff; width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius:8px; cursor:pointer; font-size:14px; z-index:3; }
.legend .toggle svg { transition: transform 180ms ease; transform-origin: 50% 50%; }
.legend-show-handle { position:fixed; display:none; z-index:1003; right:8px; width:36px; height:36px; border-radius:8px; background: rgba(20,30,46,0.95); border:1px solid rgba(255,255,255,0.08); color:#fff; align-items:center; justify-content:center; cursor:pointer; box-shadow: 0 8px 22px rgba(0,0,0,0.5); backdrop-filter: blur(8px); }
.legend-show-handle svg { transition: transform 180ms ease; transform-origin: 50% 50%; }
.flipped { transform: rotate(180deg); }
.row { display:flex; align-items:center; gap:8px; margin:4px 0; }
.legend-row { cursor: pointer; }
.legend-icon { width:20px; height:20px; display:inline-block; vertical-align:middle; }
.legend-icon img { width:100%; height:100%; display:block; }
.dot { display:none; }
#map { touch-action: none; }
.status { font-variant-numeric: tabular-nums; opacity:.95 }
.overlay { position: fixed; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; background: rgba(9,14,26,.9); backdrop-filter: blur(6px); text-align: center; padding: 24px; }
.overlay .card { max-width: 720px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 20px 22px; background: linear-gradient(180deg, rgba(22,34,62,.9), rgba(12,18,30,.9)); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.overlay h2 { margin: 0 0 8px 0; font-size: 18px; letter-spacing:.3px; }
.overlay p { margin: 0; opacity:.92; line-height: 1.45; }
.overlay .hours { margin-top: 10px; font-size: 13px; opacity:.8 }
.banner { display:none; position:absolute; left:50%; transform:translateX(-50%); top:70px; z-index:3; background:#2b3a55; border:1px solid rgba(255,255,255,.12); color:#fff; padding:10px 14px; border-radius:10px; font-size:14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width:92vw; }
.banner strong { font-weight:600; }

/* Schedule panel (left) */
.schedule {
  position: absolute;
  z-index: 1002;
  left: 8px;
  top: 76px;
  background: rgba(34,44,64,0.98);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  width: min(420px, 86vw);
  max-height: calc(100vh - 92px);
  overflow: auto;
  transform: translateX(calc(-100% - 12px));
  transition: transform 220ms ease, opacity 220ms ease;
  opacity: .98;
}
.schedule.open { transform: translateX(0); }
.schedule .inner { padding: 12px 14px 16px 14px; font-size: 14px; }
.schedule .hdr { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.schedule .hdr h3 { margin:0; font-size:12px; font-weight:600; letter-spacing:.2px; text-transform:uppercase; opacity:.85; }
.schedule .btn { border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.05); color:#fff; border-radius:8px; padding:6px 10px; font-size:12px; cursor:pointer; }
.schedule .btn:hover { background: rgba(255,255,255,.08); }
.stop-selector-container { margin: 8px 0 12px 0; }
.stop-selector { 
  width: 100%; 
  background: rgba(255,255,255,.08); 
  border: 1px solid rgba(255,255,255,.15); 
  border-radius: 8px; 
  color: #fff; 
  padding: 8px 10px; 
  font-size: 13px; 
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 32px;
}
.stop-selector:focus { 
  outline: none; 
  border-color: rgba(255,255,255,.3); 
  background: rgba(255,255,255,.12); 
}
.stop-selector option { 
  background: #1a2332; 
  color: #fff; 
}
.schedule .tab {
  position:absolute; right:-36px; top:12px; width:28px;
  border-radius:8px; background:rgba(10,16,28,.95);
  border:1px solid rgba(255,255,255,.1); color:#fff;
  display:inline-flex; align-items:center; justify-content:center;
  padding:6px 4px; box-shadow:0 8px 20px rgba(0,0,0,.35);
  cursor:pointer; user-select:none;
}
.schedule .tab .vlabel { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing:.6px; font-size:12px; font-weight:600; opacity:.9; }

@media (max-width: 520px) {
  header { gap:10px; padding:8px 10px; }
  header img.logo { height:28px; }
  header h1 { font-size:16px; }
  header .sub { font-size:12px; }
  .legend { left:8px; right:8px; top:70px; padding:10px; font-size:13px; border-radius:10px; }
  .legend.hidden { transform: translateX(120%); }
  .legend .toggle { right:12px; bottom:12px; }
  .schedule { left:6px; top:70px; width: min(92vw, 440px); max-height: calc(100vh - 86px); }
  .schedule .tab { right:-32px; top:10px; }
  .schedule .inner { font-size: 13px; }
  .stop-selector { font-size: 12px; }
  .schedule-badge { font-size: 12px; }
  .schedule-section-header { font-size: 12px; }
}

/* Schedule badge styles */
.schedule-badge {
  display:inline-flex; align-items:center; gap:6px; padding:6px 8px; border:1px solid rgba(255,255,255,.12); border-radius:8px; background: rgba(255,255,255,.04);
}
.schedule-badge .time { font-variant-numeric: tabular-nums; }
.schedule-badge .when { font-size:11px; opacity:.75; margin-left:6px; }
.schedule-badge.end-service { background: rgba(255,40,40,0.12); border-color: rgba(255,80,80,0.18); }
.schedule-badge.end-service .time { color: #ffdede; }
.schedule-badge .end-label { margin-left:8px; font-size:11px; color:#ffbdbd; font-weight:600; }
.sr-only { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Legend stop tweaks moved from inline */
.legend-stop-row { margin-top: 6px; }
.legend-stop-icon { width:24px; height:24px; border-radius:4px; display:inline-block; }
.legend-stop-text { font-size:13px; }
.legend-stop-text .muted { opacity: .9; }

.legend-schedule-row { margin-top: 6px; }
.legend-schedule-icon { 
  width: 24px; 
  height: 24px; 
  color: rgba(255, 255, 255, 0.9); 
  flex-shrink: 0; 
  border-radius: 4px; 
  display: inline-block; 
}
.legend-schedule-text { font-size: 13px; }
.legend-schedule-text .schedule-link { 
  color: rgba(255, 255, 255, 0.95); 
  text-decoration: none; 
  font-weight: 600;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.legend-schedule-text .schedule-link:hover { 
  color: #ffffff; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}
.legend-schedule-text .muted { opacity: .9; }

/* Popup HTML classes */
.popup-wrapper { min-width:240px; padding:8px 10px; color:#111; line-height:1.35; }
.popup-entry { margin:0 0 8px 0; }
.popup-entry .entry-title { font-weight:700; margin:0 0 4px 0; }
.popup-entry .entry-sub { font-size:12px; opacity:.85; margin:0 0 2px 0; }
.popup-entry .entry-times { font-size:12px; margin:0; }
.no-posted-times { color:#555; }

/* Generic entry title used in schedule and popups */
.entry-title { font-weight:700; margin-bottom:6px; }

/* Schedule list entries */
.schedule-entry { margin:14px 0 6px 0; }
.schedule-entry.first { margin:4px 0 6px 0; }
.schedule-badges { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.schedule-section-header { 
  font-weight: 600; 
  font-size: 13px; 
  margin: 20px 0 10px 0; 
  padding-bottom: 4px; 
  border-bottom: 1px solid rgba(255,255,255,0.15); 
  color: #fff; 
  opacity: 0.9; 
}
.transfer-entry { margin-top: 8px; }

/* Utility & small components */
.muted { opacity: .85; }
.service-note { font-size:12px; opacity:.85; }
.selected-stop-label { margin-bottom:8px; opacity:.9; }
.selected-stop-title { font-weight:700; margin-bottom:8px; }
.no-posted-times { color:#555; }

/* Vehicle marker (DIV-based) */
.vehicle-marker {
  width: 96px;
  height: 72px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  /* position absolutely within the overlay pane and anchor bottom-center */
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(-50%, -100%, 0);
  pointer-events: auto;
  will-change: transform;
}
