html.popup {
	overflow: hidden;
	scrollbar-gutter: stable;

	#overlay {
		visibility: visible;
		opacity: 1;
	}
}

#overlay {
	visibility: hidden;
	display: flex;
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	justify-content: center;
	align-items: center;
	z-index: 101;
	opacity: 0;
	transition: opacity .3s;

	&:before {
		content: "";
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		background: black;
		opacity: 0.7;
	}
}

#popup {
	background: var(--bg);
	z-index: 102;
	border: 2px solid var(--strong);
	border-radius: 10px;
	box-shadow: 0 0 20px 5px rgba(255,255,255, 0.5);
	padding: 30px;
	font-size: 24px;
	font-family: var(--font);
	display: flex;
	flex-direction: column;
	gap: 20px;
	justify-content: center;
	align-items: center;
	position: relative;
	max-width: calc(100% - 200px);

	#popupTitle {
		color: var(--dark);
	}

	#popupContent {
		width: 100%;
		max-height: 80vh;
		overflow-y: auto;
		padding: 0 10px 0 0;
		text-align: center;
		border-top: 1px solid var(--border);
		padding-top: 20px;

		&:has(.nobar) {
			border-top: none;
	  		padding-top: 0;
		}
	}

	h2 {
		font-size: 22px;
		padding: 0;
	}
	
	h3 {
		font-size: 16px;
		margin: 10px 0 0 0;
	}

	textarea {
		margin-bottom: 10px;
	}

	dl {
		display: grid;
		flex-direction: column;
		margin: 0;
		gap: 15px;
		text-align: left;
		column-count: 2;
		/* width: 50%; */
		grid-template-columns: auto auto;
		align-items: flex-start;
		
		dt {
			font-weight: bold;
			font-size: 14px;
			margin: 0;
			letter-spacing: 0.5px;
			word-spacing: 1px;
		}

		dd {
			font-family: var(--font);
			font-size: 14px;
			margin: 0;
			letter-spacing: 0.5px;
			word-spacing: 1px;
		}
	}

	table {
		margin: 10px 0 20px 0;
		border-collapse: collapse;
		width: 100%;

		&:last-of-type {
			margin-bottom: 0;
		}

		td, th {
			font-size: 12px;
			padding: 5px;
			border: 1px solid var(--border);
		}

		th {
			color: var(--dark);
		}
	}

	ul {
		font-size: 14px;
		margin: 10px 0 20px 0;
		padding: 0 0 0 20px;
	}

	ul.history {
		background: white;
		list-style: none;
		margin: 0;
		border: 1px solid var(--border);
		border-radius: 5px;
		padding: 15px;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		font-size: 16px;
		font-family: courier;
		color: var(--strong);
	}
	
	ol {
		font-size: 14px;
		margin: 10px 0 20px 0;
		padding: 0 0 0 20px;
	}

	ol.inventory {
		display: flex;
		flex-direction: column;
		gap: 10px;
		width: 300px;

		li {
			width: 100%;
		}
	}

	.help {
		text-align: left;
	}

	button.close {
		position: absolute;
		top: 0;
		right: -40px;
		cursor: pointer;
		color: white;
		background: var(--button);
		border-radius: 5px;
		font-size: 16px;
		width: 30px;
		height: 30px;
		display: flex;
		justify-content: center;
		align-items: center;
		font-family: var(--icon);

		&:hover {
			background: var(--hover);
			color: var(--strong);
		}
	}

	.gallery {
		display: flex;
		flex-wrap: wrap;
		max-width: 1050px;
		gap: 5px;
		margin-bottom: 20px;
	
		span {
			display: block;
			width: 200px;
			height: 200px;
			filter: saturate(0) sepia(0.7) contrast(0.5) brightness(1.5);
			transition: filter .2s linear, background-size .2s;
			cursor: pointer;
			border: 1px solid var(--border);
			border-radius: 5px;
			background-size: 100%;
			background-position: center center;
		
			&:hover {
				filter: none;
				background-size: 150%;
			}
		}
	}
}
