/* Mobile-readable meteorological charts, controls and export actions.
   Scientific data/colors are not transformed; scoped to phones only. */
.cdm-scroll-hint{display:none}
@media(max-width:600px){
 body.cd-mobile-ready :is(.dashboard-main,main,.panel,.card,.controls,
   .t850-grid,.t850-model-card,.t850-comparison-card,
   .strato-diagnostic-charts,.strato-diagnostic-chart){min-width:0}
 body.cd-mobile-ready .cdm-scroll-hint{
   display:block;margin:6px 0 3px;padding:3px 2px;
   color:#4d6378;font:650 11px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif;
 }
 body.cd-mobile-ready :is(.table-wrap,.table-scroll,.regional-ranking-table-wrap,
  .profile-table-scroll,.profile-daily-table,.station-precip-monthly-wrap,
  .strato-trend-table-scroll,.strato-heat-scroll,.strato-diagnostic-table,
  .current-ranking-table-wrap,.current-table-wrap){
   max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;
 }
 body.cd-mobile-ready :is(.chart-container,.chart-box,.t850-chart-shell,
  .strato-diagnostic-chart,.strato-trend-chart,.ensemble-chart,.ecmwf-chart){
   min-width:0;max-width:100%;
 }
 body.cd-mobile-ready :is(.t850-legend-note,.strato-heat-legend,
  .current-map-legend,.regional-map-legends,.sg-links,.chart-legend,.legend,
  .periods,.durations,.toolbar,.t850-export,.strato-diagnostic-actions,
  .strato-heat-actions){
   max-width:100%;flex-wrap:wrap;
 }
 body.cd-mobile-ready :is(.t850-controls,.strato-diagnostic-controls,
  .strato-trend-controls,.controls,.toolbar,.sg-toolbar){
   max-width:100%;min-width:0;
 }
 body.cd-mobile-ready :is(.t850-controls label,.strato-diagnostic-controls label,
  .strato-trend-controls label,.controls label,.sg-toolbar label){
   max-width:100%;min-width:0;
 }
 body.cd-mobile-ready :is(.t850-export button,.strato-heat-actions button,
  .strato-diagnostic-actions button,.toolbar button,.periods button,.durations button){
   min-height:44px;white-space:normal;overflow-wrap:anywhere;line-height:1.3;
 }
 body.cd-mobile-ready :is(.t850-export,.strato-heat-actions,.strato-diagnostic-actions){
   display:flex;flex-wrap:wrap;gap:8px;
 }
 body.cd-mobile-ready :is(.t850-export,.strato-heat-actions,.strato-diagnostic-actions)>button{
   flex:1 1 135px;max-width:100%;
 }
 body.cd-mobile-ready :is(input:not([type="checkbox"]):not([type="radio"]),
   select,textarea){
   min-height:42px;max-width:100%;box-sizing:border-box;
 }
 /* 16px inputs prevent Safari's unwanted zoom on focus at 320–430px. */
 body.cd-mobile-ready :is(input:not([type="checkbox"]):not([type="radio"]),
   select,textarea){font-size:max(16px,1em)}
 body.cd-mobile-ready :is(.sg-grid,.df-grid,.map-layout,.strato-diagnostic-charts){
   min-width:0;max-width:100%;
 }
 body.cd-mobile-ready :is(.sg-image,.chart-body img,.era5-europe-image,
  .hyras-rank-image-wrap img,.polar-map-preview img){
   max-width:100%;height:auto;object-fit:contain;
 }
}
@media(max-width:430px){
 body.cd-mobile-ready :is(main,.dashboard-main){
   padding-left:clamp(9px,3vw,13px);padding-right:clamp(9px,3vw,13px)
 }
 body.cd-mobile-ready :is(.panel,.card,.overview-card,.t850-model-card,
   .t850-comparison-card,.sg-panel){
   max-width:100%;min-width:0;
 }
 body.cd-mobile-ready :is(.t850-chart-shell,.t850-comparison-card .t850-chart-shell,
   .strato-trend-chart,.strato-diagnostic-chart,.strato-prob-chart){
   height:clamp(300px,95vw,370px);min-height:0;
 }
 body.cd-mobile-ready .t850-grid.single-model .t850-chart-shell{
   height:clamp(340px,110vw,440px);
 }
 body.cd-mobile-ready :is(.t850-model-head,.t850-comparison-head){
   flex-wrap:wrap;row-gap:8px;
 }
 body.cd-mobile-ready :is(.t850-model-axis,.t850-axis-field){min-width:0}
 body.cd-mobile-ready .strato-diagnostic-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.cd-mobile-ready .strato-heat-table td{min-width:40px}
 body.cd-mobile-ready .strato-heat-table .strato-heat-sticky{min-width:106px}
 body.cd-mobile-ready :is(.strato-trend-controls label,.strato-diagnostic-controls label,
    .t850-controls .t850-place-control,.t850-controls .t850-view-control,
    .t850-controls .t850-axis-control,.t850-controls .t850-param-control,
    .sg-toolbar label){
    flex:1 1 100%;min-width:0;width:100%;
 }
 body.cd-mobile-ready :is(.strato-trend-controls select,.strato-diagnostic-controls select,
   .sg-toolbar select,.t850-controls select){width:100%;max-width:100%}
 body.cd-mobile-ready .sg-panel .sg-toolbar button{flex:1 1 140px;min-height:44px}
 body.cd-mobile-ready .periods{overflow-x:auto;flex-wrap:nowrap}
 body.cd-mobile-ready .periods button{flex:0 0 auto;min-width:44px}
}
@media(max-width:360px){
 body.cd-mobile-ready .strato-diagnostic-stats{grid-template-columns:1fr}
 body.cd-mobile-ready .strato-diagnostic-stats>div{padding:10px}
 body.cd-mobile-ready :is(.strato-heat-actions,.strato-diagnostic-actions)>button{
    flex-basis:100%;
 }
}
@media(max-width:600px){
 html[data-theme="dark"] body.cd-mobile-ready .cdm-scroll-hint{color:#b2c5db}
}


/* MOSMIX controls are created dynamically from mosmix.js. At 320px the
   forecast-mode strip, location search and chart filters must not require
   a horizontal document pan. Keep all modes and scientific chart panels. */
@media(max-width:430px){
 body.cd-mobile-ready .mosmix-controls{
   display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
   gap:9px;align-items:stretch;
 }
 body.cd-mobile-ready .mosmix-controls .mosmix-mode-group{
   display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
   grid-column:1/-1;width:100%;min-width:0;
 }
 body.cd-mobile-ready .mosmix-mode-button{
   min-width:0;min-height:44px;padding:9px 6px;
   white-space:normal;overflow-wrap:anywhere;text-align:center;
   border-right:1px solid #dbe2e8;border-bottom:1px solid #dbe2e8;
 }
 body.cd-mobile-ready .mosmix-controls :is(.mosmix-map-variant,.mosmix-slider-wrap){
   grid-column:1/-1;min-width:0;
 }
 body.cd-mobile-ready .mosmix-controls .mosmix-download-button{
   grid-column:1/-1;min-height:44px;
 }
 body.cd-mobile-ready .mosmix-controls :is(.mosmix-button,.mosmix-download-button){
   min-width:0;white-space:normal;overflow-wrap:anywhere;
 }
 body.cd-mobile-ready .mosmix-station-search{
   display:flex;width:100%;min-width:0;gap:8px;
 }
 body.cd-mobile-ready .mosmix-station-search input{
   flex:1 1 100%;width:100%;min-width:0;
 }
 body.cd-mobile-ready .mosmix-station-search button{flex:1 1 135px;min-height:44px}
 body.cd-mobile-ready .mosmix-chart-toolbar{
   width:100%;min-width:0;align-items:stretch;gap:9px;
 }
 body.cd-mobile-ready .mosmix-chart-toolbar label{
   display:flex;flex-wrap:wrap;min-width:0;max-width:100%;
 }
 body.cd-mobile-ready .mosmix-chart-toolbar :is(select,input[type="search"]){
   min-width:0;max-width:100%;
 }
 body.cd-mobile-ready .mosmix-chart-grid{grid-template-columns:1fr}
 body.cd-mobile-ready .mosmix-chart-card{min-width:0;max-width:100%;padding:10px}
 body.cd-mobile-ready .mosmix-chart-wrap{min-width:0;height:270px}
 body.cd-mobile-ready .mosmix-chart-wrap.mosmix-chart-short{height:220px}
 body.cd-mobile-ready .mosmix-meteogram-actions button{
   flex:1 1 125px;min-height:44px;white-space:normal;
 }
}


/* At 320px the "Datenquellen" overview table had 18px of intrinsic
   overflow. Keep all table cells and status labels visible by letting them
   wrap inside fixed-width columns rather than broadening the document. */
@media(max-width:430px){
 body.cd-mobile-home .overview-sources{min-width:0;max-width:100%}
 body.cd-mobile-home .overview-source-table{
   table-layout:fixed;
   width:calc(100% - 20px);
   min-width:0;
   max-width:calc(100% - 20px);
   margin:0 10px 12px;
   overflow-wrap:anywhere;
 }
 body.cd-mobile-home .overview-source-table :is(th,td){
   min-width:0;padding:8px 5px;
   overflow-wrap:anywhere;word-break:normal;
 }
 body.cd-mobile-home .overview-source-status{
   min-width:0;white-space:normal;flex-wrap:wrap;
 }
 body.cd-mobile-home .overview-source-table :is(a,span){
   max-width:100%;overflow-wrap:anywhere;
 }
}


/* Ultra-narrow 320px devices: the three-column source table has a
   338px intrinsic minimum (long status labels). Present it in a
   260px keyboard/touch scrollport rather than widening the whole site. */
@media(max-width:350px){
 body.cd-mobile-home #overviewSources{min-width:0;max-width:100%;overflow-x:auto}
 body.cd-mobile-home #overviewSources .overview-source-table{
   display:block;
   box-sizing:border-box;
   width:260px!important;min-width:0!important;max-width:260px!important;
   margin:0 auto 12px!important;
   overflow-x:auto!important;
   -webkit-overflow-scrolling:touch;
   overscroll-behavior-x:contain;
 }
 body.cd-mobile-home #overviewSources .overview-source-table :is(thead,tbody,tr){
   width:max-content;min-width:100%;
 }
}

