Off-Platform Project: Coded Correspondence

Hello there,

I worked on the coded correspondance exercise, and I would be happy to have some feedback on my code, about optimisation, bad part if you see something obvious, thank you!

"""
décodeur de messages basé sur le code césar
"""


ref = "abcdefghijklmnopqrstuvwxyz"
ref_lst = list("abcdefghijklmnopqrstuvwxyz")
specials = "!@#$%^&*()?:;,.\":"

#######################################################
#funtion offset alphabet letters with the offset defined by user.
######################################################
def alphabet_index_offset (offset):
    ref_lst_offset = list("abcdefghijklmnopqrstuvwxyz")
    for letter in ref_lst:
        while offset > 26:
            offset = abs(offset -26)
        else:
            offset = offset
            i = ref_lst.index(letter)
            if i < (26 - offset):
                ref_lst_offset[i + offset] = letter
            elif i >= (26 - offset):
                ref_lst_offset[i - (26 - offset)] = letter

    return ref_lst_offset




######################################################
#function to code a user message.
######################################################
def decoder (text, offset):
    #ref_lst = list("abcdefghijklmnopqrstuvwxyz")
    decypher_lst =[]
    alphabet_offset_ref = alphabet_index_offset (offset)
    text.split()
    for word in text:
        for letters in word:
            if letters in ref_lst:
                i = ref_lst.index(letters)
                decypher_lst.append(alphabet_offset_ref[i])
            else:
                continue

    msg = list(text)
    i = 0
    decoded_msg = ""
    for letter in msg:
        if letter in ref:
            decoded_msg += decypher_lst[i]
            i += 1
        elif letter in specials:
            decoded_msg += letter
        elif letter == " ":
            decoded_msg += " "
        else:
            continue

    return decoded_msg



#######################################################
#function who decode a user message.
#######################################################
def coder (text, offset):
    alphabet_offset_ref = alphabet_index_offset (offset)
    msg_to_code = list(text)
    i = 0
    coded_msg = ""

    for letter in msg_to_code:
        if letter in ref:
            coded_msg += alphabet_offset_ref[i]
            i += 1
        elif letter in specials:
            coded_msg += letter
        elif letter == " ":
            coded_msg += " "
        else:
            continue

    return coded_msg



#msg_to_decode = "xuo jxuhu! jxyi yi qd unqcfbu ev q squiqh syfxuh. muhu oek qrbu je tusetu yj? y xefu ie! iudt cu q cuiiqwu rqsa myjx jxu iqcu evviuj!"
#print(decoder(msg_to_decode, -10))

#msg_to_code = "Le loup est dans la bergerie!"
#print(coder(msg_to_code, 7))

#msg2 = "bqdradyuzs ygxfubxq omqemd oubtqde fa oapq kagd yqeemsqe ue qhqz yadq eqogdq!"
#print(decoder(msg2, -14))

#msg3 = "vhfinmxkl atox kxgwxkxw tee hy maxlx hew vbiaxkl tl hulhexmx. px'ee atox mh kxteer lmxi ni hnk ztfx by px ptgm mh dxxi hnk fxlltzxl ltyx"
#for i in range(0,26):
    #print(decoder(msg3, i))