@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;600;700&display=swap");
:root {
  --bg: #16121f;
  --panel: #211b2e;
  --lime: #d7f54a;
  --purple: #a084ff;
  --muted: #a9a1b8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 70% 0, #342950 0, #16121f 45%);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
}
.game-shell {
  max-width: 900px;
  margin: auto;
  padding: 28px 20px 50px;
}
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}
.game-header h1 {
  font-size: clamp(20px, 4vw, 32px);
  letter-spacing: -0.06em;
  margin: 0;
}
.back-link,
.button {
  font:
    500 11px "DM Mono",
    monospace;
  letter-spacing: 0.1em;
  text-decoration: none;
}
.back-link {
  color: var(--lime);
}
button {
  border: 0;
  cursor: pointer;
}
.button {
  padding: 12px 15px;
  background: var(--lime);
  color: #16121f;
}
.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--panel);
  border: 1px solid #3d3452;
  margin-bottom: 24px;
}
.hud div {
  padding: 14px 12px;
  border-right: 1px solid #3d3452;
}
.hud div:last-child {
  border: 0;
}
.hud span {
  display: block;
  color: var(--muted);
  font:
    10px "DM Mono",
    monospace;
  margin-bottom: 7px;
}
.hud strong {
  font-size: 20px;
}
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 620px;
  margin: auto;
}
.memory-card {
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Both faces occupy the same space */
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid #51466b;
}

/* Show only the question mark/logo initially */
.card-back {
  display: grid;
  background: linear-gradient(135deg, #34284e, #211b2e);
  color: white;
  font-size: 32px;
}

/* Hide the emoji initially */
.card-front {
  display: none;
  background: #d7f54a;
  color: #211b2e;
  font-size: 48px;
}

/* When JavaScript adds "flipped", swap the faces */
.memory-card.flipped .card-back {
  display: none;
}

.memory-card.flipped .card-front {
  display: grid;
}

/* Keep matched cards showing the emoji */
.memory-card.matched .card-back {
  display: none;
}

.memory-card.matched .card-front {
  display: grid;
}


.overlay {
  position: fixed;
  inset: 0;
  background: #110d19cc;
  display: grid;
  place-items: center;
  padding: 20px;
}
.hidden {
  display: none;
}
.overlay-card {
  background: var(--panel);
  border: 1px solid #5a4b78;
  padding: 38px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 10px 10px 0 #0c0911;
}
.eyebrow {
  color: var(--lime);
  font:
    11px "DM Mono",
    monospace;
  letter-spacing: 0.15em;
}
.overlay-card h2 {
  font-size: 42px;
  letter-spacing: -0.08em;
  margin: 10px 0;
}
.overlay-card p {
  color: var(--muted);
  line-height: 1.5;
}
.overlay-card .button {
  display: flex;
  margin-top: 18px;
}
.secondary {
  background: transparent;
  color: white;
  border: 1px solid #5a4b78;
  justify-content: center;
}
@media (max-width: 520px) {
  .game-header {
    flex-wrap: wrap;
  }
  .game-header h1 {
    order: 3;
    width: 100%;
  }
  .hud strong {
    font-size: 15px;
  }
  .hud div {
    padding: 10px 6px;
  }
  .hud span {
    font-size: 8px;
  }
  .memory-board {
    gap: 8px;
  }
}
