body {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 20px;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

h1 {
  text-align: center;
  margin-bottom: 10px;
}

.game-info {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
}

#progress-container {
  width: 80%;
  height: 16px;
  background-color: #ddd;
  border-radius: 10px;
  margin: 10px auto 20px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background-color: #0078d4;
  transition: width 0.3s ease-in-out;
}

.controls,
.theme-toggle,
.sound-toggle {
  text-align: center;
  margin-bottom: 10px;
}

.controls select {
  padding: 6px 12px;
  font-size: 16px;
  border-radius: 8px;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  max-width: 520px;
  margin: 0 auto;
}

.card {
  width: 100%;
  aspect-ratio: 1/1;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  backface-visibility: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card-front {
  background-color: #0078d4;
  color: white;
}

.card-back {
  background-color: white;
  color: #333;
  transform: rotateY(180deg);
}

/* Win Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#restart-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background-color: #0078d4;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

#restart-btn:hover {
  background-color: #005fa3;
}

.share-section {
  margin-top: 15px;
}

.share-section a {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
  background-color: #1da1f2;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
}

.share-section a:hover {
  background-color: #0d95e8;
}

/* Dark mode */
body.dark-mode {
  background-color: #121212;
  color: #f5f5f5;
}

body.dark-mode .card-front {
  background-color: #333;
  color: #fff;
}

body.dark-mode .card-back {
  background-color: #1e1e1e;
  color: #f5f5f5;
}

body.dark-mode .modal-content {
  background-color: #1e1e1e;
  color: #fff;
}

body.dark-mode #restart-btn {
  background-color: #333;
}

body.dark-mode #restart-btn:hover {
  background-color: #555;
}

@media (max-width: 480px) {
  .game-board {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    padding: 10px;
  }

  .modal-content {
    width: 90%;
    font-size: 16px;
  }

  #restart-btn {
    font-size: 14px;
    padding: 8px 16px;
  }
}
.share-section {
  margin-top: 20px;
}

.share-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.share-buttons a {
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 6px;
  background-color: #0078d4;
  color: white;
  font-size: 14px;
  transition: background-color 0.3s;
}

.share-buttons a:hover {
  background-color: #005fa3;
}
