:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, #1e2a45, #0a101d 62%);
  color: #e8ecff;
  font-family: "Inter", "Segoe UI", sans-serif;
}

.memory {
  width: min(760px, 100%);
  background: rgba(9, 14, 30, 0.84);
  border: 1px solid rgba(133, 157, 255, 0.35);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 18px 42px rgba(1, 3, 10, 0.55);
}

.memory__header h1 {
  margin: 0;
  font-size: clamp(1.3rem, 3.4vw, 1.85rem);
}

.memory__header p {
  margin: 8px 0 0;
  color: #b6c4ff;
}

.memory__stats {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.memory__stats p {
  margin: 0;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(38, 58, 120, 0.28);
  border: 1px solid rgba(133, 157, 255, 0.34);
  color: #dce4ff;
}

.memory__restart {
  margin-top: 14px;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #041329;
  padding: 0 16px;
  background: linear-gradient(135deg, #7fd7ff, #73a8ff);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.memory__restart:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.memory__board {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.memory__card {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(133, 157, 255, 0.34);
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #223363, #15264c);
  color: #eaf0ff;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
  font-weight: 700;
  display: grid;
  place-items: center;
  user-select: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.memory__card:hover {
  transform: translateY(-1px);
}

.memory__card.is-open {
  background: linear-gradient(135deg, #355cae, #2d4f98);
  border-color: rgba(164, 186, 255, 0.72);
}

.memory__card.is-matched {
  background: linear-gradient(135deg, #2a8f86, #216f72);
  border-color: rgba(133, 255, 221, 0.68);
  cursor: default;
}

.memory__status {
  margin: 12px 0 0;
  min-height: 1.6em;
  color: #dce4ff;
}

@media (max-width: 560px) {
  body {
    padding: 12px;
  }

  .memory {
    border-radius: 16px;
    padding: 16px;
  }

  .memory__board {
    gap: 8px;
  }
}
