:root {
	--bkg-color: rgb(255, 164, 164);
	--content-bkg-color: white;
	--text-color: rgb(37, 37, 37);
	--secondary-text-color: rgb(37, 37, 37);

	--btn-color: rgb(255, 164, 164);
	--btn-hover-color: rgb(255, 192, 192);
	--btn-pressed-color: rgb(255, 135, 135);

	--tr-color-odd: rgb(255, 236, 230);

	--tooltip-bkg-color: #1e1e1e;
	--tooltip-text-color: white;

	--boxes-color-odd: rgb(255, 241, 164);
	--boxes-color-even: rgb(255, 249, 214);
	--boxes-majorjam-color-odd: rgb(232, 152, 152);
	--boxes-majorjam-color-even: rgb(240, 170, 170);
	--boxes-color-last: rgb(158, 225, 111);

	--majorjam-tag-color: rgb(255, 164, 164);
	--early-tag-color: rgb(255, 231, 164);
	--late-tag-color: rgb(164, 211, 255);

	--link-highlight-color: rgb(255, 164, 164);

	--content-shadow: rgba(0, 0, 0, 0.192) 0px 3px 5px;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bkg-color: #2a2e44;
		--content-bkg-color: #1e1e1e;
		--text-color: rgb(215, 215, 215);
		--secondary-text-color: #1e1e1e;

		--btn-color: rgb(125, 171, 215);
		--btn-hover-color: rgb(156, 192, 227);
		--btn-pressed-color: rgb(93, 138, 181);

		--tr-color-odd: rgb(47, 47, 47);

		--tooltip-bkg-color: white;
		--tooltip-text-color: #1e1e1e;

		--boxes-color-odd: rgb(225, 198, 125);
		--boxes-color-even: rgb(240, 214, 142);
		--boxes-majorjam-color-odd: rgb(223, 119, 119);
		--boxes-majorjam-color-even: rgb(255, 143, 143);
		--boxes-color-last: rgb(146, 198, 110);

		--majorjam-tag-color: rgb(225, 157, 157);
		--early-tag-color: rgb(225, 198, 125);
		--late-tag-color: rgb(125, 171, 215);

		--link-highlight-color: rgb(125, 171, 215);
	}
}

body {
	background-color: var(--bkg-color);

	margin: 0;
	padding: 0;
}

a {
	color: inherit;
}

a.link_highlight {
	background-color: var(--link-highlight-color);
	color: var(--secondary-text-color);

	border-radius: 2px;

	padding: 2px 4px;
}

button {
	background-color: var(--btn-color);
	color: var(--secondary-text-color);
	
	border: 0;
	border-radius: 2px;

	padding: 5px 7px;

	font-size: medium;
}

button:hover {
	background-color: var(--btn-hover-color);
}

button:active {
	background-color: var(--btn-pressed-color);
}

table {
	border-collapse: collapse;
	min-width: calc(100% + 6px);
	transform: translateX(-3px);

	> thead, > tbody {
		> tr {
			> td {
				padding: 5px 0px;
				padding-right: 14px;
				vertical-align: top;
			}

			> td, > td > a {
				overflow-wrap: break-word;
			}

			> td:first-child {
				padding-left: 3px;
			}

			> td:last-child {
				padding-right: 3px;
			}

			> td:nth-child(1) {
				width: 250px;
				max-width: 250px;
			}
			> td:nth-child(2) {
				width: 90px;
			}
			> td:nth-child(3) {
				width: 160px;
				max-width: 160px;
			}
			> td:nth-child(4) {
				width: 160px;
				max-width: 160px;
			}
			> td:nth-child(5) {
				width: 40px;
				padding-right: 0;
			}
			> td:nth-child(6) {
				width: 40px;
				padding-right: 0;
			}
			> td:nth-child(7) {
				width: 40px;
				padding-right: 0;
			}
			> td:nth-child(8) {
				width: 50px;
			}
		}
	}

	> thead > tr {
		> td {
			font-weight: bold;
		}

		> td:nth-child(4), > td:nth-child(5), > td:nth-child(6),
		> td:nth-child(7), > td:nth-child(8) {
			&:after {
				content: "(i)";
			}
		}
	}

	> tbody {
		> tr:nth-child(odd) {
			> td {
				background-color: var(--tr-color-odd);
			}
		}

		> tr.tr_majorjam {
			> td:first-child:after {
				background-color: var(--majorjam-tag-color);
				color: var(--secondary-text-color);
				border-radius: 2px;
				padding: 2px 4px;

				float: right;

				content: "Major Jam";
				font-size: small;
			}
		}

		> tr {
			> td:first-child {
				border-top-left-radius: 2px;
				border-bottom-left-radius: 2px;
			}

			> td:last-child {
				border-top-right-radius: 2px;
				border-bottom-right-radius: 2px;
			}

			> td:nth-child(2) {
				> span {
					color: var(--secondary-text-color);

					font-size: small;
					border-radius: 2px;
					padding: 2px 2px;

					display: inline-block;
					width: inherit;
					
					vertical-align: top;
					text-align: center;
				}
				> span.early {
					background-color: var(--early-tag-color);
				}
				> span.late {
					background-color: var(--late-tag-color);
				}
			}
		}
	}
}

