@font-face {
	font-family: 'AppFont';
	src: url(/fonts/font.ttf);
}

* {
	font-family: 'AppFont' !important;
}

header {
	text-align: center;
	position: sticky;
	z-index: 10;
	top: 0;
	background-color: white;
	padding: 10px 0;
	border-bottom: 2px solid lightgray;
}

main {
	font-family: 'AppFont';
	max-width: 500px;
	margin: 0 auto;
}

h2,
.message {
	text-align: center;
	font-size: 20px;
}

.github-link, .blog-link {
	position: fixed;
	top: 22px;
	z-index: 15;
	text-decoration: none;
	font-size: 15px;
	line-height: 22px;

	span:not(.icon) {
		text-decoration: underline;
	}

	.icon {
		color: gray;
	}
}

.github-link {
	right: 20px;
}

.blog-link {
	right: 100px;
}

.group {
	display: inline-block;
}

.group.correct {
	color: darkgreen;
}

.message {
	display: block;
	margin-top: 10px;
	padding-bottom: 10px;
	border-bottom: 2px solid gray;

	&.hint {
		border-bottom: none;
		text-align: right;
		margin: 0 10px;
	}

	&.error {
		color: red;
		border-bottom: none;
		min-height: 30px;
	}

	&.statistics {
		border-bottom: none;
		padding: 5px;
		background-color: lightgray;
		border-radius: 10px;
	}

	&.victory {
		border-bottom: none;
		margin-bottom: 20px;
	}
}


.colors-row {
	display: flex;
	margin-top: 10px;

	.color {
		width: 100%;
		aspect-ratio: 1;
		box-sizing: border-box;
		border-radius: 10px;
		border: 2px solid gray;
		cursor: pointer;
		outline: none;
		background: url('../icons/icon48.png');
		background-position: center;
		background-repeat: no-repeat;

		.drag & {
			transition: transform 0.2s;
		}

		& dialog {
			border: none;
			width: 85vw;
			max-width: 400px;
			box-shadow: 0 0 5px black;

			.option {
				display: block;
				width: 100%;
				padding: 5px;
				box-sizing: border-box;
				font-size: 15px;
				height: 35px;
				white-space: nowrap;
				background-color: transparent;
				text-align: left;

				&:not(:hover):not(:focus) {
					border-color: transparent;
					box-shadow: none;
				}

				&::before {
					content: "";
					display: inline-block;
					height: 100%;
					aspect-ratio: 1;
					border-radius: 50%;
					vertical-align: middle;
					background-color: var(--color);
				}
			}
		}
	}

	#attemptedColorsContainer & {
		pointer-events: none;
	}

	#attemptedColorsContainer.opacity & {
		opacity: 0.6;
	}
}

button,
#gameType,
#colorHintsToSelect select {
	background-color: aqua;
	border: 2px solid gray;
	border-radius: 4px;
	padding: 6px;
	cursor: pointer;
	font-weight: bold;
	outline: none;
}

button.try {
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 30px;
}

button:hover,
#gameType:hover,
#colorHintsToSelect select:hover,
button:focus,
#gameType:focus,
#colorHintsToSelect select:focus,
.colors-row .color:focus,
.colors-row .color:hover {
	border-color: green;
	box-shadow: 0 0 5px black;
}

button:active,
#gameType:active,
#colorHintsToSelect select:active {
	background-color: blue;
}

#newGame,
#gameType,
#settings {
	vertical-align: top;
	height: 40px;
}

#newGame:active,
#gameType:active,
#newGame:hover,
#gameType:hover {
	position: relative;
	z-index: 10;
}

#newGame {
	border-radius: 4px 0 0 4px;
}

#settings {
	border-radius: 4px;
	font-size: 30px;
	line-height: 26px;
}

#gameType {
	width: 28px;
	margin-left: -6px;
	border-radius: 0 4px 4px 0;
}

:is(#gameType, #colorHintsToSelect) option {
	background-color: white;
}

.popup {
	padding: 20px 40px;
	box-sizing: border-box;
	border: 2px solid yellow;
	border-radius: 10px;
	background-color: white;
	width: 90vw;
	max-width: 600px;
	text-align: center;

	&::backdrop {
		background: repeating-linear-gradient(135deg,
				black,
				black 5px,
				rgba(0, 0, 0, 0.5) 5px,
				rgba(0, 0, 0, 0.5) 10px);
		opacity: 0.6;
	}

	.colors-row {
		pointer-events: none;
		margin-top: 25px;
	}
}

.settings-form {
	font-size: 15px;
	font-weight: bold;
	margin-bottom: 20px;

	& fieldset {
		text-align: left;
		margin: 0 0 10px 0;
		border-radius: 4px;
	}
}

.color-setting {
	cursor: pointer;
	display: inline-block;

	.checkbox,
	.radio {
		display: inline-block;
		border: 2px solid black;
		border-radius: 3px;
		vertical-align: middle;
		margin-right: 10px;
	}

	.radio {
		border-radius: 50%;
	}

	& input {
		opacity: 0;
		width: 0;
		height: 0;
		margin: 0;
		padding: 0;

		&:disabled+.checkbox,
		&:disabled+.radio {
			opacity: 0.4;
		}

		&:focus+.checkbox,
		&:focus+.radio {
			border-color: darkgreen;
			outline: 2px solid darkgreen;
		}

		&:checked+.checkbox::after,
		&:checked+.radio::after {
			content: "";
			display: block;
			background-color: black;
			width: 60%;
			height: 60%;
			margin: 20%;
			border-radius: 3px;
		}

		&:checked+.radio::after {
			border-radius: 50%;
		}
	}
}

@media screen and (max-width: 768px) {
	.github-link, .blog-link {
		line-height: 18px;
		font-size: 12px;
		top: 41px;
	}

	.blog-link {
		right: unset;
		left: 20px;
	}

	.invisible-on-mobile {
		display: none;
	}

	.settings-form {
		margin-bottom: 6px;
	}

	.color-setting {
		width: 50%;
		height: 40px;
		line-height: 30px;

		.checkbox,
		.radio {
			width: 30px;
			height: 30px;
		}

		&.nowrap {
			width: 100%;
		}
	}

	.save-btn,
	.cancel-btn {
		width: 100%;
	}

	.cancel-btn {
		margin-top: 20px;
	}

	button {
		padding: 20px;
	}

	#newGame,
	#gameType,
	#settings {
		height: 70px;
	}

	.colors-row {
		.color {
			& dialog {
				border-radius: 10px;
				top: revert !important;
				left: revert !important;
				width: calc(100vw - 72px) !important;

				&::backdrop {
					cursor: pointer;
				}

				.option {
					display: inline-block;
					width: 50%;
					height: 70px;
					padding: 10px 5px;
					text-indent: calc(50% - 50px);

					&::before {
						margin: 0 5px;
					}
				}
			}
		}
	}
}

@media screen and (min-width: 769px) {
	.color-setting {
		width: 33.33%;
		height: 30px;
		line-height: 30px;

		&.nowrap {
			width: 60%;
		}

		.checkbox,
		.radio {
			width: 20px;
			height: 20px;
		}
	}

	.colors-row {
		.color {
			& dialog {
				border: 1px solid black;
				position: absolute;
				margin: 0;
				padding: 0;

				.option {
					border-radius: 0;
					text-indent: -2px;

					&::before {
						margin-right: 5px;
					}
				}

				&::backdrop {
					background: transparent;
				}
			}
		}
	}
}