/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body */
body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-y: hidden;
}

/* Glass effect */
.glass {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* Start Page */
.start-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}

.start-page button {
  padding: 12px 30px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
}

.start-page button:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.2);
}

/* Category Page */
.category-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 90%;
  max-width: 400px;
  margin: 0 auto;
  height: 100vh;
  justify-content: center;
  align-content: center;
}

.category-page button {
  padding: 15px 10px;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
}

.category-page button:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.15);
}

/* Wrapper (Game Page) - وسط چین کل محتوا */
.wrapper {
  display: flex;
  flex-direction: column;     /* عناصر زیر هم */
  justify-content: center;    /* وسط عمودی */
  align-items: center;        /* وسط افقی */
  width: 100%;
  min-height: 100vh;
  padding: 10px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  gap: 20px;                  /* فاصله بین stats، کارت‌ها و دکمه */
}

/* Stats */
.stats {
  display: flex;
  justify-content: space-between;
  width: 90%;
  max-width: 400px;
  padding: 10px 15px;
  font-weight: bold;
  font-size: 1rem;
  color: #fff;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(5px);
}

.stats div {
  flex: 1;
  text-align: center;
}

/* Game Container 4x4 */
.games-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  justify-items: center;   /* وسط کارت‌ها داخل ستون */
  justify-content: center; /* وسط کل Grid داخل wrapper */
}
/* Stop Button */
#stop-btn {
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
  backdrop-filter: blur(5px);
}

#stop-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

/* Hide class */
.hide {
  display: none;
}

/* Card Styles - مربعی و شیشه‌ای */
.card-container {
  width: 25vw;       /* بزرگ‌تر */
  max-width: 150px;  /* بزرگ‌تر */
  aspect-ratio: 1 / 1;  /* مربعی */
  perspective: 1000px;
  position: relative;
}
.active{
  transform:scale(0.8);
}
.card-container .card-before,
.card-container .card-after {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  position: absolute;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.5s, background 0.3s;
}

.card-container .card-before {
  background: rgba(255,255,255,0.05);
  color: #fff;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.15);
}

.card-container .card-after {
  transform: rotateY(180deg);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-container.flipped .card-before {
  transform: rotateY(180deg);
}

.card-container.flipped .card-after {
  transform: rotateY(0deg);
}

.card-container .image {
  width: 90%;
  height: 90%;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  background: transparent;
}

/* Responsive tweaks for phones */
@media (max-width: 480px) {
  .games-container {
    gap: 8px;
  }

  .card-container {
    width: 22vw;
    max-width: 80px;
  }

  .stats {
    flex-direction: column;
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  #stop-btn {
    padding: 8px 20px;
    font-size: 0.85rem;
  }
}