/* Phase 2 · mobile chart actions and touch hint.
   This only alters interaction controls; plotted meteorological fields,
   contour colors and downloaded image pixels are not restyled. */
.cdm-chart-touch-hint{display:none}
@media(max-width:600px){
 body.cd-mobile-ready .cdm-chart-touch-hint{
  display:flex;align-items:center;gap:8px;
  width:100%;box-sizing:border-box;
  padding:8px 10px;margin:5px 0 12px;
  border:1px solid #d6e3f1;border-radius:8px;
  background:#f0f6fd;color:#38536c;
  font:500 12px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;
 }
 body.cd-mobile-ready :is(
   .chart-export-tools,.chart-export-actions,.chart-actions,
   .strato-downloads,.strato-export-actions,.mosmix-meteogram-actions,
   .station-chart-actions,.station-precip-chart-actions
 ){
  max-width:100%;min-width:0;display:flex;flex-wrap:wrap;
  align-items:center;gap:8px;
 }
 body.cd-mobile-ready :is(
   .chart-export-tools,.chart-export-actions,.chart-actions,
   .strato-downloads,.strato-export-actions,.mosmix-meteogram-actions,
   .station-chart-actions,.station-precip-chart-actions
 ) :is(button,a){
  box-sizing:border-box;min-width:44px;min-height:44px;
  max-width:100%;white-space:normal;overflow-wrap:anywhere;
  touch-action:manipulation;
 }
 body.cd-mobile-ready :is(
   .chart-export-tools,.chart-export-actions,.chart-actions,
   .strato-downloads,.strato-export-actions,.mosmix-meteogram-actions
 ) :is(button,a){flex:0 1 auto}
 body.cd-mobile-ready canvas[aria-describedby*="cdm-chart-tip"]:focus-visible{
  outline:3px solid #317ac3;outline-offset:3px;border-radius:5px;
 }
 html[data-theme="dark"] body.cd-mobile-ready .cdm-chart-touch-hint{
  background:#20354c;color:#d2e5f7;border-color:#4e6880;
 }
 html[data-theme="dark"] body.cd-mobile-ready
  canvas[aria-describedby*="cdm-chart-tip"]:focus-visible{outline-color:#80b9ff}
}
@media(max-width:360px){
 body.cd-mobile-ready :is(
   .chart-export-tools,.chart-export-actions,.chart-actions,
   .strato-downloads,.strato-export-actions,.mosmix-meteogram-actions
 ) :is(button,a){flex:1 1 95px}
}

/* Phase 2 · Export- und Auswahlleisten 320–430 px, no scientific data changes.
   Scope to actual modules; controls wrap instead of widening the viewport. */
@media(max-width:600px){
 body.cd-mobile-ready :is(
   .mosmix-chart-export-actions,.monthly-frequency-export-bar,
   .t850-export,.hyras-map-actions,.hyras-tmean-downloads,
   .era5-atmos-toolbar,.era5-europe-toolbar,.strato-chart-export,
   .state-monthly-export-actions
 ){
   box-sizing:border-box;display:flex;align-items:stretch;
   flex-wrap:wrap;gap:8px;width:100%;max-width:100%;min-width:0;
 }
 body.cd-mobile-ready :is(
   .mosmix-chart-export-actions,.monthly-frequency-export-bar,
   .t850-export,.hyras-map-actions,.hyras-tmean-downloads,
   .era5-atmos-toolbar,.era5-europe-toolbar,.strato-chart-export,
   .state-monthly-export-actions
 ) :is(button,a){
   box-sizing:border-box;flex:1 1 118px;min-width:0;min-height:44px;
   max-width:100%;padding:9px 10px;line-height:1.3;
   white-space:normal;overflow-wrap:anywhere;text-align:center;
   touch-action:manipulation;
 }
 body.cd-mobile-ready :is(
   .monthly-frequency-controls,.mosmix-chart-toolbar,
   .t850-controls,.era5-atmos-layout,.era5-europe-controls,
   .hyras-daily-anomaly-controls,.strato-diagnostic-controls
 ){min-width:0;max-width:100%;box-sizing:border-box}
 body.cd-mobile-ready :is(
   .monthly-frequency-controls,.mosmix-chart-toolbar,
   .t850-controls,.era5-europe-controls,.strato-diagnostic-controls
 ) :is(label,select,input,button){
   max-width:100%;min-width:0;box-sizing:border-box;
 }
 body.cd-mobile-ready :is(.era5-atmos-card,.era5-atmos-image-wrap,
   .era5-atmos-layout,.monthly-frequency-card,.monthly-frequency-chart-wrap,
   .t850-model-card,.t850-comparison-card,.mosmix-chart-card){
   box-sizing:border-box;max-width:100%;min-width:0
 }
 body.cd-mobile-ready .era5-atmos-image-wrap{min-height:260px}
 body.cd-mobile-ready .monthly-frequency-export-bar .monthly-frequency-export-btn{font-weight:700}
 body.cd-mobile-ready .mosmix-chart-export-actions button{font-size:12px}
}
@media(max-width:430px){
 body.cd-mobile-ready .monthly-frequency-controls{grid-template-columns:minmax(0,1fr)}
 body.cd-mobile-ready .mosmix-chart-export-actions{
   display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px
 }
 body.cd-mobile-ready .monthly-frequency-export-bar{
   display:grid;grid-template-columns:repeat(2,minmax(0,1fr))
 }
 body.cd-mobile-ready :is(.t850-export,.hyras-map-actions,.hyras-tmean-downloads){
   flex-wrap:wrap
 }
 body.cd-mobile-ready .t850-export :is(button,a){flex:1 1 125px}
}
@media(max-width:350px){
 body.cd-mobile-ready :is(
   .era5-atmos-layout,.monthly-frequency-chart-wrap,
   .mosmix-chart-wrap,.t850-chart-shell
 ){min-width:0;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
 body.cd-mobile-ready .mosmix-chart-export-actions button{
   padding:8px 3px;font-size:11px
 }
}

/* Step 6: keep Leaflet zoom accessible next to the stations overlay on
   small phones. Reserve a dedicated 48px map-side rail, not a transparent
   control hidden underneath the station filter panel. */
@media(max-width:520px){
 body.cd-mobile-ready #europeStations .europe-station-panel{
   width:calc(100% - 68px);
   max-width:340px;
 }
 body.cd-mobile-ready #europeStationMap .leaflet-top.leaflet-left{
   left:auto;
   right:9px;
   top:7px;
 }
 body.cd-mobile-ready #europeStationMap .leaflet-control-zoom{
   margin:0;
 }
}
