html {
	font-size: 18px;
	line-height: 1.56em;
	font-family: 'Josefin Sans', sans-serif;
}

html, body {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
}

html, html * {
	box-sizing: border-box;
	font-smooth: always;
}

h1, h2, h3, h4, h5, h6 {
	margin: 1em 0 .5em;
	text-align: center;
	font-family: 'Shadows Into Light', cursive;
}

h1 {
	font-size: 2.2em;
	font-weight: bold;
}
h2 {
	font-size: 2em;
	font-weight: bold;
}
h3 {
	font-size: 1.8em;
	font-weight: bold;
}
h4 {
	font-size: 1.6em;
	font-weight: bold;
}
h5 {
	font-size: 1.4em;
	font-weight: bold;
}
h6 {
	font-size: 1.2em;
	font-weight: bold;
}

input, select, button {
	padding: 1em;
	width: 100%;
	display: block;
	font-size: 1em;
	border: 1px solid rgba(0, 50, 25, .3);
	font-family: 'Josefin Sans', sans-serif;

	&:hover,
	&:focus {
		outline: none;
		box-shadow: none;
	}
	&::placeholder {
		font-family: 'Josefin Sans', sans-serif;
	}
}

input {
	&:hover,
	&:focus {
		border-bottom: 2px solid rgba(0, 100, 50, 1);
		padding-bottom: calc(1em - 1px);
	}
}

button {
	&:hover {
		background: rgba(134, 189, 139, 1);
	}

	&[disabled],
	&.disabled {
		background: rgba(12, 50, 25, .3) !important;
		color: rgba(12, 50, 25, .5) !important;
	}
}

