/* RADARCESKA-MOBILE-MAP-CONTROLS-v1.0.3
   Visual, mobile-only refinement. No changes to control positioning engines,
   radar playback geometry, map data or mode-switch JavaScript.
   App controls retain existing click handlers and their intrinsic hidden states.
*/
@media (max-width:700px) {
  /* Scoped palette: live content and alerts still use their native status colors. */
  #app[data-mode="weather"] { --rc-map-polish-accent:#078f7b; --rc-map-polish-tint:#eaf8f4; }
  #app[data-mode="traffic"] { --rc-map-polish-accent:#af672d; --rc-map-polish-tint:#fff4e9; }
  #app[data-mode="trains"] { --rc-map-polish-accent:#28769a; --rc-map-polish-tint:#eef7fb; }
  #app[data-mode="buses"] { --rc-map-polish-accent:#078e81; --rc-map-polish-tint:#ebf8f5; }
  #app[data-mode="water"] { --rc-map-polish-accent:#276f9d; --rc-map-polish-tint:#edf6fb; }

  /* The pre-existing map-actions column owns its bottom coordinate. Changing
     that bottom would overlap a selected-place sheet or radar playback. */
  #app .map-actions {
    right:max(9px,env(safe-area-inset-right,0px))!important;
    gap:8px;
  }
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn) {
    box-sizing:border-box;
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    min-height:44px!important;
    padding:0;
    display:grid;
    place-items:center;
    border-radius:14px!important;
    border:1px solid rgba(45,88,96,.14);
    background:rgba(255,255,255,.97);
    color:#244b54;
    box-shadow:0 5px 18px rgba(31,64,70,.12),0 1px 3px rgba(31,64,70,.05);
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation;
    transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease;
  }
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn)[hidden],
  #app .map-actions > #touristMapBtn[hidden] {display:none!important;}
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn) svg {
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.75;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn):active {
    background:var(--rc-map-polish-tint,#eaf8f4);
    border-color:rgba(11,145,126,.25);
  }
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn):focus-visible {
    outline:2px solid var(--rc-map-polish-accent,#078f7b);
    outline-offset:2px;
  }
  /* Preserve the app's GPS semantics: a location fix is not necessarily active
     follow mode. Use aria-pressed / is-following rather than has-location. */
  #app .map-actions > #locateBtn:is(.is-following,[aria-pressed="true"]) {
    color:var(--rc-map-polish-accent,#078f7b)!important;
    background:var(--rc-map-polish-tint,#eaf8f4)!important;
    border-color:rgba(6,141,123,.34)!important;
    box-shadow:0 0 0 2px rgba(11,145,126,.08),0 5px 18px rgba(31,64,70,.10);
  }
  #app .map-actions > #locateBtn.is-loading {
    cursor:progress;
  }
  /* No redesign of the tourist map action in other modes. */
  #app[data-mode="trains"] #touristMapBtn {display:none!important;}

  /* Context navigation is one-at-a-time even if a legacy CSS rule would
     override the browser's [hidden] styling during a mode transition. */
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav)[hidden] {
    display:none!important;
  }
  #app:not([data-mode="weather"]) #mobileWeatherNav,
  #app:not([data-mode="traffic"]) #mobileTrafficNav,
  #app:not([data-mode="trains"]) #mobileTrainNav,
  #app:not([data-mode="buses"]) #mobileBusNav,
  #app:not([data-mode="water"]) #mobileWaterNav {display:none!important;}

  /* Maintain each nav's sizing and scroll/gesture behavior; only unify
     surfaces, active affordance and keyboard/touch focus. */
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav):not([hidden]) {
    box-sizing:border-box;
    border-color:rgba(43,82,89,.10);
    box-shadow:0 -4px 19px rgba(26,62,70,.06);
    -webkit-backdrop-filter:blur(14px);
    backdrop-filter:blur(14px);
  }
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav)
    :is(.mobile-nav-item,.mobile-traffic-btn,.mobile-train-btn,.mobile-water-btn) {
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation;
    transition:background-color .15s ease,border-color .15s ease,color .15s ease;
  }
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav)
    :is(.mobile-nav-item,.mobile-traffic-btn,.mobile-train-btn,.mobile-water-btn):focus-visible {
    outline:2px solid var(--rc-map-polish-accent,#078f7b);
    outline-offset:-2px;
  }
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav)
    :is(.mobile-nav-item,.mobile-traffic-btn,.mobile-train-btn,.mobile-water-btn)[aria-pressed="true"] {
    border-color:rgba(12,117,108,.17);
    box-shadow:inset 0 0 0 1px rgba(12,117,108,.05);
  }

  /* Every visible detail sheet shares a quiet edge without modifying drag,
     collapse, its height or proximity to the map controls. */
  #app .mobile-map-sheet:not([hidden]) {
    border-color:rgba(39,84,93,.12);
    box-shadow:0 -7px 28px rgba(28,58,67,.11);
  }
  #app :is(#incidentCard,#trafficOverview,#trainDetailCard,#trainOverview,#busDetailCard,#busOverview)[hidden] {
    display:none!important;
  }
}
@media (max-width:360px) {
  #app .map-actions {right:max(7px,env(safe-area-inset-right,0px))!important;gap:7px;}
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn) {
    width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;border-radius:13px!important;
  }
}
@media (prefers-reduced-motion:reduce) {
  #app .map-actions > :is(#locateBtn,#layersBtn,#satelliteBaseBtn,#overviewRestoreBtn,#alertBtn),
  #app :is(#mobileWeatherNav,#mobileTrafficNav,#mobileTrainNav,#mobileBusNav,#mobileWaterNav)
    :is(.mobile-nav-item,.mobile-traffic-btn,.mobile-train-btn,.mobile-water-btn) {
    transition:none;
  }
}

