Underlay is the thin foam that you put under the carpets so they become softer. it comes in different colors and thicknesses so its ur choice for the color and the appropriate thickness at various places. i think .25-.5 inch thick underlay will be good.
the gaps should be sealed with the help of foam because in hatchbacks, the phatta needs to be changed to install aftermarket speakers. this phatta does not usually has the exact same dimensions as the original phatta and this causes some gaps which in turn lets the air out from the back of the speakers to the front, cancelling the sound. so yes for your car you will need to seal the gaps. it doesnt mean u just stuff the gaps with ugly looking foam pieces. u can do it properly so it doesnt show.
you can secure the box with screws or byinstalling small L brackets on the box and screwing it to your phatta.
I dont know the dimensions of the gap in your phatta. the dimensions i gave you are the optimum dimensions for your box