/* Match Pairs 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, #06d6a0, #118ab2);
  padding: 20px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 8px 32px rgba(6, 214, 160, 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;
  animation: float 3s ease-in-out infinite;
}

.score-box:nth-child(1) { animation-delay: 0s; }
.score-box:nth-child(2) { animation-delay: 0.5s; }
.score-box:nth-child(3) { animation-delay: 1s; }
.score-box:nth-child(4) { animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.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 rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 14px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.difficulty-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.difficulty-select option {
  background: #118ab2;
  color: white;
}

.game-container {
  position: relative;
  margin: 0 auto;
  max-width: 800px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 3px solid rgba(6, 214, 160, 0.2);
}

.game-container::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, transparent, rgba(6, 214, 160, 0.2), transparent);
  border-radius: 15px;
  animation: borderGlow 3s linear infinite;
  z-index: -1;
}

@keyframes borderGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.game-board {
  display: grid;
  gap: 4px;
  margin: 0 auto;
  padding: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  position: relative;
  z-index: 2;
}

.game-board.easy {
  grid-template-columns: repeat(8, 1fr);
  max-width: 400px;
}

.game-board.medium {
  grid-template-columns: repeat(10, 1fr);
  max-width: 500px;
}

.game-board.hard {
  grid-template-columns: repeat(12, 1fr);
  max-width: 600px;
}

.match-tile {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #fff, #f8f9fa);
  border: 2px solid rgba(6, 214, 160, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.match-tile:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3);
  border-color: rgba(6, 214, 160, 0.6);
}

.match-tile.selected {
  background: linear-gradient(135deg, #06d6a0, #118ab2);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(6, 214, 160, 0.5);
  border-color: #06d6a0;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(6, 214, 160, 0.5); }
  50% { box-shadow: 0 6px 25px rgba(6, 214, 160, 0.8); }
}

.match-tile.matched {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  transform: scale(0.9);
  opacity: 0.7;
  cursor: default;
  animation: matchSuccess 0.6s ease-in-out;
}

@keyframes matchSuccess {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.2); box-shadow: 0 0 20px rgba(40, 167, 69, 0.8); }
  100% { transform: scale(0.9); }
}

.match-tile.hint {
  animation: hintBlink 1s ease-in-out 3;
}

@keyframes hintBlink {
  0%, 100% { 
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-color: rgba(6, 214, 160, 0.3);
  }
  50% { 
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
  }
}

.match-tile.removing {
  animation: removeEffect 0.5s ease-in-out forwards;
}

@keyframes removeEffect {
  0% { 
    transform: scale(1);
    opacity: 1;
  }
  50% { 
    transform: scale(1.3) rotate(180deg);
    opacity: 0.5;
  }
  100% { 
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.connection-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.game-status {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #06d6a0;
  margin: 20px 0;
  padding: 15px;
  background: rgba(6, 214, 160, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(6, 214, 160, 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: #06d6a0;
}

.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;
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* 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: 320px;
  }
  
  .game-board.medium {
    max-width: 400px;
  }
  
  .game-board.hard {
    max-width: 480px;
  }
  
  .match-tile {
    font-size: 1.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: 280px;
  }
  
  .game-board.medium {
    max-width: 350px;
  }
  
  .game-board.hard {
    max-width: 420px;
  }
  
  .match-tile {
    font-size: 1rem;
  }
  
  .game-container {
    padding: 15px;
  }
}