Before you lose signal, note your bearing back to the trailhead and a "catch feature" — a road, river or ridge you cannot walk past without noticing.
Walk a straight line by picking two landmarks ahead in line with each other; when you reach the first, pick a new far one. This beats following a compass needle step by step.
If you are unsure of position, stop and climb only if it is safe. Height gives you the catch feature back. Never navigate downhill into unknown drainage at dusk.