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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.container {
  width: 100%;
  max-width: 450px;
}

.header {
  text-align: center;
  margin-bottom: 10px;
  color: white;
}
.header h1 {
  font-size: 24px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.stats {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}
.stat-item {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.level-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.level-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.level-title {
  font-size: 16px;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 4px;
}

.level-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 14px;
  line-height: 1.4;
}

.level-options {
  display: grid;
  gap: 10px;
}

.level-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.level-btn strong {
  display: block;
  font-size: 14px;
  color: #111827;
  margin-bottom: 2px;
}

.level-btn span {
  display: block;
  font-size: 12px;
  color: #6b7280;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  perspective: 1000px;
}

.card {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  background: transparent;
  width: 100%;
}

.card.flipped {
  transform: rotateY(180deg);
}
.card.matched {
  opacity: 0.5;
  transform: rotateY(180deg) scale(0.9);
  pointer-events: none;
}

.card-front,
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-front {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 20px;
  color: white;
}

.card-back {
  background: white;
  transform: rotateY(180deg);
  overflow: hidden;
}

.card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.controls {
  text-align: center;
  margin-top: 20px;
}
.btn {
  background: white;
  color: #764ba2;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
}
