```python
def match_setting(rules: dict, name: str) -> str | None:
    if not isinstance(name, str) or not name:
        raise ValueError("Name must be a non-empty string")
    
    for selector, value in rules.items():
        if not isinstance(selector, str):
            raise ValueError("Selector must be a string")
        if not isinstance(value, str):
            raise ValueError("Rule value must be a string")
        
        if selector == name:
            return value
        elif selector.endswith('.*') and name.startswith(selector[:-2]):
            return value
    
    if '*' in rules:
        return rules['*']
    
    return None
```