:root {
	--text-color: lime;
	--border-color: #525252;
	--select-angle: 0;
	--grey-color: #363636;
	--controls-opacity: 100;
	--select-icons: none;
	--select-text: "";
	--select-top: 0;
	--tile-fraction: 1;
	--movement-text-opacity: 0;
	
	@supports (-webkit-min-logical-height: auto) {
		--border-color: black;
	}
}

::selection {
	background-color: var(--text-color);
	color: black;
}

body {
	color: var(--text-color);
	font-family: 'courier new', monospace;
	image-rendering: pixelated;
	background: url("images/form.webp") black;
}

p, a, td {
	text-shadow: 1px 1px 0px black;
}

.icon {
	background: var(--text-color);
	mask-size: contain;
	mask-repeat: no-repeat;
	width: 16px;
	height: 16px;
	padding-right: 8px;
	font-size: 20px;
	image-rendering: smooth;
}

.thumbnail {
	pointer-events: none;
	vertical-align: center;
	width: 32px;
	height: 32px;
	object-fit: cover;
	filter: drop-shadow(2px 0px 0px var(--grey-color)) drop-shadow(0px 2px 0px var(--grey-color))
		drop-shadow(-2px 0px 0px var(--border-color)) drop-shadow(0px -2px 0px var(--border-color));
}

#nutrition-counter:before {
	mask-image: url('images/icons/nutrition.webp');
}

#health-counter:before {
	mask-image: url('images/icons/health.webp');
}

.counter:before {
	display: inline-block;
	content: "";
	background: var(--text-color);
	mask-size: contain;
	mask-repeat: no-repeat;
	width: 24px;
	height: 24px;
	margin-bottom: -7px;
}

button {
	color: var(--text-color);
	border: 3px outset var(--border-color);
	margin: 3px 0px 3px 0px;
	background: transparent;
	backdrop-filter: brightness(50%);
}

button:focus-visible {
	color: black;
	background: var(--text-color);
	outline: none;
}

button:hover {
	border-style: ridge;
}

button.active, button:active {
	border-style: inset;
}

@media (max-width: 1920px) {
	body {
		font-size: 12px;
	}
	
	button {
		padding: 1px;
		border-width: 2px;
	}
	
	.thumbnail {
		width: 20px;
		height: 20px;
	}
	
	.icon {
		padding-right: 0px;
		width: 10px;
		height: 10px;
	}
	
	.counter:before {
		width: 15px;
		height: 15px;
	}
}

#game-world {
	height: 100vh;// 97vh;
	position: relative;
	background: black;
}

#game-world canvas {
	display: block;
	color: black;
	pointer-events: none;
	image-rendering: pixelated;
	height: 100%;
	aspect-ratio: 1;
	container-type: size;
}

#game-world div {
	position: absolute;
	container-type: size;
	width: 100%;
}

#game-world p {
	padding-top: 50%;
	color: white;
	font-size: 4cqw;
	//text-shadow: 3px 3px black;
	white-space: pre-wrap;
}

.game-overlay {
	width: 100%;
	height: 100%;
	top: 0;
}

#fade-div {
	//opacity: 0;
	//transition: opacity 1s ease-out;
}

#selection-grid {
	border-spacing: 0;
	position: absolute;
}

#selection-grid p {
	opacity: var(--movement-text-opacity);
	margin: 0;
	padding: 0;
	font-size: 100%;
	pointer-events: none;
	user-select: none;
}

#selection-grid tbody {
	height: 100%;
}

#selection-grid td {
	filter: drop-shadow(1px 1px 0 black);
	width: var(--tile-fraction);
	text-align: center;
}

#selection-grid tr {
	height: var(--tile-fraction);
}

#selection-grid td.highlight {
	filter: drop-shadow(1px 1px 0 black) hue-rotate(var(--select-angle));
	background-image: url("/sprites/select.webp");
	background-size: cover;
}

#selection-grid td.highlight:before {
	position: absolute;
	//filter: drop-shadow(1px 1px 0 black);
	background-image: var(--select-icons);
	background-size: cover;
	content: var(--select-text);
	top: var(--select-top);
	left: 0;
	width: 100%;
	height: 100%;
}

#selection-grid td:hover {
	//filter: drop-shadow(1px 1px 0 black);
	background-image: url("/sprites/hover.webp");
	background-size: cover;
}

#selection-grid td:hover.highlight {
	filter: drop-shadow(1px 1px 0 black) hue-rotate(var(--select-angle));
	background: url("/sprites/hover.webp"), url("/sprites/select.webp");
	background-size: cover;
}

#selection-targetPreview {
	position: absolute;
	border: 1px solid var(--text-color);
	border-radius: 2px;
	transform-origin: bottom left;
	margin: 0;
	//filter: drop-shadow(0px 0px 2px black);
	outline: 1px solid black;
	display: none;
}

#controls-div {
	//display: flex;
	width: 100%;
	margin: 0;
	padding: 5px 5px 5px 15px;
	z-index: 1;
	background: url("images/game.webp") black;
	background-size: cover;
	max-height: 100vh;
}

#controls-div fieldset {
	border: 5px inset var(--grey-color);
	margin-top: 3px;
	overflow-x: clip;
}

#controls-div > div {
	display: flex;
	width: 100%;
}

#controls-div > div > div {
	opacity: var(--controls-opacity);
	overflow-y: auto;
	overflow-x: auto;
	margin-bottom: 6px;
	width: 33%;
}

#lobby-div {
	display: flex;
	max-width: 800px;
}

#lobby-div > div {
	width: 50%;
}

