/* main divs & main layout */
body {
	margin: 0;
	background: black;
	overflow: hidden;
}

input,
select {
	background-color: #ededed;
}

canvas {
	display: block;
}
#main {
	width: 98vw;
	height: 98vh;
	display: flex;
	flex-direction: column;
}
#mainBar {
	height: 34px;
	display: flex;
	align-items: center;
	gap: 15px;
	justify-content: space-between;
}

/* menu bar / btns */
#menu-bar {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	font-family: sans-serif;
	margin: 2px 6px;
}
.menu-section {
	display: flex;
	gap: 15px;
	align-items: center;
}
#menu-item-container {
	display: none;
	justify-content: flex-start;
}
#game-menu-container,
#editor-menu-container {
	display: flex;
	justify-content: flex-start;
}
#mode-selector-container {
	display: flex;
	justify-content: center;
	flex: 1;
}
.dropdown {
	position: relative;
	display: inline-block;
}
.dropbtn {
	background-color: #222;
	color: white;
	padding: 6px 12px;
	border: 1px solid #444;
	cursor: pointer;
	border-radius: 4px;
}
.dropdown-content {
	display: none;
	position: absolute;
	background-color: #111;
	min-width: 130px;
	box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.5);
	z-index: 101;
	border: 1px solid #333;
	border-radius: 4px;
}
.dropdown-content a {
	color: #ccc;
	padding: 8px 12px;
	text-decoration: none;
	display: block;
	white-space: pre;
}
.dropdown-content a:hover {
	background-color: #333;
	color: white;
}
.dropdown:hover .dropdown-content {
	display: block;
}

/* */
#mainLayout {
	/*margin-top: 34px;*/
	/*height: calc(100% - 34px);*/
	flex-grow: 1;
	color: white;
	position: relative;
	min-height: 0;
}

.replay-dev-widget {
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	font-size: 14px;
	color: #e5e7eb;
	padding: 10px;
	background: #111827;
	height: 100%;
	overflow-y: auto;
	box-sizing: border-box;
}

