body {
  margin: 0;
  min-height: 100vh;
  background: url('../img/background.jpg') no-repeat;
  background-size: cover;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: #fff;
}

.game-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.subtitle {
  margin: 8px 0 0;
  font-size: 18px;
  color: #e2e8f0;
}

#restart-btn {
  border: 0;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

#restart-btn:hover {
  background: #dc2626;
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat {
  background-color: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  padding: 18px;
  text-align: center;
  backdrop-filter: blur(10px);
}

#memory-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 14px;
  background: rgba(226, 232, 240, 0.9);
  max-width: 960px;
  padding: 28px;
  margin: 0 auto;
  border-radius: 36px;
  box-shadow: inset 0px 0px 20px -6px #615961;
}

.card {
  display: block;
  perspective: 300px;
  transform-style: preserve-3d;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.card.turned {
  pointer-events: none;
}

.card.blocked {
  pointer-events: none;
}

.card.turned .front {
  transform: rotateY(0deg);
}
.card.turned .back {
  transform: rotateY(180deg);
}

.card .back,
.card .front {
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.card .back {
  background: linear-gradient(135deg, #16355a 0%, #4f8ecb 100%);
}

.card .front {
  position: absolute;
  left: 0;
  top: 0;
  transform: rotateY(-180deg) translateZ(1px);
  backface-visibility: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

h1 {
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-weight: bolder;
  font-size: clamp(38px, 5vw, 64px);
  text-shadow: 0px 0px 20px #969696;
}

h2 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-weight: bolder;
  font-size: 18px;
  text-align: center;
}

p {
  margin: 0;
  font-weight: 700;
  font-size: 32px;
  text-align: center;
}

.game-message {
  min-height: 30px;
  margin-top: 16px;
  font-size: 20px;
  color: #fef08a;
}

@media (max-width: 768px) {
  .game-shell {
    padding: 16px 12px 24px;
  }

  #memory-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 16px;
    border-radius: 24px;
  }

  .hud {
    grid-template-columns: 1fr;
  }
}
