.pill-switch {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: #F3F3F3;
    /* 初始背景颜色为浅灰色 */
    border-radius: 20px;
    padding: 18px 35px;
    /* 调整 padding 来扩大药丸 */
    color: black;
    font-family: Arial, sans-serif;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.3s ease;
    width: 100px;
    /* 药丸宽度 */
    overflow: hidden;
    /* 隐藏超出部分 */
}

.pill-text {
    position: absolute;
    width: calc(100% - 40px);
    /* 减去滑块的宽度 */
    text-align: center;
        transform: translateX(10px);
            /* 示例：向左移动30px */
    transition: transform 0.3s ease;
    /* 添加移动效果 */
}

.pill-toggle {
    width: 30px;
    height: 30px;
    background-color: black;
    /* 初始背景颜色为黑色 */
    color: white;
    /* 初始文字颜色为白色 */
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 3px;
    transition: left 0.3s ease, background-color 0.3s ease;
    z-index: 1;
}

.pill-toggle::before {
    content: 'ON';
    display: block;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
}

.pill-switch[data-status="on"] {
    background-color: #509C74;
    /* 开启时背景颜色为深绿色 */
}

.pill-switch[data-status="on"] .pill-text {
    color: white;
    transform: translateX(-13px);
    /* 向左移动文本 */
}

.pill-switch[data-status="on"] .pill-toggle {
    left: calc(100% - 33px);
    /* 开关向右移动 */
    background-color: white;
    /* 开启时开关颜色为白色 */
    color: black;
    /* 开启时文字颜色为黑色 */
}

.pill-switch[data-status="on"] .pill-toggle::before {
    content: 'ON';
}