.drawit {
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 15em 15em;
	grid-template-rows: 1fr;
	width: 100%;
	height: 100%;
	position: relative;
	background: rgba(255,255,150,1);

	.score-board {
		margin: 0;
		padding: 0;
		background: linear-gradient(180deg, rgba(0, 50, 25, 0.3) 0%, rgba(0, 266, 102, 0.5));
		counter-reset: scoreboard; 
		display: grid;
		grid-template-rows: 1fr 3em;
		height: 100%;
		max-height: 100%;
		overflow: hidden;

		.scores {
			margin: 0;
			padding: 0;
			position: relative;

			&::before {
				content: 'draw it';
				position: absolute;
				bottom: 2em;
				left: 50%;
				transform: translateX(-50%;);
				font-size: 2.5em;
				font-family: 'Shadows Into Light', cursive;
				color: rgba(0, 50, 25, .5);
			}
		}
		.controls {
			display: flex;

			button {
				flex: 1;
				width: auto;
			}
		}
		.user {
			margin: 0;
			padding: 0;
			height: 3em;
			display: grid;
			grid-template-columns: 3em 1fr 3em;
			overflow: hidden;

			.name,
			.score {
				display: flex;
				align-items: center;
			}
			.score {
				justify-content: flex-end;
				text-align: right;
				padding-right: .5em;
			}

			.name {
				justify-content: flex-start;
				max-width: 100%;
				overflow: hidden;
				white-space: nowrap;
				padding: 0 .5em;
			}

			&::before {
				counter-increment: scoreboard;
				content: counter(scoreboard);
				display: flex;
				justify-content: center;
				align-items: center;
				height: 3em;
				background-color: rgba(0,2,1, 0.2);
			}

			&:first-child {
				background: rgba(0, 50, 25, 0.6);
				color: white;
			}
			&:nth-child(2) {
				background: rgba(0, 50, 25, 0.5);
				color: white;
			}
			&:nth-child(3) {
				background: rgba(0, 50, 25, 0.4);
			}
		}
	}

	.chat {
		display: grid;
		grid-template-rows: 1fr 3em;
		background: linear-gradient(180deg, rgba(0, 50, 25, 0.3) 0%, rgba(0, 266, 102, 0.7) 100%);
		height: 100%;
		max-height: 100%;
		overflow: hidden;

		.chat-entries {
			display: flex;
			flex-direction: column;
			justify-content: flex-end;
			width: 100%;
			height: 100%;
			max-height: 100%;
			overflow-y: scroll;
		}
		.message {
			margin: .5em;
			padding: .5em .5em .5em 1em;
			background: linear-gradient(270deg, white 0%, white calc(100% - .5em), rgba(0, 50, 25,.6) calc(100% - .5em), rgba(0, 50, 25,.6) 100%);
			display: flex;
			flex-wrap: wrap;
			position: relative;

			.time {
				order: 2;
				flex: 4em 0 0;
				font-size: .6em;
				text-align: right;
				font-family: monospace;
				line-height: 1em;
			}
			.sender {
				font-size: .6em;
				order: 1;
				flex: calc(100% - 4em) 0 0;
				overflow: hidden;
				text-overflow: ellipsis;
				line-height: 1em;
				white-space: nowrap;
				max-width: calc(100% - 4em);
			}
			.message-text {
				margin: 0;
				padding: 0;
				order: 3;
				display: flex;
				flex-wrap: wrap;
				flex: 100% 0 0;
				white-space: pre;
			}
			+ .message {
				margin-top: 0;
			}

			&::before {
				content: '';
				display: block;
				width: 0;
				height: 0;
				position: absolute;
				top: 1em;
				left: -.5em;
				z-index: 1;
				border: .25em solid transparent;
				border-right-color: rgba(0, 50, 25, .6); 
			}

			&.own {
				padding: .5em 1em .5em .5em;
				background: linear-gradient(90deg, white 0%, white calc(100% - .5em), rgba(0, 50, 25,.6) calc(100% - .5em), rgba(0, 50, 25,.6) 100%);

				&::before {
					left: auto;
					right: -.5em;
					border-right-color: transparent; 
					border-left-color: rgba(0, 50, 25, .6); 
				}
			}
			&.server {
				padding: .5em;
				background: rgba(0, 50, 25, .6);
				color: white;

				&::before {
					display: none;
				}
			}
		}
	}

	.draw-board {
		display: grid;
		grid-template-rows: 1fr 6em;
		position: relative;
		background: linear-gradient(180deg, rgba(0, 50, 25,.3) 0%, rgba(0, 266, 102, .5) 100%);
		overflow: hidden;

		.timer {
			position: absolute;
			top: 1em;
			left: 1em;
			z-index: 1;
			animation: timeIsRunning 1s ease-in infinite;
		}
		svg.drawing {
			margin: auto;
			background: white;
			box-shadow: .5em .5em 1em 0 rgba(0, 25, 12, 1);
			width: 20em;
			height: 20em;

			@media (min-width: 1365px) and (min-height: 700px) {
				width: 32em;
				height: 32em;
			}

			@media (min-width: 1440px) and (min-height: 900px) {
				width: 45em;
				height: 45em;
			}

			@media (min-width: 1919px) and (min-height: 1000px) {
				width: 50em;
				height: 50em;
			}

			path {
				fill: none;
			}
		}
		.controls {
			flex: 100% 0 0;
			display: flex;
			flex-wrap: wrap;
			overflow: hidden;

			.controls-line {
				flex: 100% 0 0;
				display: flex;
			}

			button {
				height: 3em;
				flex: 1;

				&.active {
					background: rgba(255,255,255,.5);
				}
				&.color.active {
					position: relative;

					&::before {
						content: '';
						display: block;
						width: 100%;
						height: 100%;
						position: absolute;
						top: 0;
						left: 0;
						z-index: 1;
						background: rgba(0, 50, 25, .5);
					}
				}
			}

		}

		@media (min-width: 1376px) {
			grid-template-rows: 1fr 3em;

			.controls .controls-line {
				flex: 50% 0 0;
			}
		}
	}

	.popup {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 100;
		width: 100%;
		height: 100%;
		display: none;
		justify-content: center;
		align-items: center;
		background: rgba(0, 50, 25, 0.3);
		backdrop-filter: blur(4px);

		&.active {
			display: flex;
		}

		.popup-content {
			width: 25em;
			height: 20em;
			display: flex;
			flex-wrap: wrap;
			overflow: auto;
			justify-content: flex-start;
			align-items: center;
			padding: 1em;
			background: white;
			box-shadow: .5em .5em 1em 0 rgba(0, 25, 12, 0.3);

			h1, h2, h3, h4, h5, h6, p, pre {
				flex: 100% 0 0;
			}

			.button-row {
				display: grid;
				grid-template-columns: 1fr 7em;
				width: 100%;

				.rate-down {
					background-color: rgba(50,0,0,.3);

					&:hover {
						background-color: rgba(50,0,0,.5);
					}
				}
			}
		}
	}
}

@keyframes timeIsRunning {
	0% {
		transform: scale(0);
		opacity: 1;
	}
	100% {
		transform: scale(3);
		opacity: 0;
	}
}