body {
	--theme-color: var(--editor-theme-color);
	--theme-color-dark: var(--editor-theme-color-dark);
	grid-template-areas: "title viewport" "sidebar viewport";
	background: #2a2306;
}

#viewport > button {
	margin: 4px;
}

#sidebar {
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: 40px minmax(0, 1fr) 90px;
	grid-template-areas: "mode" "menu" "log";
}

#mode {
	grid-area: mode;
	text-align: center;
	font-size: 2em;
	color: var(--theme-color-dark);
}

#editorVersion {
	font-size: 1rem;
}

	#menu .icon-cubes {
		margin-left: -3px;
		margin-right: 3px;
	}

	#menuContent {
		max-height: 100%;
		overflow: hidden;
		padding: 4px;
	}

#log {
	grid-area: log;
	overflow: hidden;
	border-radius: var(--border-radius);
}

#properties {
	display: flex;
	overflow: hidden;
	flex: 1;
	max-height: 100%;
}

	#properties > div {
		font-family: sans-serif;
		font-size: .8em;
		min-width: 100%;
		transition: margin-left .4s;
	}

	#properties > div:not([id]) {
		display: flex;
		flex-direction: column;
	}

	#properties > div h3 {
		font-family: "Do Hyeon",monospace;
		font-size: 1.3em;
		text-transform: uppercase;
		margin: .7em 0 0 0;
	}

	#properties > div h3:first-child {
		margin: .3em 0 0 0;
	}

.add {
	font-size: 2.3em;
	display: flex;
	justify-content: space-around;
	align-items: center;
	text-align: center;
	color: var(--theme-color-dark);
	margin: 12px;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}
	.add i {
		font-size: 1.3em;
	}
	.add:hover {
		color: var(--theme-color);
	}
	.add:hover span {
		text-decoration: underline;
	}

.addFileInput {
	display: none;
}

/* Generic collapsible item style */
.item.itemTemplate {
	display: none;
}

.itemList {
	overflow: auto;
}

.item {
	background: #222;
	min-height: 130px;
	max-height: 300px;
	transition: min-height .3s, max-height .3s;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.item:not(:nth-child(2)){ /* First child is hidden template */
	margin-top: 4px;
}

.item.collapsed {
	min-height: calc(1.4em + 12px);
	max-height: calc(1.4em + 12px);
}
	.itemHeader {
		display: flex;
		min-height: calc(1.4em + 12px);
	}
		.itemHeader i {
			display: inline-block;
			transition: transform .3s;
		}
		.itemHeader i.rotated {
			transform: rotate(90deg);
		}
		.itemHeader > button {
			font-size: 1.4em;
			background: transparent;
			color: #eee;
			padding: 4px 10px;
		}
		.itemHeader > button:hover {
			text-decoration: none;
			background: #eee;
			color: #111;
		}

		.itemName {
			margin: 4px;
			padding-left: 2px;
			flex: 1;
			background: #111;
			color: #eee;
			border: none;
			font-size: 1.1em;
			font-weight: 600;
			min-width: 100px;
		}

	.itemDetails {
		display: flex;
		justify-content: space-around;
		color: #999;
		text-align: center;
		padding: 2px;
		position: relative;
	}

		.itemDetails > * {
			flex: 1;
			font-size: .8em;
		}

		.itemDetailsId {
			font-family: monospace;
			font-size: 1.1em;
			color: #666;
		}


	.item .showItem .icon-eye-off {
		color: #666;
	}

	.item .delete,
	.delete {
		background: transparent;
		color: #f00;
		border: none;
	}
	.item .delete:hover,
	.delete:hover {
		background: #f00;
		color: #fff;
		text-decoration: none;
	}

/* Textures tab */
#textures {
	font-size: 1.2em;
	overflow-y: auto;
}

	#textureTemplate {
		display: none;
	}

	.texture {
		margin: 2px 0px;
		background: #333;
		display: flex;
	}

	.texture .image {
		width: 32px;
		height: 32px;
		object-fit: contain;
		background-color: #000;
		margin-right: 8px;
	}

	.texture .name {
		flex: 1;
		display: flex;
		align-items: center;
	}

	.texture .delete {
		font-size: 1.15em;
	}

/* Materials tab */
#materialsInformation pre {
	display: inline-block;
	font-size: 1.1em;
	padding: 1px 2px;
	background: #111;
}

.materialProperties {
	margin:0px 2px;
	display: grid;
	grid-template-columns: 1fr 2fr 50px;
	grid-gap: 1px;
}

.material .span-2 {
	grid-column-end: span 2;
}

.material .parse {
	border: none;
	color: var(--theme-color);
	background: transparent;
	text-align: right;
}
	.material .parse:hover {
		text-decoration: underline;
	}

