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

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1a1a2e;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #eee;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

h1 {
  font-size: 2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #e2e2e2;
}

.stats {
  display: flex;
  gap: 32px;
  font-size: 1.1rem;
  color: #aaa;
}

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

.card {
  width: 96px;
  height: 112px;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
  background: #16213e;
  border: 2px solid #0f3460;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.4rem;
  user-select: none;
}

.card::before {
  content: "?";
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  color: #537895;
  backface-visibility: hidden;
  transition: opacity 0.35s ease;
}

.card.face-up::before {
  opacity: 0;
}

.card.face-up {
  background: #e2e2e2;
  border-color: #ccc;
  transform: rotateY(180deg);
}

.card.matched {
  background: #2d6a4f;
  border-color: #52b788;
  transform: rotateY(180deg);
  cursor: default;
}

.card:not(.face-up):hover {
  border-color: #537895;
  transform: scale(1.04);
}

.win-message {
  font-size: 1.3rem;
  color: #52b788;
  font-weight: 600;
  text-align: center;
  min-height: 1.6em;
}

.hidden {
  visibility: hidden;
}

#new-game {
  padding: 12px 36px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #e63946;
  color: #fff;
  letter-spacing: 1px;
  transition: background 0.2s;
}

#new-game:hover {
  background: #c1121f;
}
