html, body {
	padding: 0;
	margin: 0;
	background: #222;
	font-family: sans-serif;
	overflow: hidden;
}

* {
	box-sizing: border-box;
}

#serial-interface {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	margin-top: 5px;
	overflow: hidden;
}

#serial-interface .section-header {
	flex-shrink: 0;
	margin-bottom: 5px;
}

#serial-interface-log {
	font-family: monospace;
	padding: 5px 10px;
	background: #2d2e30;
	color: white;
	flex: 1;
	min-height: 0;
	overflow: auto;
	border-radius: 5px;
}

#serial-interface-log span {
	display: block;
	min-height: 15px;
}

#editor-container {
	display: flex;
	height: calc(100vh - 55px);
	gap: 0;
}

#projects-sidebar {
	width: 190px;
	min-width: 150px;
	max-width: 300px;
	height: 100%;
	background: #2d2e30;
	border-radius: 5px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	flex-shrink: 0;
}

#projects-header {
	margin-bottom: 0;
	border-radius: 5px 5px 0 0;
	border-bottom: 1px solid #222325;
	overflow: hidden;
	flex-shrink: 0;
}

.sidebar-title {
	color: rgb(204, 208, 214);
	font-size: 0.85em;
	font-weight: bold;
	display: flex;
	align-items: center;
	padding-left: 8px;
	user-select: none;
}

.sidebar-title .fa {
	margin-right: 6px;
}

#projects-list {
	flex: 1;
	overflow-y: auto;
	padding: 5px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

#projects-list::-webkit-scrollbar {
	width: 6px;
}

#projects-list::-webkit-scrollbar-thumb {
	background: #44474d;
	border-radius: 3px;
}

#projects-list::-webkit-scrollbar-thumb:hover {
	background: #555960;
}

.project-item {
	height: 30px;
	min-height: 30px;
	padding: 0 8px;
	color: rgb(204, 208, 214);
	background: #383a3d;
	border-radius: 5px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
	font-size: 0.85em;
	box-shadow: 1px 2px #1f2225;
	position: relative;
	transition: background 0.15s, color 0.15s;
}

.project-item:active {
	box-shadow: none;
	top: 1px;
	left: 1px;
}

.project-item:hover {
	background: #404347;
	color: white;
}

.project-item.selected {
	background: #44474d;
	color: white;
	font-weight: bold;
}

.project-info {
	display: flex;
	align-items: center;
	overflow: hidden;
	flex: 1;
	min-width: 0;
	margin-right: 4px;
}

.project-info .fa {
	margin-right: 6px;
	font-size: 0.9em;
	flex-shrink: 0;
	color: #aaa;
}

.project-item.selected .project-info .fa {
	color: rgb(100, 200, 255);
}

.project-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.project-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	opacity: 0.5;
	transition: opacity 0.15s;
}

.project-item:hover .project-actions,
.project-item.selected .project-actions {
	opacity: 1;
}

.project-actions .fa {
	color: #bbb;
	cursor: pointer;
	font-size: 0.9em;
	transition: color 0.15s;
}

.project-actions .fa:hover {
	color: white;
}

.project-chevron {
	font-size: 0.7em !important;
	margin-right: 5px !important;
	color: #888;
	width: 10px;
	text-align: center;
	flex-shrink: 0;
}

.project-item.selected .project-chevron {
	color: rgb(180, 190, 205);
}

.project-files {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-left: 14px;
	padding-left: 6px;
	border-left: 1px solid #3c4045;
	margin-top: 2px;
	margin-bottom: 5px;
}

.project-file-item {
	height: 26px;
	min-height: 26px;
	padding: 0 6px 0 8px;
	color: rgb(190, 195, 202);
	background: transparent;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
	font-size: 0.82em;
	position: relative;
	transition: background 0.15s, color 0.15s;
}

.project-file-item:hover {
	background: rgba(255, 255, 255, 0.06);
	color: white;
}

.project-file-item.selected {
	background: #474b52;
	color: white;
	font-weight: 500;
}

.project-file-item .file-info {
	display: flex;
	align-items: center;
	overflow: hidden;
	flex: 1;
	min-width: 0;
	margin-right: 4px;
}

.project-file-item .file-info .fa {
	margin-right: 6px;
	font-size: 0.85em;
	color: #9da3ad;
	flex-shrink: 0;
}

