.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  background: white;
  min-height: 100vh;
  color: #333;
}

.header {
  margin-bottom: 30px;
}

.title {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 10px;
  background: #000000;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 20px;
}

/* Difficulty Selector */
.difficultySelector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.difficultyButton {
  padding: 10px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #333;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.difficultyButton:hover {
  border-color: #f59e0b;
  transform: translateY(-2px);
}

.difficultyButton.active {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  color: white;
  border-color: #f59e0b;
}

.gameStats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  background: #f8f9fa;
  padding: 15px 25px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  color: #2d3748;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.statLabel {
  display: block;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.statValue {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
}

.bestScore {
  background: #000000;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid #f59e0b;
  font-weight: bold;
}

.gameBoard {
  display: grid;
  gap: 15px;
  margin: 30px auto;
  max-width: 500px;
  perspective: 1000px;
}

.grid4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid6 {
  grid-template-columns: repeat(6, 1fr);
  max-width: 600px;
}

.card {
  aspect-ratio: 1;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
}

.card.matched:hover {
  transform: none;
  cursor: default;
}

.cardInner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card.flipped .cardInner {
  transform: rotateY(180deg);
}

.cardFront,
.cardBack {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border: 3px solid #e2e8f0;
}

.cardFront {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}

.cardBack {
  background: #22c55e;
  transform: rotateY(180deg);
}

.card.matched .cardBack {
  background: linear-gradient(135deg, #34d399, #10b981);
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
}

.cardSymbol {
  font-size: 2rem;
  font-weight: bold;
  text-shadow: none;
}

.cardFront .cardSymbol {
  color: white;
}

.cardBack .cardSymbol {
  color: white;
}
/* overlay */
.overlay{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.5s ease;
}
.gameCompleted {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 400px;
  width: 90%;
 
 
}
.completionMessage {
  background: white;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 2px solid #e2e8f0;
  color: #2d3748;
  width: 100%;
  max-width: 100%;
}

.completionMessage h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #2d3748;
  text-shadow: none;
}

.finalStats {
  margin: 20px 0;
}

.finalStats p {
  margin: 10px 0;
  font-size: 1.1rem;
}

/* Close button allows users to exit the modal */
.closeButton{
  position: absolute;
  top: 15px;
  right: 15px;
  font-weight: bold;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  background: transparent;
  color: #d32f2f;
  transition: transform 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.closeButton:hover{
  transform: scale(1.2);
}

/* Visible focus for keyboard users */
.closeButton:focus-visible{
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
  border-radius: 6px;
}

.gameControls {
  margin: 30px 0;
}

.resetButton {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.resetButton:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.resetButton:active {
  transform: translateY(0);
}
.rulesContainer {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: system-ui, -apple-system, sans-serif;
}

.sectionTitle {
  font-size: 1.5rem;
  margin: 1.8rem 0 1rem 0;
  color: #111;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Rules List Styling */
.rulesList {
  counter-reset: rule-counter;
  list-style-type: none;
  padding: 0;
  margin: 0 0 2rem 0;
  line-height: 1.6;
}

.ruleItem {
  margin-bottom: 0.8rem;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  counter-increment: rule-counter;
}

.ruleItem::before {
  content: counter(rule-counter) ". ";
  font-weight: bold;
  margin-right: 0.5rem;
}


/* Benefits List Styling */
.benefitsList {
  padding: 0;
  margin: 0 0 2rem 0;
}

.benefitItem {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  line-height: 1.6;
}

.benefitTitle {
  font-weight: 600;
  display: inline;
  color: #111;
}

.benefitDescription {
  display: block;
  padding-left: 1.5rem;
  margin-top: 0.3rem;
  color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
  .rulesContainer {
    padding: 0 1.2rem;
    margin: 1.5rem auto;
  }
  
  .sectionTitle {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.8rem 0;
  }
  
  .ruleItem,
  .benefitItem {
    margin-bottom: 0.7rem;
    padding-left: 1.2rem;
    text-indent: -1.2rem;
  }
  
  .benefitDescription {
    padding-left: 1.2rem;
  }
  .container {
    padding: 15px;
  }
  
  .title {
    font-size: 2rem;
  }
  
  .gameBoard {
    max-width: 300px;
    gap: 10px;
  }
  
  .grid6 {
    max-width: 320px;
  }
  
  .gameStats {
    gap: 15px;
  }
  
  .stat {
    padding: 10px 15px;
  }
  
  .cardSymbol {
    font-size: 1.5rem;
  }
  
  .completionMessage {
    padding: 30px 20px;
  }
  
  
  .difficultySelector {
    flex-direction: column;
    align-items: center;
  }
  
  .difficultyButton {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .gameBoard {
    max-width: 280px;
    gap: 8px;
  }
   .rulesContainer {
    padding: 0 1rem;
  }
  
  .sectionTitle {
    font-size: 1.25rem;
  }
  
  .ruleItem,
  .benefitItem {
    font-size: 0.95rem;
    padding-left: 1rem;
    text-indent: -1rem;
  }
  
  .benefitDescription {
    font-size: 0.92rem;
    padding-left: 1rem;
  }
  
  .grid6 {
    max-width: 300px;
  }
  
  .cardSymbol {
    font-size: 1.2rem;
  }
  
  .gameStats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  .stat {
    width: 100%;
    max-width: 200px;
  }
   .completionMessage h2{
    font-size:1.5rem ;
  }
}