@font-face {
  font-family: 'WinkySans';
  src: url('https://imad.click/fonts/winky-sans-medium.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

body {
  background-color: #fff;
  margin: 0;
  padding: 0;
  font-family: 'WinkySans', sans-serif;
}

/* وصف */
.description-card {
  grid-column: span 8;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 16px 24px;
  font-size: clamp(12px, 1.5vw, 16px);
  color: #707070;
  line-height: 1.4;
  text-align: center;
  margin: 0 auto 30px;
  contain: layout style;
  content-visibility: auto;
}

/* شبكة */
.category-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 15px;
  justify-items: center;
  margin: 80px auto 50px;
  padding: 0 5vw;
  box-sizing: border-box;
}

/* البطاقة */
.category-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  transition: transform 0.3s ease;
  will-change: transform;
}

.category-card:hover {
  transform: scale(1.05);
}

.category-card img {
  aspect-ratio: 1/1;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  transition: transform 0.3s ease;
  contain: content;
}

.category-card:hover img {
  transform: scale(1.05);
}

.category-card .game-title {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 5px 8px;
  font-size: clamp(10px, 1.4vw, 13px);
  line-height: 1.2;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 2px rgba(0,0,0,0.7);
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
  box-sizing: border-box;
}

.category-card:hover .game-title {
  animation: shake-image 0.8s ease-in-out;
}

.category-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 38px;
  height: 38px;
  background: url('https://imad.click/images/play-icon-white.webp') no-repeat center;
  background-size: contain;
  opacity: 0;
  transition: all 0.3s ease;
}

.category-card:hover::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* أنيميشين اهتزاز */
@keyframes shake-image {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10%, 30%, 50% { transform: rotate(3deg) scale(1.03); }
  20%, 40%, 60% { transform: rotate(-3deg) scale(1.03); }
  70%, 80% { transform: rotate(1deg) scale(1.01); }
  90% { transform: rotate(-1deg) scale(1.01); }
}

.shake-once {
  animation: shake-image 0.8s ease-in-out;
}

/* بطاقة ثابتة */
.fixed-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #00FFD1;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  overflow: hidden;
  will-change: transform;
}

.fixed-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  animation: fixedCardAnim 3.5s ease-in-out infinite;
  transform-origin: center;
}

@keyframes fixedCardAnim {
  0%, 10% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-3deg) scale(1.05); }
  20% { transform: rotate(3deg) scale(1.05); }
  25% { transform: rotate(-2deg) scale(1.03); }
  30% { transform: rotate(2deg) scale(1.03); }
  40%, 50% { transform: rotate(0deg) scale(1); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 0 30px;
  }

  .category-card::after {
    width: 32px;
    height: 32px;
  }

  .description-card {
    grid-column: span 4;
    margin: 20px 30px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px;
    margin: 60px 0 40px;
  }

  .category-card::after {
    width: 30px;
    height: 30px;
  }

  .description-card {
    grid-column: span 3;
    padding: 20px;
    font-size: clamp(13px, 2.5vw, 16px);
    margin: 15px;
  }
}
