There are two media: glass or water at the bottom and air above. A ray of light will come up through the glass and emerge at an angle into the air. However, if you increase the angle of incidence, the angle of the refracted light in the air will increase and you will see the refracted ray moving down towards the surface of the glass or water. At a certain point, the critical angle, the ray of light will come up to the top of the glass surface and goes out along the glass surface. It doesn't get into the air. You can measure the critical angle between the incident ray and the normal.
An example of this can be seen in the swimming pool. If you are swimming underwater and looking up at people on the sides, you can see them quite clearly. But at a certain point as you swim up the people suddenly vanish.
(picture from Wikimedia)