:root {
	--bg-color: #101010;
	--txt-color: #F0F0F0;
}

* {
	overscroll-behavior: none;
}

html, body {
	margin: 0;
	height: 100%;
	background-color: var(--bg-color);
	text-align: center;
	font-family: 'Courier New', Courier, monospace;
	color: var(--txt-color);
	overflow: clip;
}

#grid {
	float: inline-start;
}

#grid, #gridAnimation, #animationCover, #wormhole {
	display: flex;
	align-items: center;
    justify-content: center;
}

#grid, #gridAnimation, #resetAnimation {
	box-sizing: border-box;
	width: 50%;
	height: 100%;
	padding: 10px;
	-webkit-user-select: none;
	user-select: none;
}

#gridAnimation, #resetAnimation, #resetAnimation>div {
	position: absolute;
	z-index: 1;
}

#gridAnimation {
	transition: all 0.8s 0s, opacity 0.4s 0.8s;
}

#gridAnimation.inverse {
	transition: all 0.8s 0.4s, opacity 0.4s 0s;
}

#gridAnimation>*, #resetAnimation>div {
	background-color: var(--bg-color);
}

table {
	width: 100%;
	max-width: calc(100vh - 20px);
	border-collapse: collapse;
}

th, .header {
	background-color: #808080 !important;
	color: var(--bg-color);
	cursor: default;
}

td, th, #resetAnimation>div {
	border: 2px solid var(--txt-color);
	padding: 0;
	font-size: calc(clamp(11px, 2.75vw, 5.5vh) - 2px);
}

td::before, th::before {
	content: "";
	float: left;
	padding-top: 100%;
}

td>div, th>div, #resetAnimation>div>div {
	padding-top: 100%;
	background-color: var(--tier-color);
	line-height: 0;
}

td>div>div, th>div>div, #resetAnimation>div>div>div {
	margin-top: -45%;
}

#resetAnimation>div {
	width: var(--tile-size);
	height: var(--tile-size);
}

#bar {
	float: inline-start;
	display: flex;
	flex-direction: column;
	width: 50%;
	height: 100%;
}

#bar>div {
	border-bottom: 2px solid var(--txt-color);
}

#tabs {
	margin-top: 5px;
	display: flex;
	flex-direction: row;
	justify-content: space-evenly;
}

#tabs>button {
	margin: 0;
	border-bottom: none;
}

#tabs>button.on {
	margin-bottom: -2px;
	padding-bottom: 7px;
}

#main {
	position: relative;
	flex: 1 1 auto;
	border-left: 2px solid var(--txt-color);
	padding: 5px;
	overflow: auto;
}

.flex {
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
	justify-content: center;
	column-gap: 0.5em;
}

.info {
	flex-shrink: 0;
	margin: -0.5em 0;
	width: 2em;
	height: 2em;
	border-radius: 50%;
	fill: var(--txt-color);
	cursor: pointer;
}

.popup {
	right: 5px;
	position: absolute;
	box-sizing: border-box;
	width: fit-content;
	max-width: calc(100vw - 15px);
	border: 2px solid var(--txt-color);
	background: var(--bg-color);
	padding: 5px;
	white-space: pre-wrap;
}

.popup>div {
	margin: auto;
}

select {
	padding: 0px !important;
}

#skillContainer {
	width: 100%;
	height: 100%;
	overflow: scroll;
}

#skillTree {
	position: relative;
}

#centerSkillDisplay {
	left: calc(50% - 10em);
	top: calc(50% - 10em);
	display: flex;
	flex-direction: column;
	width: 20em;
	height: 20em;
}

.skill {
	margin: 0 !important;
	position: absolute;
	box-sizing: border-box;
	width: 10em;
	height: 10em;
	border: 2px solid var(--txt-color);
	padding: 5px;
}

.line {
	position: absolute;
	width: 2em;
	border: 1px solid var(--txt-color);
	background-color: var(--txt-color);
}

.line.off {
	border-color: #808080;
	background-color: #808080;
}

.skillUI {
	position: absolute;
	padding: 5px 10px;
	pointer-events: none;
}

.skillUI button {
	background-color: color-mix(in srgb, var(--bg-color), #808080);
	font-weight: bold;
	pointer-events: auto;
}

button.off {
	background-color: var(--bg-color);
	border-color: #808080;
	color: #808080;
}

hr {
	margin: 5px 0;
	border: 1px solid var(--txt-color);
}

input, button, select {
	font-size: medium;
	font-family: 'Courier New', Courier, monospace;
}

button:not(.on):not(.off) {
	cursor: pointer;
}

button:not(:first-of-type) {
	margin-left: 5px;
}

#barToggle {
	margin-top: -0.2em;
	margin-bottom: 5px;
	border-left: 2px solid var(--txt-color);
	padding-left: 0.3em;
	text-align: left;
	font-size: xx-large;
	cursor: pointer;
}

dialog {
	max-width: calc(100% - 24px);
	max-height: calc(100% - 24px);
}

.box {
	overflow: auto;
}

.box, dialog, input, button, select {
	background-color: var(--bg-color);
	border: 2px solid var(--txt-color);
	padding: 5px;
	color: var(--txt-color);
	outline: none;
}

.box, input, button {
	margin-top: 5px;
}

#animationCover {
	position: absolute;
	width: 100%;
	height: 100%;
	z-index: 2;
}

#wormhole {
	background: conic-gradient(#10F010, #10F0F0, #1010F0, #F010F0, #F01010, #F0F010, #10F010);
	mask: radial-gradient(#000000, transparent, transparent);
	animation: 8s ease 0s growshrink, 8s linear 0s rotate;
}

#wormhole>div {
	width: 10%;
	height: 10%;
	background: radial-gradient(#F0F0F0, transparent, transparent);
}

@keyframes wormhole {
	50% {
		transform: rotate(180deg) scale(1, 1);
	}
	100% {
		top: calc(50vh - var(--tile-size) / 2);
		left: calc(50vw - var(--tile-size) / 2);
		transform: rotate(360deg) scale(0, 0);
		display: none;
	}
}

@keyframes growshrink {
	0% {width: 0; height: 0}
	40% {width: 100vmin; height: 100vmin}
	60% {width: 100vmin; height: 100vmin}
	100% {width: 0; height: 0}
}

@keyframes rotate {
	from {transform: rotate(0deg)}
	to {transform: rotate(360deg)}
}

@media screen and (max-width: 600px) {
	#grid, #gridAnimation, #resetAnimation {
		margin-left: -100%;
	}
	#bar {
		margin-left: 5px;
		width: calc(100% - 5px);
	}
}
