* {
  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: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 900px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 3em;
  color: #667eea;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 15px;
}

.pi-display {
  font-family: 'Courier New', monospace;
  font-size: 1.2em;
  color: #333;
  background: #f0f0f0;
  padding: 15px;
  border-radius: 10px;
  word-break: break-all;
}

.pi-display span {
  color: #667eea;
  font-weight: bold;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 10px;
}

.stat {
  text-align: center;
  font-size: 1.1em;
}

.stat span {
  display: block;
  font-size: 2em;
  font-weight: bold;
  color: #667eea;
  margin-top: 5px;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 10px;
}

.card {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  font-size: 2em;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card:hover:not(.matched) {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.card.flipped {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.card.matched {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  cursor: default;
  animation: matchAnimation 0.6s ease;
}

@keyframes matchAnimation {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.card:disabled {
  cursor: default;
}

.btn {
  padding: 15px 30px;
  font-size: 1.1em;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

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

.win-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.win-screen.hidden {
  display: none;
}

.win-content {
  background: white;
  padding: 50px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.win-content h2 {
  font-size: 2.5em;
  color: #667eea;
  margin-bottom: 20px;
}

.win-content p {
  font-size: 1.2em;
  color: #666;
  margin-bottom: 10px;
}

.win-content .achievement {
  font-size: 1.3em;
  color: #764ba2;
  font-weight: bold;
  margin-bottom: 30px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 20px;
  }

  header h1 {
    font-size: 2em;
  }

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

  .stats {
    gap: 20px;
  }

  .pi-display {
    font-size: 0.9em;
  }
}