        /* === การ์ดจัดอันดับ (Ranking Cards) === */
        .ranking-card {
            position: relative;
            display: block;
            overflow: hidden;
            border-radius: 0.375rem;
            aspect-ratio: 2 / 1;
            background-color: #343a40;
            transition: transform 0.3s ease;
        }
        .ranking-card:hover {
            transform: scale(1.03);
        }
        .ranking-card-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .ranking-card-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
            padding: 1.5rem 1rem 1rem;
            text-align: center;
        }
        .ranking-card-title {
            color: #fff;
            font-size: 1.25rem;
            margin: 0;
            font-weight: bold;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
        }


/* === 1. General & Layout === */
body { 
    background-color: #212529; 
}

/* Sidebar width for desktop */
.sidebar {
    width: 310px;
    flex-shrink: 0;
}

/* Responsive: Stack sidebar below content when screen is smaller than xxl breakpoint */
@media (max-width: 1399.98px) {
    .sidebar {
        width: 100%;
        margin-top: 2rem;
    }
}

.iframe-max-width-wrapper {
    max-width: 300px; /* กว้างสุดไม่เกิน 300px */
    width: 100%;      /* แต่ถ้าพื้นที่น้อยกว่า 300px ให้กว้างเต็ม 100% */
}

/* === 2. Navbar === */
.navbar .search-expand {
    width: 150px;
    transition: width 0.4s ease-in-out;
}
.navbar .search-expand:focus {
    width: 250px;
}


/* === 3. Article Cards (Gallery & Sidebar) === */
.doujin-item {
    transition: transform 0.2s ease-in-out;
    border-radius: 0.375rem;
    overflow: hidden;
    display: block;
    height: 100%;
    background-color: #343a40;
}
.doujin-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
}
.doujin-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background-color: #343a40;
}
.doujin-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.doujin-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 0.75rem 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}
.doujin-title {
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* === 4. Tags (on Article Cards) === */
.doujin-tags-container {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}
.doujin-tag {
    color: white;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    font-weight: bold;
    display: inline-block;
}
.doujin-tag--new { background-color: #dc3545; }
.doujin-tag--popular { background-color: #0d6efd; }
.doujin-tag--thai-artist { background-color: #198754; }
.doujin-tag--color { background-color: #ffc107; color: #000; }


/* 1. ซ่อน Banner เป็นค่าเริ่มต้น */
.side-banner {
    display: none;
}
/* 2. ใช้ Media Query เพื่อกำหนดสไตล์เมื่อหน้าจอกว้าง 2000px ขึ้นไปเท่านั้น */
@media (min-width: 2000px) {
    .side-banner {
        display: block;
        position: fixed; /* ทำให้เลื่อนตามหน้าจอ */
        top: 50px;      /* เว้นระยะจากด้านบน 300px */
        width: 300px;
        height: 1000px;
        z-index: 99;     /* ให้อยู่เหนือเนื้อหาบางส่วน แต่ต่ำกว่า Modal */
    }

    #left-banner {
        /* * คำนวณตำแหน่ง:
        * 50% = กึ่งกลางหน้าจอ
        * 700px = ครึ่งหนึ่งของ container (1400px / 2)
        * 30px = ระยะห่างจากขอบ container
        * 300px = ความกว้างของ iframe
        * right: calc(50% + 700px + 30px) คือการยึดขอบขวาของ iframe ไว้ที่ตำแหน่งนี้
        */
        right: calc(50% + 700px + 30px);
    }

    #right-banner {
        /*
        * คำนวณตำแหน่ง:
        * left: calc(50% + 700px + 30px) คือการยึดขอบซ้ายของ iframe ไว้ที่ตำแหน่งนี้
        */
        left: calc(50% + 700px + 30px);
    }
}

/* === 6. Final Banner (900x300) === */
.banner-viewport {
    max-width: 900px;
    width: 100%;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    border-radius: 0.375rem;
    background-color: #343a40;
}
.banner-content {
    width: 900px;
    height: 300px;
    position: absolute;
    top: 0;
    left: 0;
}
@keyframes pan-banner {
    0% { left: 0; }
    50% { left: calc(100% - 900px); }
    100% { left: 0; }
}
@media (max-width: 899.98px) {
    .banner-viewport .banner-content {
        animation: pan-banner 10s ease-in-out infinite alternate;
    }
}

/* === Navbar Menu Hover Effect === */
.navbar-nav .nav-link {
    transition: background-color 0.2s ease-in-out;
    border-radius: 0.375rem; /* ทำให้ขอบมน */
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1); /* สีพื้นหลังโปร่งแสง */
}