.textureUV {
	position: relative;
	cursor: pointer;
	text-align: center;
	background-color: #555;
	margin: 0px 4px;
	font-weight: 600;
	color: #111;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}
	.textureUV:hover {
		background-color: #797979;
	}

	.textureUV.visible {
		background-color: var(--theme-color-dark);
	}

	.textureUV.visible:hover {
		background-color: var(--theme-color);
	}

	#textureUVTransformTemplate {
		display: none;
	}

	.textureUVTransform {
		display: none;
		position: absolute;
		cursor: default;
		background: #555;
		color: #eee;
		box-shadow: #000 2px 1px 5px;
		font-weight: normal;
		width: 300px;
		top: -10px;
		right: 44px;
		padding: 4px;
	}

	.textureUVTransform.visible {
		display: flex;
	}

/* Models */
#models {
	overflow-y: auto;
}

	.model {
		margin: 2px 0px;
		padding-left: 2px;
		min-height: 1em;
	}

	.model:hover {
		background: #393939;
	}

	.model.selected {
		background: #444;
	}

	.model .itemName {
		background: transparent;
		padding-top: 3px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.model .itemDetails {
		flex-direction: column;
	}

	.model .childMesh {
		display: flex;
		margin-bottom: 1px;
	}

		.model .childMesh > * {
			text-align: left;
			flex: 1;
		}

/* Prefabs tab */
#prefabs {
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

	#prefabTemplate {
		display: none;
	}

	#prefabsList {
		overflow: auto;
	}

		.prefabColor {
			border: none;
			padding: 0px;
			margin: 0px;
			height: 14px;
			width: 64px;
			position: absolute;
			top: 0px;
			overflow: hidden;
			clip: rect(1px,63px,13px,1px);
		}

	.prefab .objectList {
		background: #111;
		min-height: 6em;
		overflow-y: auto;
		margin: 0px 4px;
		padding: 2px;
		font-size: 1.1em;
		display: flex;
		flex-direction: column;
	}

	.prefab .objectList > div {
		cursor: pointer;
		display: flex;
		align-items: center;
	}
	.prefab .objectList > div:hover {
		background: #222;
	}

		.prefab .objectList > div.selected {
			background: #333;
		}
		.prefab .objectList > div .name {
			flex: 1;
			padding-left: 3px;
		}
		.prefab .objectList > div .uuid {
			font-family: monospace;
			padding-right: 3px;
			color: #666;
		}
		/* wow so optimized omg no layout recalculation */
		.prefab .objectList > div .delete {
			visibility: hidden;
		}
		.prefab .objectList > div:hover .delete {
			visibility: visible;
		}

		#prefabObjectTemplate,
		#prefabColliderTemplate {
			display: none;
		}

	.prefabActions {
		display: flex;
		justify-content: space-around;
		padding-top: 2px;
	}
	.prefabActions > button {
		border: none;
		color: var(--theme-color);
		background: transparent;
	}
	.prefabActions > button:hover {
		text-decoration: underline;
	}
	.prefabActions > * {
		flex: 1;
		margin: 0px 4px;
	}

/* INSPECTOR */
#inspector {
	max-height: 210px;
	overflow-y: auto;
	transition: transform .4s, min-height .4s;
}

#inspector.noSelection {
	opacity: .5;
	filter: grayscale(100%);
}

	#inspector input:disabled {
		cursor: not-allowed;
	}

	#inspector .objectProperty,
	#inspector .colliderProperty {
		display: none;
	}
	#inspector.objectSelection .objectProperty,
	#inspector.colliderSelection .colliderProperty {
		display: table-row;
	}
	#inspector h3:after {
		content: "";
		text-transform: uppercase;
		color: #999;
	}
	#inspector.objectSelection h3:after { content:" - Object" }
	#inspector.colliderSelection h3:after { content:" - Collider" }
	#inspector.worldObjectSelection h3:after { content:" - WorldObject" }

	#inspector table {
		border-collapse: collapse;
	}

	#inspector table tr:hover {
		background: #363636;
	}

/* transform */

	.transform > tr > td:first-child {
		flex: 3;
		min-width: 75px;
		vertical-align: top;
	}

	.transform > tr > td:not(:first-child) {
		margin-right: 2px;
	}

	.transform > tr > td > div {
		display: inline-flex;
		flex-direction: row-reverse; /* sort-of hack to use the '~' selector for preceding elements */
	}

	.transform span {
		min-width: 12px;
		font-weight: 600;
		padding: 2px;
		text-align: center;
		display: block;
		color: #eee;
		font-family: "Courier New";
	}

	.rotation input[type=number]::after {
		content: "&deg;";
	}

/* shapeProperties */

	.transform > tr.shapeProperties > td > div {
		display: none;
		justify-content: flex-start;
		margin-bottom: 1px;
	}

	.shapeProperties.box div.box,
	.shapeProperties.sphere div.sphere,
	.shapeProperties.cylinder div.cylinder,
	.shapeProperties.cone div.cone,
	.shapeProperties.capsule div.capsule,
	.shapeProperties.mesh div.mesh {
		display: flex;
	}

/* LOG */
#log {
	background: #111;
	height: 90px;
	font-family: monospace;
	font-size: .9em;
	overflow-y: auto; /* no need to be rude */
}

#log .error {
	color: #d00;
}

#log .warn {
	color: #dd0;
}

#log .success {
	color: #2d2;
}

