.matter-switch {
    --matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243));
    z-index: 0;
    position: relative;
    display: inline-block;
    color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.87);
    font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
    font-size: 16px;
    line-height: 1.5;
}

/* Track */
.matter-switch > input {
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    z-index: 1;
    position: relative;
    float: right;
    display: inline-block;
    margin: 0 0 0 5px;
    border: solid 5px transparent;
    border-radius: 12px;
    width: 46px;
    height: 24px;
    background-clip: padding-box;
    background-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
    outline: none;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

/* Span */
.matter-switch > input + span {
    display: inline-block;
    box-sizing: border-box;
    margin-right: -51px;
    padding-right: 51px;
    width: inherit;
    cursor: pointer;
}

/* Highlight */
.matter-switch > input + span::before {
    content: "";
    position: absolute;
    right: 11px;
    top: -8px;
    display: block;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    background-color: rgb(var(--matter-onsurface-rgb, 0, 0, 0));
    opacity: 0;
    transform: scale(1);
    pointer-events: none;
    transition: opacity 0.3s 0.1s, transform 0.2s 0.1s;
}

/* Thumb */
.matter-switch > input + span::after {
    content: "";
    z-index: 1;
    position: absolute;
    top: 2px;
    right: 21px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    background-color: rgb(var(--matter-surface-rgb, 255, 255, 255));
    box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
    pointer-events: none;
    transition: background-color 0.2s, transform 0.2s;
}

/* Checked */
.matter-switch > input:checked {
    background-color: rgba(var(--matter-helper-theme), 0.6);
}

.matter-switch > input:checked + span::before {
    right: -5px;
    background-color: rgb(var(--matter-helper-theme));
}

.matter-switch > input:checked + span::after {
    background-color: rgb(var(--matter-helper-theme));
    transform: translateX(16px);
}

/* Hover, Focus */
.matter-switch:hover > input + span::before {
    opacity: 0.04;
}

.matter-switch > input:focus + span::before {
    opacity: 0.12;
}

.matter-switch:hover > input:focus + span::before {
    opacity: 0.16;
}

/* Active */
.matter-switch:active > input {
    background-color: rgba(var(--matter-helper-theme), 0.6);
}

.matter-switch:active > input:checked {
    background-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
}

.matter-switch:active > input + span::before {
    opacity: 1;
    transform: scale(0);
    transition: transform 0s, opacity 0s;
}

/* Disabled */
.matter-switch > input:disabled {
    background-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
    opacity: 0.38;
    cursor: default;
}

.matter-switch > input:checked:disabled {
    background-color: rgba(var(--matter-helper-theme), 0.6);
}

.matter-switch > input:disabled + span {
    color: rgba(var(--matter-onsurface-rgb, 0, 0, 0, 0.38));
    cursor: default;
}

.matter-switch > input:disabled + span::before {
    z-index: 1;
    margin: 10px;
    width: 20px;
    height: 20px;
    background-color: rgb(var(--matter-surface-rgb, 255, 255, 255));
    transform: scale(1);
    opacity: 1;
    transition: none;
}

.matter-switch > input:disabled + span::after {
    opacity: 0.38;
}
