Châteaux de la Loire
The brief
Normal Sudoku rules apply. Place the digits 1 to 9 in every row, column, and blue-outlined 3x3 box.
EQUAL SPLIT LOOP - Shade some cells to form a 1-cell-wide, orthogonally-connected loop that does not touch itself, not even diagonally. Split the loop into non-overlapping segments so that digits do not repeat within a segment and each segment has the same sum.
RIVER - Split points of the loop cannot occur on the blue river (loop segments must form a "bridge" when crossing the river).
CASTLES - A digit in a castle gives the number of loop segments in the same 3x3 box as that castle. A loop segment is counted if at least one of its cells appears within the 3x3 box. Castles may be on or off the loop.
FLAGS - Each flag touches one loop cell and one non-loop cell. Digits joined by a white flag must be consecutive, and digits joined by a black flag must be in a 2:1 ratio.