/* Phone navigation and sheets. Desktop components retain their own layout. */
#mobileSearchShortcut,.mobile-sheet-size,.mobile-city-facts { display:none; }
@media (max-width:680px), (max-width:960px) and (max-height:500px) and (pointer:coarse) {
  :root {
    --mobile-dock-space:76px;
    --mobile-keyboard-offset:0px;
    --mobile-panel-height:calc(var(--mobile-viewport-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 60px - var(--mobile-dock-space));
    --mobile-sheet-bottom:calc(var(--mobile-keyboard-offset) + env(safe-area-inset-bottom) + var(--mobile-dock-space));
  }
  html body .page .topline { gap:8px; }
  html body .page .topline .brand { border:0;box-shadow:none;background:var(--mobile-surface)!important; }
  #mobileSearchShortcut { display:flex;align-items:center;flex:1;min-width:0;min-height:44px;padding:0 12px;border:1px solid var(--theme-border);border-radius:12px;background:var(--mobile-surface);color:var(--theme-text);font:inherit;font-size:14px;font-weight:700;text-align:left;box-shadow:0 2px 12px #0002;pointer-events:auto; }
  html body .page .topline .top-actions { flex:none;width:48px!important; }
  html body #visualThemePicker > summary { width:48px;min-width:48px;font-size:12px; }
  #visualThemePicker > summary .visual-theme-summary-icon { display:none; }
  #visualThemePicker > summary::before { content:'設定'; }
  html body #visualThemePicker .visual-theme-menu { width:min(330px,calc(100vw - var(--mobile-left) - var(--mobile-right)));max-height:var(--mobile-panel-height);overflow-y:auto;overscroll-behavior:contain;padding:12px; }
  html body .visual-theme-menu .mobile-header-tools { display:grid!important;gap:8px;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--theme-border); }
  .mobile-header-tools .map-explore-presets { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px; }
  html body .mobile-header-tools .map-explore-preset { display:flex;flex-direction:column;width:100%;height:auto;min-height:56px;padding:6px;font-size:12px;gap:3px; }
  .mobile-header-tools .map-explore-preset-label { display:block;font-size:12px; }
  html body .mobile-header-tools .map-layer-detail-toggle { width:100%;font-size:13px; }
  html body #visualThemePicker .visual-theme-menu #mapHelpBtn { width:100%;height:48px;display:flex;align-items:center;justify-content:flex-start;padding:8px 12px;gap:8px; }
  #visualThemePicker .visual-theme-menu #mapHelpBtn .map-help-label { display:inline; }
  #mobileSearchShortcut:focus-visible { outline:3px solid var(--theme-accent);outline-offset:2px; }

  html body #concentrationModeLaunchers {
    display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;padding:5px;box-sizing:border-box;
    height:64px;border:1px solid var(--theme-border);border-radius:18px;background:var(--mobile-surface);box-shadow:0 5px 25px #0005;
    bottom:calc(var(--mobile-keyboard-offset) + env(safe-area-inset-bottom) + 6px);
  }
  html body #concentrationModeLaunchers > button,
  html body #concentrationModeLaunchers > #cityModeReopen,
  html body #concentrationModeLaunchers > #railwayRouteReopen,
  html body #concentrationModeLaunchers > #airportModeReopen,
  html body #concentrationModeLaunchers > #tripModeReopen,
  html body #concentrationModeLaunchers > #mobileRecordsButton {
    min-height:52px!important;height:52px!important;min-width:0;border:0!important;border-radius:12px!important;
    padding:4px 2px!important;gap:3px!important;background:transparent!important;color:var(--theme-text)!important;
    box-shadow:none!important;transform:none!important;transition:background-color .12s;outline:0;
  }
  html body #concentrationModeLaunchers > button[aria-pressed="true"] { background:var(--theme-launcher)!important;box-shadow:inset 0 0 0 2px var(--theme-accent)!important;outline:0; }
  html body #concentrationModeLaunchers > button:focus-visible { outline:3px solid var(--theme-accent);outline-offset:0; }
  #concentrationModeLaunchers .launcher-state { display:none!important; }
  html body #concentrationModeLaunchers .railway-route-reopen-icon { background:transparent!important;color:var(--theme-text)!important;border:0!important;width:24px!important;height:24px!important; }
  html body #concentrationModeLaunchers .mobile-launcher-symbol { width:22px;height:22px; }
  html body #concentrationModeLaunchers .railway-route-reopen-copy strong { font-size:12px!important; }

  html body #cityModePanel:not([hidden]),html body #airportModePanel:not([hidden]) {
    top:auto!important;bottom:var(--mobile-sheet-bottom)!important;height:min(60dvh,var(--mobile-panel-height))!important;max-height:var(--mobile-panel-height)!important;
    display:flex!important;flex-direction:column;overflow:hidden!important;border-radius:20px;padding:0 12px 8px!important;
    box-shadow:0 -8px 30px #0004;
  }
  html body #cityModePanel[data-sheet-size="expanded"]:not([hidden]),html body #airportModePanel[data-sheet-size="expanded"]:not([hidden]),
  html body #cityModePanel:has(#cityModeFilterOptions[open]):not([hidden]) { height:var(--mobile-panel-height)!important; }
  html body #cityModePanel .city-mode-heading,html body #airportModePanel .airport-mode-heading { flex:none;min-height:56px;margin-bottom:8px;padding:6px 12px;gap:5px; }
  html body #cityModePanel .city-mode-heading strong,html body #airportModePanel .airport-mode-heading strong { font-size:15px; }
  #cityModePanel .city-mode-heading small,#airportModePanel .airport-mode-heading small { display:none; }
  html body #cityModePanel .mobile-sheet-size,html body #airportModePanel .mobile-sheet-size { display:block;font-size:11px;width:44px;height:44px; }
  #cityModePanel .city-mode-search > span,#airportModePanel .airport-mode-search > span,
  #cityModePanel .city-mode-note,#cityModePanel .mobile-ratio-guide,#airportModePanel .airport-mode-note { display:none; }
  #cityModePanel .city-mode-search,#airportModePanel .airport-mode-search { margin-bottom:8px; }
  #cityModeFilterOptions { margin-bottom:6px;max-height:44%;overflow:auto;overscroll-behavior:contain; }
  #cityModeFilterOptions > summary { min-height:44px;padding:6px 10px; }
  #cityModePanel .city-mode-results-heading { min-height:28px; }
  #airportModePanel .airport-mode-filters { margin-bottom:8px; }
  #airportModePanel .airport-mode-filters button { font-size:11px; }
  html body #cityModePanel .city-mode-list,html body #cityModePanel:has(#cityModeFilterOptions[open]) .city-mode-list,
  html body #airportModePanel .airport-mode-list { flex:1 1 auto!important;min-height:64px;overflow:auto!important;overscroll-behavior:contain; }
  #cityModePanel .city-mode-option-meta .city-mode-option-share { display:none; }
  html body #cityModePanel .city-mode-option { grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;gap:2px 8px;min-height:64px;padding:8px 10px; }
  #cityModePanel .city-mode-option-name { grid-column:1;grid-row:1;font-size:16px; }
  #cityModePanel .city-mode-option-tier { grid-column:2!important;grid-row:1/3;align-self:center; }
  #cityModePanel .city-mode-option-meta { grid-column:1;grid-row:2;text-align:left; }
  #cityModePanel .city-mode-option-meta > span:first-child { font-size:12px; }
  html body #cityModeRestore,html body #airportModeRestore { top:var(--mobile-panel-top)!important;bottom:auto!important;min-height:44px;height:44px;max-width:calc(100vw - var(--mobile-left) - var(--mobile-right)); }
  html body #cityInfoCard:not([hidden]),html body #heritageInfoCard:not([hidden]),html body #flightFocusCard:not([hidden]) { bottom:var(--mobile-sheet-bottom)!important;max-height:min(56dvh,var(--mobile-panel-height))!important; }
  html body #cityInfoCard .city-info-header,html body #heritageInfoCard .city-info-header,html body #flightFocusCard > header { min-height:56px;margin-bottom:8px;padding:6px 12px; }
  #cityInfoCard .city-info-recommendations h3 { font-size:14px; }
  #cityInfoCard .city-info-recommendations p { font-size:14px!important;line-height:1.75!important; }
  .mobile-city-facts { display:block;border-block:1px solid var(--theme-border);margin-top:12px; }
  .mobile-city-facts > summary { min-height:44px;padding:10px 0;box-sizing:border-box;font-size:13px;font-weight:700;cursor:pointer; }
  #cityInfoCard .mobile-city-facts .city-info-specs { margin-top:8px; }
  html body #railwayRoutePanel:not([hidden]),html body #railwayRoutePanel[data-collapsed="true"]:not([hidden]) { bottom:var(--mobile-sheet-bottom)!important; }
  .toast { bottom:calc(var(--mobile-sheet-bottom) + 8px); }
  :root[data-mobile-keyboard="true"] { --mobile-dock-space:8px; }
  :root[data-mobile-keyboard="true"][data-mobile-focus] body #concentrationModeLaunchers:not([hidden]) { display:none!important; }
  :root[data-mobile-keyboard="true"] body #cityModePanel:not([hidden]),:root[data-mobile-keyboard="true"] body #airportModePanel:not([hidden]) { height:var(--mobile-panel-height)!important; }
  :root[data-mobile-keyboard="true"] #cityModeFilterOptions,:root[data-mobile-keyboard="true"] .city-mode-results-heading,:root[data-mobile-keyboard="true"] .airport-mode-filters { display:none!important; }
  html body .workspace .side:not(.side-minimized) { max-height:var(--mobile-panel-height)!important; }
  /* While choosing a new place, dense labels must not intercept the map tap. */
  .map-column.adding #map .leaflet-marker-pane *,
  .map-column.adding #map .leaflet-tooltip-pane *,
  .map-column.adding #map .leaflet-overlay-pane path { pointer-events:none!important; }
  .mobile-add-hint:not([hidden]) { display:flex;align-items:center;justify-content:space-between;gap:8px;position:fixed;left:var(--mobile-left);right:var(--mobile-right);top:var(--mobile-panel-top);z-index:1550;padding:6px 8px 6px 12px;border:1px solid var(--theme-accent);border-radius:12px;background:var(--mobile-surface);color:var(--theme-text);font-size:13px;box-shadow:0 3px 15px #0004; }
  .mobile-add-hint button { min-height:44px;min-width:60px;padding:6px 10px;font:inherit;font-weight:700;border:1px solid var(--theme-border);border-radius:9px;background:var(--theme-action);color:var(--theme-action-text); }
}
@media (max-width:960px) and (max-height:500px) and (pointer:coarse) {
  html body #cityModePanel:not([hidden]),html body #airportModePanel:not([hidden]) { height:var(--mobile-panel-height)!important; }
  #cityModePanel .city-mode-results-heading { display:none; }
  #airportModePanel .airport-mode-filters { grid-template-columns:repeat(3,1fr); }
  html body #cityModePanel .city-mode-heading,html body #airportModePanel .airport-mode-heading { min-height:48px;padding-block:2px;margin-bottom:4px; }
  html body #cityInfoCard:not([hidden]),html body #heritageInfoCard:not([hidden]),html body #flightFocusCard:not([hidden]) { max-height:calc(var(--mobile-panel-height) - 52px)!important; }
  .mobile-add-hint { right:auto!important;width:min(440px,calc(100vw - var(--mobile-left) - var(--mobile-right)));box-sizing:border-box; }
}
@media (prefers-reduced-motion:reduce) { html body #concentrationModeLaunchers > button { transition:none; } }
