.telemetry-map-layout { position: relative; width: 100%; }
#telemetry-stops-handle { display: none; }

.schedule-page-title { display: block; }

/* The compact view selector belongs only to the mobile header. */
@media (max-width: 760px) {
  .route-page .route-intro { flex-direction: column; align-items: stretch; }
  .route-page .route-intro > div:first-child { display: flex; flex-direction: column; align-items: stretch; }
  .route-page .route-intro #route-intro-copy { order: 1; margin: 0 0 14px; }
  .route-page .route-intro .mobile-view-switcher { order: 0; display: grid; width: min(430px, 100%); margin: 8px 0 10px; }
  .schedule-page-title { display: none; }
}
#telemetry-latest-position { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; background: #eef3f0; color: #48685d; font-size: 13px; font-weight: 700; }
#telemetry-latest-position[hidden] { display: none !important; }
#telemetry-nearest-stop { margin: 8px 0; padding: 9px 12px; border-radius: 8px; background: #eef3f0; color: #48685d; font-size: 13px; font-weight: 700; }
#telemetry-nearest-stop[hidden] { display: none !important; }
#telemetry-stops-panel {
  position: absolute; z-index: 4; left: 12px; top: 16px; bottom: 108px;
  width: 224px; display: flex; flex-direction: column; box-sizing: border-box;
  color: #e8f0ee; background: rgba(17, 28, 26, .96); border: 1px solid #34443e;
  border-radius: 14px; box-shadow: 0 8px 28px #0005; overflow: hidden;
  font-family: inherit;
}
#telemetry-stops-panel[hidden], #telemetry-stops-panel [hidden] { display: none !important; }
#telemetry-stops-panel .telemetry-stops-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 16px 14px; border-bottom: 1px solid #34443e; flex: 0 0 auto;
}
#telemetry-stops-panel .telemetry-stops-eyebrow { font-size: 10px; letter-spacing: .14em; font-weight: 700; color: #a5bcad; }
#telemetry-stops-panel h3 { margin: 4px 0 0; padding: 0; font-size: 19px; line-height: 1.2; color: #f2f7f4; }
#telemetry-stops-count { padding: 4px 9px; border-radius: 20px; background: #2c3c30; color: #d5ee9c; font-size: 12px; font-weight: 700; }
#telemetry-stops-panel .telemetry-stops-list {
  margin: 0; padding: 8px; list-style: none; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #74917e #18251f;
}
#telemetry-stops-panel li { position: relative; margin: 0; padding: 0; }
#telemetry-stops-panel li:not(:last-child)::after { content: ''; position: absolute; left: 20px; top: 36px; bottom: -18px; width: 1px; background: #496044; pointer-events: none; }
#telemetry-stops-panel button {
  position: relative; width: 100%; min-height: 56px; display: grid; grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px; align-items: center; padding: 10px 7px; margin: 0; border: 1px solid transparent;
  border-radius: 9px; background: transparent; color: #e8f0ee; text-align: left;
  font: inherit; cursor: pointer; box-shadow: none; transform: none;
}
#telemetry-stops-panel button:hover { background: #24372c; }
#telemetry-stops-panel button.is-selected { background: #2b412c; border-color: #91b65f; }
#telemetry-stops-panel button:focus-visible, #telemetry-stops-panel ol:focus-visible { outline: 2px solid #c1e66b; outline-offset: -2px; }
#telemetry-stops-panel .telemetry-stop-number {
  position: relative; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px;
  border: 1px solid #78985e; border-radius: 50%; background: #1c3026; color: #d5ee9c;
  font-size: 11px; line-height: 1; font-weight: 700;
}
#telemetry-stops-panel .telemetry-stop-name { font-size: 12px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; }
#telemetry-stops-panel .telemetry-stops-empty { margin: 0; padding: 20px 16px; color: #b6c7be; font-size: 13px; line-height: 1.6; }
@media (max-width: 760px) {
  .schedule-page #telemetry-message { margin-bottom: 6px; }
  .schedule-page #telemetry-map-shell { margin-top: -6px; }
  #telemetry-latest-position { margin: 8px 0 0; }
  /* Keep the live map closer to the fixed mobile header. */
  .schedule-page #telemetry-panel { margin-top: -18px; }
  .schedule-page #telemetry-panel h2 { margin-top: 0; }
  #telemetry-map-shell { height: 620px !important; min-height: 620px !important; }
  #telemetry-map-shell { height: 620px !important; min-height: 620px !important; }
  #telemetry-map-shell { --telemetry-stops-width: min(320px, 84vw); }
  #telemetry-stops-panel { position: absolute; z-index: 6; left: 0; top: 0; bottom: 0; width: var(--telemetry-stops-width); max-height: none; margin: 0; box-shadow: 8px 0 24px #0003; transform: translateX(-100%); transition: transform .24s ease; }
  #telemetry-stops-panel.is-drawer-open { transform: translateX(0); }
  #telemetry-stops-handle { position: absolute; z-index: 7; left: 0; top: 37.5%; bottom: auto; transform: translateY(-50%); border: 0; border-radius: 0 12px 12px 0; padding: 16px 8px; background: #e0ebda; color: #244233; font: 700 12px/1 inherit; box-shadow: 0 2px 8px #0003; cursor: pointer; writing-mode: vertical-rl; text-orientation: mixed; transition: transform .24s ease; }
  #telemetry-map-shell.is-stops-drawer-open #telemetry-stops-handle { transform: translateX(var(--telemetry-stops-width)) translateY(-50%); }
  #telemetry-stops-handle { display: block; }
  #telemetry-map-shell .telemetry-map-tools { top: 12px; right: 12px; left: auto; width: auto; bottom: auto; }
  #telemetry-map-shell #telemetry-locate { width: auto; min-width: 0; padding: 9px 12px; border-radius: 9px; font-size: 12px; line-height: 1.1; }
  #telemetry-stops-panel .telemetry-stops-header { padding: 14px 16px; }
  #telemetry-stops-panel button { min-height: 54px; }
  #telemetry-stops-panel .telemetry-stop-name { font-size: 13px; }
}

