:root {
	--white: rgba(255, 255, 255, 0.8);
	--black: #161616;
	--gray-1: #393939;
	--gray-2: #8d8d8d;
	--gray-3: #ccc;
	--gray-4: #dcdcdc;
	--gray-5: #eee;
	--gray-6: #f3f3f3;
}

html,
body {
	font-size: 14px;
}

html,
body, aside {
	height: 100%;
}

main {
	height: calc(100% - 32px);
	overflow: hidden;
}

#menubar {
	height: 32px;
	width: 100%;
	background: var(--black);
	display: flex;
	align-items: center;
}

.menu {
	outline: 0;
	position: relative;
	color: var(--white);
}

.menu .title {
	user-select: none;
	line-height: 16px;
	padding: 8px 12px;
	transition: background .11s cubic-bezier(.2,0,.38,.9);
}

.menu:hover .title, .menu:focus .title {
	background: var(--gray-1);
}

.menu:focus .options {
	display: block;
}

.options {
	display: none;
	position: absolute;
	min-width: 240px;
	background: var(--black);
	box-shadow: 0 4px 8px 0 rgb(0 0 0 / 50%);
	z-index: 2;
}

.option {
	user-select: none;
	padding: 6px 12px;
	color: var(--white);
	white-space: nowrap;
	cursor: pointer;
}

.option[data-disabled] {
	pointer-events: none;
	cursor: default;
	color: var(--gray-2);
}

.option::after {
	content: attr(data-shortcut);
	float: right;
}

.option:hover {
	background: var(--gray-1);
	color: #fff;
}

.option[data-line] {
	border-bottom: 1px solid var(--gray-1);
}

main {
	display: flex;
}

aside, #viewport {
	position: relative;
}

aside {
	min-width: 4px;
	display: flex;
	flex-direction: column;
}

.tabs {
	padding: 0 4px;
	display: flex;
	border-bottom: 1px solid var(--border-color);
}

.tab {
	margin: 0;
	font-weight: 500;
	padding: 12px 8px 12px 8px;
	color: var(--secondary-text-color);
	cursor: pointer;
	user-select: none;
}

.tab[data-selected] {
	color: var(--text-color);
}

.panel {
	flex-grow: 1;
	overflow: auto;
}

/* width */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

/* Track */
::-webkit-scrollbar-track {
	background: var(--gray-5);
}

/* Handle */
::-webkit-scrollbar-thumb {
	background: var(--gray-3);
	border-radius: 8px;
	border: 1px solid var(--gray-5);
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
	background: var(--gray-2);
}

.panel section {
	padding: 12px 4px 12px 12px;
	border-bottom: 1px solid var(--border-color);
	display: flex;
	flex-direction: column;
}

.panel h1 {
	margin: 0;
}

fieldset {
	border: none;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	margin-bottom: 12px;
	padding-right: 8px;
}

legend {
	user-select: none;
	padding: 0;
	width: 112px;
	flex: 1;
	padding-right: 6px;
	float: left;
	white-space: initial;
	overflow: hidden;
	text-overflow: ellipsis;
}

#left-sidebar legend {
	margin-right: auto;
}

select {
	border: none;
	border-bottom: 1px solid var(--border-color);
	font-family: inherit;
	font-size: inherit;
	color: inherit;
	padding: 1px 24px 1px 4px;
	appearance: none;
	background: url("img/chevron-down.svg") no-repeat right 4px center, var(--gray-5);
	background-size: 16px;
	height: 22px;
	outline: 0;
	width: 162px;
}

label {
	margin: 0 8px 0 4px;
	user-select: none;
}

input {
	outline: 0;
	font-family: inherit;
}

input[type="color"], select {
	cursor: pointer;
}

input[type="color"] {
	border: 1px solid var(--border-color);
	background-color: transparent;
	padding: 0;
	width: 22px;
	height: 22px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
	padding: 0;
}

input[type="color"]::-webkit-color-swatch {
	border: none;
}

