/* The sheet keeps its height while the map picker is open. */
body.center-picking #panel,
body.center-picking .tools,
body.center-picking .map-status {
  visibility: hidden;
  pointer-events: none;
}

body.center-picking #map {
  cursor: grab;
}
body.center-picking #map.leaflet-drag-target {
  cursor: grabbing;
}

body.center-picking #prompt {
  top: max(63px, calc(env(safe-area-inset-top) + 58px));
  left: 14px;
  width: auto;
  max-width: none;
  transform: none;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.center-picking #prompt-text {
  display: none;
}
body.center-picking #cancel {
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid #ffffffbd;
  border-radius: 999px;
  background: #f8fafcf2;
  box-shadow: 0 2px 12px #15223326;
}

#map-pick-marker {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 48px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  filter: drop-shadow(0 3px 3px #1020304d);
}
#map-pick-marker svg {
  display: block;
  width: 36px;
  height: 48px;
  fill: #252b35;
  stroke: #fff;
  stroke-width: 2;
}
#map-pick-marker circle {
  fill: #fff;
  stroke: none;
}
#map-pick-marker span {
  position: absolute;
  left: 14px;
  bottom: -3px;
  width: 8px;
  height: 3px;
  border-radius: 50%;
  background: #1020304d;
}

#map-pick-controls {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px));
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 22px;
  text-align: center;
}
#map-pick-controls p:first-child {
  font-size: 13px;
  font-weight: 620;
}
#map-pick-coordinates {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
#confirm-map-pick {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border-radius: 14px;
  color: #fff;
  background: #252b35;
  font-weight: 650;
}

/* Keep only the title and close control over the scrolling credits. */
#credits-dialog .list-title {
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#credits-dialog [data-close] {
  background: transparent;
  box-shadow: none;
}

/* Journey guidance stays above the map and leaves the route visible. */
#journey-guide {
  position: absolute;
  z-index: 9;
  top: max(76px, calc(env(safe-area-inset-top) + 72px));
  left: calc(50% + 195px);
  transform: translateX(-50%);
  width: min(380px, calc(100vw - 460px));
  padding: 10px 14px 14px;
  border-radius: 22px;
}
.journey-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}
.journey-guide-header .text {
  min-height: 34px;
  padding: 4px;
  font-size: 12px;
}
.journey-guide-instruction {
  display: flex;
  align-items: center;
  gap: 12px;
}
.journey-guide-icon {
  flex: none;
  width: 40px;
  color: #242b35;
  text-align: center;
  font-size: 38px;
  font-weight: 650;
  line-height: 1.2;
}
.journey-guide-icon svg {
  display: block;
  width: 40px;
  height: 40px;
  stroke-width: 2.8;
}
.journey-guide-title {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.journey-guide-distance {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.journey-guide-detail {
  margin-top: 3px;
  font-size: 11px;
}
.journey-guide-next {
  width: 100%;
  min-height: 39px;
  margin-top: 12px;
  border-radius: 12px;
  color: #fff;
  background: #252b35;
  font-weight: 630;
  font-size: 13px;
}
body.center-picking #journey-guide {
  visibility: hidden;
}
@media (max-width: 720px) {
  #journey-guide {
    top: max(60px, calc(env(safe-area-inset-top) + 56px));
    left: 50%;
    width: min(380px, calc(100vw - 24px));
  }
  body.journey-active .layer-box {
    pointer-events: none;
  }
}

