/* --- RESET & VARIABLES (DARK MODE THEME) --- */
:root {
    /* MÀU CHỦ ĐẠO MỚI */
    --primary-theme: #506891; 
    
    /* MÀU NỀN (DARK MODE) */
    --bg-body: #1a1a1a;       /* Đen gần đậm (không đen kịt) */
    --bg-element: #252525;    /* Nền cho các ô input/card */
    --bg-hover: #333333;      /* Màu khi di chuột vào */
    
    /* MÀU CHỮ */
    --text-main: #e0e0e0;     /* Chữ chính (trắng ngà) */
    --text-muted: #999999;    /* Chữ phụ (xám) */
    --text-dark: #000000;     /* Dùng cho các badge nền sáng */

    /* VIỀN & PHÂN CÁCH */
    --border-color: #333333;  /* Viền tối màu */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 13px;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--text-main); }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; color: var(--text-main); }

/* --- UTILITIES --- */
.container, .header__container, .nav__container, .main-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Badge giữ nguyên màu đỏ đặc trưng nhưng chỉnh lại viền cho hợp dark mode */
.badge-red {
    background: #ff4d4d;
    color: white;
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 50%;
    vertical-align: super;
}

/* Chấm xanh chuyển sang màu chủ đạo mới */
.badge-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--primary-theme);
    border-radius: 50%;
    margin-left: 2px;
}

.text-green { color: var(--primary-theme); } /* Đổi class này theo màu chủ đạo */

/* --- HEADER --- */
.header {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    background-color: var(--bg-body);
}
.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header__logo {
    font-size: 20px;
    letter-spacing: -1px;
    color: var(--text-main);
}
.header__search {
    position: relative;
    width: 350px;
}
.header__search input {
    width: 100%;
    padding: 8px 35px 8px 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-body); /* Input nền tối */
    color: var(--text-main);
    border-radius: 2px;
}
.header__search input::placeholder {
    color: #555;
}
.header__search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.btn-login {
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    font-size: 11px;
    margin-right: 5px;
    color: var(--text-muted);
    border-radius: 2px;
}
.btn-login:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

/* --- NAV --- */
.nav {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    background-color: var(--bg-body);
}
.nav__container {
    display: flex;
    align-items: center;
    height: 44px;
}
.nav__item {
    font-weight: bold;
    margin-right: 25px;
    font-size: 14px;
    color: var(--text-main);
    height: 100%;
    display: flex;
    align-items: center;
    opacity: 0.8;
}
.nav__item:hover { opacity: 1; }

.nav__item--active {
    background-color: var(--primary-theme); /* Màu chủ đạo mới */
    color: white;
    padding: 0 15px;
    margin-right: 15px;
    opacity: 1;
}

.nav__btn-creator {
    margin-left: auto;
    border: 1px solid var(--primary-theme);
    color: var(--primary-theme); /* Đổi sang style viền cho thanh thoát ở darkmode */
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
}
.nav__btn-creator .badge-dot { background-color: var(--primary-theme); }

/* --- MAIN LAYOUT --- */
.main-container {
    display: flex;
    gap: 30px;
}
.content { flex: 3; }
.sidebar { flex: 1; }

/* --- SECTIONS --- */
.section { margin-bottom: 40px; }
.section__header {
    display: flex;
    align-items: baseline;
    margin-bottom: 15px;
    position: relative;
}
.section__header h3 { font-size: 18px; margin-right: 15px; color: var(--text-main); }
.section__filters { font-size: 12px; color: var(--text-muted); }
.section__view-all {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
}
.section__view-all:hover { color: var(--text-main); text-decoration: underline; }

.divider { border: 0; border-top: 1px solid var(--border-color); margin: 30px 0; }

/* --- CARD LIST --- */
.card-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.card { cursor: pointer; }
.card__thumb {
    position: relative;
    width: 100%;
    height: 180px; /* 1. Chiều cao CỐ ĐỊNH cho khung ảnh */
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-element);
    flex-shrink: 0; /* Đảm bảo khung ảnh không bị co lại nếu flex bị lỗi */
}
.card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 2. Ảnh sẽ tự cắt (crop) để lấp đầy khung mà không bị méo */
    transition: transform 0.3s;
    opacity: 0.9;
}
.card:hover .card__thumb img { transform: scale(1.05); opacity: 1; }

.card__title {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--text-main);
    line-height: 1.4; /* Tăng khoảng cách dòng cho dễ đọc */
    
    /* 3. Kỹ thuật xuống dòng tối đa 2 dòng */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Số dòng tối đa muốn hiển thị */
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal; /* Cho phép xuống dòng tự nhiên */
}
.card__author {
    font-size: 11px;
    color: var(--text-muted);
}

