/* Memory Match */

.mm-setup {
  text-align: center;
  padding: 8px 0 24px;
}

.mm-setup-title {
  font-size: 26px;
  font-weight: 700;
  color: #19100c;
  margin: 0 0 16px;
}

.mm-setup-label {
  color: #6f6b6b;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 8px;
}

.mm-choice-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mm-choice-btn {
  cursor: pointer;
  background: #fff;
  border: 2px solid #e0e0e0;
  color: #19100c;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
  transition: border-color 0.2s, background-color 0.2s;
}

.mm-choice-btn.is-active {
  border-color: #f3724b;
  background: #fdece6;
}

.mm-begin-btn {
  cursor: pointer;
  background-color: #19100c;
  color: #fff;
  border: none;
  padding: 14px 40px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 28px;
  min-height: 44px;
  transition: background-color 0.2s;
}

.mm-begin-btn:hover {
  background-color: #f3724b;
}

.mm-loading {
  text-align: center;
  color: #6f6b6b;
  padding: 40px 0;
}

.mm-hud {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: #19100c;
  margin-bottom: 16px;
  padding: 0 4px;
}

.mm-peek-message {
  text-align: center;
  color: #f3724b;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px;
}

.mm-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 auto;
}

.mm-board--hard {
  grid-template-columns: repeat(4, 1fr);
}

.mm-card {
  /* Set by fitBoard() in memory-match.js so the whole board fits on one screen. */
  height: var(--mm-cell-h, 160px);
  perspective: 800px;
  cursor: pointer;
}

.mm-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}

.mm-card.is-flipped .mm-card-inner,
.mm-card.is-matched .mm-card-inner {
  transform: rotateY(180deg);
}

.mm-card.is-matched {
  cursor: default;
  opacity: 0.55;
}

.mm-card-back,
.mm-card-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* No position override here (or on the fronts) - they must stay absolutely positioned from the
   shared rule above, or they collapse to 0 height and the card shows nothing. */
.mm-card-back {
  background: linear-gradient(135deg, #f3724b 0%, #c65a3a 35%, #4a2f1f 70%, #19100c 100%);
}

.mm-card-back::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 44%;
  height: 44%;
  background-image: url('../../images/brachos-logo-white.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
}

.mm-card-front {
  background: #fff;
  border: 2px solid #f0f0f0;
  transform: rotateY(180deg);
  text-align: center;
  overflow: hidden;
  padding: 0;
}

/* Text-side cards (the bracha name) get a dark gradient instead of sitting on plain white, so
   they read as a distinct "type" of card at a glance, not just floating text - kept darker than
   the (now multicolor) card back so the two sides of the deck are still easy to tell apart. */
.mm-card-front--text {
  background: linear-gradient(135deg, #4a2f1f, #19100c);
  border-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

/* Image-side cards: the food photo fills the whole card as a background, with the food name in
   a scrim bar overlaid at the bottom, instead of a small thumbnail sitting above a text caption. */
.mm-card-front .mm-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mm-card-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 6px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
}

.mm-card-caption {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.mm-card-text {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  padding: 0 6px;
}

.mm-summary {
  text-align: center;
  padding: 24px 0;
}

.mm-summary h2 {
  font-size: 26px;
  color: #19100c;
  margin: 0 0 8px;
}

.mm-summary p {
  color: #6f6b6b;
  font-size: 15px;
  margin: 0;
}

@media (max-width: 480px) {
  .mm-board {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .mm-board--hard {
    grid-template-columns: repeat(4, 1fr);
  }

  .mm-card-caption {
    font-size: 9px;
  }

  .mm-card-text {
    font-size: 11px;
  }
}

.mm-hud {
  gap: 8px;
}