/* WORLD */
#world {
	padding-top: 120px; /* For the inspector */
	display: flex;
	flex-direction: column;
}

	#worldHierarchy {
		background: #111;
		border: 3px solid #262626;
		flex:1;
		min-height: 100px;
		display: flex;
		flex-direction: column;
	}

		#worldObjectList {
			flex:1;
			overflow-y: auto;
		}

			#worldObjectTemplate {
				display: none;
			}

			.worldObject {
				cursor: pointer;
				margin: 2px 0px;
				padding-left: 2px;
				display: flex;
				align-items: center;
			}

			.worldObject:hover {
				background: #333333;
			}

			.worldObject.selected {
				background: #444;
			}

			.worldObject .uuid {
				font-family: monospace;
				font-size: 1.1em;
				padding-right: 3px;
				color: #666;
			}

			.worldObject .delete {
				padding: 0px;
				visibility: hidden;
			}

			.worldObject:hover .delete {
				visibility: visible;
			}
			.worldObject:hover .delete:hover i {
				color: #eee;
			}

			.worldObject .name {
				flex: 1;
				display: flex;
				align-items: center;
				overflow: hidden;
			}

			.worldObject .prefabName {
				margin: 1px 4px 1px 2px;
				padding: 0px 2px;
				background: #000;
				color: #ccc;
				border: none;
				overflow: hidden;
				white-space: nowrap;
				min-width: 12px;
				min-height: 12px;
				max-width: 65px;
				border-radius: 2px;
				font-family: 'BenchNine', sans-serif;
				text-shadow: 0px 1px 1px #111;
			}

		#worldAddPrefab {
			background-color: #262626;
			padding-top: 3px;
			display: flex;
			justify-content: space-around;
		}

			#worldPrefabList {
				width: 180px;
			}

			#worldAddPrefabButton {
				flex: 1;
				font-size: 1.3em;
				margin: 0px;
			}

			#worldPrefabList:disabled ~ #worldAddPrefabButton {
				color: #666;
				cursor: not-allowed;
			}

			#worldPrefabList:disabled ~ #worldAddPrefabButton:hover span {
				text-decoration: none;
			}

		#worldMeta {
			overflow-y: auto;
		}

/* PROJECT */
#project {
	padding-top: 16px;
}

	#project > h4 {
		font-family: "Do Hyeon", monospace;
		letter-spacing: 0.05em;
		font-size: 1.1em;
		text-transform: uppercase;
	}

	#project .publish {
		font-size: 2.3em;
		justify-content: space-around;
		align-items: center;
		text-align: center;
		color: var(--theme-color-dark);
		margin: 12px;
		text-transform: uppercase;
		cursor: pointer;
		padding: 4px 8px;
	}
		#project .publish i {
			font-size: 1.3em;
		}
		#project .publish:hover {
			color: var(--theme-color);
		}
		#project .publish:disabled {
			color: #666;
			cursor: not-allowed;
			text-decoration: none;
		}

	#project table.buttons td {
		text-align: center;
	}

	#project table.checklist td {
		text-align: left;
		padding: 0px;
	}

	#project table.checklist td {
		font-size: 0.95em;
		font-weight: 600;
		color: #666;
	}
		#project table.checklist td.fail {
			color: #d00;
		}

		#project table.checklist td.success {
			color: #2c2;
		}

/* Other things */

input[type=number] {
	max-width: 50px;
	min-width: 30px;
	width: 100%;
	max-height: 19px;
	padding: 1px 2px 1px 3px;
	-webkit-appearance: textfield;
	-moz-appearance: textfield;
	appearance: textfield;
	box-sizing: border-box;
}

input[type=number]:disabled,
select:disabled {
	opacity: .5;
}

input[type=number],
input[type=text],
select {
	background: #060606;
	color: #eee;
	border: none;
}

input:read-only {
	color: #999;
	font-style: italic;
}
input:-moz-read-only { /* little disappointed here */
	color: #999;
	font-style: italic;
}
input[type=number]:focus,
span.x:active ~ input[type=number],
span.y:active ~ input[type=number],
span.z:active ~ input[type=number],
span.q:active ~ input[type=number] {
	background: #262626;
}
input[type=number]:hover:not(:disabled) {
	-webkit-appearance: initial;
	-moz-appearance: initial;
	appearance: initial;
}

table {
	min-width: 100%;
}

td:last-child {
	text-align: right;
}

span.x, span.y, span.z, span.q, span.w {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	text-shadow: 1px 1px 1px #333;
}

span.x, span.y, span.z, span.q {
	cursor: e-resize;
}

input:disabled ~ span.x,
input:disabled ~ span.y,
input:disabled ~ span.z,
input:disabled ~ span.q,
input:disabled ~ span.w {
	filter: grayscale(100%);
	opacity: .5;
	cursor: not-allowed;
}

span.x:active,
span.y:active,
span.z:active,
span.q:active {
	opacity: .6;
}

span.x {background: #c00;}
span.y {background: #2a2;}
span.z {background: #33f;}
span.q, span.w {background: #666;}
