/* GC51: location cards own their top navigation. Category screens retain the
   shell header. Derive ownership from mounted, visible roots, so closing,
   back navigation and suspending a card cannot leave a stale global flag. */
.g2-phone:has(> :is(
  #wow-atlas-active-venues-gc25,
  #wow-atlas-city-sightseeing-gc24,
  #wow-atlas-adventure-ux10,
  #wow-atlas-service-ux9,
  #wow-atlas-hotel-ms2,
  #wow-atlas-spb-active-gc48,
  #wow-atlas-spb-hotel-gc48,
  #wow-atlas-spb-active-gc49,
  #wow-atlas-spb-hotel-gc49,
  #wow-atlas-spb-food-gc49,
  #wow-atlas-editorial-ah14.is-detail,
  #wow-atlas-food-ah13.is-detail,
  #wow-atlas-wowpick-ah10.is-detail,
  #wow-atlas-parks-ah9.is-detail,
  #wow-atlas-afisha-ah12.is-detail,
  #wow-atlas-kh1[data-card-type]:not([data-card-type="list"])
):not([hidden])) > .g2-header,
.g2-phone:has(> #wow-atlas-spb-sp1:not([hidden]) [data-sp1-place]) > .g2-header,
.g2-phone:has(> #wow-atlas-yoga-ah10:not([hidden]) .yg-detail-hero) > .g2-header {
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
}

/* Remove the category header's reserved vertical space only in detail view.
   Existing gallery, heart, close, sheet and bottom-dock layouts remain owned
   by the corresponding card. */
#wow-atlas-spb-food-gc49:not([data-bars]) .fd-scroll,
#wow-atlas-food-ah13.is-detail:not([data-bars]) .fd-scroll,
#wow-atlas-parks-ah9.is-detail .pk-scroll,
#wow-atlas-afisha-ah12.is-detail .af-scroll,
#wow-atlas-kh1[data-card-type]:not([data-card-type="list"]) .kh1-scroll,
#wow-atlas-spb-sp1:has([data-sp1-place]) .sp1-scroll,
#wow-atlas-yoga-ah10:has(.yg-detail-hero) .yg-scroll {
  padding-top:max(14px,env(safe-area-inset-top,0px))!important;
  scroll-padding-top:76px;
}
#wow-atlas-editorial-ah14.is-detail:not(.is-panorama) .ed-scroll {
  top:max(14px,env(safe-area-inset-top,0px))!important;
}
#wow-atlas-wowpick-ah10.is-detail .wp-scroll {
  padding-top:0!important;
}

/* These back buttons live inside a scrolling toolbar. Position only Back
   against the card root, like CSK; the remaining actions scroll normally. */
#wow-atlas-spb-food-gc49:not([data-bars]) .fd-toolbar,
#wow-atlas-food-ah13.is-detail:not([data-bars]) .fd-toolbar,
#wow-atlas-parks-ah9.is-detail .pk-navigation,
#wow-atlas-afisha-ah12.is-detail .af-toolbar,
#wow-atlas-kh1[data-card-type]:not([data-card-type="list"]) .kh1-toolbar,
#wow-atlas-spb-sp1:has([data-sp1-place]) .sp1-toolbar,
#wow-atlas-yoga-ah10:has(.yg-detail-hero) .yg-navigation {
  position:static;
  min-height:46px;
  padding-left:105px;
  justify-content:flex-end;
}
#wow-atlas-spb-food-gc49:not([data-bars]) .fd-toolbar > .fd-back,
#wow-atlas-food-ah13.is-detail:not([data-bars]) .fd-toolbar > .fd-back,
#wow-atlas-parks-ah9.is-detail .pk-navigation > .pk-back,
#wow-atlas-afisha-ah12.is-detail .af-toolbar > .af-back,
#wow-atlas-kh1[data-card-type]:not([data-card-type="list"]) .kh1-toolbar > .kh1-back,
#wow-atlas-spb-sp1:has([data-sp1-place]) .sp1-toolbar > .sp1-back,
#wow-atlas-yoga-ah10:has(.yg-detail-hero) .yg-navigation > .yg-back {
  position:absolute;
  top:max(14px,env(safe-area-inset-top,0px));
  left:18px;
  z-index:10;
  min-height:43px;
  box-shadow:0 3px 12px #173f3814;
}
@media(max-width:374px) {
  #wow-atlas-spb-food-gc49:not([data-bars]) .fd-toolbar > .fd-back,
  #wow-atlas-food-ah13.is-detail:not([data-bars]) .fd-toolbar > .fd-back,
  #wow-atlas-parks-ah9.is-detail .pk-navigation > .pk-back,
  #wow-atlas-afisha-ah12.is-detail .af-toolbar > .af-back,
  #wow-atlas-kh1[data-card-type]:not([data-card-type="list"]) .kh1-toolbar > .kh1-back,
  #wow-atlas-spb-sp1:has([data-sp1-place]) .sp1-toolbar > .sp1-back,
  #wow-atlas-yoga-ah10:has(.yg-detail-hero) .yg-navigation > .yg-back {left:14px;}
}
