/* 多列网格容器：自动适配实际列数，不留空白 */
.book-rank-grid{
    display: grid;
    grid-template-columns: repeat(var(--col-count), 1fr);
    gap: 20px;
    margin: 24px 0;
}
/* 单个排行榜模块 */
.book-rank-module{
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    min-width: 0; /* 修复：防止grid子项内容溢出撑宽 */
}
/* 头部 */
.rank-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.rank-title{
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.rank-more{
    color: var(--color-link);
    font-size: 13px;
    text-decoration: none;
}
.rank-more:hover{
    color: var(--color-link-hover);
}
/* 排行列表 */
.rank-list{
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rank-item{
    border-radius: 6px;
    overflow: hidden;
    transition: background 0.2s;
}
.rank-item:hover{
    background: var(--bg-hover);
}
/* 精简行 */
.rank-item-main{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
}
/* 激活时隐藏精简行，解决编号标题重复 */
.rank-item.is-active .rank-item-main{
    display: none;
}
.rank-num{
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
}
/* 前三名彩色 */
.rank-1{ background: #fff1f0; color: #ff4d4f; }
.rank-2{ background: #fff7e6; color: #fa8c16; }
.rank-3{ background: #f9f0ff; color: #722ed1; }
.rank-item-content{
    flex: 1;
    min-width: 0;
}
.rank-item-title{
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.rank-item-meta{
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-tertiary);
}
/* 展开详情 */
.rank-item-detail{
    display: none;
    gap: 12px;
    padding: 8px 6px 10px;
}
.rank-item.is-active .rank-item-detail{
    display: flex;
}
.detail-cover{
    flex-shrink: 0;
    width: 80px;
    height: 110px;
    display: block;
}
.detail-cover img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.detail-info{
    flex: 1;
    min-width: 0;
}
.detail-title-row{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.detail-title{
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
    /* 修复：最多2行，超出省略，防止撑高 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.detail-desc{
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.detail-meta{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
}
.detail-meta span{
    display: flex;
    align-items: center;
    gap: 3px;
}
.detail-meta svg{
    width: 12px;
    height: 12px;
}
.meta-author{
    padding: 2px 6px;
    background: #fff7e6;
    color: #fa8c16;
    border-radius: 4px;
}
.meta-cate{
    padding: 2px 6px;
    background: #e6f7ff;
    color: #1890ff;
    border-radius: 4px;
}
/* 响应式适配 */
@media (max-width: 1024px){
    .book-rank-grid{
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px){
    .book-rank-grid{
        grid-template-columns: 1fr;
        gap: 16px;
    }
    /* 移动端全部展开详情 */
    .rank-item-main{
        display: none;
    }
    .rank-item-detail{
        display: flex;
        padding: 10px 0;
    }
    .detail-cover{
        width: 90px;
        height: 120px;
    }
    .detail-title{
        font-size: 16px;
    }
    .detail-desc{
        font-size: 13px;
    }
}
.empty-tip{
    padding: 30px 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}