/* Map revision 7.2.0 */
:root { --ink:#000; --blue:#000; --muted:#555a61; font-family:"SF Pro Text","SF Pro Display",-apple-system,BlinkMacSystemFont,system-ui,sans-serif; }
body,button,input,select,textarea,dialog { font-family:"SF Pro Text","SF Pro Display",-apple-system,BlinkMacSystemFont,system-ui,sans-serif; }
#expand-sheet { display:none !important; }
.trip-actions { display:flex; gap:8px; align-items:center; flex-wrap:nowrap; }
.trip-actions .text { font-size:12px; white-space:nowrap; }
#trip-delete { color:#ac2639; }
#credits-dialog[open] { display:flex; flex-direction:column; overflow:hidden; max-height:min(85dvh,700px); }
#credits-dialog .list-title { flex:none; position:relative; z-index:3; margin:0; padding:9px 0 13px; background:#f7f8fa !important; border-bottom:1px solid #d9dde3; }
#credits-dialog .credits-list { flex:1; min-height:0; margin-top:0; padding:4px 2px 20px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; }
#credits-dialog .credits-list::-webkit-scrollbar { display:none; }
#journey-guide .journey-guide-header { justify-content:flex-end; }
#journey-guide .journey-guide-header .text { font-size:23px; line-height:1; padding:0 3px; }
#map-attribution { background:transparent !important; border:0 !important; box-shadow:none !important; color:#17232a; text-shadow:0 1px 2px #fff; font-size:8px; }
.segments button[aria-pressed="true"] { color:#000 !important; }
@media(max-width:720px) {
 body.journey-active .layer-box { opacity:0; visibility:hidden; }
 body:has(#panel.expanded) #journey-guide { visibility:hidden; }
 #journey-guide { width:min(360px,calc(100vw - 24px)); top:max(58px,calc(env(safe-area-inset-top) + 54px)); }
 #credits-dialog[open] { max-height:min(80dvh,660px); }
}

/* Revision 7.2.0: isolated dialog scrolling and imagery metadata */
#credits-dialog { padding:0 !important; overflow:hidden !important; width:min(470px,calc(100vw - 24px)); max-height:calc(100dvh - 40px) !important; }
#credits-dialog[open] { display:block !important; }
#credits-dialog .credits-shell { display:flex; flex-direction:column; height:min(76dvh,630px); max-height:calc(100dvh - 44px); min-height:0; }
#credits-dialog .list-title { flex:none; height:72px; position:relative !important; top:0 !important; z-index:3; margin:0 !important; padding:12px 20px !important; background:#f7f8fa !important; backdrop-filter:none !important; border-bottom:1px solid #d9dde3 !important; }
#credits-dialog .credits-scroll { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; padding:0 20px 24px; scrollbar-width:none; }
#credits-dialog .credits-scroll::-webkit-scrollbar { display:none; }
#credits-dialog .credits-list { display:block; overflow:visible !important; max-height:none !important; margin:0; padding-top:6px; }
#credits-dialog .credits-list dt:first-child { border-top:0; }
.layer-box .satellite-date { max-width:280px; margin:5px auto 0; padding:6px 9px; border-radius:12px; font-size:10px; line-height:1.3; text-align:center; font-weight:550; color:#1b252c; background:rgba(246,248,250,.88); }
@media(max-width:720px) { #credits-dialog .credits-shell { height:min(76dvh,620px); } .layer-box .satellite-date { max-width:245px; font-size:9px; } }

/* Source-grounded stage fallback for routes without verified map geometry */
.route-stages { margin:15px 0 18px; border-top:1px solid rgba(15,20,30,.13); padding-top:12px; }
.route-stages h3 { margin:7px 0 9px; font-size:17px; }
.route-stages h4 { margin:16px 0 7px; font-size:14px; line-height:1.35; }
.route-stages ol { padding-left:21px; margin:7px 0 15px; }
.route-stages li { line-height:1.45; padding:4px 0; font-size:13px; }

/* 6.0: route endpoints and quiet imagery metadata */
#satellite-date{display:none !important}
.route-endpoints{margin:12px 0 18px;border:1px solid rgba(10,20,30,.1);border-radius:18px;padding:13px 15px;background:rgba(240,243,247,.65)}
.route-endpoints h3{font-size:16px;margin:2px 0 9px}
.route-endpoints ol{margin:0;padding-left:20px}
.route-endpoints li{padding:6px 0;line-height:1.3;overflow-wrap:anywhere}
.route-endpoints li strong{display:block;font-size:13px;font-weight:650}
.route-endpoints li span{display:block;margin-top:3px;font-size:11px;color:#57606b}
.route-endpoints summary{font-weight:600;font-size:12px}
.route-endpoints .muted{margin:10px 0 0;font-size:11px}
#map-attribution{font-size:8px!important;max-width:calc(100vw - 28px);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;opacity:.75}

/* Revision 7.2.0: operator scheduled departure summary */
.schedule-next{border:1px solid rgba(20,30,40,.12);border-radius:15px;margin:14px 0;padding:12px;background:rgba(248,249,251,.75)}
.schedule-next h4{font-size:14px;margin:0 0 10px}
.schedule-next ul{padding:0;list-style:none;margin:0}
.schedule-next li{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-top:1px solid rgba(20,30,40,.08);font-size:12px}
.schedule-next li strong{flex:none;font-variant-numeric:tabular-nums}
.schedule-next .muted{margin:10px 0 0;font-size:11px;line-height:1.4}

/* Revision 7.2.0: prevent credits modal animation from shifting the fixed header. */
#credits-dialog[open] { animation:none !important; transition:none !important; transform:none !important; }
#credits-dialog .credits-shell, #credits-dialog .list-title { transform:none !important; }

/* 6.1: fixed fare selection overlay + directional route controls */
#choice-dialog[open]{display:flex!important;flex-direction:column;overflow:hidden!important;max-height:min(82dvh,670px)!important;animation:none!important;transition:none!important;transform:none!important}
#choice-dialog .list-title{flex:none;position:relative!important;z-index:4;margin:0!important;padding:5px 0 13px;background:#f7f8fa!important;border-bottom:1px solid #d9dde3}
#choice-dialog .search{flex:none;margin:8px 0 5px;position:relative;z-index:2}
#choice-dialog .choice-options{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;align-content:start;margin:0;padding:4px 0 18px;scrollbar-width:none}
#choice-dialog .choice-options::-webkit-scrollbar{display:none}
#choice-dialog #choice-empty{flex:none}
.route-endpoints .route-choice{display:block;width:100%;text-align:left;padding:10px 6px;border-radius:11px;white-space:normal}
.route-endpoints .route-choice strong{display:block;font-size:13px}
.route-endpoints .route-choice span{display:block;font-size:11px;color:#5e6670;margin-top:3px}
.route-endpoints .route-choice[aria-pressed=true]{background:#dfe4e9}
.route-endpoints ol{padding-left:20px}
#line-direction-stages{max-width:100%}
#line-direction-stages li{font-size:12px}
#line-direction-stages li span{display:block;font-size:11px;color:#58616b}

/* 7.2.0: compact, accessible provider attribution; full credits remain in dialog */
#map-attribution{display:inline-grid;place-items:center;background:rgba(246,248,250,.82)!important;border:0!important;min-width:21px;min-height:19px;border-radius:8px;padding:3px 5px;font-size:9px!important;line-height:1.1;color:#28323b;cursor:pointer;text-shadow:none!important;white-space:nowrap;max-width:calc(100vw - 36px);text-overflow:ellipsis;overflow:hidden}
#map-attribution:focus-visible{outline:2px solid #212834;outline-offset:2px}

/* 6.3: smaller monochrome map-position selector */
#map-pick-marker{width:22px!important;height:30px!important;filter:drop-shadow(0 2px 3px rgba(0,0,0,.24))!important}
#map-pick-marker svg{width:22px!important;height:30px!important;fill:#050505!important;stroke:#fff!important;stroke-width:1.7!important}
#map-pick-marker circle{fill:#fff!important;stroke:none!important}
#map-pick-marker span{left:8px!important;bottom:-2px!important;width:6px!important;height:2px!important;background:rgba(0,0,0,.2)!important}

/* 6.3: map sources accessible in the Saved tab, consistent with neutral UI */
.saved-credits{margin:18px 3px 22px;border-top:1px solid rgba(20,30,42,.12);padding-top:14px}
#saved-credits{width:100%;min-height:44px;text-align:left;padding:12px 14px;background:rgba(228,233,238,.72);border-radius:14px;color:#101316;font-size:13px;font-weight:630}
#saved-credits:focus-visible{outline:2px solid #161b20;outline-offset:3px}

/* 6.4: transparent dialog headings, compact dark guidance, responsive layout */
dialog:not(#choice-dialog):not(#credits-dialog) .list-title{
 position:relative!important;top:auto!important;margin:0 0 8px!important;
 padding:4px 0 12px!important;border:0!important;background:transparent!important;
 backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
 box-shadow:none!important;transform:none!important
}
dialog:not(#choice-dialog):not(#credits-dialog) .list-title h2{background:transparent!important}
#point-dialog,#settings-dialog,#pin-dialog,#hidden-dialog{background:rgba(247,248,250,.96)!important}
#point-dialog .actions,#settings-dialog .actions{flex-wrap:wrap}
#point-dialog #point-results{max-height:min(40dvh,370px);overflow-y:auto;overscroll-behavior:contain}
#point-dialog #point-message{font-size:11px;line-height:1.4}
#settings-dialog .actions{gap:6px}
#settings-dialog .actions button{flex:1 1 135px;white-space:normal;min-height:42px}
#settings-dialog .settings-explanation{font-size:11px;line-height:1.5;margin:12px 2px}
#journey-guide{
 background:rgba(24,29,35,.95)!important;color:#fff!important;
 border:1px solid rgba(255,255,255,.14)!important;
 box-shadow:0 6px 28px rgba(10,16,25,.23)!important;
 border-radius:20px!important;backdrop-filter:blur(18px)!important;
 -webkit-backdrop-filter:blur(18px)!important
}
#journey-guide .muted,#journey-guide .journey-guide-detail{color:rgba(255,255,255,.74)!important}
#journey-guide .journey-guide-icon{color:#fff!important}
#journey-guide .journey-guide-next{border-radius:11px;background:rgba(255,255,255,.15)!important;color:#fff;min-height:36px}
#journey-guide .journey-guide-title{font-weight:670;letter-spacing:-.02em}
#journey-guide .journey-guide-header{min-height:17px}
#journey-guide .journey-guide-header .text{color:#fff!important;background:transparent!important}
.location-dot{background:#161c24!important}
.location-heading::before{border-left-width:7px;border-right-width:7px;border-bottom:13px solid #161c24!important;left:11px;top:-4px;filter:drop-shadow(0 0 1px #fff)}
@media(max-width:720px){
 #journey-guide{left:12px!important;top:max(10px,env(safe-area-inset-top))!important;
 transform:none!important;width:min(380px,calc(100vw - 24px))!important;
 max-height:calc(100dvh - 36px)!important;overflow-y:auto}
}
@media(max-height:530px) and (orientation:landscape){
 #journey-guide{left:12px!important;top:10px!important;max-height:calc(100dvh - 20px)!important;
 width:min(355px,48vw)!important;overflow-y:auto}
 #journey-guide .journey-guide-icon{width:30px;font-size:28px}
 #journey-guide .journey-guide-icon svg{width:30px;height:30px}
 #map-pick-controls{width:min(280px,45vw)!important;padding:10px!important}
 #point-dialog,#settings-dialog{max-height:calc(100dvh - 24px)}
}

/* 6.5 map stop selection and 3-height responsive sheet */
@media(max-width:720px){
 #panel[data-height="medium"]{height:min(52dvh,520px)!important;max-height:calc(100dvh - 112px)!important;bottom:24px!important}
 #panel[data-height="medium"] nav{display:flex}
 #panel[data-height="medium"] .body{display:block;overflow-y:auto}
 #panel[data-height="medium"] footer{display:flex}
 #point-dialog .map-stop-select{background:#050505;color:#fff;border-radius:12px;font-size:12px;font-weight:680;min-height:38px}
}
.filters button[aria-pressed="true"],#line-types button[aria-pressed="true"],
.travel button[aria-pressed="true"],.route-choice[aria-pressed="true"]{background:#050505!important;color:#fff!important;box-shadow:0 2px 8px rgba(0,0,0,.14)!important}
.filters button[aria-pressed="true"] svg,.travel button[aria-pressed="true"] svg{stroke:#fff!important}
.stop-count{font-size:11px;line-height:1.4;margin:3px 0 13px}
#detail .back{color:#080808;font-weight:680;font-size:13px;min-height:36px}
body.picking #prompt{max-width:min(340px,calc(100vw - 24px));white-space:normal}

/* Production archive available from Save tab */
.saved-export{padding:12px 3px 14px;margin-top:8px;border-top:1px solid rgba(0,0,0,.08)}
.saved-export a{display:block;background:#050505;color:#fff;text-align:center;border-radius:13px;padding:14px 12px;font-size:13px;font-weight:680;text-decoration:none}
.saved-export p{font-size:10px;margin:9px 3px 0;line-height:1.4}

/* Revision 7: deep-black selected states, precise stop highlights and private export */
#tabs.segments button[aria-pressed="true"],.filters button[aria-pressed="true"],
.travel button[aria-pressed="true"],#fare-modes button[aria-pressed="true"],
.route-choice[aria-pressed="true"],.choice-options button[aria-pressed="true"],
#settings-dialog button[aria-pressed="true"]{
 background:#050505!important;color:#fff!important;
 box-shadow:0 2px 8px rgba(0,0,0,.18)!important
}
#tabs.segments button[aria-pressed="true"] svg,.filters button[aria-pressed="true"] svg,
.travel button[aria-pressed="true"] svg{stroke:#fff!important;fill:none!important}
.travel button svg{width:18px!important;height:18px!important;stroke-width:1.9!important;
 stroke-linecap:round;stroke-linejoin:round}
.stop-marker[aria-selected="true"]>span{
 background:#050505!important;color:#fff!important;
 box-shadow:0 0 0 2px #fff,0 0 0 4px #050505,0 5px 12px rgba(0,0,0,.22)!important
}
.saved-export button{display:block;width:100%;background:#050505;color:#fff;border-radius:13px;
 padding:14px 12px;font-size:13px;font-weight:680}
#owner-export-dialog{border:1px solid rgba(255,255,255,.72);border-radius:24px;
 padding:24px;width:min(420px,calc(100vw - 32px));max-height:85dvh;
 box-shadow:0 22px 80px rgba(0,0,0,.26);background:rgba(245,247,250,.97);
 color:#101215;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px)}
#owner-export-dialog::backdrop{background:rgba(0,0,0,.52);backdrop-filter:blur(4px)}
#owner-export-dialog h2{font-size:20px;font-weight:750;letter-spacing:-.03em;margin:0 0 10px}
#owner-export-dialog p{font-size:12px;line-height:1.5;margin:8px 0 16px}
#owner-export-dialog label{display:block;font-size:12px;font-weight:680;margin-bottom:7px}
#owner-export-key{width:100%;height:45px;border:1px solid #cfd4da;border-radius:12px;
 background:#fff;padding:11px;font-size:13px;min-width:0;box-sizing:border-box}
#owner-export-submit{background:#050505;color:#fff}
#owner-export-close{background:#e3e7ec;color:#121518}

/* Revision 7.2: compact stable scale text, always-readable map attribution */
.map-status{
 display:flex!important;flex-direction:column!important;align-items:flex-start!important;
 justify-content:flex-end!important;flex-wrap:nowrap!important;
 gap:1px!important;width:max-content!important;max-width:calc(100vw - 78px)!important;
 pointer-events:none!important
}
#map-scale{display:block!important;line-height:1!important;width:max-content!important;max-width:100%!important}
#map-scale .leaflet-control-scale{
 display:block!important;width:auto!important;float:none!important;position:static!important;
 margin:0!important;min-width:0!important
}
#map-scale .leaflet-control-scale-line{
 display:inline-block!important;width:max-content!important;max-width:100%!important;
 min-width:0!important;height:auto!important;
 border:0!important;border-radius:0!important;background:transparent!important;
 box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
 padding:1px 0!important;margin:0!important;
 color:#16252b!important;font-size:10px!important;line-height:1.15!important;
 font-weight:700!important;font-variant-numeric:tabular-nums!important;
 text-shadow:0 1px 2px rgba(255,255,255,.85)!important;
 text-align:left!important
}
#map-attribution{
 display:block!important;flex:none!important;min-width:0!important;min-height:0!important;
 width:auto!important;max-width:min(305px,calc(100vw - 88px))!important;
 padding:0!important;margin:0!important;border:0!important;border-radius:0!important;
 background:transparent!important;box-shadow:none!important;
 font-size:8px!important;line-height:1.25!important;letter-spacing:.005em!important;
 font-weight:530!important;color:#20313a!important;opacity:.94!important;
 white-space:normal!important;overflow-wrap:normal!important;text-overflow:clip!important;
 text-shadow:0 1px 2px rgba(255,255,255,.92)!important;
 cursor:pointer!important;pointer-events:auto!important
}
#map-attribution:empty{display:none!important}
body.picking:not(.center-picking) .leaflet-marker-pane .stop-marker{
 pointer-events:auto!important;cursor:pointer!important
}
body.picking:not(.center-picking) .stop-marker>span{pointer-events:auto!important}
@media(max-width:720px){
 .map-status{left:12px!important;right:auto!important;bottom:calc(var(--sheet-height) + 12px)!important}
 #map-scale .leaflet-control-scale-line{font-size:10px!important;padding:1px 0!important}
 #map-attribution{font-size:8px!important}
}