/* RADARCESKA-TRAIN-MAP-NAV-v2
   The existing mode-aware dock remains the single owner of bottom geometry.
   Train-only extra row is accounted for by the sheet's existing height token.
   Weather, traffic, buses and water keep their previous navigation geometry. */
@media (max-width:700px) {
  #app[data-mode="trains"] {
    --rc-mobile-nav-base-h:112px;
  }
  #app[data-mode="trains"] #mobileTrainNav.rc-train-map-dock-v2 {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:44px 58px;
    align-content:start;
    align-items:stretch;
    overflow:hidden;
    background:rgba(250,252,251,.97);
    border-top:1px solid #dce7e4;
    box-shadow:0 -6px 24px rgba(24,55,53,.07);
    -webkit-backdrop-filter:blur(16px);
    backdrop-filter:blur(16px);
  }
  #app[data-mode="trains"] #mobileTrainNav.rc-train-map-dock-v2[hidden] {
    display:none;
  }
  #app[data-mode="trains"] .rc-train-map-filters-v2 {
    min-width:0;
    height:44px;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:center;
    gap:4px;
    padding:2px 3px 4px;
    box-sizing:border-box;
    border-bottom:1px solid #edf1f0;
  }
  #app[data-mode="trains"] .rc-train-filter-v2 {
    min-width:0;
    width:100%;
    height:37px;
    min-height:37px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:2px;
    border:1px solid transparent;
    border-radius:11px;
    background:#f3f6f6;
    color:#526970;
    font:750 10px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    white-space:nowrap;
    cursor:pointer;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
    transition:background-color .15s,border-color .15s,color .15s;
  }
  #app[data-mode="trains"] .rc-train-filter-v2.is-active {
    color:#126e65;
    background:#e5f6f1;
    border-color:#c6e9de;
  }
  #app[data-mode="trains"] .rc-train-filter-v2[data-train-filter="delay5"].is-active {
    color:#826013;
    background:#fff4d9;
    border-color:#f1dfab;
  }
  #app[data-mode="trains"] .rc-train-filter-v2[data-train-filter="delay15"].is-active {
    color:#a14d2e;
    background:#fff0e6;
    border-color:#f2d1b9;
  }
  #app[data-mode="trains"] .rc-train-region-v2[data-has-region="1"] {
    color:#245f78;
    background:#eaf4f9;
    border-color:#cce4ee;
  }
  #app[data-mode="trains"] .rc-train-region-v2 span {
    max-width:calc(100% - 12px);
    overflow:hidden;
    text-overflow:ellipsis;
  }
  #app[data-mode="trains"] .rc-train-region-v2 svg {
    width:12px;
    height:12px;
    flex:0 0 auto;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  #app[data-mode="trains"] .rc-train-map-links-v2 {
    min-width:0;
    height:58px;
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:2px;
    padding:1px 2px 0;
    box-sizing:border-box;
  }
  #app[data-mode="trains"] .rc-train-map-link-v2 {
    min-width:0;
    min-height:55px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    border-radius:12px;
    color:#71818a;
    text-decoration:none;
    font:750 10px/1.12 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    white-space:nowrap;
    -webkit-tap-highlight-color:transparent;
  }
  #app[data-mode="trains"] .rc-train-map-link-v2.is-active {
    color:#087e69;
    background:#e7f6f0;
  }
  #app[data-mode="trains"] .rc-train-map-link-v2 svg {
    width:21px;
    height:21px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
    flex:0 0 auto;
  }
  #app[data-mode="trains"] .rc-train-map-link-v2:focus-visible,
  #app[data-mode="trains"] .rc-train-filter-v2:focus-visible {
    outline:2px solid #0eab91;
    outline-offset:-2px;
  }
  /* The old dynamically injected VLAKY shortcut is now part of the 4-item row. */
  #app[data-mode="trains"] #mobileTrainDirectoryLink {
    display:none;
  }
  /* Map controls and region picker remain above the expanded dock. */
  #app[data-mode="trains"] .map-actions {
    translate:0 -54px;
  }
  #app[data-mode="trains"] #trainLayerPanel {
    bottom:calc(var(--rc-mobile-nav-base-h) + var(--rc-mobile-nav-safe-bottom) + 8px);
    max-height:min(61dvh,calc(100dvh - 220px));
  }
}
@media (max-width:350px) {
  #app[data-mode="trains"] .rc-train-filter-v2 {font-size:9px;}
  #app[data-mode="trains"] .rc-train-map-link-v2 {font-size:9.5px;}
}
@media (max-width:700px) and (prefers-reduced-motion:reduce) {
  #app[data-mode="trains"] .rc-train-filter-v2 {transition:none;}
}


/* RADARCESKA-RAIL-UNIFIED-NAV-v3: only the trains mode owns these variables. */
@media (max-width:700px) {
  #app[data-mode="trains"] #trainOverview {
    --rc-overview-collapsed-height:64px;
    --rc-overview-collapsed-padding-top:12px;
    --rc-overview-collapsed-head-height:38px;
  }
  #app[data-mode="trains"] .rc-train-map-link-v2 {
    font-size:10px;
    line-height:1.12;
  }
  #app[data-mode="trains"] .rc-train-filter-v2[aria-pressed="true"] {
    box-shadow:inset 0 0 0 1px rgba(15,119,103,.05);
  }
}
