#enginePanel {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	border-bottom: 5px solid #286b31;
	box-sizing: border-box;
}

/* Scrollable body: title bar stays fixed like tree browser */
.engine-panel-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
}

/* Bottom bar: Stop analysis + Save evaluations (same logic as tree browser Save) */
.engine-panel-bottom {
	flex-shrink: 0;
}

.engine-btn-hint {
	margin: 0;
	padding: 8px 0;
	font-size: 11px;
	color: #888;
	text-align: center;
	min-height: 16px;
	display: flex;
	justify-content: center;
}

.hint-move {
	width: 70px;
	text-align: right;
}

.hint-eval {
	width: 50px;
	text-align: center;
	font-weight: bold;
}

.hint-depth {
	width: 60px;
	text-align: left;
}

.hint-fulltext {
	width: auto;
	font-weight: normal;
}

.engine-panel-buttons {
	padding: var(--tb-spacing-md);
	padding-top: 4px;
	text-align: center;
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

.engine-panel-buttons input[type="button"] {
	background-color: var(--tb-primary-color);
	color: white;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	transition: background-color 0.2s;
}

.engine-panel-buttons input[type="button"]:disabled {
	background-color: var(--tb-disabled-color);
	cursor: not-allowed;
}

.engine-panel-buttons input[type="button"]:disabled:hover {
	background-color: var(--tb-disabled-hover);
}

.engine-panel-buttons input[type="button"]:not(:disabled):hover {
	background-color: var(--tb-primary-hover);
}

.engine-panel-buttons input[type="button"]:not(:disabled):active {
	background-color: var(--tb-primary-active);
}

#enginePanel hr {
	border: none;
	border-top: 1px solid #ddd;
	width: 100%;
}

/* Auto-analysis row */

.engine-auto-row {
	display: flex;
	align-items: center;
	gap: var(--tb-spacing-sm);
	padding: 15px 15px 10px 15px;
}

.engine-auto-label {
	font-weight: bold;
	white-space: nowrap;
}

.engine-name {
	margin-left: auto;
	color: #666;
	font-size: 0.9em;
	white-space: nowrap;
}

/* Settings section */

.engine-settings {
	padding: 10px 15px;
}

.engine-slider-container {
	padding: 3px 0;
}

.engine-slider-container label {
	display: block;
	margin-bottom: 5px;
}

.engine-slider-container input[type="range"] {
	width: 100%;
}

/* On/off toggle - gray when off, green when on */

.on-off-toggle .slider {
	height: 14px !important;
	background-color: #b5b5b5 !important;
}

.on-off-toggle .slider:before {
	height: 18px !important;
	width: 18px !important;
}

.on-off-toggle .switch:hover .slider {
	background-color: #999 !important;
}

.on-off-toggle input:checked + .slider {
	background-color: var(--tb-primary-color) !important;
}

.on-off-toggle .switch:hover input:checked + .slider {
	background-color: var(--tb-primary-hover) !important;
}

.on-off-toggle input:checked + .slider:before {
	transform: translate(20px, -50%) !important;
}

/* Engine error notification */

.engine-error {
	background: #fff3f3;
	border: 1px solid #e88;
	border-radius: 4px;
	padding: 8px 12px;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.engine-error p {
	margin: 0;
	color: #c33;
	font-size: 12px;
	flex: 1;
}

.restart-engine-btn {
	background: #c33;
	color: #fff;
	border: none;
	border-radius: 3px;
	padding: 4px 10px;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}

.restart-engine-btn:hover {
	background: #a22;
}

/* Analysis output section */

.engine-analysis {
	padding: 10px 15px 15px 15px;
}

.analysis-header {
	font-weight: bold;
	margin: 0 0 8px 0;
	font-size: 1.05em;
}

#analysisLines {
	display: flex;
	gap: 2px;
	overflow-x: auto;
}

.analysis-col {
	display: flex;
	flex-direction: column;
	min-width: 80px;
	flex: 1;
	font-size: 13px;
	line-height: 1.5;
	border-right: 1px solid #eee;
	padding-right: 2px;
}

.analysis-col:last-child {
	border-right: none;
}

.analysis-col-header {
	display: flex;
	flex-direction: column;
	padding: 2px 4px 4px 4px;
	border-bottom: 1px solid #eee;
	margin-bottom: 2px;
	padding-left: 18px;
}

.analysis-depth {
	color: #888;
	font-size: 11px;
	white-space: nowrap;
}

.analysis-score {
	font-weight: bold;
	white-space: nowrap;
}

.analysis-move {
	cursor: pointer;
	padding: 1px 4px;
	border-radius: 3px;
	white-space: nowrap;
	transition: background-color 0.1s;
	display: flex;
}

.analysis-movenum {
	display: inline-block;
	min-width: 28px;
	text-align: right;
	color: #999;
	margin-right: 3px;
	flex-shrink: 0;
}

.analysis-move:hover {
	background-color: #e0edff;
}

/* Hover-lock: grey out moves beyond the first two rows after dblclick */
#analysisLines.hover-locked .analysis-move[data-move-idx] {
	color: #ccc;
	cursor: default;
}
#analysisLines.hover-locked .analysis-move[data-move-idx] .analysis-movenum {
	color: #ddd;
}
#analysisLines.hover-locked .analysis-move[data-move-idx]:hover {
	background-color: transparent;
}

/* Keep the first PV move (data-move-idx="0") and origin move (no data-move-idx) active */
#analysisLines.hover-locked .analysis-move:not([data-move-idx]),
#analysisLines.hover-locked .analysis-move[data-move-idx="0"] {
	color: inherit;
	cursor: pointer;
}
#analysisLines.hover-locked .analysis-move:not([data-move-idx]) .analysis-movenum,
#analysisLines.hover-locked .analysis-move[data-move-idx="0"] .analysis-movenum {
	color: #999;
}
#analysisLines.hover-locked .analysis-move:not([data-move-idx]):hover,
#analysisLines.hover-locked .analysis-move[data-move-idx="0"]:hover {
	background-color: #e0edff;
}

/* Engine output (development, hidden by default) */

.engine-output-row {
	padding: 10px 15px 15px 15px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.engine-output-label {
	font-size: 0.9em;
	font-weight: bold;
	color: #555;
}

.engine-output {
	width: 100%;
	min-height: 120px;
	font-family: Consolas, "Liberation Mono", Monaco, monospace;
	font-size: 11px;
	line-height: 1.3;
	padding: 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fafafa;
	resize: vertical;
	box-sizing: border-box;
}
