body {
	margin: 32px;
	background: #f2fff0;
	color: #575870;
	font-family: Helvetica, sans-serif;
	font-size: 14px;
}
body.facelift64 {
	background: #282833;
	color: #9bbbb8;
	font-family: Helvetica, sans-serif;
	font-size: 14px;
	line-height: 20px;
}

* {
	box-sizing: border-box;
}

.facelift64 .language-switcher,
.facelift64 .language-switcher a,
.facelift64 .language-switcher a.active,
.facelift64 .language-switcher a:hover,
.facelift64 .language-switcher a:visited {
	color: #9bbbb8;
}

.language-switcher,
.language-switcher a,
.language-switcher a.active,
.language-switcher a:hover,
.language-switcher a:visited {
	color: #575870;
}

.language-switcher {
	position: absolute;
	top: 0;
	right: 0;
	font-size: 14px;
	font-weight: normal;
}

.language-switcher a {
	text-decoration: none;
	transition: background-color 0.2s ease;
	font-weight: normal;
	font-style: normal;
	opacity: 0.5;
}
.language-switcher a.active,
.language-switcher a:hover {
	opacity: 1;
}

#content {
	position: relative;
	max-width: 840px;
	margin: 0 auto;
}
h1 {
	background: #575870;
	color: #f2fff0;
	display: inline;
	padding: 8px 0;
}
.facelift64 h1 {
	background: #9bbbb8;
	color: #282833;
}
p.details {
	font-style: italic;
	margin-left: 32px;
	opacity: 0.8;
}
pre {
	font-family: "Monaco", Courier, monospace;
	/*font-size: 13px;*/
}
h2,
h3,
h4 {
	margin-bottom: 0px;
	padding-bottom: 0px;
	margin-top: 50px;
}
.img {
	width: 100%;
	text-align: center;
}

.img img {
	border-radius: 4px;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.img a img {
	cursor: pointer;
}

.img a img:hover {
	transform: scale(1.02);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.beforeafter {
	margin: 0 auto;
	position: relative;
	overflow: hidden;
}
.beforeafter .beforeimg,
.beforeafter .afterimg {
	position: absolute;
	top: 0px;
	left: 0px;
}
.beforeafter .beforeimg {
	opacity: 0;
	transition: opacity 1s;
	-webkit-transition: opacity 1s;
	-moz-transition: opacity 1s;
	-o-transition: opacity 1s;
	-ms-transition: opacity 1s;
}
.beforeafter .beforeimg:hover {
	opacity: 1;
}

canvas {
	image-rendering: optimizeSpeed;
	image-rendering: -moz-crisp-edges;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: -o-crisp-edges;
	image-rendering: pixelated;
	-ms-interpolation-mode: nearest-neighbor;
}
#canvas {
	width: 640px;
	height: 480px;
}
#resources,
#buffers {
	display: none;
}
#screen,
#buffers {
	background: #444444;
	overflow: hidden;
}
#screen {
	margin: 0 auto 16px auto;
	width: 640px;
	height: 480px;
}
#buffers {
	width: 128px;
	height: 128px;
}
#controls {
	width: 120px;
	font-size: 10px;
	margin-top: 16px;
}
#controls h4 {
	font-size: 13px;
	margin: 0 0 8px 0;
}
#controls label {
	width: 56px;
	display: inline-block;
	overflow: hidden;
}
#controls button {
	margin: 0 0 4px 0;
	font-size: 13px;
	font-family: monospace;
	font-weight: bold;
	width: 24px;
}
#controls button.free {
	width: 50px;
	font-family: Helvetica;
	font-weight: normal;
	font-size: 11px;
}

#table1 {
	position: relative;
	margin: 0 auto 32px auto;
	width: 640px;
	height: 160px;
	overflow: hidden;
	text-align: center;
	user-select: none;
	-webkit-user-select: none;
}
#table1 .table1row {
	width: 640px;
	height: 32px;
	margin: 0;
	padding: 0px;
	overflow: hidden;
	text-align: center;
}
#table1 .table1row:first-child {
	margin: 8px 0 4px 0;
}
#table1 .table1row.off {
	opacity: 0.15;
}
#table1 .table1row.off > div.table1cell2 {
	pointer-events: none;
}
#table1 .table1cell1,
#table1 .table1cell1btn {
	display: inline-block;
	width: 128px;
	height: 24px;
	overflow: hidden;
	text-align: center;
	font-weight: bold;
	font-size: 14px;
	padding-top: 8px;
}
#table1 .table1cell1 {
	vertical-align: top;
}
#table1 .table1cell1btn {
	padding: 0px;
	height: 32px;
}
#table1 .table1cell1.link {
	cursor: pointer;
}
#table1 .table1cell2 {
	display: inline-block;
	width: 80px;
	height: 32px;
	overflow: hidden;
}
#table1 .table1cell2t {
	display: inline-block;
	width: 80px;
	height: 30px;
	padding: 2px 0 0 0;
	text-align: center;
	font-weight: bold;
	font-size: 18px;
	vertical-align: top;
	line-height: 12px;
}
#table1 .table1cell2t small {
	font-size: 12px;
	font-weight: normal;
}
div.minus,
div.plus,
div.wall,
div.floor,
div.res {
	display: inline-block;
	width: 30px;
	height: 32px;
	overflow: hidden;
	cursor: pointer;
	margin: 0 4px;
}
div.minus {
	margin: 0 0 0 10px;
	background: url(images/minus.svg);
}
div.minus:hover,
div.plus:hover,
div.wall:hover,
div.floor:hover,
div.res:hover {
	opacity: 0.5;
}
div.plus {
	margin: 0 10px 0 0;
	background: url(images/plus.svg);
}
div.wall {
	background: url(images/wall.svg);
}
div.floor {
	background: url(images/floor.svg);
}
div.res {
	background: url(images/resolution.svg);
}
pre {
	background: #fffcf9;
	border: 1px solid #bbc0d3;
	margin: 0px auto;
	padding: 16px;
	max-width: 640px;
	font-size: 10px;
}
a {
	color: #456c86;
	font-style: italic;
	text-decoration: none;
}
a:visited {
	color: #00c9e7;
}
a:hover {
	text-decoration: underline;
}
ul {
	margin: 20px 0;
	padding-left: 0;
	list-style: none;
}
ul > li {
	font-weight: bold;
	margin: 16px 0;
	line-height: 1.3;
}
ul ul {
	margin: 8px 0;
	padding-left: 24px;
	list-style: disc;
}
ul ul li {
	font-weight: normal;
	margin: 6px 0;
	line-height: 1.2;
}

