/* Phone layout: visible viewport, fixed sheet chrome, independently scrolling content. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
.country-view .atlas-sheet-body { min-width:0; }
@media(max-width:779px), (max-width:1024px) and (pointer:coarse) {
  html, body { width:100%; max-width:100%; overscroll-behavior:none; }
  .country-view { position:fixed; inset:auto 0 auto; top:var(--atlas-viewport-top,0px); height:var(--atlas-viewport,100dvh); width:100%; overflow:hidden; }
  .country-view input, .country-view select, .country-view textarea,
  .country-view .national-route-field input { font-size:16px!important; }
  .country-view *, .country-view *::before, .country-view *::after { box-sizing:border-box; }
  .country-view .national-sidebar.search-hub { top:calc(8px + env(safe-area-inset-top)); left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); width:auto; max-width:none; }
  .country-view .atlas-context-panel,
  .country-view #atlasMenuPanel,.country-view #atlasAccountPanel,.country-view #atlasProfilePanel,.country-view #layersPanel,.country-view #atlasInfoPanel {
    display:flex; flex-direction:column; left:0; right:0; top:auto; bottom:0; width:100%; min-width:0; max-width:100%;
    height:auto; max-height:min(52%,460px); padding:0 16px env(safe-area-inset-bottom); overflow:hidden;
    border-radius:22px 22px 0 0; transition:height 180ms ease; overscroll-behavior:none;
  }
  .country-view #regionPreview { max-height:min(43%,360px); }
  .country-view[data-sheet=full] .atlas-context-panel { height:calc(100% - env(safe-area-inset-top) - 12px); max-height:calc(100% - env(safe-area-inset-top) - 12px); }
  .country-view[data-sheet=peek] .atlas-context-panel { height:calc(98px + env(safe-area-inset-bottom)); max-height:calc(98px + env(safe-area-inset-bottom)); }
  .country-view .atlas-context-panel[hidden] { display:none!important; }
  .country-view .atlas-sheet-body { flex:1 1 auto; min-height:0; overflow:auto; overflow-x:hidden; overscroll-behavior-y:none; padding:0 0 16px; scroll-padding:8px; -webkit-overflow-scrolling:touch; }
  .country-view[data-sheet=peek] .atlas-sheet-body { visibility:hidden; }
  .country-view .atlas-sheet-handle { display:flex!important; position:static; flex:0 0 28px; width:100%; height:28px; min-height:28px; margin:0; padding:0; background:none; border:0; align-items:center; justify-content:center; }
  .country-view .atlas-sheet-grab { touch-action:none; cursor:grab; flex-shrink:0; }
  .country-view .atlas-sheet-dragging { transition:none; max-height:calc(100% - env(safe-area-inset-top) - 8px)!important; }
  .country-view .atlas-context-panel > header { margin:0 0 8px; align-items:center; min-width:0; }
  .country-view .atlas-context-panel h2 { font-size:21px; line-height:1.2; margin:0 48px 8px 0; }
  .country-view #regionPreviewType { flex-shrink:0; font-size:12px; margin-bottom:5px; }
  .country-view #regionPreviewTitle { flex-shrink:0; }
  .country-view #regionPreviewSecondaryTitle { margin:0 48px 8px 0; }
  .country-view #regionPreview .preview-close { top:30px; right:12px; }
  .country-view #regionPreviewText { margin:4px 0 12px; font-size:14px; line-height:1.4; }
  .country-view .region-preview-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .country-view .region-preview-actions .region-route-action { grid-column:auto; }
  .country-view .region-preview-actions button, .country-view .region-preview-actions a { min-width:0; min-height:44px; font-size:15px; padding:10px 8px; }
  .country-view .region-preview-stats { margin-top:16px; }
  .country-view .national-route-profiles { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px; }
  .country-view .national-route-profiles button { min-width:0; width:100%; height:auto; min-height:48px; padding:5px 2px; font-size:13px; gap:3px; white-space:normal; }
  .country-view .national-route-profiles button svg { width:20px; height:20px; flex:0 0 20px; }
  .country-view .national-route-form,.country-view .national-route-result,.country-view .national-route-fields,
  .country-view .national-route-field,.country-view .national-route-field label,.country-view .national-route-field input { min-width:0; max-width:100%; }
  .country-view .national-navigation-launchers { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .country-view .national-navigation-launchers button { min-width:0; }
  .country-view .atlas-toast { top:calc(120px + env(safe-area-inset-top)); bottom:auto; left:12px; right:12px; width:auto; max-width:none; transform:none; padding:9px 12px; font-size:13px; line-height:1.4; pointer-events:none; }
  .country-view .atlas-toast button { pointer-events:auto; min-height:36px; }
  .country-view[data-sheet=full] .atlas-toast { top:calc(70px + env(safe-area-inset-top)); }
  .country-view[data-active-panel=regionPreview] .public-map-controls { display:none; }
  .country-view .search-hub .national-search-results { overflow:auto; overscroll-behavior:contain; max-height:calc(var(--atlas-viewport,100dvh) - env(safe-area-inset-top) - 126px); }
  .country-view #nationalNavigation { inset:0; top:0; bottom:0; width:100%; height:100%; max-height:none; padding:0; overflow:hidden; }
  #nationalNavigation .atlas-guidance-card { left:max(10px,env(safe-area-inset-left)); right:max(10px,env(safe-area-inset-right)); top:calc(8px + env(safe-area-inset-top)); width:auto; transform:none; border-radius:18px; }
  #nationalNavigation .atlas-guidance-main { padding:12px 14px; gap:12px; }
  #nationalNavigation .atlas-guidance-main > svg, #nationalNavigation .national-navigation-maneuver-icon { width:44px; height:44px; flex:0 0 44px; }
  #nationalNavigation #nationalNavigationManeuver { font-size:30px; }
  #nationalNavigation #nationalNavigationInstruction { font-size:17px; line-height:1.3; }
  #nationalNavigation .atlas-guidance-road { padding:7px 14px; font-size:13px; }
  #nationalNavigation .atlas-guidance-road p, #nationalNavigation .atlas-guidance-road span { font-size:13px; }
  #nationalNavigation .atlas-navigation-bottom { left:10px; right:10px; width:auto; transform:none; bottom:calc(26px + env(safe-area-inset-bottom)); }
  #nationalNavigation .atlas-trip-bar { padding:12px; min-height:72px; gap:10px; }
  #nationalNavigation .national-navigation-metrics { min-width:0; gap:8px; }
  #nationalNavigation .national-navigation-metrics b { font-size:20px; white-space:nowrap; }
  #nationalNavigation .national-navigation-metrics small { font-size:12px; }
  #nationalNavigation .atlas-navigation-tools { right:max(10px,env(safe-area-inset-right)); bottom:calc(var(--journey-bottom-height,86px) + 38px + env(safe-area-inset-bottom)); gap:8px; }
  #nationalNavigation .atlas-navigation-tools button { width:44px; height:44px; min-height:44px; padding:10px; border-radius:14px; }
  #nationalNavigation .atlas-navigation-tools button b { display:none; }
  #nationalNavigation .national-navigation-driving { left:12px; bottom:calc(var(--journey-bottom-height,86px) + 38px + env(safe-area-inset-bottom)); }
  #nationalNavigation .national-navigation-speed { min-width:54px; padding:8px; }
  #nationalNavigation .atlas-navigation-options, #nationalNavigation .atlas-navigation-steps-panel { top:calc(env(safe-area-inset-top) + 12px); bottom:auto; left:12px; right:12px; width:auto; max-height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 38px); z-index:10; }
  .country-view .maplibregl-ctrl-bottom-left { bottom:env(safe-area-inset-bottom); max-width:calc(100% - 16px); }
  .country-view .maplibregl-ctrl-attrib { max-width:100%; font-size:10px; line-height:16px; }
  .country-view .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner { display:none; }
  html[data-atlas-keyboard=true] .country-view .atlas-top-actions,
  html[data-atlas-keyboard=true] .country-view .public-map-controls,
  html[data-atlas-keyboard=true] .country-view .atlas-weather { display:none; }
  html[data-atlas-keyboard=true] .country-view .atlas-context-panel { max-height:calc(100% - env(safe-area-inset-top) - 4px); }
  html[data-atlas-keyboard=true] .country-view .national-route-suggestions { max-height:140px; }
}
@media(max-width:1024px) and (orientation:landscape) and (pointer:coarse) {
  .country-view .national-sidebar.search-hub { top:8px; height:48px; grid-template-columns:1fr; grid-template-rows:48px; padding:0; border:0; background:none; width:auto; max-width:480px; }
  .country-view .national-sidebar .atlas-brand { display:none!important; }
  .country-view .national-sidebar .national-search { grid-column:1; grid-row:1; }
  .country-view .atlas-top-actions { display:flex; position:fixed; top:8px; right:max(12px,env(safe-area-inset-right)); left:auto; }
  .country-view .atlas-top-actions button { width:44px; padding:10px; }
  .country-view .atlas-top-actions button b { display:none; }
  .country-view .search-hub .national-search-results { top:52px; max-height:calc(var(--atlas-viewport,100dvh) - 66px); }
  .country-view .atlas-context-panel { left:max(8px,env(safe-area-inset-left)); right:auto; width:min(400px,55%); max-height:calc(100% - 70px); border-radius:18px 18px 0 0; }
  .country-view #atlasMenuPanel,.country-view #atlasAccountPanel,.country-view #atlasProfilePanel,.country-view #layersPanel,.country-view #atlasInfoPanel { left:max(8px,env(safe-area-inset-left)); right:auto; width:min(400px,55%); max-height:calc(100% - 70px); }
  .country-view[data-sheet=full] .atlas-context-panel, html[data-atlas-keyboard=true] .country-view .atlas-context-panel { height:calc(100% - 8px); max-height:calc(100% - 8px); }
  #nationalNavigation .atlas-guidance-card { width: min(330px,43%); right:auto; top:8px; }
  #nationalNavigation .atlas-guidance-road { display:none; }
  #nationalNavigation .atlas-navigation-bottom { left:max(10px,env(safe-area-inset-left)); width:min(350px,46%); bottom:calc(20px + env(safe-area-inset-bottom)); }
  #nationalNavigation .atlas-navigation-tools { right:max(12px,env(safe-area-inset-right)); bottom:calc(24px + env(safe-area-inset-bottom)); flex-direction:row; }
  #nationalNavigation .national-navigation-driving { top:10px; left:auto; right:max(12px,env(safe-area-inset-right)); bottom:auto; }
  .country-view .atlas-toast { top:65px; max-width:440px; }
}
@media(prefers-reduced-motion:reduce) { .country-view .atlas-context-panel { transition:none; } }
@media(max-width:1024px) and (pointer:coarse) {
  html[data-atlas-keyboard=true] .country-view #nationalRouteDrawer > header,
  html[data-atlas-keyboard=true] .country-view #nationalRouteDrawer .national-route-profiles { display:none; }
  html[data-atlas-keyboard=true] .country-view #nationalRouteDrawer .atlas-sheet-handle { flex-basis:18px; min-height:18px; height:18px; }
  html[dir=rtl] .country-view .atlas-context-panel h2 { margin:0 0 8px 48px; }
  html[dir=rtl] .country-view #regionPreview .preview-close { left:12px; right:auto; }
}

/* Floating cards leave a visible map margin and keep dialogs below the status bar. */
@media(max-width:779px), (max-width:1024px) and (pointer:coarse) {
 .country-view { --atlas-sheet-top:70; }
 .country-view .atlas-context-panel,
 .country-view #regionPreview,.country-view #nationalRouteDrawer,.country-view #atlasNearbyPanel,
 .country-view #atlasMenuPanel,.country-view #atlasAccountPanel,.country-view #atlasProfilePanel,.country-view #layersPanel,.country-view #atlasInfoPanel {
  left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));width:auto;max-width:none;
  bottom:calc(8px + env(safe-area-inset-bottom));padding:0 14px;border-radius:24px;box-shadow:0 8px 32px #0003;
 }
 .country-view[data-sheet=full] .atlas-context-panel {height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);max-height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);}
 .country-view[data-sheet=peek] .atlas-context-panel {height:100px;max-height:100px;}
 .country-view .atlas-sheet-grab {touch-action:pan-y;}
 .country-view .atlas-sheet-body {overscroll-behavior-y:contain;}
 .country-view .atlas-sheet-dragging {max-height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px)!important;}
 .country-view .atlas-context-panel > header {flex-shrink:0;}
 .country-view .atlas-sheet-handle {flex-basis:24px;min-height:24px;height:24px;}
 dialog.atlas-beta-dialog,dialog.atlas-contribute-dialog,dialog.atlas-save-dialog {
  box-sizing:border-box;width:calc(100% - 32px);max-width:480px;
  max-height:calc(var(--atlas-viewport,100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px);
  position:fixed;top:calc(var(--atlas-viewport-top,0px) + env(safe-area-inset-top) + 12px);bottom:auto;
  margin:0 auto;padding:20px;border-radius:24px;overflow:auto;overscroll-behavior:contain;
 }
 dialog input,dialog select,dialog textarea {font-size:16px!important;}
 .atlas-beta-dialog textarea {min-height:100px;max-height:180px;}
 html[data-atlas-keyboard=true] dialog textarea {height:min(120px,var(--atlas-field-space,120px));min-height:min(44px,var(--atlas-field-space,120px));max-height:var(--atlas-field-space,120px);overflow:auto;}
 .atlas-beta-dialog .beta-consent {padding:14px;}
 .atlas-transit-stop-list {margin:0 0 12px 38px;font-size:13px;}
 .country-view #nationalRouteSteps button {align-items:flex-start;gap:8px;}
 .country-view #nationalRouteSteps button small {display:block;line-height:1.5;}
}
@media(max-width:1024px) and (orientation:landscape) and (pointer:coarse) {
 .country-view .atlas-context-panel,.country-view #regionPreview,.country-view #nationalRouteDrawer,.country-view #atlasNearbyPanel,.country-view #atlasMenuPanel,.country-view #atlasAccountPanel,.country-view #atlasProfilePanel,.country-view #layersPanel,.country-view #atlasInfoPanel {right:auto;width:min(400px,55%);}
}