input[type="number"] {
	font-size: 12px;
	height: 22px;
	width: 50px;
	border: none;
	border-bottom: 1px solid var(--border-color);
	background: var(--gray-5);
	-moz-appearance: textfield;
	padding-left: 4px;
}

input[type=number]::-webkit-inner-spin-button {
	display: none;
}

input[type="text"] {
	height: 22px;
	border: 1px solid var(--border-color);
	border: none;
	border-bottom: 1px solid var(--border-color);
	background: var(--gray-5);
	padding: 0 8px;
}

input[type="checkbox"] {
	position: relative;
	appearance: none;
	margin: 0;
	cursor: pointer;
}

input[type="checkbox"]:disabled {
	cursor:not-allowed;
}

input[type="checkbox"]:disabled::before {
	border: 1px solid var(--gray-3);
}

input[type="checkbox"]::before {
	position: relative;
	display: block;
	width: 14px;
	height: 14px;
	content: "";
	border: 1px solid var(--text-color);
	border-radius: 0;
}

input[type="checkbox"]:checked::before {
	background: var(--text-color);
}

input[type="checkbox"]::after {
	position: absolute;
    top: 2px;
    left: 4px;
    width: 7px;
    height: 3px;
    margin-top: -1px;
    background: none;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    transform: scale(0) rotate(-45deg);
    transform-origin: bottom right;
    content: "";
}

input[type="checkbox"]:checked::after {
	transform: scale(1) rotate(-45deg);
}

.asset-icon {
	cursor: pointer;
}

/*scene*/

#background-color, #background-texture, #background-equirect, #environment-texture {
	display: none;
	margin-left: 8px;
}

#fog-wrapper {
	margin-bottom: 6px;
}

#linear-fog input:first-child, #exponential-fog input {
	margin-left: auto;
}

#linear-fog input:first-child {
	margin-right: 6px;
}

#linear-fog input {
	width: 78px;
	padding-left: 4px;
}

#exponential-fog input {
	width: 162px;
	padding-left: 4px;
}

#color-linear-fog, #color-exp-fog {
	margin-left: 8px;
	display: none;
}

#linear-fog, #exponential-fog {
	display: none;
}

#left-sidebar .panel > div {
	display: none;
	float: left;
	min-height: 100%;
	min-width: 100%;
	height: max-content;
	padding: 12px 0;
	background: var(--gray-5);
}

/**/

#entity-name {
	min-width: 250px;
}

#scene div, #assets div {
	margin: 0;
	padding: 4px 8px 4px 24px;
	position: relative;
	cursor: pointer;
	user-select: none;
	border: 1px dashed transparent;
	white-space: nowrap;
	outline: none;
}

#scene .drag-into {
	border-color: var(--theme-color);
}

#scene .drag-above, .component.drag-above {
	border-top-color: var(--theme-color);
}

#scene .drag-below, .component.drag-below {
	border-bottom-color: var(--theme-color);
	border-bottom-style: dashed;
}

#scene div:hover, #assets div:hover {
	background: var(--gray-4);
}

#scene div[data-selected], #assets div[data-selected] {
	background: var(--gray-3);
}

.parent[data-opened]::before {
	transform: rotate(90deg)
}

.parent::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("img/caret.svg");
    background-repeat: no-repeat;
    position: absolute;
    margin-left: -20px;
    top: 5px;
}

#scene li {
	list-style-type: none;
	position: relative;
}

#assets span {
	display: block;
	height: 24px;
}

#add-assets {
	position: absolute;
	right: 6px;
	padding: 0;
	border: none;
	cursor: pointer;
	outline: none;
}

#add-assets svg {
	fill: var(--gray-2);
	transition: fill .11s cubic-bezier(.2,0,.38,.9);
}

#add-assets:hover svg {
	fill: var(--black);
}

#add-assets:focus + #add-assets-list {
	display: block;
}

#add-assets-list {
	display: none;
	position: absolute;
	right: -216px;
	margin: -4px 0 0 0;
	background: var(--black);
	color: var(--white);
	z-index: 2;
	box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
	border-radius: 2px;
	list-style-type: none;
	padding: 4px 0;
}

