/* 0.7.1: rendezett külső keret és jelentéshelyes döntésszínek. */
.bng-fc-matching {
  position: relative;
  width: min(100%, 940px);
  min-height: 518px;
  padding: 24px;
  border: 1px solid #d9e7df;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 12px 34px #174f3812;
}
.bng-match-start { padding: 12px 25px 25px; }
.bng-match-closed-decks div {
  width: min(38vw, 288px);
  height: 250px;
}
.bng-match-actions button { background: #174f38; }
.bng-match-actions button + button { background: #ab0939; }
/* 0.7.4: a vegyes médiás kártyák közös tartalmi tengelye. */
.bng-match-card {
  position: relative;
  gap: 8px;
  height: 250px;
  min-height: 250px;
  max-height: 250px;
  overflow: hidden;
}
.bng-match-main {
  display: flex;
  min-width: 0;
  width: 100%;
  align-items: center;
  justify-content: center;
}
.bng-match-card.has-audio:not(.is-audio-only) .bng-match-main {
  min-height: 150px;
}
.bng-match-card.has-text.has-audio:not(.has-image) .bng-match-main {
  min-height: 0;
}
.bng-match-card.has-text.has-audio:not(.has-image) .bng-match-audio {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
}
.bng-match-card.has-image.has-audio img {
  max-height: 145px;
}
.bng-match-card.has-audio:not(.is-audio-only) .bng-match-audio {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  margin-top: 0;
}
.bng-match-card.has-audio:not(.is-audio-only) .bng-match-audio svg {
  width: 23px;
  height: 23px;
}
.bng-match-audio:disabled {
  cursor: default;
  opacity: .68;
}
/* 0.7.5: látható kártyamozgások, erősebb keverés és középre tett hanggomb. */
.bng-match-card.is-audio-only { display: grid !important; place-items: center !important; padding: 20px !important; }
.bng-match-card.is-audio-only .bng-match-main { display: none !important; }
.bng-match-card.is-audio-only > .bng-match-audio--solo {
  position: absolute !important;
  inset: 50% auto auto 50% !important;
  width: 92px !important;
  height: 92px !important;
  min-width: 92px !important;
  min-height: 92px !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: translate(-50%,-50%) !important;
  z-index: 8 !important;
}
.bng-match-card.is-audio-only > .bng-match-audio--solo svg { width: 48px !important; height: 48px !important; }
.bng-match-deck { isolation: isolate; }
.bng-match-deck::before,.bng-match-deck::after {
  z-index: 0;
  background: repeating-linear-gradient(135deg,var(--green),var(--green) 12px,#236e51 12px,#236e51 24px);
}
.bng-match-card { position: relative; z-index: 2; transform-style: preserve-3d; }
.bng-match-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 5;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: repeating-linear-gradient(135deg,var(--green),var(--green) 12px,#236e51 12px,#236e51 24px);
  backface-visibility: hidden;
  transform-origin: center;
  transition: opacity .62s ease,transform .84s cubic-bezier(.2,.72,.28,1);
}
.bng-match-card.is-face-down::after { opacity: 1; transform: rotateY(0); }
.bng-match-card.is-face-up::after { opacity: 0; transform: rotateY(90deg); pointer-events: none; }
.bng-match-card.is-matched { animation: bng-match-shrink .68s cubic-bezier(.4,0,.6,1) forwards; }
.bng-match-card.is-returning { animation: bng-match-return .7s ease-in-out forwards; }
.bng-match-actions [data-answer]:disabled { opacity: .55; cursor: wait; }
@keyframes bng-match-shrink {
  0% { opacity: 1; transform: scale(1); }
  72% { opacity: 1; transform: scale(.35); }
  100% { opacity: 0; transform: scale(0); }
}
@keyframes bng-match-return {
  0% { opacity: 1; transform: rotateY(0) translateY(0); }
  100% { opacity: 1; transform: rotateY(90deg) translateY(8px); }
}
.bng-match-shuffle { height: 260px; overflow: hidden; }
.bng-match-shuffle div {
  top: 46px;
  width: min(34vw,230px);
  height: 175px;
  border: 1px solid #d9e7df;
  background: repeating-linear-gradient(135deg,var(--green),var(--green) 12px,#236e51 12px,#236e51 24px);
  box-shadow: 5px 7px 0 #d9e7df;
}
.bng-match-shuffle div.is-left { animation: bng-riffle-left 1.55s ease-in-out infinite; }
.bng-match-shuffle div.is-right { animation: bng-riffle-right 1.55s ease-in-out infinite; }
.bng-match-shuffle div:nth-child(3),.bng-match-shuffle div:nth-child(4) { animation-delay: .26s; }
@keyframes bng-riffle-left {
  0%,100% { transform: translateX(-105%) rotate(-5deg); }
  52% { transform: translateX(-58%) rotate(2deg); }
}
.bng-match-restart {
  display: block;
  position: static;
  margin: 10px auto 0 0;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #b9ccc1;
  border-radius: 20px;
  background: #fff;
  color: var(--green);
  font: 700 .86rem/1 inherit;
  cursor: pointer;
}
.bng-match-restart:hover { background: #f2f8f5; }
.bng-match-restart span { font-size: 1.15em; }
@keyframes bng-riffle-right {
  0%,100% { transform: translateX(5%) rotate(5deg); }
  52% { transform: translateX(-42%) rotate(-2deg); }
}

/* 0.7.9: a döntés visszajelzése legyen azonnal észrevehető. */
.bng-match-feedback {
  height: 76px !important;
  font-size: clamp(4rem, 8vw, 5.5rem) !important;
  line-height: 1 !important;
}
@media (prefers-reduced-motion: reduce) {
  .bng-match-card,.bng-match-card::after,.bng-match-shuffle div { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 620px) {
  .bng-fc-matching { min-height: 0; padding: 14px; border-radius: 18px; }
  .bng-match-start { padding: 12px 8px 20px; }
  .bng-match-closed-decks div { width: min(34vw, 180px); height: 140px; }
  .bng-match-board { gap: 10px; }
  .bng-match-card,.bng-match-board.has-media .bng-match-card { height: 185px; min-height: 185px; max-height: 185px; }
  .bng-match-feedback { height: 58px !important; font-size: 4rem !important; }
  /* A rossz pár csak visszajelzést kap, majd új lapok jelennek meg. */
  .bng-match-card.is-returning { animation: none; }
  .bng-match-actions:has([data-answer]) {
    flex-direction: row;
    gap: 8px;
  }
  .bng-match-actions:has([data-answer]) button {
    flex: 1 1 50%;
    width: auto;
    min-width: 0;
  }
  .bng-match-actions [data-answer="no-pair"] { order: 1; }
  .bng-match-actions [data-answer="pair"] { order: 2; }
  /* A döntésgombok közelebb kerülnek az alsó kártyához; az újraindítás marad. */
  .bng-match-actions:has([data-answer]) { margin-top: -18px; }
  .bng-match-card.has-audio:not(.is-audio-only) .bng-match-main { min-height: 105px; }
  .bng-match-card.has-text.has-audio:not(.has-image) .bng-match-main { min-height: 0; }
  .bng-match-card.has-text.has-audio:not(.has-image) .bng-match-audio { bottom: 14px; }
  .bng-match-card.has-image.has-audio img { max-height: 100px; }
  .bng-match-restart { padding: 6px 9px; font-size: .78rem; }
}
