* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: system-ui, sans-serif;
  background: #1e1b4b;
  color: #e0e7ff;
  text-align: center;
}

:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.hud {
  width: 100%;
  padding: 0.75rem;
  background: #312e81;
}

.hud h1 {
  margin: 0;
  font-size: 1.25rem;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.status {
  min-height: 1.5rem;
  margin: 0;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 72px));
  gap: 10px;
  justify-content: center;
}

.card {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #4338ca;
  color: inherit;
  font-size: 1.75rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.card:hover:not(:disabled) {
  background: #4f46e5;
}

.card.open {
  background: #fff;
  transform: scale(1.06);
}

.card.matched {
  background: #312e81;
  opacity: 0.55;
  cursor: default;
}

.button {
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 8px;
  background: #6366f1;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  background: #4f46e5;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card.open {
    transform: none;
  }
}