/* config widget */
#configList {
	flex-direction: column;
}
.config-editor-widget {
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	font-size: 14px;
	color: #e5e7eb;
	background: #111827;
	height: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

.config-group-header {
	font-size: 1.1em;
	color: #aaa;
	margin: 10px 0 5px 0;
	padding-bottom: 5px;
	border-bottom: 1px solid #444;
}

.config-row {
	display: grid;
	grid-template-columns: 1fr 1fr 2fr;
	gap: 10px;
	padding: 5px 0;
	align-items: center;
	font-size: 0.9em;
}

.config-val-input {
	padding: 4px 8px;
	border: 1px solid #4b5563;
	border-radius: 3px;
	background: #111827;
	color: #e5e7eb;
	width: 100%;
	box-sizing: border-box;
}

.config-val-input:focus {
	outline: none;
	border-color: #60a5fa;
}

/* ---- */

/* connectionWidget */
.wl-dashboard {
	display: flex;
	gap: 20px;
	background: #1e1e1e;
	color: #e0e0e0;
	padding: 15px;
	border-radius: 8px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
	box-sizing: border-box;
	margin-bottom: 15px;
}

.wl-controls {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wl-statuses {
	font-weight: bold;
	font-size: 14px;
	color: #a0a0a0;
	display: flex;
	gap: 20px;
	white-space: nowrap;
}

.status-badge {
	padding: 4px 8px;
	border-radius: 4px;
	background: #333333;
	color: #ffffff;
	border: 1px solid #444;
}

.wl-row {
	display: flex;
	gap: 10px;
}

.wl-controls button,
.wl-controls input {
	font-size: 14px;
	padding: 10px 15px;
	border-radius: 6px;
	border: 1px solid #444;
	outline: none;
	background-color: #2a2a2a;
	color: #ffffff;
}

.wl-controls input::placeholder {
	color: #777;
}

.wl-controls input:focus {
	border-color: #0070f3;
}

.wl-controls button {
	background-color: #0066d6;
	color: white;
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
}

.wl-controls button:hover {
	background-color: #0070f3;
}

.wl-controls button:active {
	background-color: #004ba0;
}

.disconnect-btn {
	background-color: #c82333 !important;
}

.disconnect-btn:hover {
	background-color: #dc3545 !important;
}

.disconnect-btn:active {
	background-color: #a71d2a !important;
}

.msg-input {
	flex-grow: 1;
}

.wl-logs {
	flex: 1;
	background: #000000;
	color: #00ff00;
	font-family: "Courier New", Courier, monospace;
	font-size: 13px;
	padding: 12px;
	border-radius: 6px;
	border: 1px solid #333;
	height: 120px;
	overflow-y: auto;
	white-space: pre-wrap;
	line-height: 1.2;
	box-sizing: border-box;
}

.wl-main {
	width: 100%;
	height: calc(100% - 165px);
	min-height: 300px;
	position: relative;
	border: 2px solid #333;
	box-sizing: border-box;
	background: #121212;
	color: #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.wl-chat {
	height: 100%;
	padding: 15px;
	box-sizing: border-box;
	overflow-y: auto;
	font-family: monospace;
	font-size: 15px;
	word-break: break-word;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.wl-remoteCursor {
	position: absolute;
	width: 12px;
	height: 12px;
	background: #ff4757;
	border-radius: 50%;
	pointer-events: none;
	z-index: 9999;
	box-shadow: 0 0 12px rgba(255, 71, 87, 0.8);
	transform: translate(-50%, -50%);
}

/* collab */
.collab-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.collab-modal {
	background: #18181c;
	color: #e4e4e7;
	border: 1px solid #2e2e33;
	border-radius: 8px;
	padding: 15px 25px;
	/*width: 300px;*/
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
}
.collab-header {
	font-size: 1.25rem;
	font-weight: 600;
	margin-bottom: 16px;
	color: #ffffff;
}
.collab-row {
	margin-bottom: 8px;
	font-size: 0.9rem;
	display: grid;
	grid-template-columns: 145px auto;
	align-items: center;
	justify-items: start;
}
.collab-badge {
	background: #2e2e33;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.8rem;
	font-family: monospace;
}
.badge-active {
	background: #16a34a;
	color: #ffffff;
}
.collab-error {
	background: #400303;
	color: #fdadad;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 0.85rem;
	margin-top: 10px;
	border: 1px solid #791111;
}
.collab-group {
	margin: 14px 0;
	font-size: 0.9rem;
}
.collab-group label {
	cursor: pointer;
	user-select: none;
}
.collab-actions {
	margin-top: 20px;
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	flex-direction: column;
}
.collab-btn {
	background: #2e2e33;
	color: #ffffff;
	border: none;
	padding: 8px 14px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85rem;
	transition: background 0.2s;
}
.collab-btn:hover {
	background: #3f3f46;
}
.collab-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.btn-primary {
	background: #2563eb !important;
}
.btn-primary:hover {
	background: #1d4ed8 !important;
}
.btn-danger {
	background: #dc2626 !important;
}
.btn-danger:hover {
	background: #b91c1c !important;
}
.btn-success {
	background: #16a34a !important;
}
.btn-success:hover {
	background: #15803d !important;
}
hr {
	border: 0;
	border-top: 1px solid #2e2e33;
	margin: 12px 0;
}

/* replay */
#replayInfo {
	color: #d5d8df;
	white-space: pre-wrap;
}
#replay-container {
	display: flex;
	gap: 10px;
	align-items: center;
}
#replay-container > button {
	white-space: pre;
}

.replay-node-item {
	padding: 6px;
	display: flex;
	justify-content: space-between;
	cursor: pointer;
	border-bottom: 1px solid #444;
}

.replay-stats-section {
	margin-bottom: 15px;
	padding-bottom: 10px;
	border-bottom: 2px solid #666;
}

.replay-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	font-size: 0.95em;
}

.replay-nodes-container {
	background: #1e1e1e;
	border: 1px solid #333;
	border-radius: 4px;
}

.replay-data-section {
	margin-top: 15px;
}

.replay-data-pre {
	background: #1e1e1e;
	border: 1px solid #333;
	border-radius: 4px;
	padding: 10px;
	margin: 0;
	white-space: pre-wrap;
	word-wrap: break-word;
	font-size: 0.85em;
	max-height: 300px;
	overflow-y: auto;
}

