/* Three window sizes with a persistent toolbar. */
body.v9-map-first .sized-panel.sized-panel[hidden],
body.v9-map-first dialog.sized-panel.sized-panel:not([open]) { display: none !important; }
body.v9-map-first .sized-panel.sized-panel > * { flex-shrink: 0; }
body.v9-map-first :is(.sized-panel,.panel-size-local) > .panel-size-controls {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  flex: 0 0 auto;
  align-self: stretch;
  margin: 0 -1px 8px;
  padding: 0 48px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel-solid, #081e27);
}
body.v9-map-first .panel-size-controls > :is(button[data-panel-size-choice],.panel-size-close) {
  min-width: 0;
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 750 14px/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
body.v9-map-first .panel-size-controls > button[aria-pressed="true"] {
  border-color: rgba(88,227,210,.6);
  background: var(--accent-soft);
  color: var(--ink);
}
body.v9-map-first .panel-size-controls > .panel-size-grip {
  position: static;
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  transform: none;
  background: transparent;
  cursor: ns-resize;
  touch-action: none;
}
body.v9-map-first .panel-size-grip::before {
  content: '';
  width: 52px;
  height: 5px;
  border-radius: 99px;
  background: rgba(175,213,214,.45);
}
body.v9-map-first .panel-size-grip i { display: none; }
body.v9-map-first .panel-size-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.v9-map-first .sized-panel.sized-panel > :is(.sheet-close,.media-close) {
  position: absolute;
  z-index: 11;
  top: 24px;
  right: 12px;
  width: 44px;
  height: 44px;
  float: none;
}
body.v9-map-first .sized-panel.sized-panel > :is(#inspectContent,.land-content,.station-list,.harbour-list) {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
body.v9-map-first .land-sheet.sized-panel.sized-panel > header { display: flex !important; }
body.v9-map-first .land-sheet.sized-panel.sized-panel .land-modes { display: flex !important; }
body.v9-map-first .sized-panel.sized-panel > form { min-height: 0; }
body.v9-map-first .sized-panel .media-stage { flex: 1 1 auto; min-height: 100px; }
body.v9-map-first .sized-panel .media-stage :is(img,video) { object-fit: contain; }
body.v9-map-first .sized-panel > :is(.panel-resizer,.panel-resize-e,.panel-resize-bottom,.panel-grip) { display: none !important; }
body.v9-map-first .land-sheet.sized-panel .land-modes > button { flex: 1 1 0; min-width: 0; min-height: 44px; }
body.v9-map-first .sized-panel #closeInfoLayers { width: 44px; height: 44px; min-height: 44px; }
body.v9-map-first .sized-panel.layer-information > header { position: static; }
/* Let a full-screen travel window rise above the desktop header. */
body.v9-map-first .land-ui { z-index: auto; }
body.v9-map-first .sized-panel.sized-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: auto !important;
  overscroll-behavior: contain;
  border: 1px solid var(--line, #31545d);
  border-radius: 18px 18px 0 0;
  padding: 0 12px 12px !important;
  background: var(--panel-solid, #081e27);
  box-shadow: 0 -12px 40px rgba(0,0,0,.45);
}
body.v9-map-first .sized-panel.sized-panel[data-panel-size="full"] { border-radius: 0 !important; }
body.v9-map-first .sized-panel.sized-panel > .panel-size-controls { order: -100; }
body.v9-map-first .sized-panel.sized-panel :is(.browser-size-toggle,#pointSheetHandle,#mInspectExpand) { display: none !important; }
body.v9-map-first .sized-panel.sized-panel > :is(.sheet-close,.media-close,#inspectClose,#mediaClose) { top: 24px !important; }
body.v9-map-first .sized-panel.sized-panel .panel-size-controls { width: auto !important; min-height: 0 !important; }
body.v9-map-first .sized-panel.sized-panel .panel-size-controls button[data-panel-size-choice] { display: block !important; height: 44px !important; width: auto !important; }
body.v9-map-first .sized-panel.sized-panel .panel-size-controls .panel-size-grip { display: grid !important; }
html.atlas-phone-shell.atlas-sheet-open #phoneTabs { z-index: 210 !important; }
html body.v9-map-first #mSheet.sized-panel.sized-panel { display: flex !important; flex-direction: column !important; overflow: hidden !important; padding-top: 0 !important; }
html body.v9-map-first #mSheet.sized-panel.sized-panel[hidden] { display: none !important; }
html body.v9-map-first #mSheet.sized-panel.sized-panel #mBody { flex: 1 1 auto; min-height: 0; max-height: none !important; overflow: auto !important; }
html body.v9-map-first #mSheet.sized-panel.sized-panel #mHandle { position: static !important; width: 100% !important; margin: 0 !important; }
html body.v9-map-first #atlasBriefSheet.sized-panel { display: flex !important; flex-direction: column; }
html body.v9-map-first #atlasBriefSheet.sized-panel[hidden] { display: none !important; }
html body.v9-map-first #atlasBriefSheet.sized-panel #atlasBriefBody { flex: 1 1 auto; min-height: 0; overflow: auto !important; }
/* Short landscape phones keep navigation reachable beside full-screen windows. */
html.atlas-landscape-phone body.v9-map-first #phoneTabs#phoneTabs {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0,1fr));
  position: fixed !important;
  inset: auto 0 0 !important;
  z-index: 210 !important;
  width: 100%;
  height: calc(44px + env(safe-area-inset-bottom)) !important;
  min-height: 44px;
  padding: 0 0 env(safe-area-inset-bottom);
  background: #0c161c;
}
html.atlas-landscape-phone body.v9-map-first #phoneTabs button { min-height: 44px; }
:root { --panel-safe-top: env(safe-area-inset-top, 0px); }
body.v9-map-first .sized-panel.sized-panel { padding-left: max(12px, env(safe-area-inset-left)) !important; padding-right: max(12px, env(safe-area-inset-right)) !important; }
/* Catalogues scroll their list, keeping both size choices and close reachable. */
body.v9-map-first :is(#harbourBrowser,#stationBrowser).sized-panel.sized-panel { overflow: hidden !important; }
body.v9-map-first :is(#harbourBrowser,#stationBrowser).sized-panel.sized-panel > header { position: static !important; z-index: auto !important; flex: 0 0 auto; padding: 8px 0 10px; }
body.v9-map-first :is(#harbourBrowser,#stationBrowser).sized-panel.sized-panel > header > .browser-close { position: absolute; top: 24px; right: 12px; z-index: 11; width: 44px; height: 44px; }
body.v9-map-first :is(#harbourBrowser,#stationBrowser).sized-panel.sized-panel > :is(.harbour-list,.station-list) { flex: 1 1 0 !important; min-height: 0; height: auto !important; }
@media (orientation: landscape) and (max-height: 320px) {
  html body.v9-map-first #stationBrowser.sized-panel.sized-panel:not([hidden]):not([data-panel-size="small"]) {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    grid-template-rows: 52px auto minmax(0,1fr);
    gap: 5px 8px;
  }
  body.v9-map-first #stationBrowser.sized-panel > header { display: none !important; }
  body.v9-map-first #stationBrowser.sized-panel > :is(.panel-size-controls,.station-list) { grid-column: 1 / -1; }
  body.v9-map-first #stationBrowser.sized-panel > :is(.harbour-search,.station-tools) { margin-block: 0; align-self: center; }
  body.v9-map-first #stationBrowser.sized-panel > .station-tools label { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 5px; }
  body.v9-map-first #mediaDialog.sized-panel[open]:not([data-panel-size="small"]) {
    display: grid !important;
    grid-template-columns: minmax(120px,24%) minmax(0,1fr);
    grid-template-rows: 48px auto minmax(0,1fr);
    gap: 6px 10px;
  }
  body.v9-map-first #mediaDialog.sized-panel > .panel-size-controls { grid-column: 1 / -1; }
  body.v9-map-first #mediaDialog.sized-panel #mediaStage {
    grid-column: 2;
    grid-row: 2 / -1;
    min-height: 0;
    aspect-ratio: auto;
    margin: 0;
  }
  body.v9-map-first #mediaDialog.sized-panel #mediaStage > :is(img,video,iframe) { min-height: 0; }
  body.v9-map-first #mediaDialog.sized-panel > #mediaSource { grid-row: 3; margin: 0; }
}
/* Clip the settings window itself; only its content scrolls beneath the header. */
body.v9-map-first #appearancePanel.sized-panel.sized-panel { overflow: hidden !important; }
body.v9-map-first #appearancePanel.sized-panel.sized-panel > header { position: static !important; z-index: auto !important; flex: 0 0 auto; padding: 8px 0 10px; }
body.v9-map-first #appearancePanel.sized-panel.sized-panel .appearance-header-actions > button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
body.v9-map-first #appearancePanel.sized-panel.sized-panel button { min-height: 44px; }
body.v9-map-first #appearancePanel.sized-panel.sized-panel > .appearance-body { flex: 1 1 0 !important; min-height: 0; min-width: 0; overflow: auto !important; overscroll-behavior: contain; padding-bottom: 12px; }

body.v9-map-first .sized-panel.sized-panel .panel-size-original-close { display: none !important; }
body.v9-map-first .panel-size-controls > .panel-size-close {
  position: absolute;
  z-index: 1;
  inset-inline-end: 0;
  bottom: 8px;
  inline-size: 44px;
  block-size: 44px;
  font-size: 22px;
}
body.v9-map-first .sized-panel.sized-panel[data-panel-size="small"] { overflow: hidden !important; }
html body.v9-map-first .sized-panel.sized-panel[data-panel-size="small"] > :not(.panel-size-controls) { display: none !important; }
@media (max-width: 400px) {
  body.v9-map-first .panel-size-controls > button[data-panel-size-choice] { padding-inline: 3px; font-size: 12px; }
}
@media (max-height: 440px) {
  html body.v9-map-first :is(.sized-panel,.panel-size-local) > .panel-size-controls > .panel-size-grip { display: none !important; }
  body.v9-map-first .sized-panel.sized-panel > .panel-size-controls { padding-top: 4px; margin-bottom: 4px; }
}