/* Badges */
.badge-up {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--bg-body); /* Đổi nền badge thành màu tối */
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    font-size: 9px;
    padding: 1px 2px;
    font-weight: bold;
}
.badge-new {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-theme);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 2px;
}

/* --- FANTASY SECTION (Ranked) --- */
.genre-tags { margin-bottom: 15px; font-size: 12px; color: var(--text-muted); }
.genre-tags a { margin-right: 5px; }
.genre-tags a.active { color: var(--primary-theme); font-weight: bold; }

.rank-number {
    position: absolute;
    bottom: 0;
    left: 0;
    color: var(--text-main);
    font-size: 40px;
    font-weight: 900;
    line-height: 0.8;
    /* Tạo viền đen cho số để nổi trên ảnh */
    text-shadow: 2px 2px 0px var(--bg-body), -1px -1px 0 #000; 
    transform: translate(-5px, 5px); 
    z-index: 2;
}

/* --- NEW GAME SECTION --- */
.new-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.new-card__img {
    position: relative;
    height: 150px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: var(--bg-element);
}
.new-card__img img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9;}
.new-card__content h4 { font-size: 14px; margin-bottom: 3px; color: var(--text-main); }
.new-card__content .author { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.new-card__content .desc { font-size: 12px; color: #777; line-height: 1.4; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* --- SIDEBAR --- */
.widget__header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}
.widget__header h3 { font-size: 16px; margin-bottom: 5px; }
.widget__tabs { font-size: 11px; color: var(--text-muted); text-align: right; width: 100%; }
.widget__tabs span { cursor: pointer; }
.widget__tabs span:hover { color: var(--text-main); }
.widget__tabs span.active { color: var(--primary-theme); font-weight: bold; }

.sidebar__widget .widget__header span a {
    color: var(--primary-theme);
    font-size: 15px;
}

.sidebar__widget { margin-bottom: 30px; }

.ranking-list { border-top: 1px solid var(--border-color); }
.ranking-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.ranking-item:hover { background-color: var(--bg-hover); } /* Thêm hiệu ứng hover */

.rank-idx {
    font-size: 18px;
    font-weight: bold;
    width: 30px;
    text-align: center;
    color: var(--text-muted);
}
.rank-idx--1 { color: var(--primary-theme); } /* Top 1 màu #506891 */

.ranking-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 10px;
    border: 1px solid var(--border-color);
}
.rank-info h4 { font-size: 13px; font-weight: bold; color: var(--text-main); }
.rank-info p { font-size: 11px; color: var(--text-muted); }
.badge-up-small {
    border: 1px solid #ff4d4d; color: #ff4d4d; font-size: 8px; padding: 0 2px; margin-right: 3px;
}

/* --- SIDEBAR 2 --- */
.widget__header2 {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}
.widget__header2 h3 { font-size: 16px; margin-bottom: 5px; }
.widget__tabs2 { font-size: 11px; color: var(--text-muted); text-align: right; width: 100%; }
.widget__tabs2 span { cursor: pointer; }
.widget__tabs2 span:hover { color: var(--text-main); }
.widget__tabs2 span.active { color: var(--primary-theme); font-weight: bold; }

.sidebar__widget2 .widget__header2 span a {
    color: var(--primary-theme);
    font-size: 15px;
}

.sidebar__widget2 { margin-bottom: 30px; }

.ranking-list2 { border-top: 1px solid var(--border-color); }
.ranking-item2 {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.ranking-item2:hover { background-color: var(--bg-hover); } /* Thêm hiệu ứng hover */

.rank-idx2 {
    font-size: 18px;
    font-weight: bold;
    width: 30px;
    text-align: center;
    color: var(--text-muted);
}

.ranking-item2 img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 10px;
    border: 1px solid var(--border-color);
}
.rank-info2 h4 { font-size: 13px; font-weight: bold; color: var(--text-main); }
.rank-info2 p { font-size: 11px; color: var(--text-muted); }
.badge-up-small2 {
    border: 1px solid #ff4d4d; color: #ff4d4d; font-size: 8px; padding: 0 2px; margin-right: 3px;
}

/* Responsive cơ bản */
@media (max-width: 768px) {
    .main-container { flex-direction: column; }
    .card-list { grid-template-columns: repeat(3, 1fr); }
    .new-list { grid-template-columns: 1fr; }
}
