body {
  margin-left: 20%;
  margin-right: 20%;
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.game-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 900px;
  margin: 3rem auto;
  border-bottom: 1px solid #ccc;
  padding-bottom: 1.5rem;

}

h1, h2 {
  grid-column: 1 / -1;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5rem;
}

.controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  grid-column: 1 / -1;
}

.controls label {
  font-weight: bold;
}

.controls input[type="number"] {
  width: 50px;
  padding: 5px;
}

.controls button {
  padding: 5px 15px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  cursor: pointer;
}

.controls button:hover {
  background-color: #e0e0e0;
}

.matrix-container {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px;
  align-items: flex-start;
}

.row-headers {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.row-header {
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  text-align: center;
  user-select: none;
}

.row-header.selected-from {
  background-color: #64b5f6; /* Blue for source row */
  color: white;
}

.matrix {
  width: fit-content;
  display: grid;
  border: 2px solid #333;
  background-color: #ccc;
  gap: 5px;
}

.matrix-cell {
  width: 40px;
  height: 40px;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

.history-container {
  padding: 1rem;
  border: 1px solid #ddd;
  background-color: #fafafa;
}

.history-container h3 {
  margin-top: 0;
}

#history-list {
  padding-left: 1.5rem;
  margin: 0;
}

@media (max-width: 600px) {
  .game-container {
    grid-template-columns: 1fr;
  }

  .matrix-container,
  .history-container {
    grid-column: 1 / -1;
  }
}
