Many runners develop black toenails, especially after longer runs. This is a very specific type of bruising known as a "subungual hematoma." It has often been believed that this is caused by the shoe's toe box size restricting the toes to so much that direct trauma and bruising develops. This isn't always the case, and The Gait Guys suggest that there is another cause in one of their older blog posts.
Many runners tend to curl their toes downward in an effort to grip the inner surface of their shoe. In addition to black toenails, another sign of this habit is the presence of a callus on the very tip of the toe. Curling your toes downward requires heavy use of the flexor digitorum longus and/or flexor hallucis longus muscles. Using these muscles is a way to gain stability within the shoe, but it is not a good habit. Regardless of the presence of black toenails, this should be avoided because these muscles are not built to produce larger amounts of power or engage in constant stability control.
The area under a toenail has a large blood vessel supply close to the nail bed, so bruising occurs more easily with any vessel damage. Gripping downward combined with a small forward/backward movement of the shoe causes a shearing force through the skin and fatty tissue of the toes. That repetitive pressure with this shearing force against the insole is thought to be enough trauma to disrupt the blood vessels. The solution? Don't grip the shoe with your toes.
Shorter runs usually aren't enough repetition to harm the vessels, but longer runs will. Especially as we fatigue we rely more heavily on muscles that aren't fatigued as much during shorter runs. Trail running could cause a greater problem because the trail surfaces are unstable and the runner will more frequently seek stability by gripping with the toes. Also, there is a greater likelihood of steeper inclines and declines that will cause more sheer force of the foot against the insole.
Although there isn't existing research to back up this idea yet, it makes good sense. Next time you are running, think about what your toes are doing. If you are gripping the inside of your shoe then STOP IT!
Let me know if you have any questions at firstname.lastname@example.org.