:root {
	--card: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
	--bg-bgc: hsl(0, 0%, 94%);
	--txt-clr: black;
	--popup-bgc: hsl(0, 0%, 100%);
}

@media (prefers-color-scheme: dark) {
	:root {
		--card: 0 1px 4px rgba(200, 200, 200, 0.2), 0 1px 2px rgba(200, 200, 200, 0.3);
		--bg-bgc: hsl(0, 0%, 8%);
		--txt-clr: #bdc1c6;
		--popup-bgc: hsl(0, 0%, 20%);
	}
}

body {
	text-size-adjust: 100%;
	font-size: 95%;
	background-color: var(--bg-bgc);
	color: var(--txt-clr);
	margin-left: 20%;
	width: 60%;
}

button {
	--btn-clr: dodgerblue;
	box-shadow: var(--card);
	background-color: var(--btn-clr);
	border-radius: 0.4em;
	padding: 0.5em 0.8em;
	border: none;
	color: #fff;
	text-align: center;
	font-weight: bold;
	cursor: pointer;

	&:disabled {
		background-color: grey;
		cursor: not-allowed;
	}
}

.config-item {
	box-shadow: var(--card);
	background-color: var(--popup-bgc);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.5em;
}

.switch {
	position: relative;
	display: inline-block;
	width: 60px;
	height: 34px;

	& input {
		opacity: 0;

		&:checked + .slider {
			background-color: limegreen;
		}

		&:focus + .slider {
			box-shadow: 0 0 1px limegreen;
		}

		&:checked + .slider:before {
			translate: 26px;
		}
	}
}

.slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #ccc;
	transition: 0.4s;
	border-radius: 34px;

	&:before {
		position: absolute;
		content: "";
		height: 26px;
		width: 26px;
		left: 4px;
		bottom: 4px;
		background-color: white;
		transition: 0.4s;
		border-radius: 50%;
	}
}

dialog {
	border: none;
	box-shadow: var(--card);
	border-radius: 0.4em;
	color: inherit;
	background-color: var(--popup-bgc);

	&::backdrop {
		background-color: rgb(0 0 0 / 0.4);
	}

	&[open] {
		animation: slide-from-bottom 0.6s ease-out normal;
	}

	& h2 {
		text-align: center;
	}

	& dt {
		display: inline-block;
		padding: 2px;
		font-weight: bold;
		background-color: var(--bg-bgc);
	}
}

@keyframes slide-from-bottom {
	from {
		translate: 0 110%;
	}

	to {
		translate: 0 0;
	}
}
