body {
  color: #333;
  font-family: 'Open Sans', arial, sans-serif;
  margin: 0;
  padding: 0;
}

.main-container {
  display: flex;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
  height: 95vh;
  padding: 10px;
}

.config-column {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow-y: auto;
}

.config-column.left {
  /* background: #fffcf0; */
  border-right: 1px solid #444;
}

.config-column.right {
  /* background: #f9f9f9; */
  border-left: 1px solid #444;
}

.config-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-row label {
  color: #333;
  width: 100px;
  font-weight: bold;
  white-space: nowrap;
}

.config-input {
  background: #fff;
  color: #333;
  border: 1px solid #ccc;
  padding: 4px;
}

select.config-input {
  width: 190px;
}

input[type="number"].config-input {
  width: 50px;
}

#wasm-version-select {
  width: 280px;
  margin-left: 10px;
}

.action-section {
  margin-top: 20px;
  border-top: 1px solid #555;
  padding-top: 10px;
}

.console-container {
  flex: 1;
  margin-top: 10px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  background: #1e1e1e;
  color: #00ff00;
  font-family: monospace;
  font-size: 8px;
}

.console-header {
  padding: 5px;
  background: #333;
  color: white;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-output {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-output div {
  margin-bottom: 1.5em;
}

.center-column {
  flex: 0 1 62vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.board-controls {
  margin: 10px auto;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.engine-console, .console-output {
  background: #1e1e1e;
  color: #eeeeee;
  padding: 10px;
  height: 250px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  border: 1px solid #333;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.console-output.muted {
  opacity: 0.4;
  filter: grayscale(1);
  pointer-events: none;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: #333;
  color: #eee;
  font-size: 11px;
  font-weight: bold;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.console-controls {
  display: flex;
  gap: 5px;
}

.btn-toggle-console, .btn-copy-console {
  background: #444;
  color: #ccc;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
}

.btn-toggle-console:hover, .btn-copy-console:hover {
  background: #555;
  color: #fff;
}

.btn-toggle-console.active {
  background: #666;
  color: #f39c12;
  border-color: #f39c12;
}

.stats-grid {
  margin-top: 0px;
  display: flex;
  gap: 15px;
  overflow: visible;
  font-size: 0.82em;
}

.player-stats {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.player-stats.white {
  background: #fffcf0;
}

.player-stats.black {
  background: #f8f8f8;
}

.stats-header {
  margin-bottom: 5px;
  border-bottom: 1px solid #eee;
  padding-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.header-main {
  display: flex;
  flex-direction: column;
}

.move-line {
  display: flex;
  align-items: baseline;
}

.version-info {
  font-size: 0.7em;
  color: #888;
  margin-top: 1px;
}

.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
}

.stats-item {
  flex: 1;
}

.stats-item strong {
  display: block;
  color: #555;
  font-size: 0.9em;
}

.stats-value {
  font-family: monospace;
  font-size: 0.9em;
  color: #333;
}

.player-status {
  border-top: 1px solid #eee;
  padding-top: 4px;
  color: #666;
  font-style: italic;
}

button {
  background: #2ba6cb;
  border-radius: 3px;
  border: 1px solid #1e728c;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s;
}

button:hover {
  background: #258faf;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.start {
  background-color: #4CAF50;
  border-color: #45a049;
}

button.pause {
  background-color: #FF9800;
  border-color: #e68a00;
}

.engine-status-text {
  font-size: 0.9em;
  color: #aaa;
  font-family: monospace;
}
.engine-status-text:not(:empty) {
  margin-top: 6px;
  min-height: 1.2em;
}
.captured-piece {
  height: 20px;
  width: auto;
  margin-right: 2px;
  vertical-align: middle;
}
.score-text {
  font-weight: bold;
  color: #555;
  margin-left: 5px;
  vertical-align: middle;
  font-size: 0.9em;
}

.profiling-stats {
  margin-top: 5px;
  font-size: 10px;
  border-top: 1px solid #ddd;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
  border-radius: 4px;
  line-height: 1.1;
}

.player-stats.white .profiling-stats {
  background: #fff5d7; /* Slightly darker pale yellow for contrast */
  border-top-color: #eee;
}

.player-stats.black .profiling-stats {
  background: #ebebeb;
  border-top-color: #ddd;
}

/* UI Utility Classes */
.config-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.threads-container {
  /* Inherits from .config-group */
}

.label-auto {
  width: auto !important;
  white-space: nowrap;
}

.label-checkbox {
  width: auto !important;
  font-weight: normal !important;
}

.pvs-summary {
  cursor: pointer;
  user-select: none;
  font-weight: bold;
  color: #555;
}

.pvs-details-content {
  margin-left: 15px;
  margin-top: 5px;
}

.history-controls-wrapper {
  margin-top: 6px;
  margin-bottom: 6px;
  text-align: center;
}

.last-move-link {
  cursor: pointer;
  text-decoration: underline;
  color: #2ba6cb;
}

.move-count-label {
  float: right;
  font-size: 0.9em;
  color: #666;
}

.captured-area {
  min-height: 16px;
  margin-bottom: 5px;
}

.stats-item-bordered {
  border-left: 1px solid #eee;
  padding-left: 5px;
}

.player-stats.black .stats-item-bordered {
  border-left-color: #ddd;
}

/* Panic Overlay */
.panic-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: sans-serif;
  font-size: 16px;
}

.panic-container {
  background: #222;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  border: 1px solid #444;
}

.panic-title {
  color: #ff5555;
  margin-top: 0;
  margin-bottom: 1rem;
}

.panic-message {
  background: #333;
  padding: 1rem;
  border-radius: 6px;
  font-family: monospace;
  white-space: pre-wrap;
  text-align: left;
  color: #ddd;
  border: 1px solid #555;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  max-width: 800px;
}

.panic-button {
  background: #4caf50;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.panic-button:hover {
  background: #45a049;
}

.panic-button:disabled {
  background: #666;
  cursor: not-allowed;
}

/* Reset Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 450px;
  max-width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateY(-20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-body p {
  margin-top: 0;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

.fen-input-wrapper {
  margin-top: 15px;
}

.fen-input-wrapper label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #444;
  font-size: 0.9rem;
}

#reset-fen-input {
  width: 100%;
  padding: 10px;
  border: 2px solid #eee;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

#reset-fen-input:focus {
  border-color: #2ba6cb;
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #ebebeb;
}

.btn-danger {
  background: #ff5555;
  border-color: #d44;
}

.btn-danger:hover {
  background: #e44;
}

/* Brand Header Styling */
.header-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 4px;
  margin-top: 0px;
}

.header-container img {
  width: 80px;
  height: 80px;
  margin-top: -8px;
  margin-bottom: -8px;
  filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.15));
}

.header-container h1 {
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  font-size: 2.0rem;
  font-weight: 800;
  color: #2ba6cb;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-container h1 span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  border: 1.5px solid #888;
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: none;
  letter-spacing: 0;
}

/* PVS Columns Styling */
.pvs-columns-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
}

.pvs-column {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pvs-column-header {
  margin: 0 0 6px 0;
  font-size: 0.75rem;
  font-weight: bold;
  color: #2ba6cb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 2px;
}

.pvs-column div {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.optimizations-container {
  width: 100%;
  box-sizing: border-box;
}

.optimizations-container details {
  width: 100%;
}
