.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 16px;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #e9edf3;
    position: relative;
}

.category-tag {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 6px 16px;
    color: #64748b;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 48px;
}

.category-tag:hover {
    border-color: rgba(37, 99, 235, 0.4);
    color: #2563eb;
}

.category-tag.active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
    font-weight: 500;
}

/* 分类折叠：JS 计算第三行起的标签并加 tag-hidden，最多显示两行 */
.category-bar.collapsed .category-tag.tag-hidden {
    display: none;
}

.category-expand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 6px 12px;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 折叠态：按钮浮动紧跟第二行末尾标签，不再独立换行 */
.category-expand.is-float {
    position: absolute;
    z-index: 2;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.category-expand:hover {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.4);
}

.category-expand .expand-icon {
    font-size: 12px;
    transition: transform 0.25s ease;
}

.category-expand.expanded .expand-icon {
    transform: rotate(180deg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    position: relative;
    padding-left: 12px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: #2563eb;
}

.sort-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px;
}

.sort-item {
    padding: 5px 14px;
    border-radius: 2px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sort-item.active {
    background: #ffffff;
    color: #2563eb;
    font-weight: 500;
}

.sort-item:hover {
    color: #2563eb;
}

.comic-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.comic-card-sm {
    display: block;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.card-sm-cover {
    position: relative;
    padding-top: 140%;
    overflow: hidden;
    background: #f1f5f9 url('/assets/images/default_cover.png') center/cover no-repeat;
    border-radius: 4px;
}

.card-sm-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.comic-card-sm:hover .card-sm-cover img {
    transform: scale(1.05);
}

.card-sm-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    padding: 2px 7px;
    border-radius: 2px;
    font-size: 10px;
    color: #fff;
    line-height: 1.4;
}

.card-sm-info {
    padding: 8px 2px 0;
}

.card-sm-title {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.card-sm-author {
    font-size: 11px;
    color: #94a3b8;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 15px;
}

@media (max-width: 768px) {
    .comic-grid-3 {
        gap: 10px;
    }

    .category-bar {
        padding: 12px;
        gap: 8px;
    }

    .card-sm-info {
        padding: 8px 2px 0;
    }

    .card-sm-title {
        font-size: 12px;
    }
}
