@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

html,
body {
	height: 100%;
}

.layout {
	grid-template-columns: 220px minmax(0, 1fr);
}

.topbar-logo {
	width: 220px;
}

.main--fullscreen {
	min-width: 0;
}

.files-layout {
	grid-template-columns: var(--files-tree-w, 220px) 6px minmax(0, 1fr);
	min-height: 0;
}

.file-tree {
	min-width: 0;
}

.tree-row {
	min-width: 0;
}

.tree-name {
	min-width: 0;
}

.file-editor {
	min-width: 0;
	min-height: 0;
}

.editor-topbar {
	min-width: 0;
}

.part-tabs {
	display: flex;
	align-items: center;
	gap: 4px;
	max-width: 40%;
	overflow-x: auto;
}

.part-tab {
	flex: 0 0 auto;
	padding: 4px 8px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: transparent;
	color: var(--text-2);
	font: inherit;
	font-size: 11px;
	cursor: pointer;
}

.part-tab.active {
	border-color: var(--accent);
	color: var(--text);
}

.editor-area {
	min-height: 0;
}

#monaco-editor {
	width: 100%;
	height: 100%;
}

.editor-empty[hidden],
#monaco-editor[hidden],
#search-view[hidden],
#files-layout[hidden],
[hidden] {
	display: none !important;
}

.editor-statusbar {
	min-height: 24px;
}

.ws-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: auto;
	height: auto;
	padding: 0 8px;
	border-radius: 0;
	background: transparent;
	color: var(--text-2);
	font-size: 11px;
	white-space: nowrap;
	flex-shrink: 0;
}

.ws-status::before {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--text-3);
	content: '';
}

.ws-status.ws-online {
	color: var(--green);
	background: transparent;
}

.ws-status.ws-online::before {
	background: var(--green);
}

.ws-status.ws-error {
	color: var(--red);
	background: transparent;
}

.ws-status.ws-error::before {
	background: var(--red);
}

.topbar-right {
	flex: 0 0 auto;
	white-space: nowrap;
}

.topbar-actions {
	min-width: 0;
}

.tree-icon.file-icon {
	width: 14px;
	text-align: center;
	font-family: var(--mono);
	font-size: 10px;
	font-weight: 700;
}

.file-icon-pwn {
	color: #77c69b;
}

.file-icon-inc {
	color: #8ca9e8;
}

.etab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.etab-name {
	min-width: 0;
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.etab-close {
	font-size: 15px;
	line-height: 1;
	color: var(--text-2);
}

.etab-close:hover {
	color: var(--text);
}

.auth-wrap {
	z-index: 20;
	position: fixed;
	inset: 0;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(8px);
}

.auth-box {
	padding: 24px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius-md);
	background: var(--surface);
}

.auth-connection {
	color: var(--text-2);
}

.auth-logo p {
	color: var(--text-2);
}

.auth-box .input {
	width: 100%;
	min-height: 38px;
	padding: 8px 10px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius);
	background: var(--surface2);
	color: var(--text);
	font: inherit;
}

.auth-box .input:focus {
	border-color: var(--accent);
	outline: 2px solid var(--accent-dim);
}

.search-panel {
	max-width: 920px;
	margin: 0 auto;
	padding: 24px;
}

.search-heading {
	margin-bottom: 16px;
	font-size: 16px;
	font-weight: 600;
}

.search-controls {
	display: flex;
	align-items: center;
	gap: 10px;
}

.search-controls > input[type="search"] {
	flex: 1;
	min-width: 0;
	min-height: 34px;
	padding: 7px 10px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius);
	background: var(--surface2);
	color: var(--text);
	font: inherit;
}

.search-controls label {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-2);
	white-space: nowrap;
}

.search-results {
	display: flex;
	flex-direction: column;
	margin-top: 16px;
	border-top: 1px solid var(--border);
}