.replay-active-indicator {
	color: #4caf50;
	font-size: 0.8em;
	margin-left: 5px;
}

.replay-size-display {
	color: #888;
	font-size: 0.9em;
}

/* map */
.editor-panel {
	height: 100%;
	box-sizing: border-box;
}

.editor-toolbar .search-tag {
	width: 35%;
}

.tile-list-item {
	padding: 5px;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
}

.tile-list-item.active {
	background-color: #5a5a5a;
}

.map-props-widget {
	padding: 10px;
	width: 100%;
	max-width: 300px;
	overflow: auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.map-props-widget input {
	box-sizing: border-box;
	width: 100%;
}

.map-props-widget label {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
}

.editor-panel button {
	padding: 2px 6px;
	font-size: 0.8em;
	white-space: pre-wrap;
	max-width: 200px;
}

.map-props-wrapper {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
}

.map-props-wrapper .map-props-header {
	display: flex;
	justify-content: space-between;
	gap: 5px;
	width: 100%;
}
.map-props-widget input {
	box-sizing: border-box;
}

.map-props-widget label {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
#mapIdDisplay {
	font-family: monospace;
	color: #888;
	font-size: 1em;
}

#btnBack {
	align-self: center;
}

.map-props-wrapper > label > input {
	max-width: 50px;
}
#mapName {
	max-width: 200px;
}

.tile-widget {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 100px;
}

/* brush */

.brush-widget {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.brush-btn {
	padding: 4px 10px;
	background: #374151;
	color: #e5e7eb;
	border: 1px solid #4b5563;
	border-radius: 3px;
	cursor: pointer;
}

#selectedTileDisplay {
	padding: 8px;
	background: #1f2937;
	border: 1px solid #374151;
	border-radius: 4px;
	min-height: 40px;
}
.layerBtn,
.mapBtn {
	padding: 4px 8px;
	font-size: 11px;
	cursor: pointer;
	background: #2563eb;
	color: white;
	border: none;
	border-radius: 4px;
}
.mapBtn {
	background: #114467;
}
.mapBtn.enabled {
	background: #2599eb;
}

/* game */
.gameCanvas,
.textCanvas,
.menuCanvas,
.overlayCanvas {
	display: block;
	image-rendering: pixelated;
	background: #000;
	position: absolute;
	top: 0;
	left: 0;
}

/* map editor */
.mapRenderer {
	width: 100%;
	height: 100%;
	overflow: hidden;
	position: relative;
	background: #000;
	display: flex;
	flex-direction: column;
}

.mapLayerBar {
	display: flex;
	gap: 8px;
	padding: 6px;
	background: #222;
	border-bottom: 1px solid #333;
	z-index: 10;
}
.mapCanvas {
	display: block;
	image-rendering: pixelated;
	flex: 1;
	min-height: 0;
}

#lastSeenList {
	background-color: rgb(45 45 45) !important;
}

/* Editor panels */
.editor-widget {
	padding: 5px 10px;
	height: 100%;
	overflow: auto;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}
