/* Memory Cards Game specific styles */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
  background: linear-gradient(135deg, #e83e8c, #f06292);
  padding: 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 8px 32px rgba(232, 62, 140, 0.3);
}

.score-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.score-box {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  min-width: 70px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.score-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.score-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.game-controls .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.game-controls .btn:active {
  transform: translateY(0);
}

.difficulty-select {
  padding: 8px 12px;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  cursor: pointer;
}

.difficulty-select:focus {
  outline: none;
  border-color: #e83e8c;
  box-shadow: 0 0 0 3px rgba(232, 62, 140, 0.1);
}

.game-container {
  position: relative;
  margin: 0 auto;
  max-width: 600px;
}

.game-board {
  display: grid;
  gap: 10px;
  margin: 0 auto;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px solid #e1e8ed;
}

.game-board.easy {
  grid-template-columns: repeat(4, 1fr);
  max-width: 320px;
}

.game-board.medium {
  grid-template-columns: repeat(4, 1fr);
  max-width: 400px;
}

.game-board.hard {
  grid-template-columns: repeat(6, 1fr);
  max-width: 480px;
}

.memory-card {
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
  perspective: 1000px;
}

.memory-card:hover {
  transform: scale(1.05) rotateY(5deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.memory-card.flipped {
  transform: rotateY(180deg);
}

.memory-card.matched {
  transform: scale(0.95) rotateY(180deg);
  opacity: 0.8;
  cursor: default;
  animation: matchSuccess 0.6s ease-in-out;
}

@keyframes matchSuccess {
  0% { transform: scale(0.95) rotateY(180deg); }
  50% { transform: scale(1.1) rotateY(180deg); box-shadow: 0 0 20px rgba(232, 62, 140, 0.6); }
  100% { transform: scale(0.95) rotateY(180deg); }
}

.memory-card.matched:hover {
  transform: scale(0.95) rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  backface-visibility: hidden;
  border: 3px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card-front {
  background: linear-gradient(135deg, #e83e8c, #f06292, #ff6b9d);
  color: #fff;
  transform: rotateY(180deg);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.2);
}

.card-back {
  background: linear-gradient(135deg, #667eea, #764ba2, #8e44ad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.card-back::before {
  content: '?';
  font-size: 2.5rem;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
  position: relative;
}

.card-back::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
  100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

.game-status {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #e83e8c;
  margin: 20px 0;
  padding: 15px;
  background: rgba(232, 62, 140, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(232, 62, 140, 0.2);
}

.game-instructions {
  margin-top: 20px;
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 16px;
}

.instruction-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  font-size: 16px;
}

.instruction-content p {
  margin: 8px 0;
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
}

.instruction-content strong {
  color: #495057;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 20px 0;
  text-align: center;
}

.modal-header h3 {
  margin: 0;
  color: #495057;
  font-size: 20px;
}

.modal-body {
  padding: 20px;
  text-align: center;
}

.modal-body p {
  margin: 0 0 15px;
  color: #6c757d;
}

.final-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
}

.stat-item span:last-child {
  color: #e83e8c;
}

.new-record {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b7500;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Card flip animation */
@keyframes cardFlip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(180deg); }
}

.memory-card.flipping {
  animation: cardFlip 0.3s ease-in-out;
}

/* Responsive design */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .score-container {
    justify-content: center;
  }
  
  .game-controls {
    justify-content: center;
  }
  
  .game-board.easy {
    max-width: 280px;
    gap: 8px;
  }
  
  .game-board.medium {
    max-width: 320px;
    gap: 8px;
  }
  
  .game-board.hard {
    max-width: 360px;
    gap: 6px;
  }
  
  .card-face {
    font-size: 1.5rem;
  }
  
  .card-back::before {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .score-container {
    gap: 8px;
  }
  
  .score-box {
    min-width: 60px;
    padding: 8px 12px;
  }
  
  .score-label {
    font-size: 11px;
  }
  
  .score-value {
    font-size: 16px;
  }
  
  .game-board.easy {
    max-width: 240px;
    gap: 6px;
  }
  
  .game-board.medium {
    max-width: 280px;
    gap: 6px;
  }
  
  .game-board.hard {
    max-width: 300px;
    gap: 4px;
  }
  
  .card-face {
    font-size: 1.2rem;
  }
  
  .card-back::before {
    font-size: 1.5rem;
  }
}