.project-file-item.selected .file-info .fa {
	color: #61afef;
}

.project-file-item .file-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.project-file-item .file-actions {
	display: flex;
	align-items: center;
	gap: 5px;
	flex-shrink: 0;
	opacity: 0;
	pointer-events: none;
}

.project-file-item:hover .file-actions {
	opacity: 1;
	pointer-events: auto;
}

.project-file-item .file-actions .fa {
	color: #888e99;
	cursor: pointer;
	font-size: 0.85em;
}

.project-file-item .file-actions .fa:hover {
	color: white;
	transform: scale(1.15);
}

.project-file-item .file-name-input {
	width: 100%;
	height: 20px;
	font-size: 0.82em;
	padding: 1px 3px;
}

.project-name-input {
	outline: none;
	border: 1px solid #282a2e;
	border-radius: 5px;
	background: #3d3f44;
	color: white;
	font-size: 0.9em;
	padding: 2px 4px;
	width: 100%;
}

#editor-main {
	flex: 1;
	min-width: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
}

#editor-main .section-header.small {
	margin-bottom: 5px;
	flex-shrink: 0;
}

#code-editor {
	width: 100%;
	flex: 1;
	height: calc(100vh - 95px);
	font-size: 16px;
}

.left-tab, .right-tab {
	height: calc(100vh - 55px);
}

#container {
	display: flex;
	height: 100vh;
	overflow: hidden;
}

#container-left {
	flex: 1;
	min-width: 300px;
	height: calc(100vh - 10px);
	margin: 5px 0 5px 5px;
}

#container-right {
	width: 604px;
	flex-shrink: 0;
	margin: 5px 5px 5px 0;
	container-type: inline-size;
}

#simulation-container {
	display: flex;
	flex-direction: column;
	height: calc(100vh - 55px);
	overflow: hidden;
}

#simulation-container canvas {
	width: 100%;
	aspect-ratio: 1 / 1;
	max-height: 60vh;
	min-width: 300px;
	min-height: 300px;
	display: block;
	flex-shrink: 0;
	margin: 0 auto;
}

.resizer-col {
	cursor: col-resize;
	user-select: none;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	z-index: 10;
	touch-action: none;
}

#resizer-sidebar {
	width: 8px;
}

#resizer-main {
	width: 10px;
}

.resizer-col::after {
	content: '';
	width: 2px;
	height: 36px;
	background: #3c4045;
	border-radius: 2px;
	transition: background 0.15s, height 0.15s, width 0.15s;
}

.resizer-col:hover::after,
.resizer-col.resizing::after {
	background: #61afef;
	width: 4px;
	height: 60px;
}

@container (max-width: 380px) {
	#container-right .section-header-button {
		width: 30px;
		margin-left: 2px;
		margin-right: 2px;
	}
	#container-right .section-header-elem {
		padding: 3px 6px;
		margin-left: 2px;
		margin-right: 2px;
		font-size: 0.82em;
	}
}

.section-header {
	width: 100%;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #2d2e30;
	border-radius: 5px;
	margin-bottom: 5px;
	overflow: auto;
}

.section-header.small {
	height: 35px;
}

.section-header.small .section-header-elem, .section-header.small .section-header-button {
	height: 25px;
	font-size: 0.8em !important;
}

.section-header-items {
	display: flex;
}

.section-header-elem, .section-header-button {
	margin-left: 5px;
	margin-right: 5px;
	height: 30px;
	color: rgb(204, 208, 214);
	background: #383a3d;
	user-select: none;
	cursor: pointer;
	border-radius: 5px;
}

.section-header-elem {
	width: max-content;
	padding: 3px 10px;
	font-size: 0.9em;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.section-header-elem.selected {
	color: white;
	background: #44474d;
}

.section-header-buttons {
	display: flex;
}

.section-header-button {
	width: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: 0.2s;
}

#save-button {
	background: transparent !important;
	cursor: default !important;
}

.section-header-button.disabled {
	background: #383a3d !important;
	cursor: not-allowed !important;
}

.section-header-button:hover {
	background: #44474d;
}

.section-header-button:active .fa {
	font-size: 0.9em;
}

canvas, #code-editor, #serial-interface {
	border-radius: 5px;
}

.section-header-elem span.fa {
	font-size: 0.9em;
	margin-right: 6px;
}

.fa {
	transition: 0.2s;
}