/* Layout & Containers */
.entity-widget {
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Toolbar & Search */
.editor-toolbar {
	padding: 5px;
	border-bottom: 1px solid #333;
	display: flex;
	gap: 5px;
	flex-shrink: 0;
}

.editor-toolbar input {
	height: 1.2em;
	padding: 4px;
	border: 1px solid #444;
	background: #222;
	color: #fff;
	border-radius: 4px;
}

.editor-toolbar button {
	height: 1.65em;
	white-space: pre;
}

.category-buttons {
	display: flex;
	gap: 5px;
	flex-wrap: wrap;
}

.cat-btn {
	background: #374151;
	color: #e5e7eb;
	border: none;
	padding: 4px 8px;
	cursor: pointer;
	border-radius: 4px;
}

.cat-btn.active {
	background: #2563eb;
	color: white;
}

.search-container {
	display: flex;
	gap: 5px;
	align-items: center;
}

/* Main Editor Layout */
.editor-main {
	flex: 1;
	overflow: hidden;
	display: flex;
	min-height: 0;
}

.editor-lists {
	min-width: 100px;
	max-width: 200px;
	display: flex;
	flex-direction: column;
	border-right: 1px solid #ccc;
	background-color: rgb(61, 61, 61);
	flex-shrink: 0;
}

.editor-list {
	overflow-y: auto;
}

.list-separator {
	height: 2px;
	background: #959595;
	flex-shrink: 0;
}

/* Tile List Items */
.tile-list-item {
	display: flex;
	align-items: center;
	padding: 4px 8px 4px 4px;
	cursor: pointer;
	gap: 5px;
}

.tile-list-item.active {
	background-color: #2563eb;
}

.editor-content {
	flex: 1;
	padding: 10px;
	overflow: auto;
}

/* Entity Properties Panel */
.entity-properties {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.entity-properties > div {
	display: flex;
	margin-bottom: 10px;
}

.graphic-container {
	gap: 10px;
	align-items: flex-start;
}

.graphic-container .graphic-controls {
	display: flex;
	flex-direction: column;
	gap: 5px;
	align-items: flex-start;
}

.graphic-container input[type="text"] {
	width: 30px;
	text-align: center;
}

.graphic-container input[type="color"] {
	height: 30px;
}

.entity-canvas {
	background: #222;
	border: 1px solid #444;
	border-radius: 4px;
}

/* Components Grid */
#componentsContainer {
	display: grid;
	gap: 6px 15px;
	margin-top: 10px;
}

#componentsContainer.has-instance {
	grid-template-columns: max-content max-content max-content;
}

#componentsContainer.no-instance {
	grid-template-columns: max-content max-content;
}

.editor-columns-header {
	display: contents;
}

.editor-columns-header > div {
	font-size: 0.9em;
	color: #aaa;
	justify-self: end;
}

.editor-columns-header > :nth-child(2),
.editor-columns-header > :nth-child(3) {
	padding-right: 8px;
}

.btn-close-instance {
	font-size: 0.8em;
	margin-right: 5px;
}

/* Individual Component Styles */
.component-block {
	display: contents;
}

.component-header {
	grid-column: 1 / -1;
	padding-top: 4px;
	display: flex;
	align-items: center;
	gap: 4px;
	background-color: #424242;
}

.component-name {
	font-weight: bold;
}
.component-inherit {
	font-size: 0.9em;
}

.component-info-symbol {
	cursor: help;
	color: #aaa;
	font-size: 12px;
}

.delete-comp-btn {
	color: red;
	cursor: pointer;
	border: none;
	background: none;
	font-weight: bold;
	margin-left: auto;
}

.missing-def-warning {
	color: #fbbf24;
	grid-column: 1 / -1;
}

.component-row {
	display: contents;
}

.component-label-wrapper {
	display: flex;
	margin-left: auto;
	gap: 5px;
	align-self: center;
	overflow: hidden;
	text-overflow: ellipsis;
}

.input-group {
	display: flex;
	gap: 4px;
	align-items: center;
}

.input-group > select {
	width: 60px;
	padding: 2px 0;
	font-size: 0.7em;
}

.input-group > input {
	width: 90px;
}

.componentReadonly > * {
	background-color: #c6c6c6;
	cursor: unset;
}

/* Modal / Overlay */
.components-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.components-overlay > div {
	background: #18181c;
	color: #e4e4e7;
	border: 1px solid #2e2e33;
	border-radius: 8px;
	padding: 15px 25px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
}

.components-overlay-header {
	font-size: 1.25rem;
	font-weight: 600;
	margin-bottom: 16px;
	color: #ffffff;
}

#compList {
	max-height: 300px;
	overflow-y: auto;
	margin-bottom: 15px;
}

.comp-group-title {
	font-weight: bold;
	margin-top: 10px;
	color: #aaa;
}

.comp-checkbox-row {
	padding: 5px;
	display: flex;
	align-items: center;
	gap: 5px;
}

.btns-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
}

.addComponentBtn {
	padding: 4px 10px;
	background: #313a47;
	color: #e5e7eb;
	border: 1px solid #4b5563;
	cursor: pointer;
	border-radius: 3px;
	font-size: 1em;
}

.addComponentBtn:hover {
	background: #515c6b;
}

