* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #1e1e2e;
  color: #cdd6f4;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1,
h2,
h3 {
  margin-bottom: 15px;
  color: #89b4fa;
}

.upload-section {
  background-color: #313244;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  align-items: center;
}

.controls-section {
  background-color: #313244;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.control-group {
  flex: 1;
  min-width: 300px;
  background-color: #1e1e2e;
  padding: 15px;
  border-radius: 8px;
}

.control-group h3 {
  margin-bottom: 15px;
  font-size: 1.1em;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.slider-group label {
  min-width: 180px;
}

input[type="range"] {
  flex: 1;
  max-width: 300px;
}

button {
  background-color: #89b4fa;
  color: #11111b;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

button:disabled {
  background-color: #585b70;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background-color: #b4befe;
}

.toggle-btn {
  background-color: #45475a;
  color: #cdd6f4;
  width: 100%;
  text-align: left;
  padding: 15px;
  font-size: 1.1em;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.toggle-btn:hover:not(:disabled) {
  background-color: #585b70;
}

.main-content {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.left-panel,
.right-panel {
  flex: 1;
  min-width: 300px;
  background-color: #313244;
  padding: 20px;
  border-radius: 8px;
}

.canvas-container {
  width: 100%;
  overflow: hidden;
  border: 2px dashed #585b70;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

canvas {
  max-width: 100%;
  height: auto;
}

.parsed-data {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  background-color: #45475a;
  padding: 5px;
  border-radius: 5px;
  width: fit-content;
}

.cell {
  width: 30px;
  height: 30px;
  background-color: #1e1e2e;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.cell.filled {
  background-color: #a6e3a1;
}

.pieces-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.piece-grid {
  display: grid;
  gap: 2px;
  background-color: #45475a;
  padding: 5px;
  border-radius: 5px;
}

.piece-cell {
  width: 20px;
  height: 20px;
  background-color: #1e1e2e;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.piece-cell.filled {
  background-color: #f9e2af;
  border-radius: 3px;
}

.solution-box {
  background-color: #1e1e2e;
  padding: 15px;
  border-radius: 5px;
  min-height: 100px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
}

.solution-container {
  background-color: #313244;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.best-solution {
  border: 2px solid #a6e3a1;
}

.alternative-solution {
  border: 1px solid #585b70;
  margin-top: 10px;
}

.moves-container {
  display: flex;
  flex-wrap: nowrap;
  gap: 15px;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 10px;
}

.moves-container.large-mode {
  flex-direction: column;
  align-items: center;
  overflow-x: visible;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.step-label {
  font-size: 14px;
  color: #cdd6f4;
  text-align: center;
}

.solution-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  background-color: #45475a;
  padding: 3px;
  border-radius: 3px;
  width: fit-content;
}

.solution-cell {
  width: 15px;
  height: 15px;
  background-color: #1e1e2e;
  border-radius: 2px;
}

.large-mode .solution-cell {
  width: 30px;
  height: 30px;
}

.solution-cell.existing-piece {
  background-color: #89b4fa;
}

.solution-cell.new-piece {
  background-color: #fab387;
}

.large-mode .solution-cell.cleared-piece {
  border: 2px solid #11111b;
}

.solution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.toggle-size-btn {
  background-color: #45475a;
  color: #cdd6f4;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}

.toggle-size-btn:hover {
  background-color: #585b70;
}

.other-solutions-wrapper {
  margin-top: 20px;
}

.toggle-other-solutions-btn {
  width: 100%;
  background-color: #45475a;
  color: #cdd6f4;
  text-align: center;
  padding: 10px;
  margin-bottom: 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

.toggle-other-solutions-btn:hover {
  background-color: #585b70;
}
