body {
  display: flex;
  flex-direction: column; /* Stack children vertically */
  min-height: 100vh; /* Ensure body takes at least full viewport height */
  margin: 0; /* Remove default margin */
  font-family: Arial, sans-serif; /* Set a default font */
}

header {
  background-color: rgb(31, 41, 55); /* Dark background for visibility */
  color: white; /* White text color */
  padding: 1rem; /* Padding for spacing */
  position: fixed; /* Fix the header at the top */
  width: 100%; /* Full width */
  top: 0; /* Align to the top */
  z-index: 1000; /* Ensure it stays above other content */
}

.header-content {
  display: flex; /* Use flexbox for layout */
  justify-content: space-between; /* Space between logo and nav */
  align-items: center; /* Center items vertically */
}

.logo {
  height: 50px; /* Set logo height */
  margin-right: 1rem; /* Space between logo and nav */
}

body {
  margin-top: 80px; /* Add margin to prevent content from hiding behind the header */
  flex: 1; /* Allow the body to grow and fill space */
}

.container {
  flex: 1; /* Allow the container to grow and fill space */
  display: flex;
  flex-direction: column; /* Stack children vertically */
  justify-content: center; /* Center content vertically */
  align-items: center; /* Center content horizontally */
  padding: 1rem; /* Add padding for spacing */
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns for the game board */
  gap: 1rem; /* Space between cards */
  margin-bottom: 1.5rem; /* Space below the board */
  z-index: 1; /* Ensure the board is above other elements */
  width: 100%; /* Full width for the board */
  max-width: 600px; /* Limit the maximum width */
}

.card {
  aspect-ratio: 3/4; /* Maintain aspect ratio */
  background-color: rgb(59, 130, 246); /* Card color */
  border-radius: 0.5rem; /* Rounded corners */
  cursor: pointer; /* Pointer cursor on hover */
  transition: transform 0.6s; /* Smooth flip transition */
  transform-style: preserve-3d; /* Preserve 3D transformations */
  position: relative; /* Position relative for absolute children */
  z-index: 1; /* Ensure cards are above the board */
}

.card.flipped {
  transform: rotateY(180deg); /* Flip the card */
}

.card.matched {
  background-color: rgb(34, 197, 94); /* Color for matched cards */
}

.card-front,
.card-back {
  position: absolute; /* Position absolute for front and back */
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  backface-visibility: hidden; /* Hide backface when flipped */
  display: flex; /* Flexbox for centering content */
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
  font-size: 2rem; /* Font size for content */
  color: white; /* Text color */
  border-radius: 0.5rem; /* Rounded corners */
}

.card-front {
  background-color: rgb(59, 130, 246); /* Front color */
}

.card-back {
  background-color: rgb(59, 130, 246); /* Back color */
  transform: rotateY(180deg); /* Rotate back face */
}

.matched .card-back {
  background-color: rgb(34, 197, 94); /* Color for matched card back */
}

.status {
  text-align: center; /* Center text */
  font-size: 1.25rem; /* Font size */
  color: rgb(31, 41, 55); /* Text color */
  margin-top: 1rem; /* Space above status */
  min-height: 1.75rem; /* Minimum height for status */
}

footer {
  background-color: rgb(31, 41, 55); /* Match footer with header */
  color: white; /* White text color */
  text-align: center; /* Center text */
  padding: 1rem; /* Padding for spacing */
  position: relative; /* Position relative */
  z-index: 1000; /* Ensure it stays above other content */
}

nav ul {
  list-style-type: none; /* Remove bullet points */
  padding: 0; /* Remove padding */
  display: flex; /* Use flexbox for horizontal layout */
}

nav ul li {
  margin-left: 1rem; /* Space between links */
}

nav ul li a {
  color: white; /* Link color */
  text-decoration: none; /* Remove underline */
}

nav ul li a:hover {
  text-decoration: underline; /* Underline on hover */
}

@media (max-width: 640px) {
  .board {
    grid-template-columns: repeat(3, 1fr); /* Adjust for smaller screens */
  }
}