/* Basic Styling */
html,
body {
display: grid;
height: 100vh;
place-items: center;
background: #fff;
transition: background 0.3s ease;
}
body {
width: 100%;
height: 100%;
}
/* Hide Default Checkbox */
input {
appearance: none;
position: absolute;
}
/* Switch Styling */
.switch span {
display: block;
width: 40px;
height: 20px;
background: #ddd;
border-radius: 20px;
transition: 0.3s;
position: relative;
cursor: pointer;
}
/* Toggle Button */
span::before {
content: "";
position: absolute;
width: 16px;
height: 16px;
background: #fff;
border-radius: 50%;
margin: 2px;
transition: 0.3s;
}
input:checked+span {
background: #4ecdc4;
}
input:checked+span::before {
transform: translateX(20px);
}
body:has(input:checked) {
background: #212121;
}