:root{
    --darker-blue : #0b1a37;
    --dark-blue : #0B1E36;
    --light-blue : #0e243e;
    --champagne-gold : #c9a84c;
    --accent-rgb : 201, 168, 76;
    --error-red : #c0392b;
    --error-rgb : 192, 57, 43;
    --text-rgb : 255, 255, 255;
}

.profile_main_style{
    background-color: var(--darker-blue);
    min-height: 100vh;

    display: flex;
    justify-content: center;

    padding-bottom: 4rem;
}

.profile_first_section{
    width: 100%;
}

.profile_page_header{
    max-width: 60rem;
    margin: 3rem auto 2rem;
    padding: 0 1.2rem;

    text-align: center;
}
.profile_page_title{
    color: rgba(var(--text-rgb), 0.92);
    font-size: 2.2rem;
    font-weight: 500;
    letter-spacing: 3px;

    margin: 0 0 0.6rem;
    margin-top: 2rem;
}
.profile_page_subtitle{
    color: var(--champagne-gold);
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin: 0;
}

.profile_main_container{
    max-width: 60rem;
    margin: 0 auto;
    padding: 0 1.2rem;

    display: grid;
    grid-template-columns: 1.2fr 1fr;
    grid-template-areas:
        "edit   stats"
        "theme  theme"
        "achievement achievement";
    gap: 1.5rem;
}
.profile_card_edit{ grid-area: edit; }
.profile_card_stats{ grid-area: stats; }
.profile_card_theme{ grid-area: theme; }
.profile_card_achievement{ grid-area: achievement; }

@media (max-width: 46rem){
    .profile_main_container{
        grid-template-columns: 1fr;
        grid-template-areas:
            "edit"
            "stats"
            "theme"
            "achievement";
    }
}

.profile_theme_grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr));
    gap: 0.9rem;
}
.profile_theme_option{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;

    padding: 0.9rem 0.5rem 0.3rem;

    background-color: var(--darker-blue);
    border: 1px solid rgba(var(--text-rgb), 0.1);
    border-radius: 6px;

    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.profile_theme_option:hover{
    border-color: rgba(var(--accent-rgb), 0.4);
}
.profile_theme_option.profile_theme_option_active{
    border-color: var(--champagne-gold);
    background-color: rgba(var(--accent-rgb), 0.08);
}

.profile_theme_swatch{
    position: relative;

    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;

    border: 1px solid rgba(var(--text-rgb), 0.15);
    overflow: hidden;

    box-shadow: 0 0 0 3px transparent;
    transition: box-shadow 150ms ease;
}
.profile_theme_option_active .profile_theme_swatch{
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.35);
}