/* logger */
.logger-widget-root {
	overflow: auto;
	height: 100%;
	width: 100%;
}
.logger-table {
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: fixed;
	width: 100%;
}
.logger-table th {
	padding: 2px 3px;
	text-align: left;
	position: sticky;
	top: 0;
	z-index: 2;
	background-color: #333;
}
.logger-table thead tr:nth-child(2) th {
	top: 1em;
	z-index: 1;
}
.logger-table td {
	border: 1px solid #ccc;
	padding: 2px 5px;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
	font-family: monospace;
}
.logger-table td.expanded {
	white-space: pre-wrap;
	word-break: break-all;
}
.logger-filter-input {
	width: 100%;
	box-sizing: border-box;
}
.log-row-hidden {
	display: none;
}
.logger-table tr.expanded td {
	white-space: pre-wrap;
	overflow: visible;
	word-break: break-word;
}
.logger-overlay {
	position: absolute;
	top: 50px;
	left: 50px;
	right: 50px;
	bottom: 50px;
	background: #222;
	z-index: 1000;
	overflow: auto;
	padding: 20px;
	border: 1px solid #444;
	color: white;
}
#close-logger {
	margin-left: 15px;
}

.hidden {
	display: none;
}

/* ecsListenersWidget */
.ecs-listeners-list {
	margin-top: 10px;
	overflow-y: auto;
	flex: 1;
}
.ecs-listeners-header {
	font-weight: bold;
	margin-top: 10px;
	padding: 5px;
	background: #444;
}
.ecs-listeners-row {
	padding: 2px 0 2px 20px;
}
.delete-btn,
.delete-elem-btn {
	color: red;
	cursor: pointer;
	border: none;
	background: none;
	font-weight: bold;
	margin-left: auto;
}

/* Component Modal Styles */
.comp-modal-table {
	border-collapse: collapse;
	margin-bottom: 15px;
}
.comp-modal-table th {
	padding: 6px 8px;
	text-align: left;
	color: #aaa;
}
.comp-modal-table td {
	padding: 4px 8px;
	border: none;
}
.comp-modal-table th,
.comp-modal-table td {
	border: none;
}
.comp-input {
	padding: 2px 4px;
	background: #ededed;
}
.stat-input {
	width: 60px;
}
.comp-delete-btn {
	color: red;
	cursor: pointer;
	border: none;
	background: none;
	font-weight: bold;
}

.component-name-label {
	font-weight: 500;
	color: #e5e7eb;
}

.component-value-label {
	font-family: monospace;
	color: #a0aec0;
}

.summary-row {
	display: flex;
	gap: 10px;
	align-items: center;
}

/* Modal & Action Defaults */
.comp-modal-content-auto {
	width: max-content;
	min-width: 400px;
}

.comp-action-cell {
	text-align: right;
}

.comp-readonly-btn {
	cursor: default;
}

.comp-action-btn {
	cursor: pointer;
}

.comp-add-container {
	display: flex;
	gap: 10px;
	margin: 15px 0;
}

/* StatModifiersRenderer */
.stat-header-name {
	font-weight: bold;
	color: #fff;
}

.stat-nested-name,
.stat-nested-add {
	padding-left: 24px;
}

.stat-elem-select {
	margin-right: 8px;
}

.stat-all-added-msg {
	color: #777;
}

/* InventoryItemsRenderer */
.inventory-count-input {
	width: 35px;
	margin-left: 1px;
}
.inventory-count-input:disabled {
	opacity: 0.5;
}

/* EquipmentRenderer */
.eq-slot-name {
	font-weight: bold;
}

.eq-slot-item {
	background-color: #323232;
	padding: 2px 6px !important;
}

.equip-list-container {
	max-height: 300px;
	overflow-y: auto;
	margin-bottom: 15px;
	border: 1px solid #444;
	min-height: 40px;
}

.equip-empty-msg {
	padding: 10px;
	color: #888;
}

.equip-list-item {
	padding: 8px;
	cursor: pointer;
	border-bottom: 1px solid #444;
}

.equip-list-item.selected {
	background-color: #555;
}

/* EquippableRenderer */
.req-slots-container {
	margin-bottom: 15px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.req-slots-label {
	color: #fff;
}

.editor-btn {
	background: #2e2e33;
	color: #ffffff;
	border: none;
	padding: 8px 14px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85rem;
	transition: background 0.2s;
}
.editor-btn:hover {
	background: #3f3f46;
}
.editor-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
