Game New Code
Game New Code
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simon Game</title>
<style>
body {
text-align: center;
background-color: white; /* Initial background color */
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
h2 {
margin-top: 20px;
}
.btn-container {
display: flex; /* Flex layout */
justify-content: center;
flex-wrap: wrap; /* Wrap buttons on smaller screens */
width: 440px; /* Adjusted width to fit four buttons */
margin: 40px auto; /* Center the container */
}
.btn {
height: 200px;
width: 200px;
border-radius: 20%;
border: 10px solid black;
margin: 10px; /* Adjusted margin */
cursor: pointer;
transition: filter 0.2s, transform 0.2s; /* Smooth transition */
}
.red {
background-color: #d95980;
}
.yellow {
background-color: #f99b45;
}
.purple {
background-color: #819ff9;
}
.green {
background-color: #63aac0;
}
/* Flash effect using brightness filter */
.flash {
filter: brightness(150%);
transform: scale(1.1); /* Slightly enlarge for visual effect */
}
/* Optional: Different flash effect for user clicks */
.userflash {
filter: brightness(200%);
transform: scale(1.2);
}
/* Responsive Design */
@media (max-width: 500px) {
.btn-container {
width: 90%;
}
.btn {
height: 100px;
width: 100px;
margin: 5px;
}
}
</style>
</head>
<body>
<h2>Press Any Key to Start</h2>
<div class="btn-container">
<div class="btn red" id="red"></div>
<div class="btn yellow" id="yellow"></div>
<div class="btn purple" id="purple"></div>
<div class="btn green" id="green"></div>
</div>
<script>
let gameSeq = [];
let userSeq = [];
const h2 = document.querySelector("h2");