.search-result {
	padding: 9px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: transparent;
	color: var(--text-2);
	font-family: var(--mono);
	font-size: 12px;
	text-align: left;
	white-space: pre-wrap;
	word-break: break-word;
	cursor: pointer;
}

.search-result:hover {
	background: var(--surface2);
	color: var(--text);
}

.console-panel,
.debug-panel {
	position: fixed;
	z-index: 15;
	right: 12px;
	bottom: 12px;
	width: min(820px, calc(100vw - 24px));
	max-height: 42vh;
	border: 1px solid var(--border-2);
	border-radius: var(--radius-md);
	background: var(--surface);
	box-shadow: var(--shadow-2);
}

.console-panel[hidden],
.debug-panel[hidden] {
	display: none;
}

.console-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 38px;
	padding: 4px 10px 4px 14px;
	border-bottom: 1px solid var(--border);
	color: var(--text-2);
	font-size: 12px;
}

#compile-result {
	max-height: 140px;
	margin: 0;
	padding: 10px 14px;
	overflow: auto;
	border-bottom: 1px solid var(--border);
	color: var(--text);
	font-family: var(--mono);
	font-size: 12px;
	white-space: pre-wrap;
}

#server-console {
	max-height: 32vh;
	margin: 0;
	padding: 10px 14px;
	overflow: auto;
	color: var(--text);
	font-family: var(--mono);
	font-size: 12px;
	white-space: pre-wrap;
}

.debug-panel {
	width: min(360px, calc(100vw - 24px));
}

#connection-details {
	padding: 10px 14px;
	color: var(--text-2);
	font-size: 12px;
}

#event-log {
	max-height: 28vh;
	margin: 0;
	padding: 0 14px 12px 32px;
	overflow: auto;
	color: var(--text-2);
	font-family: var(--mono);
	font-size: 11px;
}

.toast-wrap {
	position: fixed;
	z-index: 30;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	align-items: center;
}

.toast {
	max-width: min(520px, calc(100vw - 32px));
	padding: 9px 12px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius);
	background: var(--surface3);
	color: var(--text);
	font-size: 12px;
}

.toast.success {
	border-color: var(--green);
}

.toast.error {
	border-color: var(--red);
}

@media (max-width: 800px) {
	.files-layout {
		grid-template-columns: minmax(130px, 38vw) 4px minmax(0, 1fr);
	}

	.layout {
		grid-template-columns: 48px minmax(0, 1fr);
	}

	.topbar-logo {
		width: 48px;
		padding: 0 12px;
	}

	.topbar-logo-label,
	.sidebar .label,
	.sidebar-section,
	.sidebar-footer,
	#nav-collapse,
	#console-button,
	#debug-button {
		display: none;
	}

	.sidebar {
		align-items: center;
		padding: 8px 3px;
	}

	.sidebar a {
		width: 40px;
		min-height: 36px;
		justify-content: center;
		font-size: 0;
	}

	.sidebar a::before {
		content: attr(data-short);
		font-size: 12px;
	}

	.files-layout {
		grid-template-columns: minmax(130px, 38vw) 4px minmax(0, 1fr);
	}

	.topbar {
		padding-right: 4px;
	}

	.topbar-actions {
		justify-content: flex-start;
		padding: 0 4px;
	}

	.btn-sm {
		padding: 4px 6px;
		font-size: 10px;
	}

	.topbar-right {
		gap: 0;
	}

	.topbar-btn {
		padding: 0 5px;
		font-size: 10px;
	}

	.ws-status {
		display: none;
	}

	.editor-topbar {
		flex-wrap: wrap;
		gap: 4px;
		padding: 4px 6px;
		height: auto;
		min-height: 38px;
	}

	.editor-filename {
		flex-basis: 100%;
	}

	.part-tabs {
		max-width: 100%;
		margin-right: auto;
	}

	.search-controls {
		align-items: stretch;
		flex-wrap: wrap;
	}
}
