In the late 12th and early 13th centuries , a scientific approach to castle defense emerged .
By the late 12th and early 13th centuries , though , castles became longer and more complex .