body {
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  margin: 0;
  display: flex;
  flex-direction: column; /*Xếp dọc*/
  height: 100vh;
}

h1 {
  text-align: center;
  margin: 15px 0;
  color: #333;
}

/* Container gồm Sidebar và Maze */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden; /* Cố định body, không scroll*/
  padding: 10px;
  gap: 20px;
}

/* SIDEBAR */
.sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto; /* scroll nếu màn hình nhỏ */
}

/* CONTROLS */
.controls {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.controls label {
  font-weight: bold;
  margin-top: 10px;
  display: block;
  font-size: 14px;
}

.controls input,
.controls button {
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.controls button:hover {
  background-color: #f1f1f1;
}

.mode-buttons,
#algoButtons {
  display: flex;
  gap: 7px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.mode-buttons button,
#algoButtons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #bdc3c7;
  color: #000;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;

  width: auto;
  flex: 0 0 auto;
}




#algoButtons button.active {
  background-color: #2ecc71; /* màu khi click */
  color: white;
}

.set-map {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 5px;
}

/* ACTIVE BUTTON: đổi màu khi chọn */
button.active.wall-btn {
  background: #343a40;
  color: white;
  font-weight: bold;
  border: none;
}

button.active.start-btn {
  background: #2ecc71;
  color: white;
  font-weight: bold;
  border: none;
}

button.active.end-btn {
  background: #e74c3c;
  color: rgb(30, 14, 122);
  font-weight: bold;
  border: none;
}

#reset-btn {
  background-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

/* STATS */
.stats {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  border: 1px solid #eee;
  padding: 6px;
  text-align: center;
  font-size: 12px;
}

th {
  background-color: #f8f9fa;
  font-weight: bold;
}

/* MAZE AREA */
.maze-wrapper {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: auto;
}

.maze {
  display: grid;
  border: 2px solid #333;
  max-width: 100%;
  max-height: 100%;
  width: fit-content;
  margin: auto;
}

.cell {
  width: 100%;
  aspect-ratio: 1/1;
  border: 1px solid #ddd;
  background: white;
  box-sizing: border-box;
}

.cell.wall {
  background: #343a40;
  border-color: #343a40;
}

.cell.start {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cell.start::before {
  content: "🏁";
}

.cell.end {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cell.end::before {
  content: "🚩";
}

.cell.visited {
  background: #a5d8ff;
  transition: background 0.2s;
  z-index: 1;
}
.cell.path {
  background: #fcc419;
  transition: background 0.2s;
}
.cell {
  position: relative; 
  
}

.step-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 9px;
  font-weight: bold;
  color: #000;
  opacity: 0.8;
  pointer-events: none;
}
.cell {
  user-select: none;
}

