* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  text-align: center;
}

h1 {
  color: #333;
  margin-bottom: 20px;
  font-size: 2rem;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.controls span {
  font-size: 1.1rem;
  font-weight: 600;
  color: #555;
  background: #f0f0f0;
  padding: 8px 16px;
  border-radius: 10px;
}

button {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: #5a6fd6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.card {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #667eea, #764ba2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  user-select: none;
}

.card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.card.flipped {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: scale(1);
}

.card.matched {
  background: #4caf50;
  cursor: default;
  animation: matchPop 0.4s ease;
}

.card.matched:hover {
  transform: scale(1);
}

@keyframes matchPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.win-message {
  margin-top: 20px;
  padding: 20px;
  background: #e8f5e9;
  border-radius: 16px;
  border: 2px solid #4caf50;
}

.win-message h2 {
  color: #2e7d32;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.win-message p {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 15px;
}

.hidden {
  display: none;
}

@media (max-width: 480px) {
  .container {
    padding: 20px;
  }
  .grid {
    gap: 8px;
  }
  .card {
    font-size: 1.8rem;
  }
  h1 {
    font-size: 1.5rem;
  }
}