Create a visually engaging and interactive Snake Game using HTML, CSS, and JavaScript. The game should have a classic feel while incorporating modern design elements, smooth animations, and additional features for enhanced gameplay. Here are the specifications:

1. Game Overview:
The player controls a snake that grows longer by eating food items that appear randomly on the screen.
The objective is to eat as many food items as possible without running into the walls or the snake’s own body.
The game should include a scoring system that tracks the player’s score based on the number of food items eaten.
2. Design and Aesthetic:
Create a clean and modern interface with a visually appealing canvas for the game area.
Use a vibrant color scheme for the snake, food, and background, ensuring good contrast for visibility.
Implement a light mode and dark mode toggle for user preference, with smooth transitions between the two.
The game canvas should have rounded corners and a subtle shadow for depth.
3. HTML Structure:
Header:
A title ("Snake Game") with a toggle switch for light/dark mode.
A display for the current score and a button to start/restart the game.
Main Section:
A canvas element where the snake and food will be rendered.
Footer:
Instructions for the game (e.g., controls) and a reset button to clear the score and restart the game.
4. Responsive and Accessible Design:
Ensure the game is fully responsive, adapting to different screen sizes (desktops, tablets, smartphones).
Use accessible design principles, including keyboard navigation support and appropriate contrast ratios for readability.
5. Light and Dark Mode:
Light Mode: Utilize soft, bright colors for the background and elements.
Dark Mode: Use deeper colors with glowing highlights for the snake and food.
Implement smooth transitions when switching between modes, enhancing the user experience.
6. Animations and Interactions:
Snake Movement: Animate the snake’s movement smoothly across the canvas. Use a trailing effect to create a realistic motion.
Food Appearance: Animate the food items to appear with a subtle bounce effect when they spawn on the canvas.
Game Over Animation: When the snake collides with the wall or itself, display a game over message with a brief animation (e.g., fading out the canvas and displaying the score).
7. JavaScript Functionality:
Game Controls: Implement controls for the snake’s movement using the arrow keys (up, down, left, right).
Snake Logic: Write the logic to move the snake in the direction chosen by the player, grow the snake when it eats food, and check for collisions with walls or itself.
Food Logic: Randomly generate food positions on the canvas that the snake can eat.
Scoring System: Keep track of the score based on the number of food items consumed, updating the score display in real time.
Game Loop: Create an efficient game loop that updates the game state, renders the snake and food, and checks for collisions at regular intervals (e.g., every 100 milliseconds).
8. Additional Features (Optional Enhancements):
Speed Increase: Gradually increase the snake's speed as it grows longer or as the score increases, adding challenge to the game.
Obstacle Generation: Introduce static obstacles on the canvas that the snake must avoid, increasing the game’s difficulty.
Pause Functionality: Allow the player to pause the game and resume it using a designated key or button.
Leaderboard: Implement a local leaderboard that stores and displays the top scores using localStorage.
Sound Effects: Add subtle sound effects for eating food, collisions, and game over, with an option to toggle sound on and off.
9. Page Structure:
HTML: Use semantic elements to structure the layout, ensuring proper accessibility and readability.
CSS: Use CSS Grid or Flexbox for layout, and CSS transitions for smooth animations.
JavaScript: Organize the code with modular functions for better readability and maintenance.
10. Advanced Animations (Optional Enhancements):
Fluid Transitions: Implement smooth transitions for the score updates and game state changes.
Particle Effects: Add particle effects when the snake eats food or when the game ends, enhancing the visual appeal.
Interactive UI Elements: Use hover animations for buttons and menu items to create an engaging user interface.
Expected Output:

The final result should be a visually engaging and fully functional Snake Game that captures the classic gameplay experience while providing modern design and features. The game should be responsive, with smooth animations, a user-friendly interface, and a satisfying gameplay loop that encourages players to achieve high scores.