/* container fluid but capped */
#csudoku-container {
  width: 100%;
  max-width: 450px;     /* cap it at your original 450px */
  margin: 20px auto;
  padding: 0 10px;
  font-family: Arial, sans-serif;
  text-align: center;
}

/* grid fills container, always 9×9 equal squares */
#csudoku-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  border: 3px solid #444;
  margin-bottom: 10px;
  user-select: none;
}

/* cells keep a 1:1 ratio */
.csudoku-cell {
  aspect-ratio: 1;
  width: 100%;
  border: 1px solid #999;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.csudoku-cell.fixed {
  cursor: default;
  border: 2px solid #222;
}

.csudoku-cell.empty:hover {
  outline: 2px solid #666;
}

/* palette flexes, swatches size flexibly between 24px and 40px */
#csudoku-palette {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.csudoku-swatch {
  width: clamp(24px, 6vw, 40px);
  aspect-ratio: 1;
  border: 2px solid #ccc;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

.csudoku-swatch.selected {
  border-color: #000;
}

/* controls centered, buttons scale text & padding */
.csudoku-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.csudoku-controls button {
  padding: clamp(6px, 1.5vw, 12px) clamp(12px, 3vw, 20px);
  font-size: clamp(14px, 2vw, 18px);
  cursor: pointer;
}

/* message text scales too */
#csudoku-message {
  margin-top: 10px;
  font-weight: bold;
  font-size: clamp(14px, 2vw, 18px);
}

/* tweak for really small screens */
@media (max-width: 500px) {
  #csudoku-grid {
    gap: 1px;
  }
  .csudoku-controls button {
    padding: 4px 8px;
    font-size: clamp(12px, 3vw, 14px);
  }
}
