.memory-hero {
  min-height: 68vh;
  background-color: #000;
  background-image: none;
}

.memory-hero .hero-title {
  max-width: 10ch;
}

.memory-mascot {
  width: min(100%, 380px);
  height: auto;
  display: block;
  margin-left: auto;
}

.breadcrumb-bar .breadcrumb {
  margin-bottom: 0;
}

.breadcrumb-bar a {
  color: #C90C0F;
  text-decoration: none;
}

.breadcrumb-bar a:hover {
  text-decoration: underline;
}

.breadcrumb-bar .breadcrumb-item.active {
  color: #968F88;
}

#memory-game {
  scroll-margin-top: 96px;
}

.memory-panel {
  max-width: 760px;
  margin: 0 auto 36px;
  background: #FFFFFF;
  border: 1px solid #E9E4DF;
  border-radius: 18px;
  padding: 28px 24px 8px;
}

.memory-panel .form-control {
  border: 1px solid #E9E4DF;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  color: #1E1B19;
}

.memory-panel .form-control:focus {
  border-color: #C90C0F;
  box-shadow: 0 0 0 3px rgba(201, 12, 15, 0.12);
}

#gameButtons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 20px;
}

#main button.btn-primary-brand,
#main button.btn-memory {
  border-radius: 999px;
  padding: 12px 22px;
  font-family: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms, box-shadow 140ms, transform 140ms;
}

#main button.btn-primary-brand {
  background: #C90C0F;
  color: #fff;
  border: none;
}

#main button.btn-primary-brand:hover {
  background: #B00A0D;
  box-shadow: 0 10px 30px rgba(201, 12, 15, 0.28);
  transform: translateY(-1px);
  color: #fff;
}

#main button.btn-memory {
  background: #FFFFFF;
  color: #0E0C0B;
  border: 1.6px solid #E9E4DF;
}

#main button.btn-memory:hover {
  border-color: #C90C0F;
  color: #C90C0F;
}

#main button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.memory-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.memory-stat {
  background: #F4F1EE;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 15px;
  color: #0E0C0B;
}

.memory-stat span {
  color: #C90C0F;
}

#gameBoardWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#gameBoard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

#gameBoard .card-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
}

#gameBoard .card-body {
  width: 100%;
  height: 100%;
  padding: 0;
  flex: none;
}

#gameBoard .card-flip-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
  position: relative;
  width: 100%;
  height: 100%;
}

#gameBoard .card-wrapper.flipped .card-flip-inner {
  transform: rotateY(180deg);
}

#gameBoard .card-front,
#gameBoard .card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(30, 27, 25, 0.08);
}

#gameBoard .card-back {
  transform: rotateY(180deg);
}

#leaderboardModal .modal-content {
  border: none;
  border-radius: 18px;
  overflow: hidden;
  font-family: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
}

#leaderboardModal .modal-header {
  background: #0E0C0B;
  color: #fff;
  border-bottom: none;
}

#leaderboardModal .btn-close {
  filter: invert(1);
}

#leaderboardModal .table {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .memory-hero {
    min-height: 0;
    padding-bottom: 12px;
  }

  .memory-mascot {
    width: min(100%, 240px);
    margin: 12px auto 0;
  }

  .memory-panel {
    padding: 20px 16px 4px;
  }

  #gameBoard {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #gameBoard .card-flip-inner,
  #main button.btn-primary-brand,
  #main button.btn-memory {
    transition: none;
  }
}