/* Mobile: taller, light stop list; desktop retains its dark sidebar. */
@media (max-width: 760px) {
  #telemetry-stops-panel { color: #e8f0ee; background: rgba(17, 28, 26, .98); border-color: #34443e; }
  #telemetry-stops-panel .telemetry-stops-header { border-bottom-color: #34443e; }
  #telemetry-stops-panel .telemetry-stops-eyebrow { color: #a5bcad; }
  #telemetry-stops-panel h3 { color: #f2f7f4; }
  #telemetry-stops-count { background: #2c3c30; color: #d5ee9c; }
  #telemetry-stops-panel .telemetry-stops-list { scrollbar-color: #74917e #18251f; }
  #telemetry-stops-panel li:not(:last-child)::after { background: #496044; }
  #telemetry-stops-panel button { color: #e8f0ee; }
  #telemetry-stops-panel button:hover { background: #24372c; }
  #telemetry-stops-panel button.is-selected { background: #2b412c; border-color: #91b65f; }
  #telemetry-stops-panel .telemetry-stop-number { background: #1c3026; color: #d5ee9c; border-color: #78985e; }
  #telemetry-stops-panel .telemetry-stops-empty { color: #b6c7be; }
}

/* Credits have their own row beneath the canvas, before the mobile stop list. */
#telemetry-map-credits {
  box-sizing: border-box; min-height: 28px; width: 100%; display: flex;
  align-items: center; justify-content: flex-end; padding: 6px 10px;
  background: #252a33; color: #c5cdd7; border-top: 1px solid #3b4350;
}
#telemetry-map-credits[hidden] { display: none !important; }
#telemetry-map-credits .maplibregl-ctrl-attrib {
  margin: 0; padding: 0; float: none; max-width: 100%; background: transparent;
  color: #c5cdd7; font-size: 10px; line-height: 16px; text-align: right;
}
#telemetry-map-credits .maplibregl-ctrl-attrib a { color: #d2dae4; }
@media (max-width: 760px) {
  #telemetry-map-credits { justify-content: flex-start; padding: 7px 9px; }
  #telemetry-map-credits .maplibregl-ctrl-attrib { text-align: left; font-size: 10px; }
}
#telemetry-map .maplibregl-marker.telemetry-vehicle-marker { display: block !important; visibility: visible !important; opacity: 1 !important; z-index: 20; pointer-events: none; }
