.mondrian-generator {
  display: flex;
  padding: 1rem;
  gap: 1rem;
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  margin: 0 auto;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.controls {
  flex: 0 0 280px;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: calc(100vh - 4rem);
}

.controls-scroll-container {
  height: 100%;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.control-group {
  margin-bottom: 1rem;
}

.control-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #333;
}

.dimension-input,
.line-width-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.dimension-input input {
  flex: 1;
  width: 70px;
}

.dimension-input select,
.line-width-input select {
  width: 70px;
}

.line-width-input {
  flex-wrap: wrap;
}

.line-width-input input {
  width: 70px;
}

.line-width-input .fraction-select {
  flex: 1;
  min-width: 100px;
  margin-top: 0.5rem;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.control-group input[type="number"],
.control-group input[type="range"],
.control-group select {
  padding: 0.4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.hint-text,
.fraction-hint {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  font-style: italic;
}

.control-group button {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.9rem;
}

.control-group button:hover {
  background: #0056b3;
}

.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mondrian-generator {
    flex-direction: column;
    height: auto;
    max-height: none;
    padding: 0.5rem;
  }

  .controls {
    flex: none;
    max-height: none;
    width: 100%;
    box-sizing: border-box;
  }

  .canvas-container {
    height: 60vh;
    width: 100%;
  }

  .dimension-input,
  .line-width-input {
    flex-wrap: wrap;
  }

  .dimension-input input,
  .line-width-input input,
  .dimension-input select,
  .line-width-input select {
    flex: 1;
    min-width: 80px;
  }
}

/* For very small screens */
@media (max-width: 480px) {
  .mondrian-generator {
    padding: 0.25rem;
  }

  .controls {
    padding: 0.75rem;
  }

  .canvas-container {
    height: 50vh;
  }
}
