export const CHAT_FONT_LEVEL_MIN = 1
export const CHAT_FONT_LEVEL_MAX = 6

export function clampChatFontLevel(level: number): number {
    const n = Math.floor(Number(level) || CHAT_FONT_LEVEL_MIN)
    return Math.max(CHAT_FONT_LEVEL_MIN, Math.min(CHAT_FONT_LEVEL_MAX, n))
}

/** 直播間主聊天（預設 level 2） */
export function roomChatFontSizePx(level: number): number {
    const clamped = clampChatFontLevel(level)
    return Math.max(12, 13 + (clamped - 2) * 2)
}

/** 彈出視窗／OBS（預設 level 4，base 14px） */
export function popoutChatFontSizePx(level: number, baseSize = 14): number {
    const clamped = clampChatFontLevel(level)
    return Math.max(10, baseSize + (clamped - 4) * 2)
}