/* Gallery Styles */
.gallery-container {
	width: 100%;
	max-width: 840px;
	margin: 20px auto;
	text-align: center;
}

.gallery-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-bottom: 10px;
	align-items: flex-start;
	position: relative;
	transition: max-height 0.3s ease, opacity 0.3s ease;
}

.gallery-grid.multi-row {
	overflow: hidden;
	max-height: 200px;
}

.gallery-grid.multi-row::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 150px;
	background: linear-gradient(transparent, #282833);
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.4s ease;
}

.facelift64 .gallery-grid.multi-row::after {
	background: linear-gradient(transparent, #282833);
}

body:not(.facelift64) .gallery-grid.multi-row::after {
	background: linear-gradient(transparent, #f2fff0);
}

.gallery-container:hover .gallery-grid.multi-row {
	max-height: 2000px;
}

.gallery-container:hover .gallery-grid.multi-row::after {
	opacity: 0;
}

.gallery-thumb {
	width: 150px;
	height: auto;
	cursor: pointer;
	border-radius: 4px;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	object-fit: cover;
	flex-shrink: 0;
}

.gallery-thumb:hover {
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-caption {
	font-style: italic;
	color: #666;
	margin-top: 10px;
}

.facelift64 .gallery-caption {
	color: #9bbbb8;
}

/* Gallery Viewer Overlay */
.gallery-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-overlay.active {
	opacity: 1;
	visibility: visible;
}

.gallery-viewer {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gallery-image {
	max-width: 800px;
	max-height: 800px;
	cursor: pointer;
	border-radius: 4px;
	transition: opacity 0.3s ease;
}

.gallery-image.loading {
	opacity: 0.3;
	filter: blur(1px);
}

.gallery-viewer {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gallery-viewer.loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 40px;
	height: 40px;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top: 4px solid white;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	z-index: 1002;
}

@keyframes spin {
	0% {
		transform: translate(-50%, -50%) rotate(0deg);
	}
	100% {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

.gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	font-size: 48px;
	color: white;
	cursor: pointer;
	padding: 20px;
	user-select: none;
	transition: opacity 0.2s ease;
	z-index: 1001;
}

.gallery-nav:hover {
	opacity: 0.7;
}

.gallery-nav.prev {
	left: -80px;
}

.gallery-nav.next {
	right: -80px;
}

.gallery-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: none;
	border: none;
	font-size: 36px;
	color: white;
	cursor: pointer;
	padding: 10px;
	z-index: 1001;
}

.gallery-close:hover {
	opacity: 0.7;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
	body {
		margin: 16px;
		font-size: 16px;
		line-height: 1.5;
	}

	body.facelift64 {
		margin: 16px;
		font-size: 16px;
		line-height: 1.5;
	}

	#content {
		max-width: 100%;
	}

	/* Make main images responsive */
	.img img {
		max-width: 100%;
		height: auto;
		width: auto !important;
	}

	/* Gallery thumbnails responsive */
	.gallery-thumb {
		width: 120px;
	}

	/* Mobile gallery viewer */
	.gallery-viewer {
		max-width: 95%;
		max-height: 95%;
		margin: 0 60px; /* Make room for nav buttons */
	}

	.gallery-image {
		max-width: 100%;
		max-height: 70vh;
		width: auto;
		height: auto;
	}

	/* Reposition navigation buttons for mobile */
	.gallery-nav {
		font-size: 36px;
		padding: 15px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: 50%;
		width: 50px;
		height: 50px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.gallery-nav.prev {
		left: 10px;
	}

	.gallery-nav.next {
		right: 10px;
	}

	.gallery-close {
		top: 10px;
		right: 10px;
		font-size: 30px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: 50%;
		width: 40px;
		height: 40px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
}

@media (max-width: 480px) {
	body {
		margin: 12px;
		font-size: 14px;
	}

	body.facelift64 {
		margin: 12px;
		font-size: 14px;
	}

	.gallery-thumb {
		width: 100px;
	}

	.gallery-viewer {
		margin: 0 50px;
	}

	.gallery-image {
		max-height: 60vh;
	}

	.gallery-nav {
		font-size: 28px;
		width: 40px;
		height: 40px;
	}

	.gallery-nav.prev {
		left: 5px;
	}

	.gallery-nav.next {
		right: 5px;
	}
}