#content {
	background-color: var(--content-bkg-color);
	font-family: sans-serif;
	color: var(--text-color);
	
	margin: 20px 0px;
	padding: 10px 20px 20px 20px;
	width: 900px;
	min-height: calc(100vh - 70px);
	
	position: relative;
	left: 50vw;
	transform: translateX(-50%);

	box-shadow: var(--content-shadow);
	border-radius: 2px;
}

#nav {
	line-height: 170%;

	> a {
		margin-right: 10px;
	}
}

.page_links {
	margin-top: 16px;

	> a {
		display: inline-block;
		margin-right: 4px;
		margin-bottom: 4px;
	}
}

.page_links:last-child {
	margin-top: 25px;
}

.boxes {
	> span {
		position: relative;

		background-color: var(--boxes-color-odd);
		color: var(--secondary-text-color);

		float: left;
		height: 25px;
		width: 25px;
		line-height: 25px;
		text-align: center;
	}

	> span:after {
		background-color: var(--tooltip-bkg-color);
		color: var(--tooltip-text-color);
		box-shadow: var(--content-shadow);

		content: "game's rank";
		white-space: nowrap;

		position: absolute;
		top: -40px;
		left: 50%;
		transform: translateX(-50%);

		padding: 3px 7px;
		border-radius: 2px;

		z-index: 2;

		display: none;
	}

	> span.box_majorjam:after {
		content: "rank (Major Jam)"
	}

	> span:last-child:after {
		content: "num of games";
	}

	> span:hover:after {
		display: block;
	}

	> span:nth-child(even) {
		background-color: var(--boxes-color-even);
	}

	> span.box_majorjam:nth-child(odd) {
		background-color: var(--boxes-majorjam-color-odd);
	}

	> span.box_majorjam:nth-child(even) {
		background-color: var(--boxes-majorjam-color-even);
	}

	> span:last-child {
		background-color: var(--boxes-color-last);

		float: none;
		display: inline-block;
	}
}

@media only screen and (max-width: 990px) {
	#content {
		transform: translateX(0px);
		left: 0px;

		width: calc(100vw - 20px);
		min-height: calc(100vh - 20px);

		margin: 0px;
		padding: 10px;
	}

	table {
		min-width: 100vw;
		transform: translateX(-10px);

		> thead {
			display: none;
		}

		> tbody {
			> tr:nth-child(odd) {
				background-color: var(--tr-color-odd);
			}

			> tr {
				display: block;
				padding: 10px 10px;

				> td {
					display: block;
					margin: 0;
					padding: 0;
					margin-bottom: 8px;
				}
				
				> td:nth-child(1), > td:nth-child(3), > td:nth-child(4) {
					width: auto;
					max-width: unset;
				}
				> td:nth-child(1) {
					> a {
						font-weight: bold;
					}
				}
				> td:nth-child(3):not(:empty):before {
					content: "with ";
					font-weight: bold;
				}
				> td:nth-child(5), > td:nth-child(6),
				> td:nth-child(7), > td:nth-child(8) {
					display: inline-block;
					width: auto;
					margin-bottom: 0;
					margin-right: 10px;
				}
				> td:nth-child(5):before {
					content: "Vs: ";
				}
				> td:nth-child(6):before {
					content: "Rank: ";
				}
				> td:nth-child(7):before {
					content: "Ratings: ";
				}
				> td:nth-child(8):before {
					content: "ilScore: ";
				}
			}

			> tr.tr_majorjam {
				> td:first-child:after {
					float: none;
					margin-left: 8px;
					white-space: nowrap;
				}
			}
		}
	}
}