#add-assets-list li {
	cursor: pointer;
	width: 240px;
	padding: 4px 12px;
	user-select: none;
	display: flex;
}

#add-assets-list li:hover {
	background: var(--gray-1);
}

#add-assets-list li[data-line] {
	border-bottom: 1px solid var(--gray-1);
}


#add-assets-list li svg {
	width: 16px;
	height: 16px;
	margin: auto 8px auto 0;
	fill: var(--white);
}

#contextmenu {
	background: var(--black);
	color: var(--white);
	position: absolute;
	padding: 4px 0;
	box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
	border-radius: 2px;
	display: none;
	z-index: 2;
	outline: none;
}

#contextmenu div {
	cursor: pointer;
	width: 240px;
	padding: 4px 12px;
	user-select: none;
}

#contextmenu div[data-line] {
	border-bottom: 1px solid var(--gray-1);
}

#contextmenu div[data-disabled] {
	cursor: default;
	color: var(--gray-2);
}

#contextmenu div::after {
	content: attr(data-shortcut);
	float: right;
}

#contextmenu div:not([data-disabled]):hover {
	background: var(--gray-1);
}

/*inspector*/

#component-wrapper {
	position: relative;
	user-select: none;
}

#component-selector {
	margin: 0 auto;
	height: initial;
	padding: 6px 8px;
	background: url(img/chevron-down.svg) no-repeat right 8px center, var(--gray-5);
	width: 169px;
}

#component-list {
	position: absolute;
	top: 43px;
	width: 169px;
	margin-left: auto;
	margin-right: auto;
	left: 0;
	right: 0;
	background: var(--gray-5);
	box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
	max-height: 400px;
	overflow-y: auto;
	z-index: 1
}

#component-list div {
	padding: 4px 0 4px 8px;
	cursor: pointer;
}

#component-list div:hover {
	background: var(--gray-4);
}

section.component {
	padding: 0;
	user-select: none;
	border-top: 1px dashed transparent;
}

.component fieldset {
	padding: 0 12px;
}

.component fieldset:first-of-type {
	padding-top: 6px;
}

.component h1 {
	font-weight: 500;
	font-size: 14px;
	padding: 6px 0 6px 28px;
	position: relative;
	cursor: pointer;
	transition: background .11s cubic-bezier(.2,0,.38,.9);
	display: flex;
}

.component h1[data-opened]::before {
	transform: rotate(90deg)
}

.component h1:not([data-opened]) ~ fieldset {
	display: none;
}

.component h1::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("img/caret.svg");
    background-repeat: no-repeat;
    position: absolute;
    left: 7px;
    top: 7px;
}

.trash {
    width: 16px;
    height: 16px;
    margin: 0 6px;
}

.trash svg {
	pointer-events: none;
}

.component h1:hover {
	background: var(--gray-6);
}

.component input[type="color"] {
	width: 60px;
	margin-right: 102px;
}

/*general*/

#left-sidebar {
	border-right: 1px solid var(--border-color);
	width: 240px;
}

#right-sidebar {
	border-left: 1px solid var(--border-color);
	width: 299px;
}

.resizer {
	position: absolute;
	width: 7px;
	height: 100%;
	cursor: e-resize;
	z-index: 1;
}

#left-resizer {
	right: -4px;
}

#right-resizer {
	left: -4px;
}

#viewport {
	flex: 1;
}

#canvas, #player {
	width: 100%;
	height: 100%;
	outline: none;
}

#player {
	display: none;
}

#toolbar {
	position: absolute;
	left: 10px;
	top: 10px;
	width: 32px;
}

.tool {
	padding: 5px 8px;
	border: none;
	background: #000;
	outline: none;
	cursor: pointer;
	transition: background .11s cubic-bezier(.2,0,.38,.9);
}

.tool:hover {
	background: var(--gray-1);
}

.tool[data-selected] {
	background: var(--theme-color);
}

.tool svg {
	fill: var(--white);
	pointer-events: none;
}

.tool[data-selected] svg {
	fill: #fff;
}

#toolbar img {
	width: 16px;
}
