/* ==========================================================================
   Konak Hafıza Kartları (Eşleştirmece) — MK Konağı Oyun Odası
   ========================================================================== */

.hf-alan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* Zorluk & Ayar Çubuğu */
.hf-ust-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  background: var(--oo-kart-arkaplan);
  border: 1px solid var(--oo-kart-kenarlik);
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.hf-istatistik-grup {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.hf-stat-deger {
  color: var(--oo-altin);
  font-weight: 800;
  font-size: 1.05rem;
}

/* 3D Kart Izgarası */
.hf-izgara-sarmal {
  perspective: 1000px;
  width: 100%;
}

.hf-izgara {
  display: grid;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

/* Farklı Zorluk Seviyeleri için Izgara Sütunları */
.hf-izgara.kolay {
  grid-template-columns: repeat(4, 1fr); /* 12 kart (4x3) */
}

.hf-izgara.orta {
  grid-template-columns: repeat(4, 1fr); /* 16 kart (4x4) */
}

.hf-izgara.usta {
  grid-template-columns: repeat(6, 1fr); /* 24 kart (6x4) */
}

/* Tekil Kart Yapısı (3D Flip) */
.hf-kart {
  /* kart bir düğme: tarayıcının düğme görünümünü sıfırla */
  border: 0; padding: 0; margin: 0; background: none; font: inherit; color: inherit; width: 100%; display: block;
  aspect-ratio: 1 / 1.15;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.hf-kart:active {
  transform: scale(0.97);
}

.hf-kart.acik,
.hf-kart.eslesti {
  transform: rotateY(180deg);
  cursor: default;
}

.hf-kart.eslesti {
  animation: eslestiTitre 0.5s ease;
}

@keyframes eslestiTitre {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.08); }
}

.hf-kart-yuz {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s;
}

/* Kartın Önü (Kapalı Hali) - Konak Mührü */
.hf-kart-on {
  background: radial-gradient(circle at 50% 30%, #1e293b, #0f172a);
  border-color: rgba(212, 175, 55, 0.3);
}

.hf-kart-on::before {
  content: '🏛️';
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0.7;
}

.hf-kart-on::after {
  content: 'MK';
  font-family: var(--oo-font-baslik);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--oo-altin);
  margin-top: 4px;
  opacity: 0.8;
}

@media (hover: hover) { .hf-kart:hover:not(.acik):not(.eslesti) .hf-kart-on {
  border-color: var(--oo-altin);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
  transform: translateY(-2px);
} }

/* Kartın Arkası (Açık Hali) */
.hf-kart-arka {
  background: radial-gradient(circle at 50% 30%, #312e81, #1e1b4b);
  border-color: var(--oo-mor-acik);
  transform: rotateY(180deg);
  padding: 0.4rem;
}

.hf-kart.eslesti .hf-kart-arka {
  background: radial-gradient(circle at 50% 30%, #065f46, #064e3b);
  border-color: var(--oo-yesil);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.hf-kart-emoji {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.hf-kart-ad {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--oo-metin);
  text-align: center;
  margin-top: 0.3rem;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 540px) {
  .hf-izgara {
    gap: 6px;
  }
  .hf-kart-emoji {
    font-size: 1.6rem;
  }
  .hf-kart-ad {
    display: none; /* Mobilde kart adını gizle, sadece emoji kalsın */
  }
  .hf-izgara.usta {
    grid-template-columns: repeat(4, 1fr); /* Mobilde 24 kartı 4 sütuna yay */
  }
  .hf-ust-panel {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .hf-istatistik-grup {
    justify-content: space-around;
  }
}

.hf-kart:focus-visible { outline: 3px solid var(--oo-altin); outline-offset: 3px; border-radius: 0.9rem; }