/* State selectors must outrank the ID-based panel defaults above. Inline drag
   heights remain authoritative while the finger moves. */
@media(max-width:779px), (max-width:1024px) and (pointer:coarse) {
 .country-view[data-sheet=full] :is(#regionPreview,#nationalRouteDrawer,#atlasNearbyPanel,#layersPanel,#atlasInfoPanel,#atlasAccountPanel,#atlasProfilePanel,#atlasMenuPanel) {
  height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  max-height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
 }
 .country-view[data-sheet=peek] :is(#regionPreview,#nationalRouteDrawer,#atlasNearbyPanel,#layersPanel,#atlasInfoPanel,#atlasAccountPanel,#atlasProfilePanel,#atlasMenuPanel) {height:100px;max-height:100px;}
}

/* One scroll container per sheet, including the ID-specific route defaults. */
.atlas-sheet-resume {display:none;}
.country-view #nationalNavigation {backdrop-filter:none;-webkit-backdrop-filter:none;}
#nationalNavigation[data-camera=free] #nationalNavigationRecenter {background:var(--atlas-blue,#2668eb);color:#fff;}
#nationalNavigation .national-navigation-audio > div {grid-template-columns:minmax(0,1fr);}
#nationalNavigation .national-navigation-audio label {display:grid;gap:6px;min-width:0;}
#nationalNavigation .national-navigation-audio select {box-sizing:border-box;height:48px;min-height:48px;padding:0 10px;font-size:16px;line-height:normal;}
#nationalNavigation .atlas-navigation-options details > summary {display:block;list-style:revert;}
#nationalNavigation .atlas-navigation-options .atlas-voice-help {display:none;}
@media(max-width:779px), (max-width:1024px) and (pointer:coarse) {
 .country-view :is(#regionPreview,#nationalRouteDrawer,#atlasNearbyPanel,#layersPanel,#atlasInfoPanel,#atlasAccountPanel,#atlasProfilePanel,#atlasMenuPanel) {display:flex;flex-direction:column;top:auto;overflow:hidden;}
 .country-view[data-sheet=half] :is(#nationalRouteDrawer,#atlasNearbyPanel) {height:min(52%,460px);max-height:min(52%,460px);}
 .country-view[data-sheet=peek] #nationalRouteDrawer {height:136px;max-height:136px;}
 .country-view[data-sheet=peek] #nationalRouteDrawer .atlas-sheet-body {display:none;}
 .country-view[data-sheet=peek] #nationalRouteDrawer > header {margin-bottom:2px;}
 .country-view[data-sheet=peek] .atlas-sheet-resume {display:block;flex:0 0 44px;min-height:44px;width:100%;margin:0 0 8px;border:0;border-radius:12px;background:var(--atlas-milk);color:var(--atlas-ink);font-family:inherit;font-size:15px;font-weight:600;}
 #nationalNavigation .atlas-navigation-options, #nationalNavigation .atlas-navigation-steps-panel {top:auto;bottom:calc(26px + env(safe-area-inset-bottom));left:12px;right:12px;max-height:min(46%,390px);padding:12px 16px;border-radius:22px;overscroll-behavior:contain;}
 #nationalNavigation .atlas-navigation-options > header {position:sticky;top:-12px;background:var(--atlas-paper);z-index:1;padding:4px 0;}
 #nationalNavigation .atlas-navigation-options h2 {font-size:18px!important;}
 #nationalNavigation .atlas-navigation-options .atlas-camera-hint {font-size:13px;}
}
@media(max-width:1024px) and (orientation:landscape) and (pointer:coarse) {
 #nationalNavigation .atlas-navigation-options, #nationalNavigation .atlas-navigation-steps-panel {left:auto;right:max(12px,env(safe-area-inset-right));bottom:12px;width:min(340px,48%);max-height:calc(100% - 24px);}
}

/* A calculated itinerary opens on its results, not the transport help form. */
.country-view[data-map-state=route-selected] #nationalRouteForm {display:none;}

/* Search results can be tucked away while their pins remain on the map. */
.atlas-nearby-resume{display:none;}
@media(max-width:779px), (max-width:1024px) and (pointer:coarse){
 .country-view[data-sheet=peek] #atlasNearbyPanel{height:96px;max-height:96px;padding-bottom:8px;}
 .country-view[data-sheet=peek] #atlasNearbyPanel>header,.country-view[data-sheet=peek] #atlasNearbyPanel>.atlas-sheet-body{display:none;}
 .country-view[data-sheet=peek] #atlasNearbyPanel>.atlas-sheet-handle{flex-basis:20px;height:20px;min-height:20px;}
 .country-view[data-sheet=peek] #atlasNearbyPanel>.atlas-nearby-resume{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:1 1 auto;min-height:56px;width:100%;margin:0;padding:0 0 4px;border:0;background:transparent;color:var(--atlas-ink);font:inherit;text-align:start;cursor:pointer;touch-action:manipulation;}
 .atlas-nearby-resume>span:first-child{min-width:0;}
 .atlas-nearby-resume strong,.atlas-nearby-resume small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
 .atlas-nearby-resume strong{font-size:18px;line-height:1.3;}
 .atlas-nearby-resume small{margin-top:3px;font-size:13px;line-height:1.4;color:var(--atlas-muted);}
 .atlas-nearby-resume-arrow{font-size:28px;line-height:1;flex-shrink:0;color:var(--atlas-blue,#2463ed);}
}
