import random

def play_game():
    print("Welcome to the Number Guessing Game!")
    print("I'm thinking of a number between 1 and 100.")
    print("You have 7 attempts to guess the number.")
    
    secret_number = random.randint(1, 100)
    attempts = 7
    
    while attempts > 0:
        guess = int(input("Enter your guess: "))
        attempts -= 1
        
        if guess < secret_number:
            print("Too low! Guess higher.")
        elif guess > secret_number:
            print("Too high! Guess lower.")
        else:
            print("Congratulations! You guessed the number!")
            break
        
        print(f"Attempts remaining: {attempts}")
    
    if attempts == 0:
        print(f"Game over! The secret number was {secret_number}.")
    
    play_again = input("Do you want to play again? (y/n): ")
    if play_again.lower() == "y":
        play_game()
    else:
        print("Thank you for playing the Number Guessing Game!")

play_game()
