/* Compact controls retain the existing MarTrans appearance. */
.pwa-controls{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 6px}.pwa-controls button{min-height:40px;padding:8px 12px;border:1px solid #b8b8b8;border-radius:3px;background:linear-gradient(#fff,#eee);color:#222;font:inherit;cursor:pointer}.pwa-controls button:focus-visible{outline:2px solid #087fab;outline-offset:2px}.pwa-controls [hidden]{display:none}.pwa-help{font-size:13px;line-height:1.5;color:#444;overflow-wrap:anywhere}.pwa-privacy{margin-top:14px;border-top:1px solid #ccc;padding-top:10px}.pwa-privacy summary{cursor:pointer;font-weight:bold}.pwa-privacy p{font-size:13px;line-height:1.5}.pwa-version{font-size:12px;color:#666}
#loading{padding:18px;max-width:100%;box-sizing:border-box}#loading-progress{display:block;width:min(320px,100%);height:8px;margin:12px 0;accent-color:#087fab}

/* One app surface; only its panes scroll. Startup and modal layers are siblings. */
:root{--mt-safe-top:env(safe-area-inset-top,0px);--mt-safe-right:env(safe-area-inset-right,0px);--mt-safe-bottom:env(safe-area-inset-bottom,0px);--mt-safe-left:env(safe-area-inset-left,0px);--mt-action-bottom-gap:max(6px,min(18px,var(--mt-safe-bottom)))}
#mt-app-frame{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0;width:100%;max-width:100%;overflow:hidden;background:#e0e0e0}
body.mode-mobile #mt-app-frame{background:#fff}
body.mt-booting #mt-app-frame>:is(#header,#layout,#advertising-slot){visibility:hidden;pointer-events:none}
body.mode-mobile #mt-app-frame .route-table .route-title{align-items:center}
body.mode-mobile #mt-app-frame .route-table .route-title>.route-number{margin-top:0}

/* The new frame preserves the existing drawer's movement without moving its viewport. */
body.mode-mobile #mt-app-frame>:is(#advertising-slot,#header,#layout,#notice){transition:transform 180ms ease-out}
body.mode-mobile.mobile-drawer-open #mt-app-frame>:is(#advertising-slot,#header,#layout){transform:translateX(calc(0px - var(--mobile-drawer-width)))}
body.mode-mobile.mobile-drawer-open #mt-app-frame>#notice{transform:translateX(calc(-50% - var(--mobile-drawer-width)))}

@media screen{
  html.mt-installed,html.mt-installed body{min-height:0;overflow:hidden;overscroll-behavior:none}
  html.mt-installed body,html.mt-installed body.mobile-client{position:fixed;inset:0;height:auto;padding:0}
  html.mt-installed #mt-app-frame{position:fixed;inset:0;height:auto;padding:var(--mt-safe-top) var(--mt-safe-right) 0 var(--mt-safe-left);overscroll-behavior:none}
  html.mt-installed #mt-app-frame>#layout{min-width:0;min-height:0}
  /* End padding scrolls with content; it never creates an empty external bottom band. */
  html.mt-installed #content-pane,html.mt-installed #sidebar{padding-bottom:var(--mt-safe-bottom);scroll-padding-bottom:calc(12px + var(--mt-safe-bottom));-webkit-overflow-scrolling:touch}
  html.mt-installed #content-pane{overscroll-behavior-y:contain}
  html.mt-installed #notice{bottom:calc(20px + var(--mt-safe-bottom));max-width:calc(100vw - var(--mt-safe-left) - var(--mt-safe-right) - 24px)}
  html.mt-installed body.mode-mobile #notice{bottom:calc(8px + var(--mt-safe-bottom))}
  html.mt-installed #map-pane .leaflet-bottom{bottom:var(--mt-safe-bottom)}
  /* The drawer is outside the frame and owns its own safe edges once. */
  html.mt-installed #mobile-drawer{height:auto;max-height:none;padding-right:var(--mt-safe-right)}
  html.mt-installed #mobile-drawer .mobile-drawer-heading{min-height:calc(60px + var(--mt-safe-top));padding-top:calc(8px + var(--mt-safe-top))}
  html.mt-installed #mobile-drawer .mobile-home-grid{padding-bottom:var(--mt-safe-bottom)}
  html.mt-installed :is(#about-dialog,#trip-dialog){max-width:calc(100% - var(--mt-safe-left) - var(--mt-safe-right) - 20px);max-height:calc(100% - var(--mt-safe-top) - var(--mt-safe-bottom) - 20px)}
  html.mt-installed .mt-ad-header{min-height:calc(64px + var(--mt-safe-top));padding-top:var(--mt-safe-top);padding-left:calc(16px + var(--mt-safe-left));padding-right:calc(4px + var(--mt-safe-right))}
  html.mt-installed .mt-ad-body{padding-left:calc(20px + var(--mt-safe-left));padding-right:calc(20px + var(--mt-safe-right));padding-bottom:calc(20px + var(--mt-safe-bottom))}
  /* Containment alone permits local stretch. Keep native interior scrolling,
     but suppress its boundary affordance on each owned scroll container. */
  html.mt-installed #mt-app-frame :is(#content-pane,#sidebar,#layout,#mobile-types,#notice,.direction-menu,.stop-suggest [role=listbox]){overscroll-behavior:none}
  /* Desktop content has no horizontal range of its own. Let that gesture reach
     the wide layout, which owns the horizontal boundary. */
  html.mt-installed body.mode-desktop #mt-app-frame :is(#content-pane,#sidebar){overscroll-behavior-x:auto;overscroll-behavior-y:none}
  html.mt-installed :is(#mobile-drawer,#about-dialog,#trip-dialog,.mt-ad-body,.mt-legal-content,.mt-legal-footer,.leaflet-popup-content){overscroll-behavior:none}
}
@media(prefers-reduced-motion:reduce){body.mode-mobile #mt-app-frame>:is(#advertising-slot,#header,#layout,#notice){transition:none}}
@media print{.pwa-controls,.pwa-help,.pwa-privacy,.pwa-version{display:none!important}#mt-app-frame{display:block;position:static;height:auto;overflow:visible;padding:0}}
