.game-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
}

.difficulty-selector {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px #0000004d;
  text-align: center;
  max-width: 500px;
  animation: .5s ease-out slide-in;
}

.difficulty-selector.hidden {
  display: none;
}

.selector-content h2 {
  margin: 0 0 10px;
  font-size: 32px;
  color: #333;
}

.selector-content p {
  margin: 0 0 30px;
  font-size: 16px;
  color: #666;
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.difficulty-btn {
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  cursor: pointer;
  transition: all .3s;
}

.difficulty-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px #667eea66;
}

.difficulty-btn:active {
  transform: translateY(0);
}

.game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow-y: auto;
}

.game-container.hidden {
  display: none;
}

.game-header {
  text-align: center;
  margin-bottom: 20px;
  color: #fff;
  flex-shrink: 0;
}

.game-header h1 {
  margin: 0 0 20px;
  font-size: 28px;
}

.game-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  background: #fff3;
  padding: 10px 20px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.stat-label {
  font-weight: 600;
  margin-right: 8px;
}

.stat-value {
  font-weight: bold;
  font-size: 18px;
}

.game-board {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: #ffffff1a;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
}

.card {
  aspect-ratio: 1;
  min-width: 60px;
  min-height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  transition: all .3s;
  user-select: none;
  box-shadow: 0 4px 15px #0003;
}

.card:hover:not(.matched) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px #0000004d;
}

.card:active:not(.matched) {
  transform: scale(.98);
}

.card.flipped {
  background: #fff;
  color: #333;
  border-color: #667eea;
}

.card.matched {
  background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
  border-color: #84fab0;
  box-shadow: 0 4px 15px #84fab066;
  animation: .6s ease-out match-pulse;
}

@keyframes match-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.game-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000b3;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: .3s ease-out fade-in;
}

.game-overlay.hidden {
  display: none;
}

.overlay-content {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  box-shadow: 0 20px 60px #0000004d;
  animation: .4s ease-out slide-up;
}

.overlay-content h2 {
  margin: 0 0 20px;
  font-size: 32px;
  color: #333;
}

.overlay-message {
  margin: 20px 0;
  font-size: 16px;
  color: #666;
  line-height: 1.6;
}

.overlay-message p {
  margin: 10px 0;
}

.overlay-message strong {
  color: #667eea;
  font-weight: 700;
}

.overlay-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .3s;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px #667eea66;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #667eea;
}

.btn-secondary:hover {
  background: #667eea;
  color: #fff;
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (width <= 768px) {
  .game-board {
    max-width: 500px;
    gap: 10px;
    padding: 15px;
  }

  .card {
    min-width: 50px;
    min-height: 50px;
    font-size: 32px;
  }

  .game-header h1 {
    font-size: 24px;
  }

  .game-stats {
    gap: 20px;
  }

  .stat {
    padding: 8px 15px;
    font-size: 14px;
  }

  .stat-value {
    font-size: 16px;
  }

  .difficulty-selector {
    padding: 30px;
    max-width: 90%;
  }

  .selector-content h2 {
    font-size: 28px;
  }

  .overlay-content {
    padding: 30px;
    max-width: 90%;
  }
}

@media (width <= 480px) {
  .game-wrapper {
    padding: 10px;
  }

  .game-container {
    padding: 10px;
  }

  .game-board {
    max-width: 100%;
    gap: 8px;
    padding: 10px;
  }

  .card {
    min-width: 45px;
    min-height: 45px;
    font-size: 28px;
  }

  .game-header {
    margin-bottom: 15px;
  }

  .game-header h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .game-stats {
    gap: 10px;
    flex-direction: column;
  }

  .stat {
    padding: 6px 12px;
    font-size: 12px;
  }

  .stat-value {
    font-size: 14px;
  }

  .difficulty-selector {
    padding: 20px;
    max-width: 95%;
    border-radius: 15px;
  }

  .selector-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .selector-content p {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .difficulty-btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .overlay-content {
    padding: 20px;
    max-width: 95%;
    border-radius: 15px;
  }

  .overlay-content h2 {
    font-size: 24px;
    margin-bottom: 15px;
  }

  .overlay-message {
    font-size: 14px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}
