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

body {
	background-color: #313131;
	color: #ccc;
	display: flex;
	flex-direction: column;

	align-items: center;
	justify-content: space-between;
}

a { color: #00aff0; }
a:visited { color: #0094cc; }

header, footer {
	background-color: #181818;
	color: #ccc;
	padding: 0.5rem;

	align-self: stretch;
	text-align: center;
}

main {
	flex: auto;
	align-self: stretch;

	display: flex;
	align-items: center;
	justify-content: center;
}

section {
	display: none;
	box-sizing: border-box;
}

body[data-view="error"] #error,
body[data-view="noscript"] #noscript,
body[data-view="results"] #results,
body[data-view="welcome"] #welcome {
	background-color: #eee;
	color: #111;
	padding: 1rem;

	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-align: center;
}

#welcome > div {
	display: flex;
	flex-direction: row;
	justify-content: stretch;
}

body[data-view="loading"] #loading {
	display: flex;

	flex-direction: column;
	align-items: center;
}

#loading .message {
	font-size: 1.5rem;
	margin-top: 0.5em;
}

body[data-view="game"] #game {
	position: relative;
	width: 100%;
	height: 100%;

	display: flex;
	flex-direction: row;
	align-items: stretch;
	justify-content: stretch;
}

#game > div.choice {
	position: relative;
	box-sizing: border-box;
	width: 50vw;
	height: 0;
	min-height: 100%; /* !?!? */

	display: block;
	flex: auto;
	overflow: clip;
	transition: border-color 0.25s ease-in-out;
	transition: width 0.25s ease-in-out;

	border: 3px solid #00aff000;
	border-radius: 1rem;
}

#game[data-state=choose] > div.choice {
	cursor: pointer;
}

#game[data-state=choose] > div.choice:hover,
#game[data-state=loading][data-vote=a] > div.choice[data-choice=a],
#game[data-state=loading][data-vote=b] > div.choice[data-choice=b] {
	border-color: #00aff0;
	width: 67vw;
}

#game[data-winner=a] > div.choice[data-choice=a],
#game[data-winner=b] > div.choice[data-choice=b] {
	border-color: #0f0f;
	width: 75vw;
}

#game[data-winner=a] > div.choice[data-choice=b],
#game[data-winner=b] > div.choice[data-choice=a] {
	border-color: #f00f;
}

#game[data-winner=draw] > div.choice {
	border-color: #ff0f;
}

#game > div.choice .result {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;

	display: flex;
	align-items: center;
	justify-content: center;

	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s linear;
}

#game[data-winner] > div.choice .result {
	opacity: 1;
}

#game[data-winner=a] > div.choice[data-choice=a] .result,
#game[data-winner=b] > div.choice[data-choice=b] .result {
	background-color: #0f02;
	color: #0f0f;
}

#game[data-winner=a] > div.choice[data-choice=b] .result,
#game[data-winner=b] > div.choice[data-choice=a] .result {
	background-color: #f002;
	color: #f00f;
}

#game[data-winner=draw] > div.choice .result {
	background-color: #ff02;
	color: #ff0f;
}

#game > div.choice .percent {
	-webkit-text-stroke-color: #111;
	-webkit-text-stroke-width: 2px;
	paint-order: stroke fill;
	font-size: 2rem;
}

#game div.top,
#game div.bottom {
	position: absolute;
	left: 0;

	width: 100%;
	padding: 0.5rem;
	box-sizing: border-box;

	-webkit-text-stroke-color: #111;
	-webkit-text-stroke-width: 2px;
	paint-order: stroke fill;
	font-size: 1.5rem;

	display: flex;
	flex-direction: row;
}

#game div.top {
	top: 0;
	justify-content: space-between;
}

#game div.bottom {
	bottom: 0;
	justify-content: center;
	text-align: center;
}

#game img.country {
	height: 1em;
}

#game img.back {
	position: absolute;
	left: 0;
	top: 0;
	z-index: -1;

	height: 100%;
	width: 100%;
	object-fit: cover;

	filter: blur(8px) brightness(0.3);
}

#game img.scran {
	height: 100%;
	width: 100%;

	object-fit: contain;
	transition: transform 0.3s ease-out;
}

#game > #game-continue {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);

	padding: 1rem 2rem;

	opacity: 0;
	transition: opacity 0.5s linear;

	pointer-events: none;
	user-select: none;
}

#game[data-winner] > #game-continue {
	opacity: 1;
	pointer-events: all;
	transition: opacity 0.5s linear 0.5s;
}

#game > .loading {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;

	background: #0004;
	opacity: 0;
	pointer-events: none;

	display: flex;
	align-items: center;
	justify-content: center;
	
	transition: opacity 0.5s linear;
}

#game[data-state=loading] > .loading {
	opacity: 1;
	pointer-events: all;
}

button {
	box-sizing: border-box;
	border: 1px solid #31313188;
	border-radius: 0.5rem;
	padding: 0.75em 1.5em;
	flex: auto;

	background-color: #00aff0;
	color: #111;

	cursor: pointer;
}

button:hover {
	background-color: #0094cc;
}

button:disabled {
	background-color: #b4dff0;
	cursor: not-allowed;
}

.loading-spinner {
	box-sizing: border-box;
	width: 2rem;
	height: 2rem;

	border: 4px solid #fff;
	border-bottom-color: #fff0;
	border-radius: 50%;

	animation: loading-spin 2s linear infinite;
}

@keyframes loading-spin {
	0% { rotate: 0; }
	100% { rotate: 360deg; }
}