.profile_theme_swatch_fill{
    position: absolute;
    inset: 0;
}
.profile_theme_swatch_check{
    position: absolute;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    color: rgba(var(--text-rgb), 0.92);
    font-size: 1.1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.profile_theme_option_active .profile_theme_swatch_check{
    display: flex;
}

.profile_theme_name{
    color: rgba(var(--text-rgb), 0.92);
    font-size: 0.85rem;
    letter-spacing: 1px;
}
.profile_theme_desc{
    color: rgba(var(--text-rgb), 0.4);
    font-size: 0.68rem;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.4;
}

.profile_card{
    background-color: var(--dark-blue);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 8px;

    padding: 1.8rem 1.6rem;
}
.profile_card_title{
    color: rgba(var(--text-rgb), 0.92);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 2px;

    margin: 0 0 1.4rem;
    padding-bottom: 0.8rem;

    border-bottom: 1px solid rgba(var(--accent-rgb), 0.2);
}

.profile_avatar_row{
    display: flex;
    align-items: center;
    gap: 1.2rem;

    margin: 0 0 1.6rem;
}

.profile_avatar_preview{
    position: relative;
    flex-shrink: 0;

    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;

    background-color: var(--darker-blue);
    border: 1px solid rgba(var(--accent-rgb), 0.4);

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#profile_avatar_placeholder{
    color: rgba(var(--text-rgb), 0.4);
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-align: center;
}
#profile_avatar_img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile_avatar_actions{
    flex: 1;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.profile_avatar_upload_btn{
    padding: 0.45rem 1rem;

    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: var(--champagne-gold);
    color: var(--darker-blue);

    border-radius: 5px;
    cursor: pointer;
    transition: all 150ms ease;
}

.profile_avatar_remove_btn{
    padding: 0.45rem 1rem;

    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: transparent;
    color: rgba(var(--text-rgb), 0.75);

    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 5px;

    cursor: pointer;
    transition: all 150ms ease;
}
.profile_avatar_remove_btn:hover{
    border-color: var(--error-red);
    color: var(--error-red);
}

.profile_avatar_hint{
    width: 100%;
    margin: 0;

    color: rgba(var(--text-rgb), 0.45);
    font-size: 0.75rem;
    line-height: 1.5;
}

.profile_field_label{
    display: block;

    color: rgba(var(--text-rgb), 0.75);
    font-size: 0.85rem;
    letter-spacing: 1px;

    margin-bottom: 0.5rem;
}
.profile_input,
.profile_textarea{
    width: 100%;
    box-sizing: border-box;

    background-color: var(--darker-blue);
    color: rgba(var(--text-rgb), 0.92);

    border: 1px solid rgba(var(--accent-rgb), 0.4);
    border-radius: 5px;

    padding: 0.6rem 0.8rem;

    font-size: 0.95rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    transition: all 50ms ease;
}
.profile_input:focus,
.profile_textarea:focus{
    outline: none;
    background-color: var(--light-blue);
}
.profile_input{
    margin-bottom: 0;
}
.profile_textarea{
    height: 6rem;
    resize: none;
    margin: 0 0 1.4rem;
}

.profile_username_warning{
    min-height: 1.1rem;

    margin: 0.4rem 0 1.2rem;

    color: var(--error-red);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.profile_update_btn{
    padding: 0.65rem 1.6rem;

    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: var(--champagne-gold);
    color: var(--darker-blue);

    border: 1px solid var(--champagne-gold);
    border-radius: 5px;

    cursor: pointer;
    transition: all 150ms ease;
}
.profile_update_btn:hover{
    background-color: transparent;
    color: var(--champagne-gold);
}
.profile_update_btn:disabled{
    opacity: 0.6;
    cursor: default;
}

.profile_danger_zone{
    margin-top: 1.4rem;
    padding-top: 1.4rem;

    border-top: 1px solid rgba(var(--text-rgb), 0.1);
}
.profile_danger_btn{
    padding: 0.8rem 1.2rem;

    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: transparent;
    color: var(--error-red);

    border: 1px solid var(--error-red);
    border-radius: 2px;

    cursor: pointer;
    transition: all 150ms ease;
}
.profile_danger_btn:hover{
    background-color: var(--error-red);
    color: rgba(var(--text-rgb), 0.92);
}

.profile_danger_confirm{
    margin-top: 1rem;
    padding: 1rem 1.1rem;

    background-color: rgba(var(--error-rgb), 0.08);
    border: 1px solid rgba(var(--error-rgb), 0.4);
    border-radius: 6px;
}
.profile_danger_confirm_text{
    margin: 0 0 1rem;

    color: rgba(var(--text-rgb), 0.75);
    font-size: 0.85rem;
    line-height: 1.7;
    letter-spacing: 0.5px;
}
.profile_danger_confirm_actions{
    display: flex;
    gap: 0.7rem;
}
.profile_danger_btn_cancel{
    padding: 0.5rem 1.1rem;

    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: transparent;
    color: rgba(var(--text-rgb), 0.75);

    border: 1px solid rgba(var(--text-rgb), 0.25);
    border-radius: 2px;

    cursor: pointer;
}
.profile_danger_btn_confirm{
    padding: 0.5rem 1.1rem;

    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;

    background-color: var(--error-red);
    color: rgba(var(--text-rgb), 0.92);

    border: 1px solid var(--error-red);
    border-radius: 2px;

    cursor: pointer;
    transition: opacity 150ms ease;
}
.profile_danger_btn_confirm:disabled{
    opacity: 0.6;
    cursor: default;
}

.profile_toggle_row{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;

    margin: 0 0 1.4rem;
}
.profile_toggle_text{
    flex: 1;
}
.profile_toggle_hint{
    margin: 0.35rem 0 0;

    color: rgba(var(--text-rgb), 0.5);
    font-size: 0.78rem;
    line-height: 1.5;
}

.profile_toggle_switch{
    position: relative;
    display: inline-block;
    flex-shrink: 0;

    width: 3rem;
    height: 1.6rem;
}
.profile_toggle_switch input{
    opacity: 0;
    width: 0;
    height: 0;
}
.profile_toggle_slider{
    position: absolute;
    inset: 0;
    cursor: pointer;

    background-color: var(--darker-blue);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    border-radius: 1rem;

    transition: background-color 150ms ease;
}

.profile_toggle_slider::before{
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;

    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;

    background-color: rgba(var(--text-rgb), 0.6);
    transition: transform 150ms ease, background-color 150ms ease;
}
.profile_toggle_switch input:checked + .profile_toggle_slider{
    background-color: var(--champagne-gold);
    border-color: var(--champagne-gold);
}
.profile_toggle_switch input:checked + .profile_toggle_slider::before{
    transform: translateX(1.4rem);
    background-color: var(--darker-blue);
}

.profile_toggle_switch input:disabled + .profile_toggle_slider{
    opacity: 0.5;
    cursor: default;
}

.profile_stat_list{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.profile_stat_row{
    display: flex;
    justify-content: space-between;
    align-items: baseline;

    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.12);
}
.profile_stat_row:last-child{
    border-bottom: none;
    padding-bottom: 0;
}
.profile_stat_label{
    color: rgba(var(--text-rgb), 0.7);
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.profile_stat_value{
    color: var(--champagne-gold);
    font-size: 1.05rem;
    font-weight: 500;
}

.profile_achievement_empty{
    color: rgba(var(--text-rgb), 0.6);
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-align: center;

    padding: 1.6rem 0;
    margin: 0;
}

.profile_toast{
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translateX(-50%) translateY(0.6rem);

    background-color: var(--dark-blue);
    color: rgba(var(--text-rgb), 0.92);

    border: 1px solid var(--champagne-gold);
    border-radius: 2px;

    padding: 0.7rem 1.4rem;

    font-size: 0.9rem;
    letter-spacing: 1px;

    opacity: 0;
    pointer-events: none;

    transition: opacity 220ms ease, transform 220ms ease;

    z-index: 500;
}
.profile_toast.profile_toast_show{
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.profile_toast.profile_toast_error{
    border-color: var(--error-red);
}