local q={s=function(q,O,e)applyUnit(q,O,e,nil,"\083\105\122\101")end,sx=function(q,O,e)applyUnit(q,O,e,"\120","\083\105\122\101")end,sy=function(q,O,e)applyUnit(q,O,e,"\121","\083\105\122\101")end;p=function(q,O,e)q.Padding=e=="\115\099"and UDim.new(O,0)or UDim.new(0,O)end;bg=function(q,O)local e,N,g=O:match("\040\037\100\043\041\044\040\037\100\043\041\044\040\037\100\043\041")if e and(N and g)then q.BackgroundColor3=Color3.fromRGB(tonumber(e),tonumber(N),tonumber(g))else warn("\073\110\118\097\108\105\100 \099\111\108\111\114 \102\111\114\109\097\116\058 "..O)end end,round=function(q,O,e)local N=q:FindFirstChild("\085\073\067\111\114\110\101\114")or Instance.new("\085\073\067\111\114\110\101\114",q)N.CornerRadius=e=="\115\099"and UDim.new(0,O)or UDim.new(O,0)end,border=function(q,O)q.BorderSizePixel=O end;bgtrans=function(q,O)q.BackgroundTransparency=O end;texttrans=function(q,O)q.TextTransparency=O end}function applyUnit(q,O,e,N,g)local o=q[g]if e=="\115\099"then if N=="\120"then q[g]=UDim2.new(O,o.X.Offset,o.Y.Scale,o.Y.Offset)elseif N=="\121"then q[g]=UDim2.new(o.X.Scale,o.X.Offset,O,o.Y.Offset)else q[g]=UDim2.new(O,o.X.Offset,O,o.Y.Offset)end elseif e=="\111\102\102"then if N=="\120"then q[g]=UDim2.new(o.X.Scale,O,o.Y.Scale,o.Y.Offset)elseif N=="\121"then q[g]=UDim2.new(o.X.Scale,o.X.Offset,o.Y.Scale,O)else q[g]=UDim2.new(o.X.Scale,O,o.Y.Scale,O)end elseif e=="\037"then local e=O/100 if N=="\120"then q[g]=UDim2.new(e,o.X.Offset,o.Y.Scale,o.Y.Offset)elseif N=="\121"then q[g]=UDim2.new(o.X.Scale,o.X.Offset,e,o.Y.Offset)else q[g]=UDim2.new(e,o.X.Offset,e,o.Y.Offset)end end end return q
local styleHandlers = {
    ["s"] = function(guiElement, value, unit)
        applyUnit(guiElement, value, unit, nil, "Size")
    end,
    ["sx"] = function(guiElement, value, unit)
        applyUnit(guiElement, value, unit, "x", "Size")
    end,
    ["sy"] = function(guiElement, value, unit)
        applyUnit(guiElement, value, unit, "y", "Size")
    end,
    ["p"] = function(guiElement, value, unit)
        guiElement.Padding = unit == "sc" and UDim.new(value, 0) or UDim.new(0, value)
    end,
    ["bg"] = function(guiElement, value)
        local r, g, b = value:match("(%d+),(%d+),(%d+)")
        if r and g and b then
            guiElement.BackgroundColor3 = Color3.fromRGB(tonumber(r), tonumber(g), tonumber(b))
        else
            warn("Invalid color format: " .. value)
        end
    end,
    ["round"] = function(guiElement, value, unit)
        local corner = guiElement:FindFirstChild("UICorner") or Instance.new("UICorner", guiElement)
        corner.CornerRadius = unit == "sc" and UDim.new(0, value) or UDim.new(value, 0)
    end,
    ["border"] = function(guiElement, value)
        guiElement.BorderSizePixel = value
    end,
    ["bgtrans"] = function(guiElement, value)
        guiElement.BackgroundTransparency = value
    end,
    ["texttrans"] = function(guiElement, value)
        guiElement.TextTransparency = value
    end,
    -- Add more handlers as needed
}

function applyUnit(guiElement, value, unit, axis, property)
    local size = guiElement[property]
    
    if unit == "sc" then
        if axis == "x" then
            guiElement[property] = UDim2.new(value, size.X.Offset, size.Y.Scale, size.Y.Offset)
        elseif axis == "y" then
            guiElement[property] = UDim2.new(size.X.Scale, size.X.Offset, value, size.Y.Offset)
        else
            guiElement[property] = UDim2.new(value, size.X.Offset, value, size.Y.Offset)
        end
    elseif unit == "off" then
        if axis == "x" then
            guiElement[property] = UDim2.new(size.X.Scale, value, size.Y.Scale, size.Y.Offset)
        elseif axis == "y" then
            guiElement[property] = UDim2.new(size.X.Scale, size.X.Offset, size.Y.Scale, value)
        else
            guiElement[property] = UDim2.new(size.X.Scale, value, size.Y.Scale, value)
        end
    elseif unit == "%" then
        local scaledValue = value / 100
        if axis == "x" then
            guiElement[property] = UDim2.new(scaledValue, size.X.Offset, size.Y.Scale, size.Y.Offset)
        elseif axis == "y" then
            guiElement[property] = UDim2.new(size.X.Scale, size.X.Offset, scaledValue, size.Y.Offset)
        else
            guiElement[property] = UDim2.new(scaledValue, size.X.Offset, scaledValue, size.Y.Offset)
        end
    end
end

return styleHandlers