.fa-spinner {
	animation: spin 1s linear 0s infinite forwards;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

#examples-container, #options-container {
	padding: 10px 20px;
}

#documentation-container, #examples-container, #options-container {
	background: #2d2e30;
	border-radius: 5px;
	color: white;
	overflow: auto;
}

#documentation-container {
	display: flex;
	flex-direction: row;
	padding: 0;
	overflow: hidden;
}

#docs-toc-sidebar {
	width: 190px;
	min-width: 150px;
	flex-shrink: 0;
	background: #2d2e30;
	border-right: 1px solid #222325;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#docs-toc-header {
	margin-bottom: 0;
	border-radius: 5px 0 0 0;
	border-bottom: 1px solid #222325;
	flex-shrink: 0;
}

#docs-toc-list {
	overflow-y: auto;
	flex: 1;
	padding: 6px 0;
}

.toc-item {
	padding: 4px 12px;
	cursor: pointer;
	font-size: 0.82em;
	color: #ccd0d6;
	border-left: 2px solid transparent;
	transition: background 0.15s, border-color 0.15s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.toc-item:hover {
	background: #36393d;
	border-left-color: #5b8dd9;
}

.toc-h1 { font-weight: bold; }
.toc-h2 { padding-left: 20px; }
.toc-h3 { padding-left: 30px; color: #aaa; }

#docs-content {
	flex: 1;
	min-width: 0;
	overflow-y: auto;
	padding: 10px 20px;
}

h1 {
	margin: 0 0 10px 0;
}

.example {
	width: calc(50% - 5px);
	min-width: 400px;
	background: #36393d;
	padding: 10px 15px;
	border-radius: 5px;
	margin-bottom: 10px;
	display: flex;
	flex-direction: column;
	box-shadow: 2px 2px #1f2225;
}

.example-name {
	font-size: 1.1em;
	font-weight: bold;
	margin-bottom: 5px;
}

.badge-easy, .badge-medium, .badge-hard {
	font-size: 0.9em;
	margin-left: 10px;
	background: #40464e;
	padding: 2px 8px;
	border-radius: 5px;
}

.badge-easy {
	color: rgb(96, 202, 96);
}

.badge-medium {
	color: rgb(216, 224, 97);
}

.badge-hard {
	color: rgb(255, 102, 102);
}

.example-desc {
	margin-bottom: 10px;
}

.example-button {
	user-select: none;
	cursor: pointer;
	background: #40464e;
	width: max-content;
	padding: 3px 10px;
	border-radius: 5px;
	font-size: 0.9em;
	margin-top: auto;
	transition: 0.2s;
}

.example-button:hover {
	background: #444c57;
}

#examples-listing {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	container-type: inline-size;
}

@container (max-width: 810px) {
	.example {
		width: 100%;
	}
}

#files-list {
	display: flex;
}

#files-list .section-header-elem .fa {
	margin-right: 0 !important;
	margin-left: 10px;
	color: #aaa;
}

#files-list .section-header-elem .fa:hover {
	color: white;
	font-size: 1.1em;
}

#docs-content .section {
	margin-left: 20px;
}

.options-header {
	margin: 10px 0 15px 0;
	font-size: 1.3em;
	font-weight: bold;
	display: block !important;
	border-bottom: 2px solid #999;
}

#options-container label {
	font-weight: bold;
}

#options-container span {
	font-size: 0.85em;
	color: #aaa;
}

#options-container label, #options-container span {
	display: block;
}

#options-container input {
	margin: 3px 0 10px 0;
	padding: 6px 10px;
	background: #36393d;
	color: white;
	outline: none;
	border: 2px solid #393e46;
	border-radius: 5px;
}

#options-container input:focus {
	border: 2px solid #4b525f !important;
}

.option {
	display: inline-block;
	margin-right: 10px;
}

.section-header-elem, .section-header-button, .example-button {
	box-shadow: 1px 2px #1f2225;
	position: relative;
}

.section-header-elem:active, .section-header-button:active, .example-button:active {
	box-shadow: none;
	top: 1px;
	left: 1px;
}

.file-name-input {
	outline: none;
	border: 1px solid #282a2e;
	border-radius: 5px;
	background: #3d3f44;
	color: white;
	font-size: 0.9em;
	padding: 2px 4px;
}

.section-header-elem:has(.file-name-input) {
	padding-left: 3px !important;
}