I have painted foam with a lacquer paint
and it will melt the foam. lowering the surface + or - an eighth inch. use enamel for best results. ( I think ). If there is a face surface and a back surface, one could cut a small layer of foam out, leaving a 1/8" slot from left to right at the bottom. cut a piece of wood to the size of the opening length and width lets say 1/8" by 7/16" by 16". put in place with a super glue. but it must not melt the foam. Hobby lobby may have some of this glue. or at a radio control hobby shop. It is expensive. a good wood glue should work. edge banding scrap from a cabinet shop, ( that they give you ) will stick in place with contact cement. it might have a self adhesive on the back side.
wish you luck