.control-strip {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(7, 18, 16, 0.76);
}

.control-strip label {
  display: grid;
  gap: 5px;
  min-width: min(250px, 100%);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

select {
  min-height: 44px;
  padding: 9px 34px 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--cream);
  background: #10231e;
  font-weight: 750;
}

.key-tip {
  margin: 0 0 7px auto;
  color: var(--muted);
  font-size: 0.74rem;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.07);
  font: inherit;
}

.board-wrap {
  isolation: isolate;
  min-height: 460px;
  display: grid;
  place-items: center;
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: -1;
  background:
    repeating-linear-gradient(45deg, transparent 0 29px, rgba(84, 243, 194, 0.027) 30px 31px),
    radial-gradient(circle, rgba(255, 79, 163, 0.08), transparent 56%);
}

.board-stamp {
  position: absolute;
  right: -4px;
  bottom: -22px;
  z-index: -1;
  color: rgba(255, 243, 207, 0.035);
  font-family: Georgia, serif;
  font-size: clamp(7rem, 25vw, 18rem);
  line-height: 1;
  transform: rotate(-7deg);
}

.match-board {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(7px, 1.4vw, 13px);
  perspective: 900px;
}

.match-card {
  position: relative;
  min-height: clamp(92px, 14vw, 132px);
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: transparent;
  cursor: pointer;
  perspective: 700px;
}

.match-card:disabled {
  cursor: default;
}

.card-inner {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 243, 207, 0.2);
  border-radius: inherit;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.25);
  transform-style: preserve-3d;
  transition: transform 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.match-card.flipped .card-inner,
.match-card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 9px;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-back {
  background:
    radial-gradient(circle at center, rgba(200, 255, 54, 0.14) 0 7%, transparent 8%),
    repeating-radial-gradient(circle at center, transparent 0 12px, rgba(84, 243, 194, 0.05) 13px 14px),
    linear-gradient(145deg, #16372e, #0b1d1a);
}

.card-back::after {
  content: "ک";
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: auto;
  border: 1px solid rgba(255, 200, 86, 0.45);
  border-radius: 50%;
  color: var(--gold);
  font: 800 1.45rem Georgia, serif;
}

.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #fff1c7, #f4d997);
  color: #15221d;
}

.match-card[data-side="ur"] .card-front {
  border: 2px solid var(--pink);
  background: linear-gradient(145deg, #ffe3f2, #f5abc9);
}

.match-card.matched .card-inner {
  border-color: var(--acid);
  box-shadow: 0 0 0 2px rgba(200, 255, 54, 0.2), 0 12px 28px rgba(200, 255, 54, 0.15);
}

.urdu-word {
  font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Segoe UI", serif;
  font-size: clamp(1.65rem, 4.7vw, 2.85rem);
  font-weight: 750;
  line-height: 1.45;
}

.english-word {
  font-size: clamp(0.96rem, 2.3vw, 1.35rem);
  font-weight: 950;
  line-height: 1.05;
  text-transform: uppercase;
}

.roman-word {
  margin-top: 5px;
  color: #5a4941;
  font-size: clamp(0.68rem, 1.7vw, 0.84rem);
  font-weight: 750;
}

.help-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
}

.result-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 20px;
}

.result-words span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
}

.centered {
  justify-content: center;
}

.result-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

@media (max-width: 610px) {
  .match-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .match-card {
    min-height: 84px;
    border-radius: 12px;
  }

  .key-tip {
    display: none;
  }

  .board-wrap {
    min-height: 390px;
    padding: 9px;
  }
}

@media (max-width: 390px) {
  .match-board {
    grid-template-columns: repeat(4, minmax(61px, 1fr));
  }

  .match-card {
    min-height: 76px;
  }

  .urdu-word {
    font-size: 1.45rem;
  }

  .english-word {
    font-size: 0.78rem;
  }

  .roman-word {
    font-size: 0.58rem;
  }
}