@supports selector(::-webkit-scrollbar) {
	div::-webkit-scrollbar-track {
		background: black;
	}
	
	div::-webkit-scrollbar-thumb {
		background-clip: content-box;
	}

	div::-webkit-scrollbar-corner {
		background: transparent;
	}

	@media (max-width: 1920px) {
		div::-webkit-scrollbar {
			width: 3px;
			height: 3px;
		}
		
		div::-webkit-scrollbar-thumb {
			background: var(--text-color);
		}
	}

	@media not (max-width: 1920px) {
		div::-webkit-scrollbar {
			width: 18px;
		}
		
		div::-webkit-scrollbar-track {
			border: 3px inset --var(grey-color);
		}
		
		div::-webkit-scrollbar-thumb {
			background: var(--grey-color);
			border: 3px solid transparent;
			outline: 3px outset var(--border-color);
			outline-offset: -6px;
		}
	}
}

@supports not selector(::-webkit-scrollbar) {
	div {
		scrollbar-width: thin;
		scrollbar-color: var(--text-color) black;
	}
}

#warnings {
	color: red;
	animation: 0.5s infinite alternate flash;
}

@keyframes flash {
	from {
		color: lime;
	}
	
	to {
		color: red;
	}
}

.list-table tr:hover {
	color: black;
	background: var(--text-color);
}

.list-table tr.highlight {
	outline: 3px inset var(--border-color);
}

.list-table tr.target td:first-child:after {
	content: "<";
}

.list-table tr.hand {
	text-decoration: underline var(--text-color);
}

.list-table tr.hand:hover {
	text-decoration: underline black;
}

div.scrolled {
	border-left: 2px solid var(--text-color);
	padding-left: 10px;
	margin-left: -10px;
}

#title-p {
	position: relative;
	z-index: 1;
	pointer-events: none;
	filter: none;
}

#sound-texts {
	height: 100%;
	z-index: 1;
	pointer-events: none;
}

#sound-texts p {
	position: absolute;
	font-size: 20px;
	padding-top: 0;
	text-shadow: 1px 1px black;
	z-index: 0;
}

#click-prompt {
	z-index: 3;
}

#game-video {
	z-index: 2;
	position: absolute;
}

fieldset {
	border: 5px ridge var(--border-color);
	margin-bottom: 5px;
	overflow: auto;
	background: url("images/fieldset.webp") black;
}

fieldset fieldset {
	background: transparent;
}

legend {
	outline: 3px ridge var(--border-color);
	margin: 3px;
	background: transparent;
	backdrop-filter: brightness(50%);
}

textarea {
	border: 3px inset var(--border-color);
	background: transparent;
	color: var(--text-color);
	backdrop-filter: brightness(50%);
}

input {
	color: var(--text-color);
	border: 3px inset var(--border-color);
	background: transparent;
	backdrop-filter: brightness(50%);
	width: 95%;
	accent-color: var(--text-color);
}

input[type=range] {
	appearance: none;
}

input[type=range]::-moz-range-thumb {
	border: none;
	border-radius: 0;
	width: 4px;
	background: var(--text-color);
}

input[type=range]:focus-visible::-moz-range-thumb {
	background: black;
}

input[type=range]::-moz-range-progress {
	background: var(--text-color);
}

input[type=range]:focus-visible::-moz-range-progress {
	background: black;
}

input[type=range]::-webkit-slider-thumb {
	appearance: none;
	width: 4px;
	height: 1em;
	background: var(--text-color);
}

input[type=range]:focus-visible::-webkit-slider-thumb {
	background: black;
}

input[type=checkbox] {
	appearance: none;
	display: block;
	width: 1.5lh;
	height: 1.5lh;
	background: black;
	border: 3px inset var(--border-color);
}

input[type=checkbox]:checked:after {
	width: 0.7lh;
	height: 0.7lh;
	background: var(--text-color);
	position: relative;
	display: block;
	content: "";
	margin: 0 auto;
	top: 0.225lh;
}

input[type=checkbox]:focus-visible:checked:after {
	background: black;
}

input:focus-visible {
	color: black;
	background: var(--text-color);
	outline: none;
}

textarea:focus-visible {
	color: black;
	background: var(--text-color);
	outline: none;
}

input:focus-visible::selection {
	background: black;
	color: var(--text-color);
}

*:disabled {
	appearance: none;
}

textarea:focus-visible::selection {
	background: black;
	color: var(--text-color);
}
	
hr {
	border: 2px outset var(--border-color);
	margin: 6px -12px 6px -12px;
}

table {
	border-spacing: 0 8px;
	width: 100%;
}

#targeting-fieldset table {
	border-spacing: 0;
	border-collapse: collapse;
	user-select: none;
}

#targeting-fieldset td:nth-child(2) {
	width: 0;
}

#targeting-fieldset legend {
	display: flex;
}

#targeting-fieldset legend div {
	margin-top: 1px;
}

#health-table td:nth-child(3) {
	width: 0;
	text-align: right;
}

#stats-table td:nth-child(3) {
	width: 0;
	text-align: right;
}

#new-message {
	width: 92%;
}

#message-box {
	font-size: 14px;
	//line-height: 0.3;
	height: 85lvh;
	overflow: auto;
	word-wrap: anywhere;
}

nav {
	margin-bottom: 6px;
}

#turn table {
	//width: 100%;
}

select {
	color: var(--text-color);
	border: 3px inset var(--border-color);
	background: transparent;
	backdrop-filter: brightness(50%);
}

select:focus-visible {
	color: black;
	background: var(--text-color);
	outline: none;
}

option {
	background: black;
	color: var(--text-color);
}

a {
	text-decoration-style: dashed;
	color: var(--text-color);
}

a:hover {
	text-decoration-style: solid;
}

a:focus-visible {
	color: black;
	background: var(--text-color);
	outline: none;
}