Hangman implementation with a limited number of guesses.
Implement a function that processes guesses in order. Correct guesses reveal matching letters, repeated guesses have no effect, and incorrect guesses reduce the remaining guess count. Return won when every character is revealed. If the guess limit is reached first, return lost and mask only the first character in the returned pattern while revealing the remaining characters.
Use the signature def hangman(word, guesses, max_guesses):. Return a dictionary with status, pattern, and remaining_guesses.
def hangman(word, guesses, max_guesses):