/* Keep the phone comparison separate from the compact playback layout. */
html.atlas-phone-shell body.v9-map-first #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"] {
  position: fixed !important;
  inset: auto 8px calc(var(--atlas-tab-h, 44px) + var(--atlas-visual-bottom, 0px)) !important;
  width: auto !important;
  height: min(70dvh, calc(100dvh - var(--atlas-tab-h, 44px) - var(--atlas-visual-bottom, 0px) - 12px)) !important;
  min-height: 0 !important;
  max-height: none !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 135 !important;
  box-sizing: border-box;
}

html.atlas-phone-shell body.v9-map-first #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"][data-dock-mode="full"] {
  height: calc(100dvh - var(--atlas-tab-h, 44px) - var(--atlas-visual-bottom, 0px) - max(8px, env(safe-area-inset-top))) !important;
}

html.atlas-phone-shell body #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"] #graphPanel,
html.atlas-phone-shell body #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"] #graphPanelBody {
  display: flex !important;
  flex: 1 1 0 !important;
  flex-direction: column;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphDockMove {
  display: flex !important;
  flex: 0 0 44px;
  align-items: center;
}

html.atlas-phone-shell #weatherGraphSystem[data-phone-graph-focus="true"] #phoneCloseGraphs:not([hidden]) {
  min-width: 44px;
  min-height: 44px;
  font-size: 24px;
}

html.atlas-phone-shell #weatherGraphSystem[data-phone-graph-focus="true"] #phoneGraphSizes:not([hidden]) {
  display: flex;
  gap: 3px;
  margin-inline-start: auto;
}
html.atlas-phone-shell #phoneGraphSizes > button { min-height: 44px; padding-inline: 6px; white-space: nowrap; font-size: 12px; }
html.atlas-phone-shell #phoneGraphSizes > button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 460px) {
  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphDockMove > div:first-child {
    min-width: 0; flex: 1 1 auto; overflow: hidden;
  }
  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphDockMove > div:first-child :is(small,b) {
    display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  }
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList {
  display: flex !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow: auto !important;
  overscroll-behavior: contain;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-track-canvas {
  height: 150px !important;
  min-height: 150px !important;
  max-height: none !important;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-summary {
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 4px 6px !important;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  color: #f7fafb !important;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-summary > span {
  gap: 4px;
  max-width: 100%;
  padding: 3px 6px !important;
  min-height: 24px !important;
  flex-wrap: wrap;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-summary b {
  font-size: 14px !important;
  font-weight: 700 !important;
  white-space: normal;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-time {
  font-size: 12px !important;
  color: #f7fafb;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-summary :is(em, small) {
  font-size: 11px !important;
}

html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #addGraphTrack {
  display: block !important;
  position: static;
  flex: none;
  min-height: 44px;
}

html.atlas-phone-shell body.v9-map-first #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"].graph-picking:not(.graph-picking-list) {
  height: 128px !important;
}

html.atlas-phone-shell body #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"].graph-picking #graphPanelBody {
  display: none !important;
}

.graph-picking-list #graphPanel > :is(.graph-time-controls, .regional-graph-settings, .graph-period-label) {
  display: none !important;
}

#graphStationPicker:not([hidden]) {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px 8px;
}

#graphStationQuery {
  flex: none;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 16px;
}

#graphStationResults {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

#graphStationResults button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: start;
}

#graphStationResults small {color: var(--muted);}
#graphPickMapToggle {margin-left: auto;}

@media (orientation: landscape) and (max-height: 520px) {
  html.atlas-phone-shell body.v9-map-first #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"]:is(:not(.graph-picking), .graph-picking-list) {
    top: max(8px, env(safe-area-inset-top)) !important;
    height: auto !important;
  }

  html.atlas-phone-shell body.v9-map-first #weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem#weatherGraphSystem[data-phone-graph-focus="true"][data-dock-mode="half"]:is(:not(.graph-picking), .graph-picking-list) {
    top: max(24px, env(safe-area-inset-top)) !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-track-canvas {
    --comparison-plot-height: clamp(88px, 100dvh - 236px, 150px);
    flex: 0 0 var(--comparison-plot-height) !important;
    height: var(--comparison-plot-height) !important;
    min-height: var(--comparison-plot-height) !important;
    max-height: var(--comparison-plot-height) !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"][data-dock-mode="half"] .graph-track-canvas {
    --comparison-plot-height: clamp(72px, 100dvh - 250px, 124px);
  }

  #graphStationResults {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    column-gap: 12px;
  }

}

@media (orientation: landscape) and (max-height: 318px) {
  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphDockMove #addGraphTrack {
    width: auto !important;
    min-height: 36px !important;
    padding: 0 8px !important;
    white-space: nowrap;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"].graph-picking #graphDockMove #addGraphTrack {
    display: none !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-time-controls {
    padding-block: 2px !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] .graph-cursor-summary {
    background: transparent !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):only-child:has(.phone-track-settings:not([open])) {
    min-height: 0 !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):only-child:has(.phone-track-settings:not([open])) .graph-track-canvas {
    flex: 1 1 0 !important;
    height: auto !important;
    min-height: 62px !important;
    max-height: none !important;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):not(:only-child):has(.phone-track-settings:not([open])) {
    flex: none !important;
    min-height: 0 !important;
  }

  /* Put the single station's readout beside its name, clear of the curve. */
  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):not(:has(.graph-station-chip:nth-child(2))) > .phone-track-settings:not([open]) > summary {
    width: 39%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):not(:has(.graph-station-chip:nth-child(2))):has(.phone-track-settings:not([open])) .graph-track-canvas {
    overflow: visible;
  }

  html.atlas-phone-shell body #weatherGraphSystem[data-phone-graph-focus="true"] #graphTrackList .graph-track:not(.graph-region-track):not(:has(.graph-station-chip:nth-child(2))):has(.phone-track-settings:not([open])) .graph-cursor-summary {
    top: auto !important;
    bottom: 100%;
    left: 40% !important;
    padding: 0 2px !important;
    height: 24px;
    flex-wrap: nowrap;
  }
}
