.mobile-map-control,.mobile-sheet-close,.mobile-detail-back{display:none}
@media(max-width:760px){
  /* Keep the map as the viewport canvas; controls unfold over it. */
  body:not(.archive-open){overflow:hidden;height:100dvh;min-height:0}
  .mobile-map-control{display:flex;align-items:center;justify-content:center;gap:6px;background:#fff;border:1px solid #9bb3b2;min-height:44px;padding:8px 12px;border-radius:6px;font:inherit;font-size:13px;color:#174b4b;box-shadow:0 2px 6px #163f4714;cursor:pointer}
  .mobile-map-control[aria-expanded=true]{background:#e8f2ef;border-color:#007c75}
  .mobile-sheet-close{display:block;position:sticky;top:0;z-index:10;margin:0 0 8px auto;min-height:44px;padding:8px 12px;background:white;border:1px solid #9bb3b2;border-radius:5px;font-size:13px;color:#174b4b;cursor:pointer}
  .mobile-map-control:focus-visible,.mobile-sheet-close:focus-visible{outline:3px solid #005fcc;outline-offset:2px}
  body:not(.archive-open) .browse-toolbar{display:flex;flex-wrap:wrap;padding:6px 8px;gap:6px;position:relative;z-index:750}
  body:not(.archive-open) .provider-picker{flex:1;min-width:0;margin:0}
  body:not(.archive-open) #service{width:100%;min-height:44px;font-size:13px}
  body:not(.archive-open) #mobile-filters-toggle{order:1;flex:none}
  body:not(.archive-open):not(.mobile-filters-open) .browse-toolbar .map-search-controls,
  body:not(.archive-open):not(.mobile-filters-open) .browse-toolbar #refresh-data,
  body:not(.archive-open):not(.mobile-filters-open) .browse-toolbar #range-label{display:none!important}
  body.mobile-filters-open .browse-toolbar .map-search-controls{order:2;width:100%;flex-basis:100%}
  body.mobile-filters-open .browse-toolbar .rail-period-control{order:3;flex:1}
  body.mobile-filters-open .browse-toolbar #refresh-data{order:4}
  body:not(.archive-open) .map-layout>.search-panel{display:none!important}
  body:not(.archive-open).mobile-stations-open .map-layout>.search-panel{display:block!important;position:absolute;left:0;right:0;top:auto;bottom:0;width:100%;max-height:65%;padding:10px 14px;overflow:auto;z-index:850;border-radius:12px 12px 0 0;box-shadow:0 -3px 18px #173f4726}
  body:not(.archive-open) .station-list{max-height:none}
  body:not(.archive-open) #mobile-stations-toggle{position:absolute;z-index:700;left:50%;bottom:124px;top:auto;transform:translateX(-50%);white-space:nowrap}
  body.transfer-view #mobile-stations-toggle{display:none}
  body:not(.archive-open) .time-console{left:8px;right:8px;bottom:24px;top:auto;height:auto;min-height:0;width:auto;padding:6px 10px;max-width:none}
  body:not(.archive-open) .time-console .preparation,body:not(.archive-open) .time-ticks,body:not(.archive-open) .time-heading>span{display:none}
  body:not(.archive-open) .time-console .time-heading{margin:0;gap:4px}
  body:not(.archive-open) .time-console #time-latest{min-height:32px;padding:3px 8px;font-size:11px}
  body:not(.archive-open) .time-console #time-slider{margin:2px 0;min-height:24px}
  body.transfer-view .time-console{display:none}
  body:not(.archive-open) .site-footer{min-height:32px;padding:0 8px;font-size:10px;gap:8px}
  body:not(.archive-open) .site-footer>.service-summary{display:none}
  body:not(.archive-open) .site-footer .footer-menu-toggle,body:not(.archive-open) .site-footer .analytics-settings{min-height:36px;font-size:11px}
  /* Planner: one full-size map, one input disclosure, one result sheet. */
  body.mobile-planner{position:relative}
  .mobile-planner #input-panel{padding:0 10px;flex:none;z-index:850}
  .mobile-planner #input-panel>summary{min-height:48px;padding:8px 0}
  .mobile-planner #input-panel[open] #plan-form{position:absolute;left:8px;right:8px;z-index:850;background:white;border:1px solid #9bb3b2;border-radius:0 0 10px 10px;padding:12px;max-height:calc(100dvh - 180px);overflow:auto;box-shadow:0 6px 14px #173f4726}
  .mobile-planner .plan-layout{display:block;position:relative;flex:1;min-height:0}
  .mobile-planner .plan-map-region{position:absolute;inset:0;height:100%;z-index:0;isolation:isolate}
  .mobile-planner #plan-map{height:100%}
  .mobile-planner .results-panel{display:none;position:absolute;left:0;right:0;bottom:0;max-height:65%;z-index:900;overflow:auto;overscroll-behavior:contain;border-radius:12px 12px 0 0;border-top:1px solid #aebfbb;box-shadow:0 -3px 18px #173f4726;padding:10px 14px}
  .mobile-planner.mobile-results-open .results-panel{display:block}
  #mobile-results-toggle{position:absolute;bottom:64px;left:50%;transform:translateX(-50%);z-index:800;white-space:nowrap}
  .mobile-planner .route-key{left:8px;right:8px;bottom:20px;flex-wrap:wrap;gap:4px 10px;font-size:10px;padding:4px 6px;pointer-events:none}
  .mobile-planner footer{min-height:32px;max-height:48px;overflow:auto;flex-shrink:0;gap:4px 10px;padding:2px 8px;align-items:center}
  .mobile-planner footer .route-attribution{display:none}
  .mobile-planner footer .analytics-settings{font-size:10px;padding:2px 4px;min-height:32px}
  .mobile-planner .planner-stage{flex-shrink:0;font-size:10px;padding:3px 8px}
  .mobile-planner #map-search{bottom:116px}
  .mobile-planner #search-progress{top:50%;bottom:auto;left:50%;transform:translate(-50%,-50%)}
}

/* Station information takes precedence over list and timeline controls. */
@media(max-width:760px){
  body:not(.archive-open) .map-layout:has(#station-detail:not([hidden])) #mobile-stations-toggle,
  body:not(.archive-open) .map-layout:has(#station-detail:not([hidden])) .time-console{display:none}
  body:not(.archive-open) #station-detail{z-index:900;max-height:82%;padding:12px 16px 24px;border-radius:14px 14px 0 0;box-shadow:0 -4px 20px #173f4726;scroll-padding-top:12px}
  .mobile-detail-back{display:inline-flex;align-items:center;min-height:44px;margin:0 0 8px;padding:8px 12px;background:#edf5f2;border:1px solid #9bb3b2;border-radius:6px;color:#174b4b;font-size:14px}
  #station-detail .detail-heading{align-items:flex-start;gap:12px}
  #station-detail .detail-heading>div{min-width:0}
  #station-detail h2{font-size:22px;line-height:1.4;overflow-wrap:anywhere}
  #station-detail #close-detail{flex:none;min-width:44px;min-height:44px}
  #station-detail .chart-toolbar{flex-wrap:wrap;gap:8px}
  #station-detail .chart-toolbar label{flex-wrap:wrap}
  #station-detail .trend-numbers{gap:12px}
  body:not(.archive-open) .browse-toolbar #refresh-data{margin-left:auto}
}

/* Mobile search: one persistent field, with secondary controls tucked away. */
@media(max-width:760px){
 body:not(.archive-open) .browse-toolbar{padding:8px 12px 10px;gap:8px;background:#fff;border-bottom:1px solid #dce5e2}
 body:not(.archive-open) .browse-toolbar>.provider-picker{flex:1;min-width:0}
 body:not(.archive-open) .browse-toolbar .provider-picker select{min-height:36px!important;font-size:14px!important;border:0!important;border-left:3px solid #be9200!important;border-radius:0;background:#fff;padding:4px 24px 4px 10px!important}
 body:not(.archive-open) #mobile-filters-toggle{min-height:44px;border:0;box-shadow:none;padding:8px 12px;font-size:13px;background:#f1f5f3;border-radius:22px}
 body:not(.archive-open) .browse-toolbar .map-search-controls,
 body:not(.archive-open):not(.mobile-filters-open) .browse-toolbar .map-search-controls{display:flex!important;order:2;flex:0 0 100%;width:100%;flex-wrap:wrap;gap:8px;align-items:center}
 body:not(.archive-open) .map-search-controls .search-field{flex:1;min-width:0;background:#f2f6f4;border-radius:24px}
 body:not(.archive-open) .map-search-controls .search-field input{min-height:48px;border:1px solid #d9e3df;background:transparent;border-radius:24px;font-size:16px;padding-left:42px}
 body:not(.archive-open) #mobile-stations-toggle{display:flex;position:static;transform:none;min-height:44px;border:0;border-radius:22px;box-shadow:none;background:transparent;color:#006b61;padding:8px 10px;font-size:14px}
 body:not(.archive-open) .map-search-controls .area-controls{display:none;flex-basis:100%;margin:0;gap:8px}
 body:not(.archive-open).mobile-filters-open .map-search-controls .area-controls{display:flex}
 body:not(.archive-open) .browse-toolbar>.map-share-button{display:block;min-height:44px;border:1px solid #b8ceca;background:#f5faf8;border-radius:8px;box-shadow:none;color:#006b61;order:1;padding:6px 10px;font-size:12px;font-weight:600}
 body:not(.archive-open).mobile-filters-open .browse-toolbar>.map-share-button{display:block}
 body:not(.archive-open).mobile-stations-open .map-layout>.search-panel{top:0;bottom:auto;left:8px;right:8px;width:auto;max-height:calc(100% - 12px);height:auto;min-height:0;border-radius:0 0 14px 14px;box-shadow:0 8px 24px #173f4726;border:1px solid #dce5e2;padding:12px;display:flex!important;flex-direction:column;background:#fff}
 body:not(.archive-open).mobile-stations-open .search-panel .station-list{flex:0 1 auto;min-height:0;overflow:auto;max-height:38dvh}
 body:not(.archive-open).mobile-stations-open .search-panel .panel-heading{font-size:16px;min-height:44px;padding-right:100px;margin:0 0 8px;align-items:center}
 body:not(.archive-open).mobile-stations-open .search-panel .mobile-sheet-close{position:absolute;top:10px;right:12px;flex:none;margin:0;border:0;background:#edf4f1;border-radius:22px}
 body:not(.archive-open).mobile-stations-open .station-list button{padding:12px 8px}
 body:not(.archive-open).mobile-stations-open .station-name{font-size:16px}
 body:not(.archive-open).mobile-stations-open .station-subline{font-size:12px}
 body:not(.archive-open).mobile-stations-open .search-panel .search-help{margin:8px 0 0}
 body:not(.archive-open).mobile-stations-open .search-panel #search-status{margin:8px 0}
}

@media(max-width:760px){
 body:not(.archive-open).transfer-view .browse-toolbar .rail-period-control{display:block;order:3;flex:0 0 100%;width:100%}
 body:not(.archive-open).transfer-view .rail-period-control .rail-filter-bar{display:flex;width:100%;gap:2px;padding:3px;border-radius:8px;background:#f1f5f3}
 body:not(.archive-open).transfer-view .rail-period-control .rail-filter-bar button{flex:1;min-width:0;min-height:44px;padding:6px 4px;font-size:14px}
}

/* A compact departure-time chip opens just the weekday and time controls. */
@media(max-width:760px){
 .mobile-planner #input-panel{position:absolute;top:66px;right:10px;left:auto;bottom:auto;z-index:850;width:164px;max-width:calc(100% - 20px);padding:0 12px;border:1px solid #b8ceca;border-radius:24px;background:#fff;box-shadow:0 2px 10px #153e3c20}
 .mobile-planner #input-panel>summary{min-height:44px;padding:9px 0;gap:10px;justify-content:space-between;font-size:14px}
 .mobile-planner #input-panel>summary .edit-label{font-size:11px}
 .mobile-planner #input-panel[open]{width:280px;border-radius:12px}
 .mobile-planner #input-panel[open] #plan-form{position:static;max-height:none;padding:0 0 12px;border:0;box-shadow:none;border-radius:0;background:transparent}
 .mobile-planner #map-instruction{top:120px;max-width:calc(100% - 20px);font-size:12px}
 .mobile-planner #route-status{top:170px}
 .mobile-planner .planner-location-note{left:8px;bottom:3px;font-size:9px;max-width:calc(100% - 16px)}
}

/* One search row; controls float over the map without changing station markers. */
@media(min-width:761px){#mobile-map-options{display:none}}
@media(max-width:760px){
 body:not(.archive-open) .browse-toolbar{flex-wrap:nowrap;gap:4px;padding:6px 8px;min-height:56px}
 body:not(.archive-open) .browse-toolbar .map-search-controls,
 body:not(.archive-open):not(.mobile-filters-open) .browse-toolbar .map-search-controls{order:0;flex:1 1 auto;flex-basis:0;width:auto;min-width:0;flex-wrap:nowrap;gap:2px}
 body:not(.archive-open) .map-search-controls .search-field input{min-height:44px}
 body:not(.archive-open) #mobile-stations-toggle{padding:8px;min-width:44px;font-size:12px}
 body:not(.archive-open) #mobile-filters-toggle{order:1;padding:8px 10px;min-width:44px;flex:none}
 #mobile-map-options{display:none}
 body.mobile-filters-open #mobile-map-options{display:flex;position:absolute;top:calc(100% + 4px);left:8px;right:8px;z-index:800;flex-wrap:wrap;gap:8px;background:#fff;border:1px solid #c5d6cf;border-radius:12px;box-shadow:0 5px 18px #173f4726;padding:12px}
 #mobile-map-options>.provider-picker{flex:0 0 100%!important}
 body:not(.archive-open) #mobile-map-options .area-controls{display:flex;flex:1;gap:8px;margin:0}
 body:not(.archive-open):not(.mobile-filters-open) #mobile-map-options #refresh-data{display:none!important}
 body:not(.archive-open).mobile-filters-open #mobile-map-options #refresh-data{display:block;order:0;margin:0}
 body:not(.archive-open).transfer-view .map-layout>.rail-period-control{display:block;position:absolute;top:auto;bottom:24px;left:8px;right:76px;width:auto;z-index:430;padding:3px;border:1px solid #c5d6cf;border-radius:10px;background:#fff;box-shadow:0 2px 8px #173f4718}
 .map-layout>.rail-period-control .rail-filter-bar{display:flex;position:static;width:100%;gap:0;background:transparent;border:0;padding:0;box-shadow:none}
 .map-layout>.rail-period-control .rail-filter-bar button{flex:1;min-width:0;min-height:44px;padding:4px 2px;font-size:12px}
 .map-layout>.rail-period-control>p{display:none}
 .map-layout>.map-share-button{position:absolute;right:8px;bottom:24px;z-index:440;min-height:52px;width:60px;padding:6px;font-size:11px;font-weight:600;color:#006b61;background:#fff;border:1px solid #b8ceca;border-radius:10px;box-shadow:0 2px 8px #173f4718}
 body:not(.transfer-view) .map-layout>.map-share-button{bottom:124px}
}

@media(max-width:760px){
 .mobile-planner #input-panel{top:10px}
 .mobile-planner #map-instruction{top:10px;left:10px;right:auto;transform:none;max-width:calc(100% - 194px);font-size:12px;padding:10px;line-height:1.6}
}

/* Provider first: keep the selected network visible, reveal search on demand. */
@media(max-width:760px){
 body:not(.archive-open) .browse-toolbar>.provider-picker{display:flex;order:0;flex:1;min-width:0}
 body:not(.archive-open) .browse-toolbar .provider-picker select{width:100%;max-width:none!important;min-height:44px!important;font-size:14px!important;border:1px solid #d4e0db!important;border-left:4px solid #be9200!important;border-radius:8px;background:#f7faf8;padding:8px 22px 8px 10px!important}
 body:not(.archive-open)[data-provider=docomo-cycle] .browse-toolbar .provider-picker select{border-left-color:#af3042!important}
 body:not(.archive-open) .browse-toolbar>#mobile-stations-toggle{display:flex;order:1;flex:none;min-width:44px;padding:8px;font-size:13px}
 body:not(.archive-open) #mobile-filters-toggle{order:2;font-size:12px}
 body:not(.archive-open).mobile-stations-open .search-panel .panel-heading{order:-3}
 body:not(.archive-open).mobile-stations-open .search-panel .map-search-controls{display:flex;order:-2;flex:none;flex-basis:auto;width:100%;margin:0 0 8px}
 body:not(.archive-open) .search-panel .map-search-controls .search-field{width:100%;flex:1}
 body:not(.archive-open) .search-panel .map-search-controls .search-field input{width:100%;min-height:44px;font-size:16px}
}

/* The network is a small map chip, not another fixed toolbar row. */
#mobile-map-floating{display:none}
@media(max-width:760px){
 body:not(.archive-open) .browse-toolbar{height:0;min-height:0;padding:0;border:0;display:block;z-index:750}
 #mobile-map-floating{display:flex;align-items:center;gap:6px;position:absolute;top:8px;left:8px;right:8px;z-index:450;pointer-events:none}
 #mobile-map-floating>*{pointer-events:auto}
 #mobile-map-floating>.provider-picker{display:flex;flex:1;min-width:0;max-width:240px;margin:0}
 #mobile-map-floating>.provider-picker>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
 #mobile-map-floating #service{min-height:44px!important;width:100%;max-width:none!important;font-size:13px!important;padding:8px 22px 8px 10px!important;border:1px solid #c7d8d1!important;border-left:3px solid #be9200!important;border-radius:22px;background-color:#fff!important;box-shadow:0 2px 8px #173f4718}
 body[data-provider=docomo-cycle] #mobile-map-floating #service{border-left-color:#af3042!important}
 body:not(.archive-open) #mobile-map-floating #mobile-stations-toggle,
 body:not(.archive-open) #mobile-map-floating #mobile-filters-toggle{display:flex;position:static;flex:none;min-height:44px;min-width:44px;padding:8px;border:1px solid #d5e1dc;background:#fff;border-radius:22px;box-shadow:0 2px 8px #173f4718;font-size:12px;transform:none}
 body.mobile-filters-open #mobile-map-options{top:60px}
 body:not(.archive-open).transfer-view .face-legend{top:60px}
 body:not(.archive-open) .leaflet-control-zoom{margin-top:112px!important}
}

#mobile-period-chip{display:none}
@media(max-width:760px){
 body:not(.archive-open).transfer-view .map-layout>.rail-period-control{display:none!important}
 body:not(.archive-open).transfer-view #mobile-period-chip{display:block;position:absolute;bottom:24px;left:8px;z-index:440;width:112px;min-height:44px;padding:8px 22px 8px 14px;border:1px solid #c7d8d1;border-radius:24px;background-color:#fff;box-shadow:0 2px 8px #173f4718;font-size:14px;font-weight:600;color:#075c58}
}

.mobile-move-only{display:none}
@media(max-width:760px){
 body.mobile-stations-open .search-panel .mobile-move-only{display:block}
 body.mobile-stations-open .search-panel h2.mobile-move-only{order:-3;font-size:18px;min-height:44px;line-height:44px;margin:0 100px 8px 0}
 body.mobile-stations-open .search-panel .panel-heading,
 body.mobile-stations-open .search-panel .station-list,
 body.mobile-stations-open .search-panel #search-status,
 body.mobile-stations-open .search-panel #list-more,
 body.mobile-stations-open .search-panel .purpose-switch,
 body.mobile-stations-open .search-panel .filter-label,
 body.mobile-stations-open .search-panel .rail-filter-select,
 body.mobile-stations-open .search-panel .search-help{display:none!important}
 body.mobile-stations-open .search-panel #mobile-move-submit{order:-1;min-height:44px;background:#006b61;color:#fff;border:0;border-radius:8px;margin:0 0 14px}
 body.mobile-stations-open .search-panel .area-controls{display:flex;order:0;gap:8px;margin:0;border-top:1px solid #dce5e2;padding-top:14px}
 body.mobile-stations-open .search-panel .area-controls select{flex:1;min-width:0;min-height:44px;font-size:14px}
 body.mobile-stations-open .search-panel .area-controls button{min-height:44px;font-size:13px}
 body.mobile-stations-open #mobile-move-status{order:1;margin:8px 0 0;font-size:12px}
}

@media(max-width:760px){
 body.mobile-stations-open #mobile-move-suggestions{order:-1;max-height:32dvh;overflow:auto;margin:0 0 12px;overscroll-behavior:contain}
 #mobile-move-suggestions:empty{display:none!important}
 #mobile-move-suggestions button{display:block;width:100%;min-height:44px;padding:12px 8px;text-align:left;font-size:13px;line-height:1.5;border:0;border-bottom:1px solid #e0e8e3;border-radius:0;background:#fff;color:#153e3c;white-space:normal}
 #mobile-move-suggestions button:hover,#mobile-move-suggestions button:focus{background:#edf5f1}
}

#mobile-period-control,.map-share-icon{display:none}
@media(max-width:760px){
 #mobile-map-floating #service,
 body:not(.archive-open) #mobile-map-floating #mobile-stations-toggle,
 body:not(.archive-open) #mobile-map-floating #mobile-filters-toggle{border-radius:10px!important}
 body:not(.archive-open).transfer-view #mobile-period-control{display:block;position:absolute;top:60px;bottom:auto;left:8px;z-index:450;width:96px;height:60px;padding:6px 10px 2px;border:1px solid #c7d8d1;border-radius:10px;background:#fff;box-shadow:0 2px 8px #173f4718;color:#075c58}
 #mobile-period-control>span{display:block;font-size:10px;line-height:14px;color:#627771}
 body:not(.archive-open).transfer-view #mobile-period-control #mobile-period-chip{display:block;position:static;width:100%;height:34px;min-height:34px;padding:0 16px 0 0;border:0;border-radius:0;box-shadow:none;font-size:14px;background-color:#fff}
 .map-layout>.map-share-button,body:not(.transfer-view) .map-layout>.map-share-button{top:60px;bottom:auto;right:8px;width:44px;height:44px;min-height:44px;display:flex;align-items:center;justify-content:center;padding:10px;border-radius:10px}
 .map-layout>.map-share-button .map-share-icon{display:block;flex:none}
 .map-layout>.map-share-button .map-share-label{display:none}
 body:not(.archive-open).transfer-view .face-legend{top:auto;bottom:24px;left:8px;right:8px;width:auto}
 body:not(.archive-open) .leaflet-control-zoom{margin-top:116px!important}
 .mobile-planner #input-panel{border-radius:10px}
}

@media(max-width:760px){
 .map-layout>.aggregate-unit{top:128px;border-radius:10px}
 .map-layout>.aggregate-unit button{border-radius:8px}
}
