\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{patterns}

% We put nodes in a separate layer, so we can
% slightly overlap with paths for a perfect fit
\pgfdeclarelayer{nodes}
\pgfdeclarelayer{path}
\pgfsetlayers{main,nodes}

% Layer settings
\tikzset{
	% Layer hack, lets us write
	% later = * in scopes.
	layer/.style = {
		execute at begin scope={\pgfonlayer{#1}},
		execute at end scope={\endpgfonlayer}
	},
	%
	% Arrowhead tweak
	>={Latex[ width=2mm, length=2mm ]},
	%
	% Labels inside edges
	label/.style = {
		rectangle,
		% For automatic red background in solutions
		fill = \bgcolor,
		draw = none,
		rounded corners = 0mm
	},
	%
	% Nodes
	main/.style = {
		draw,
		circle,
		fill = white,
		line width = 0.35mm
	},
	accept/.style = {
		draw,
		circle,
		fill = white,
		double,
		double distance = 0.5mm,
		line width = 0.35mm
	},
	reject/.style = {
		draw,
		rectangle,
		fill = white,
		text = black,
		double,
		double distance = 0.5mm,
		line width = 0.35mm
	},
	start/.style = {
		draw,
		rectangle,
		fill = white,
		line width = 0.35mm
	},
	%
	% Loop tweaks
	loop above/.style = {
		min distance = 2mm,
		looseness = 8,
		out = 45,
		in = 135
	},
	loop below/.style = {
		min distance = 5mm,
		looseness = 10,
		out = 315,
		in = 225
	},
	loop right/.style = {
		min distance = 5mm,
		looseness = 10,
		out = 45,
		in = 315
	},
	loop left/.style = {
		min distance = 5mm,
		looseness = 10,
		out = 135,
		in = 215
	}
}