/* =========================================================================
   Category & Game AI Generated Description Styles
   Thiết kế kính/gương (glassmorphism): nền sáng, text tối dễ đọc,
   link xanh, ảnh game bọc link hiển thị dạng card.
   ========================================================================= */

.category-description {
    position: relative;
    overflow: hidden;
    margin: 40px 0;
    padding: 30px 34px;
    border-radius: 20px;
    /* Nền sáng kiểu kính mờ + hiệu ứng gương phản chiếu */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(238, 242, 248, 0.88) 100%);
    -webkit-backdrop-filter: blur(14px) saturate(165%);
    backdrop-filter: blur(14px) saturate(165%);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow:
        0 10px 36px rgba(15, 23, 42, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    color: #1f2733;
    font-size: 15px;
    line-height: 1.85;
    text-align: justify;
}

/* Vệt sáng phản chiếu chéo tạo cảm giác mặt gương */
.category-description::before {
    content: '';
    position: absolute;
    top: 0;
    left: -30%;
    width: 60%;
    height: 100%;
    background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    transform: skewX(-18deg);
    pointer-events: none;
    opacity: .6;
}

.category-description > * {
    position: relative;
    z-index: 1;
}
.category-description .ai-games-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Typography ---------- */
.category-description h2,
.category-description h3 {
    color: #0f1722;
    font-weight: 700;
    line-height: 1.35;
    margin: 22px 0 12px;
}

.category-description h2 {
    font-size: 23px;
}

.category-description h3 {
    font-size: 19px;
}

.category-description h2:first-child,
.category-description h3:first-child {
    margin-top: 0;
}

.category-description p {
    margin: 0 0 15px;
}

.category-description ul,
.category-description ol {
    padding-left: 24px;
    margin: 0 0 15px;
}

.category-description li {
    margin-bottom: 7px;
}

.category-description strong {
    color: #0f1722;
}

/* ---------- Link văn bản: màu xanh, hover đậm + gạch chân ---------- */
.category-description a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s ease;
}

.category-description a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ---------- Ảnh đại diện game (bọc trong link) -> card đẹp ---------- */
.category-description a:has(img) {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
    margin: 12px 14px 12px 0;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    color: #1f2733;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    vertical-align: top;
    transition: transform .25s ease, box-shadow .25s ease, color .25s ease;
}

.category-description a:has(img):hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
    color: #2563eb;
    text-decoration: none;
}

/* Override inline-style của AI để ảnh game gọn gàng, vuông vức */
.category-description a img,
.category-description img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 0 8px 0 !important;
    border-radius: 11px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform .25s ease;
}

.category-description a:has(img):hover img {
    transform: scale(1.04);
}

/* Khi AI đặt ảnh + tên game bên trong <li>: biến li thành card hàng ngang */
.category-description li:has(a img) {
    list-style: none;
    margin-left: -24px;
}

.category-description li:has(a img) a {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    font-size: 16px;
    color: #1f2733;
}

.category-description li:has(a img) a:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
    color: #2563eb;
    text-decoration: none;
}

.category-description li:has(a img) img {
    width: 72px !important;
    max-width: 72px !important;
    margin: 0 !important;
    flex-shrink: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 575px) {
    .category-description {
        padding: 20px 18px;
        border-radius: 16px;
        font-size: 14px;
    }

    .category-description a:has(img) {
        width: calc(50% - 10px);
        margin: 8px 8px 8px 0;
    }
}

/* -------------------------------------------------------
   Grid tổng hợp game links được gom từ ul/li hoặc p đơn
   ------------------------------------------------------- */
.category-description .ai-games-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

/* Mỗi phần tử <a> trong grid đã là card chuẩn qua rule a:has(img) bên trên */
.category-description .ai-games-grid > a {
    /* Đảm bảo mỗi card chiếm tỉ lệ cố định trong flex */
    flex: 0 0 auto;
}

@media (max-width: 575px) {
    .category-description .ai-games-grid {
        gap: 10px;
    }
}
